18 import(
'classes.file.PublicFileManager');
19 import(
'lib.pkp.classes.template.PKPTemplateManager');
27 parent::initialize($request);
30 if (!defined(
'SESSION_DISABLE_INIT')) {
37 $context = $request->getContext();
38 $site = $request->getSite();
41 $siteFilesDir = $request->getBaseUrl() .
'/' . $publicFileManager->getSiteFilesPath();
42 $this->assign(
'sitePublicFilesDir', $siteFilesDir);
43 $this->assign(
'publicFilesDir', $siteFilesDir);
47 'brandImage' =>
'templates/images/omp_brand.png',
48 'packageKey' =>
'common.software',
52 if ($user = $request->getUser()) {
55 import(
'lib.pkp.controllers.grid.notifications.TaskNotificationsGridHandler');
56 $this->assign(
'unreadNotificationCount', $notificationDao->getNotificationCount(
false, $user->getId(),
null, NOTIFICATION_LEVEL_TASK));
59 if (isset($context)) {
61 'currentPress' => $context,
62 'siteTitle' => $context->getLocalizedName(),
63 'publicFilesDir' => $request->getBaseUrl() .
'/' . $publicFileManager->getContextFilesPath($context->getId()),
64 'primaryLocale' => $context->getPrimaryLocale(),
65 'supportedLocales' => $context->getSupportedLocaleNames(),
66 'displayPageHeaderTitle' => $context->getLocalizedPageHeaderTitle(),
67 'displayPageHeaderLogo' => $context->getLocalizedPageHeaderLogo(),
68 'displayPageHeaderLogoAltText' => $context->getLocalizedData(
'pageHeaderLogoImageAltText'),
69 'numPageLinks' => $context->getData(
'numPageLinks'),
70 'itemsPerPage' => $context->getData(
'itemsPerPage'),
71 'enableAnnouncements' => $context->getData(
'enableAnnouncements'),
72 'disableUserReg' => $context->getData(
'disableUserReg'),
76 $contextStyleSheet = $context->getData(
'styleSheet');
77 if ($contextStyleSheet) {
80 $request->getBaseUrl() .
'/' . $publicFileManager->getContextFilesPath($context->getId()) .
'/' . $contextStyleSheet[
'uploadName'],
81 [
'priority' => STYLE_SEQUENCE_LAST]
85 $this->assign(
'pageFooter', $context->getLocalizedData(
'pageFooter'));
89 $contexts = $contextDao->getAll(
true)->toArray();
90 $contextsForRegistration = [];
91 foreach($contexts as $context) {
92 if (!$context->getData(
'disableUserReg')) {
93 $contextsForRegistration[] = $context;
98 'contexts' => $contextsForRegistration,
99 'disableUserReg' => empty($contextsForRegistration),
100 'displayPageHeaderTitle' => $site->getLocalizedPageHeaderTitle(),
101 'displayPageHeaderLogo' => $site->getLocalizedData(
'pageHeaderTitleImage'),
102 'siteTitle' => $site->getLocalizedTitle(),
103 'primaryLocale' => $site->getPrimaryLocale(),
104 'supportedLocales' => $site->getSupportedLocaleNames(),
105 'pageFooter' => $site->getLocalizedData(
'pageFooter'),
115 parent::setupBackendPage();
118 if (defined(
'SESSION_DISABLE_INIT')
119 || !$request->getContext()
120 || !$request->getUser()) {
124 $router = $request->getRouter();
125 $handler = $router->getHandler();
126 $userRoles = (array) $handler->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
128 $menu = (array) $this->
getState(
'menu');
131 if (in_array(ROLE_ID_MANAGER, $userRoles)) {
133 'name' => __(
'navigation.catalog'),
134 'url' => $router->url($request,
null,
'manageCatalog'),
135 'isCurrent' => $request->getRequestedPage() ===
'manageCatalog',
138 $index = array_search(
'submissions', array_keys($menu));
139 if ($index ===
false || count($menu) <= ($index + 1)) {
140 $menu[
'catalog'] = $catalogLink;
142 $menu = array_slice($menu, 0, $index + 1,
true) +
143 [
'catalog' => $catalogLink] +
144 array_slice($menu, $index + 1,
null,
true);