array( 'title' => __('editor.issues.currentIssue'), 'description' => __('manager.navigationMenus.current.description'), ), NMI_TYPE_ARCHIVES => array( 'title' => __('navigation.archives'), 'description' => __('manager.navigationMenus.archives.description'), ), NMI_TYPE_SUBSCRIPTIONS => array( 'title' => __('navigation.subscriptions'), 'description' => __('manager.navigationMenus.subscriptions.description'), 'conditionalWarning' => __('manager.navigationMenus.subscriptions.conditionalWarning'), ), NMI_TYPE_MY_SUBSCRIPTIONS => array( 'title' => __('user.subscriptions.mySubscriptions'), 'description' => __('manager.navigationMenus.mySubscriptions.description'), 'conditionalWarning' => __('manager.navigationMenus.mySubscriptions.conditionalWarning'), ), ); $types = array_merge($types, $ojsTypes); } /** * Callback for display menu item functionallity * @param $hookName string * @param $args array of arguments passed */ function getDisplayStatusCallback($hookName, $args) { $navigationMenuItem =& $args[0]; $request = \Application::getRequest(); $dispatcher = $request->getDispatcher(); $templateMgr = \TemplateManager::getManager(\Application::getRequest()); $isUserLoggedIn = \Validation::isLoggedIn(); $isUserLoggedInAs = \Validation::isLoggedInAs(); $context = $request->getContext(); $this->transformNavMenuItemTitle($templateMgr, $navigationMenuItem); $menuItemType = $navigationMenuItem->getType(); // Conditionally hide some items switch ($menuItemType) { case NMI_TYPE_CURRENT: case NMI_TYPE_ARCHIVES: $navigationMenuItem->setIsDisplayed($context && $context->getSetting('publishingMode') != PUBLISHING_MODE_NONE); break; case NMI_TYPE_SUBSCRIPTIONS: if ($context) { $paymentManager = \Application::getPaymentManager($context); $navigationMenuItem->setIsDisplayed($context->getSetting('paymentsEnabled') && $paymentManager->isConfigured()); } break; case NMI_TYPE_MY_SUBSCRIPTIONS: if ($context) { $paymentManager = \Application::getPaymentManager($context); $navigationMenuItem->setIsDisplayed(\Validation::isLoggedIn() && $context->getSetting('paymentsEnabled') && $paymentManager->isConfigured() && $context->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION); } break; } if ($navigationMenuItem->getIsDisplayed()) { // Set the URL switch ($menuItemType) { case NMI_TYPE_CURRENT: $navigationMenuItem->setUrl($dispatcher->url( $request, ROUTE_PAGE, null, 'issue', 'current', null )); break; case NMI_TYPE_ARCHIVES: $navigationMenuItem->setUrl($dispatcher->url( $request, ROUTE_PAGE, null, 'issue', 'archive', null )); break; case NMI_TYPE_SUBSCRIPTIONS: $navigationMenuItem->setUrl($dispatcher->url( $request, ROUTE_PAGE, null, 'about', 'subscriptions', null )); break; case NMI_TYPE_MY_SUBSCRIPTIONS: $navigationMenuItem->setUrl($dispatcher->url( $request, ROUTE_PAGE, null, 'user', 'subscriptions', null )); break; } } } }