/** * Display a list of plugins along with management options. */ function plugins($args) { $category = isset($args[0]) ? $args[0] : null; parent::validate(); $categories = PluginRegistry::getCategories(); if (isset($category)) { // The user specified a category of plugins to view; // get the plugins in that category only. $plugins =& PluginRegistry::loadCategory($category); } else { // No plugin specified; display all. $plugins = array(); foreach ($categories as $category) { $newPlugins =& PluginRegistry::loadCategory($category); if (isset($newPlugins)) { $plugins = array_merge($plugins, PluginRegistry::loadCategory($category)); } } } parent::setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('plugins', $plugins); $templateMgr->assign_by_ref('categories', $categories); $templateMgr->assign('isSiteAdmin', Validation::isSiteAdmin()); $templateMgr->assign('helpTopicId', 'journal.managementPages.plugins'); $templateMgr->display('manager/plugins/plugins.tpl'); }
/** * Save changes to a section. */ function updateSection($args) { parent::validate(); import('manager.form.SectionForm'); $sectionForm =& new SectionForm(!isset($args) || empty($args) ? null : (int) $args[0]); switch (Request::getUserVar('action')) { case 'addSectionEditor': $sectionForm->includeSectionEditor((int) Request::getUserVar('userId')); $canExecute = false; break; case 'removeSectionEditor': $sectionForm->omitSectionEditor((int) Request::getUserVar('userId')); $canExecute = false; break; default: $canExecute = true; break; } $sectionForm->readInputData(); if ($canExecute && $sectionForm->validate()) { $sectionForm->execute(); Request::redirect(null, null, 'sections'); } else { parent::setupTemplate(true); $sectionForm->display(); } }
/** * Display a list of journal statistics. * WARNING: This implementation should be kept roughly synchronized * with the reader's statistics view in the About pages. */ function statistics() { parent::validate(); parent::setupTemplate(true); $journal =& Request::getJournal(); $templateMgr =& TemplateManager::getManager(); $statisticsYear = Request::getUserVar('statisticsYear'); if (empty($statisticsYear)) { $statisticsYear = date('Y'); } $templateMgr->assign('statisticsYear', $statisticsYear); $sectionIds = $journal->getSetting('statisticsSectionIds'); if (!is_array($sectionIds)) { $sectionIds = array(); } $templateMgr->assign('sectionIds', $sectionIds); foreach (StatisticsHandler::getPublicStatisticsNames() as $name) { $templateMgr->assign($name, $journal->getSetting($name)); } $templateMgr->assign('statViews', $journal->getSetting('statViews')); $fromDate = mktime(0, 0, 0, 1, 1, $statisticsYear); $toDate = mktime(23, 59, 59, 12, 31, $statisticsYear); $journalStatisticsDao =& DAORegistry::getDAO('JournalStatisticsDAO'); $articleStatistics = $journalStatisticsDao->getArticleStatistics($journal->getJournalId(), null, $fromDate, $toDate); $templateMgr->assign('articleStatistics', $articleStatistics); $limitedArticleStatistics = $journalStatisticsDao->getArticleStatistics($journal->getJournalId(), $sectionIds, $fromDate, $toDate); $templateMgr->assign('limitedArticleStatistics', $limitedArticleStatistics); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $sections =& $sectionDao->getJournalSections($journal->getJournalId()); $templateMgr->assign('sections', $sections->toArray()); $issueStatistics = $journalStatisticsDao->getIssueStatistics($journal->getJournalId(), $fromDate, $toDate); $templateMgr->assign('issueStatistics', $issueStatistics); $reviewerStatistics = $journalStatisticsDao->getReviewerStatistics($journal->getJournalId(), $sectionIds, $fromDate, $toDate); $templateMgr->assign('reviewerStatistics', $reviewerStatistics); $allUserStatistics = $journalStatisticsDao->getUserStatistics($journal->getJournalId(), null, $toDate); $templateMgr->assign('allUserStatistics', $allUserStatistics); $userStatistics = $journalStatisticsDao->getUserStatistics($journal->getJournalId(), $fromDate, $toDate); $templateMgr->assign('userStatistics', $userStatistics); $enableSubscriptions = $journal->getSetting('enableSubscriptions'); if ($enableSubscriptions) { $templateMgr->assign('enableSubscriptions', true); $allSubscriptionStatistics = $journalStatisticsDao->getSubscriptionStatistics($journal->getJournalId(), null, $toDate); $templateMgr->assign('allSubscriptionStatistics', $allSubscriptionStatistics); $subscriptionStatistics = $journalStatisticsDao->getSubscriptionStatistics($journal->getJournalId(), $fromDate, $toDate); $templateMgr->assign('subscriptionStatistics', $subscriptionStatistics); } $notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO'); $notifiableUsers = $notificationStatusDao->getNotifiableUsersCount($journal->getJournalId()); $templateMgr->assign('notifiableUsers', $notifiableUsers); $reportPlugins =& PluginRegistry::loadCategory('reports'); $templateMgr->assign_by_ref('reportPlugins', $reportPlugins); $templateMgr->assign('helpTopicId', 'journal.managementPages.statsAndReports'); $templateMgr->display('manager/statistics/index.tpl'); }
/** * Save changes to an email. */ function updateEmail() { parent::validate(); import('manager.form.EmailTemplateForm'); $emailKey = Request::getUserVar('emailKey'); $emailTemplateForm =& new EmailTemplateForm($emailKey); $emailTemplateForm->readInputData(); if ($emailTemplateForm->validate()) { $emailTemplateForm->execute(); Request::redirect(null, null, 'emails'); } else { parent::setupTemplate(true); $emailTemplateForm->display(); } }
function reloadLocalizedDefaultSettings() { // make sure the locale is valid $locale = Request::getUserVar('localeToLoad'); if (!Locale::isLocaleValid($locale)) { Request::redirect(null, null, 'languages'); } parent::validate(); parent::setupTemplate(true); $journal =& Request::getJournal(); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $journalSettingsDao->reloadLocalizedDefaultSettings($journal->getJournalId(), 'registry/journalSettings.xml', array('indexUrl' => Request::getIndexUrl(), 'journalPath' => $journal->getData('path'), 'primaryLocale' => $journal->getPrimaryLocale(), 'journalName' => $journal->getTitle($journal->getPrimaryLocale())), $locale); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'languages'), 'pageTitle' => 'common.languages', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.journalManagement')); $templateMgr->display('common/message.tpl'); }
/** * Save changes to language settings. */ function saveLanguageSettings() { parent::validate(); parent::setupTemplate(true); import('manager.form.LanguageSettingsForm'); $settingsForm =& new LanguageSettingsForm(); $settingsForm->readInputData(); if ($settingsForm->validate()) { $settingsForm->execute(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'languages'), 'pageTitle' => 'common.languages', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.journalManagement')); $templateMgr->display('common/message.tpl'); } else { $settingsForm->display(); } }
function importexport($args) { parent::validate(); parent::setupTemplate(true); PluginRegistry::loadCategory(IMPORTEXPORT_PLUGIN_CATEGORY); $templateMgr =& TemplateManager::getManager(); if (array_shift($args) === 'plugin') { $pluginName = array_shift($args); $plugin =& PluginRegistry::getPlugin(IMPORTEXPORT_PLUGIN_CATEGORY, $pluginName); if ($plugin) { return $plugin->display($args); } } $templateMgr->assign_by_ref('plugins', PluginRegistry::getPlugins(IMPORTEXPORT_PLUGIN_CATEGORY)); $templateMgr->assign('helpTopicId', 'journal.managementPages.importExport'); $templateMgr->display('manager/importexport/plugins.tpl'); }
/** * Send an email to a user or group of users. */ function email($args) { parent::validate(); ManagerHandler::setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('helpTopicId', 'journal.users.emailUsers'); $userDao =& DAORegistry::getDAO('UserDAO'); $site =& Request::getSite(); $journal =& Request::getJournal(); $user =& Request::getUser(); import('mail.MailTemplate'); $email =& new MailTemplate(Request::getUserVar('template'), Request::getUserVar('locale')); if (Request::getUserVar('send') && !$email->hasErrors()) { $email->send(); Request::redirect(null, Request::getRequestedPage()); } else { $email->assignParams(); // FIXME Forces default parameters to be assigned (should do this automatically in MailTemplate?) if (!Request::getUserVar('continued')) { if (($groupId = Request::getUserVar('toGroup')) != '') { // Special case for emailing entire groups: // Check for a group ID and add recipients. $groupDao =& DAORegistry::getDAO('GroupDAO'); $group =& $groupDao->getGroup($groupId); if ($group && $group->getJournalId() == $journal->getJournalId()) { $groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO'); $memberships =& $groupMembershipDao->getMemberships($group->getGroupId()); $memberships =& $memberships->toArray(); foreach ($memberships as $membership) { $user =& $membership->getUser(); $email->addRecipient($user->getEmail(), $user->getFullName()); } } } if (count($email->getRecipients()) == 0) { $email->addRecipient($user->getEmail(), $user->getFullName()); } } $email->displayEditForm(Request::url(null, null, 'email'), array(), 'manager/people/email.tpl'); } }
/** * Display the files associated with a journal. */ function files($args) { parent::validate(); parent::setupTemplate(true); import('file.FileManager'); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'manager'), 'manager.journalManagement'))); FilesHandler::parseDirArg($args, $currentDir, $parentDir); $currentPath = FilesHandler::getRealFilesDir($currentDir); if (@is_file($currentPath)) { $fileMgr =& new FileManager(); if (Request::getUserVar('download')) { $fileMgr->downloadFile($currentPath); } else { $fileMgr->viewFile($currentPath, FilesHandler::fileMimeType($currentPath)); } } else { $files = array(); if ($dh = @opendir($currentPath)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..') { $filePath = $currentPath . '/' . $file; $isDir = is_dir($filePath); $info = array('name' => $file, 'isDir' => $isDir, 'mimetype' => $isDir ? '' : FilesHandler::fileMimeType($filePath), 'mtime' => filemtime($filePath), 'size' => $isDir ? '' : FileManager::getNiceFileSize(filesize($filePath))); $files[$file] = $info; } } closedir($dh); } ksort($files); $templateMgr->assign_by_ref('files', $files); $templateMgr->assign('currentDir', $currentDir); $templateMgr->assign('parentDir', $parentDir); $templateMgr->assign('helpTopicId', 'journal.managementPages.fileBrowser'); $templateMgr->display('manager/files/index.tpl'); } }
function setupTemplate($request, $subclass = false) { parent::setupTemplate($request, true); if ($subclass) { $templateMgr =& TemplateManager::getManager($request); $templateMgr->append('pageHierarchy', array($request->url(null, null, 'manager', 'registration'), 'manager.registration')); } }
function setupTemplate($group = null, $subclass = false) { parent::setupTemplate(true); $templateMgr =& TemplateManager::getManager(); if ($subclass) { $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'groups'), 'manager.groups')); } if ($group) { $templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'editGroup', $group->getId()), $group->getLocalizedTitle(), true)); } $templateMgr->assign('helpTopicId', 'conference.currentConferences.organizingTeam'); }
/** * Show users with no role. */ function showNoRole() { $this->validate(); $userDao =& DAORegistry::getDAO('UserDAO'); $templateMgr =& TemplateManager::getManager(); parent::setupTemplate(true); $rangeInfo = $this->getRangeInfo('users'); $users =& $userDao->getUsersWithNoRole(true, $rangeInfo); $templateMgr->assign('omitSearch', true); $templateMgr->assign_by_ref('users', $users); $templateMgr->assign_by_ref('thisUser', Request::getUser()); $templateMgr->assign('helpTopicId', 'journal.users.index'); $templateMgr->display('manager/people/searchUsers.tpl'); }
/** * Display a user's profile. * @param $args array first parameter is the ID or username of the user to display */ function userProfile($args) { parent::validate(); parent::setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('currentUrl', Request::url(null, null, 'people', 'all')); $templateMgr->assign('helpTopicId', 'journal.users.index'); $userDao =& DAORegistry::getDAO('UserDAO'); $userId = isset($args[0]) ? $args[0] : 0; if (is_numeric($userId)) { $userId = (int) $userId; $user = $userDao->getUser($userId); } else { $user = $userDao->getUserByUsername($userId); } if ($user == null) { // Non-existent user requested $templateMgr->assign('pageTitle', 'manager.people'); $templateMgr->assign('errorMsg', 'manager.people.invalidUser'); $templateMgr->assign('backLink', Request::url(null, null, 'people', 'all')); $templateMgr->assign('backLinkLabel', 'manager.people.allUsers'); $templateMgr->display('common/error.tpl'); } else { $site =& Request::getSite(); $journal =& Request::getJournal(); $roleDao =& DAORegistry::getDAO('RoleDAO'); $roles =& $roleDao->getRolesByUserId($user->getUserId(), $journal->getJournalId()); $countryDao =& DAORegistry::getDAO('CountryDAO'); $country = null; if ($user->getCountry() != '') { $country = $countryDao->getCountry($user->getCountry()); } $templateMgr->assign('country', $country); $templateMgr->assign_by_ref('user', $user); $templateMgr->assign_by_ref('userRoles', $roles); $templateMgr->assign('localeNames', Locale::getAllLocales()); $templateMgr->display('manager/people/userProfile.tpl'); } }
/** * Save changes to payment settings. */ function savePayMethodSettings() { parent::validate(); parent::setupTemplate(true); $journal =& Request::getJournal(); if (!$journal) { Request::redirect(null, null, 'index'); } import('manager.form.PayMethodSettingsForm'); $settingsForm =& new PayMethodSettingsForm(); $settingsForm->readInputData(); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('helpTopicId', 'journal.managementPages.payments'); if ($settingsForm->validate()) { $settingsForm->execute(); $templateMgr->assign(array('currentUrl' => Request::url(null, null, 'payMethodSettings'), 'pageTitle' => 'manager.payment.paymentMethods', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, 'payMethodSettings'), 'backLinkLabel' => 'manager.payment.paymentMethods')); $templateMgr->display('common/message.tpl'); } else { $settingsForm->display(); } }
function setupTemplate($subclass = false) { parent::setupTemplate(true); if ($subclass) { $templateMgr =& TemplateManager::getManager(); $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'subscriptions'), 'manager.subscriptions')); } }
/** * Set up the template with breadcrumbs etc. * @param $request PKPRequest * @param $subclass boolean */ function setupTemplate(&$request, $subclass = false) { parent::setupTemplate(true); if ($subclass) { $templateMgr =& TemplateManager::getManager(); $templateMgr->append('pageHierarchy', array($request->url(null, 'manager', 'announcements'), 'manager.announcements')); } }
/** * Show users with no role. * Last update: EL on February 13th 2013 */ function showNoRole() { $this->validate(); $userDao =& DAORegistry::getDAO('UserDAO'); // For sending the list of ERCs to the template // EL on February 13th 2013 $sectionDao =& DAORegistry::getDAO('SectionDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); $journal =& $journalDao->getJournalByPath(Request::getRequestedJournalPath()); $templateMgr =& TemplateManager::getManager(); parent::setupTemplate(true); $rangeInfo = PKPHandler::getRangeInfo('users'); $users =& $userDao->getUsersWithNoRole(true, $rangeInfo); // Send the list of IRBs to the template $templateMgr->assign('sections', $sectionDao->getJournalSections($journal->getId())); $templateMgr->assign('omitSearch', true); $templateMgr->assign_by_ref('users', $users); $templateMgr->assign_by_ref('thisUser', Request::getUser()); $templateMgr->assign('helpTopicId', 'journal.users.index'); $templateMgr->display('manager/people/searchUsers.tpl'); }
/** * Display a "Settings Saved" message */ function setupSaved($args) { parent::validate(); $step = isset($args[0]) ? (int) $args[0] : 0; if ($step >= 1 && $step <= 5) { parent::setupTemplate(true); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('setupStep', $step); $templateMgr->assign('helpTopicId', 'journal.managementPages.setup'); $templateMgr->display('manager/setup/settingsSaved.tpl'); } else { Request::redirect(null, 'index'); } }
/** * Setup common template variables. */ function setupTemplate($subclass = false, $institutional = false) { parent::setupTemplate(true); if ($subclass) { $templateMgr =& TemplateManager::getManager(); if ($institutional) { $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'subscriptions', 'institutional'), 'manager.institutionalSubscriptions')); } else { $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'subscriptions', 'individual'), 'manager.individualSubscriptions')); } } }
function setupTemplate($subclass = false, $reviewForm = null) { parent::setupTemplate(true); if ($subclass) { $templateMgr =& TemplateManager::getManager(); $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'reviewForms'), 'manager.reviewForms')); } if ($reviewForm) { $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'editReviewForm', $reviewForm->getReviewFormId()), $reviewForm->getReviewFormTitle(), true)); } }
function setupTemplate($subclass = false) { Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_READER)); parent::setupTemplate(true); if ($subclass) { $templateMgr =& TemplateManager::getManager(); $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'sections'), 'section.sections')); } }
function setupTemplate($group = null, $subclass = false) { parent::setupTemplate(true); $templateMgr =& TemplateManager::getManager(); if ($subclass) { $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'groups'), 'manager.groups')); } if ($group) { $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'editGroup', $group->getGroupId()), $group->getGroupTitle(), true)); } $templateMgr->assign('helpTopicId', 'journal.managementPages.groups'); }
function setupTemplate($request, $subclass = false) { AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_READER); parent::setupTemplate($request, true); if ($subclass) { $templateMgr =& TemplateManager::getManager($request); $templateMgr->append('pageHierarchy', array($request->url(null, null, 'manager', 'tracks'), 'track.tracks')); } }