本文整理汇总了PHP中ManagerHandler::setupTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP ManagerHandler::setupTemplate方法的具体用法?PHP ManagerHandler::setupTemplate怎么用?PHP ManagerHandler::setupTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagerHandler
的用法示例。
在下文中一共展示了ManagerHandler::setupTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugins
/**
* 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');
}
示例2: updateSection
/**
* 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();
}
}
示例3: statistics
/**
* 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');
}
示例4: updateEmail
/**
* 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();
}
}
示例5: reloadLocalizedDefaultSettings
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');
}
示例6: saveLanguageSettings
/**
* 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();
}
}
示例7: importexport
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');
}
示例8: email
/**
* 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');
}
}
示例9: files
/**
* 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');
}
}
示例10: setupTemplate
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'));
}
}
示例11: setupTemplate
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');
}
示例12: showNoRole
/**
* 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');
}
示例13: userProfile
/**
* 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');
}
}
示例14: savePayMethodSettings
/**
* 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();
}
}
示例15: setupTemplate
function setupTemplate($subclass = false)
{
parent::setupTemplate(true);
if ($subclass) {
$templateMgr =& TemplateManager::getManager();
$templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'subscriptions'), 'manager.subscriptions'));
}
}