本文整理汇总了PHP中AdminHandler::setupTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHandler::setupTemplate方法的具体用法?PHP AdminHandler::setupTemplate怎么用?PHP AdminHandler::setupTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminHandler
的用法示例。
在下文中一共展示了AdminHandler::setupTemplate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveLanguageSettings
/**
* Update language settings.
*/
function saveLanguageSettings()
{
parent::validate();
parent::setupTemplate(true);
$site =& Request::getSite();
$primaryLocale = Request::getUserVar('primaryLocale');
$supportedLocales = Request::getUserVar('supportedLocales');
if (Locale::isLocaleValid($primaryLocale)) {
$site->setPrimaryLocale($primaryLocale);
}
$newSupportedLocales = array();
if (isset($supportedLocales) && is_array($supportedLocales)) {
foreach ($supportedLocales as $locale) {
if (Locale::isLocaleValid($locale)) {
array_push($newSupportedLocales, $locale);
}
}
}
if (!in_array($primaryLocale, $newSupportedLocales)) {
array_push($newSupportedLocales, $primaryLocale);
}
$site->setSupportedLocales($newSupportedLocales);
$siteDao =& DAORegistry::getDAO('SiteDAO');
$siteDao->updateSite($site);
AdminLanguagesHandler::removeLocalesFromJournals();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign(array('currentUrl' => Request::url(null, null, 'languages'), 'pageTitle' => 'common.languages', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, 'admin'), 'backLinkLabel' => 'admin.siteAdmin'));
$templateMgr->display('common/message.tpl');
}
示例2: index
/**
* Display site admin index page.
*/
function index()
{
AdminHandler::validate();
AdminHandler::setupTemplate();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'site.index');
$templateMgr->display('admin/index.tpl');
}
示例3: editAuthSource
/**
* Display form to edit an authentication source.
*/
function editAuthSource($args)
{
parent::validate();
parent::setupTemplate(true);
import('security.form.AuthSourceSettingsForm');
$form =& new AuthSourceSettingsForm((int) @$args[0]);
$form->initData();
$form->display();
}
示例4: saveSystemConfig
/**
* Save modified system configuration settings.
*/
function saveSystemConfig()
{
parent::validate();
parent::setupTemplate(true);
$configData =& Config::getData();
// Update configuration based on user-supplied data
foreach ($configData as $sectionName => $sectionData) {
$newData = Request::getUserVar($sectionName);
foreach ($sectionData as $settingName => $settingValue) {
if (isset($newData[$settingName])) {
$newValue = $newData[$settingName];
if (strtolower($newValue) == "true" || strtolower($newValue) == "on") {
$newValue = "On";
} else {
if (strtolower($newValue) == "false" || strtolower($newValue) == "off") {
$newValue = "Off";
}
}
$configData[$sectionName][$settingName] = $newValue;
}
}
}
$templateMgr =& TemplateManager::getManager();
// Update contents of configuration file
$configParser =& new ConfigParser();
if (!$configParser->updateConfig(Config::getConfigFileName(), $configData)) {
// Error reading config file (this should never happen)
$templateMgr->assign('errorMsg', 'admin.systemConfigFileReadError');
$templateMgr->assign('backLink', Request::url(null, null, 'systemInfo'));
$templateMgr->assign('backLinkLabel', 'admin.systemInformation');
$templateMgr->display('common/error.tpl');
} else {
$writeConfigFailed = false;
$displayConfigContents = Request::getUserVar('display') == null ? false : true;
$configFileContents = $configParser->getFileContents();
if (!$displayConfigContents) {
if (!$configParser->writeConfig(Config::getConfigFileName())) {
$writeConfigFailed = true;
}
}
// Display confirmation
$templateMgr->assign('writeConfigFailed', $writeConfigFailed);
$templateMgr->assign('displayConfigContents', $displayConfigContents);
$templateMgr->assign('configFileContents', $configFileContents);
$templateMgr->assign('helpTopicId', 'site.administrativeFunctions');
$templateMgr->display('admin/systemConfigUpdated.tpl');
}
}
示例5: saveSettings
/**
* Validate and save changes to site settings.
*/
function saveSettings()
{
parent::validate();
parent::setupTemplate(true);
$site =& Request::getSite();
import('admin.form.SiteSettingsForm');
$settingsForm =& new SiteSettingsForm();
$settingsForm->readInputData();
if (Request::getUserVar('uploadSiteStyleSheet')) {
if (!$settingsForm->uploadSiteStyleSheet()) {
$settingsForm->addError('siteStyleSheet', Locale::translate('admin.settings.siteStyleSheetInvalid'));
}
} elseif (Request::getUserVar('deleteSiteStyleSheet')) {
$publicFileManager =& new PublicFileManager();
$publicFileManager->removeSiteFile($site->getSiteStyleFilename());
} elseif (Request::getUserVar('uploadPageHeaderTitleImage')) {
if (!$settingsForm->uploadPageHeaderTitleImage($settingsForm->getFormLocale())) {
$settingsForm->addError('pageHeaderTitleImage', Locale::translate('admin.settings.homeHeaderImageInvalid'));
}
} elseif (Request::getUserVar('deletePageHeaderTitleImage')) {
$publicFileManager =& new PublicFileManager();
$setting = $site->getData('pageHeaderTitleImage');
$formLocale = $settingsForm->getFormLocale();
if (isset($setting[$formLocale])) {
$publicFileManager->removeSiteFile($setting[$formLocale]['uploadName']);
unset($setting[$formLocale]);
$site->setData('pageHeaderTitleImage', $setting);
$siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
$siteSettingsDao->deleteSetting('pageHeaderTitleImage', $formLocale);
// Refresh site header
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('displayPageHeaderTitle', $site->getSitePageHeaderTitle());
}
} elseif ($settingsForm->validate()) {
$settingsForm->execute();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign(array('currentUrl' => Request::url(null, null, 'settings'), 'pageTitle' => 'admin.siteSettings', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, Request::getRequestedPage()), 'backLinkLabel' => 'admin.siteAdmin'));
$templateMgr->display('common/message.tpl');
exit;
}
$settingsForm->display();
}
示例6: setupTemplate
/**
* Set up the template.
*/
function setupTemplate()
{
parent::setupTemplate(true);
AppLocale::requireComponents(array(LOCALE_COMPONENT_OJS_MANAGER));
}
示例7: setupTemplate
/**
* Setup common template variables.
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
*/
function setupTemplate($subclass = false)
{
parent::setupTemplate();
$templateMgr =& TemplateManager::getManager();
$pageHierarchy = array(array(Request::url('admin'), 'admin.siteAdmin'));
if ($subclass) {
$pageHierarchy[] = array(Request::url('admin', 'archives'), 'admin.archives');
}
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}
示例8: import
/**
* Import data from an OJS 1.x journal.
*/
function doImportOJS1()
{
parent::validate();
import('admin.form.ImportOJS1Form');
$importForm =& new ImportOJS1Form();
$importForm->readInputData();
if ($importForm->validate() && ($journalId = $importForm->execute()) !== false) {
$redirects = $importForm->getRedirects();
$conflicts = $importForm->getConflicts();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('journalId', $journalId);
$templateMgr->assign('redirects', $redirects);
$templateMgr->assign('conflicts', $conflicts);
$templateMgr->display('admin/importComplete.tpl');
} else {
parent::setupTemplate(true);
$importForm->display();
}
}
示例9: mergeUsers
/**
* Allow the Site Administrator to merge user accounts, including attributed articles etc.
*/
function mergeUsers($args)
{
parent::validate();
parent::setupTemplate(true);
$roleDao =& DAORegistry::getDAO('RoleDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$templateMgr =& TemplateManager::getManager();
$oldUserId = Request::getUserVar('oldUserId');
$newUserId = Request::getUserVar('newUserId');
if (!empty($oldUserId) && !empty($newUserId)) {
// Both user IDs have been selected. Merge the accounts.
$articleDao =& DAORegistry::getDAO('ArticleDAO');
foreach ($articleDao->getArticlesByUserId($oldUserId) as $article) {
$article->setUserId($newUserId);
$articleDao->updateArticle($article);
unset($article);
}
$commentDao =& DAORegistry::getDAO('CommentDAO');
foreach ($commentDao->getCommentsByUserId($oldUserId) as $comment) {
$comment->setUserId($newUserId);
$commentDao->updateComment($comment);
unset($comment);
}
$articleNoteDao =& DAORegistry::getDAO('ArticleNoteDAO');
$articleNotes =& $articleNoteDao->getArticleNotesByUserId($oldUserId);
while ($articleNote =& $articleNotes->next()) {
$articleNote->setUserId($newUserId);
$articleNoteDao->updateArticleNote($articleNote);
unset($articleNote);
}
$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
$editAssignments =& $editAssignmentDao->getEditAssignmentsByUserId($oldUserId);
while ($editAssignment =& $editAssignments->next()) {
$editAssignment->setEditorId($newUserId);
$editAssignmentDao->updateEditAssignment($editAssignment);
unset($editAssignment);
}
$editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
$editorSubmissionDao->transferEditorDecisions($oldUserId, $newUserId);
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
foreach ($reviewAssignmentDao->getReviewAssignmentsByUserId($oldUserId) as $reviewAssignment) {
$reviewAssignment->setReviewerId($newUserId);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
unset($reviewAssignment);
}
$copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
$copyeditorSubmissions =& $copyeditorSubmissionDao->getCopyeditorSubmissionsByCopyeditorId($oldUserId);
while ($copyeditorSubmission =& $copyeditorSubmissions->next()) {
$copyeditorSubmission->setCopyeditorId($newUserId);
$copyeditorSubmissionDao->updateCopyeditorSubmission($copyeditorSubmission);
unset($copyeditorSubmission);
}
$layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
$layoutEditorSubmissions =& $layoutEditorSubmissionDao->getSubmissions($oldUserId);
while ($layoutEditorSubmission =& $layoutEditorSubmissions->next()) {
$layoutAssignment =& $layoutEditorSubmission->getLayoutAssignment();
$layoutAssignment->setEditorId($newUserId);
$layoutEditorSubmissionDao->updateSubmission($layoutEditorSubmission);
unset($layoutAssignment);
unset($layoutEditorSubmission);
}
$proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
$proofreaderSubmissions =& $proofreaderSubmissionDao->getSubmissions($oldUserId);
while ($proofreaderSubmission =& $proofreaderSubmissions->next()) {
$proofAssignment =& $proofreaderSubmission->getProofAssignment();
$proofAssignment->setProofreaderId($newUserId);
$proofreaderSubmissionDao->updateSubmission($proofreaderSubmission);
unset($proofAssignment);
unset($proofreaderSubmission);
}
$articleEmailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
$articleEmailLogDao->transferArticleLogEntries($oldUserId, $newUserId);
$articleEventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
$articleEventLogDao->transferArticleLogEntries($oldUserId, $newUserId);
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
foreach ($articleCommentDao->getArticleCommentsByUserId($oldUserId) as $articleComment) {
$articleComment->setAuthorId($newUserId);
$articleCommentDao->updateArticleComment($articleComment);
unset($articleComment);
}
$accessKeyDao =& DAORegistry::getDAO('AccessKeyDAO');
$accessKeyDao->transferAccessKeys($oldUserId, $newUserId);
// Delete the old user and associated info.
$sessionDao =& DAORegistry::getDAO('SessionDAO');
$sessionDao->deleteSessionsByUserId($oldUserId);
$subscriptionDao =& DAORegistry::getDAO('SubscriptionDAO');
$subscriptionDao->deleteSubscriptionsByUserId($oldUserId);
$temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO');
$temporaryFileDao->deleteTemporaryFilesByUserId($oldUserId);
$notificationStatusDao =& DAORegistry::getDAO('NotificationStatusDAO');
$notificationStatusDao->deleteNotificationStatusByUserId($oldUserId);
$userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO');
$userSettingsDao->deleteSettings($oldUserId);
$groupMembershipDao =& DAORegistry::getDAO('GroupMembershipDAO');
$groupMembershipDao->deleteMembershipByUserId($oldUserId);
$sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
$sectionEditorsDao->deleteEditorsByUserId($oldUserId);
//.........这里部分代码省略.........
示例10: setupTemplate
function setupTemplate($request = null, $category = null, $subclass = false)
{
parent::setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
if ($subclass) {
$templateMgr->append('pageHierarchy', array($request->url(null, 'admin', 'categories'), 'admin.categories'));
}
if ($category) {
$templateMgr->append('pageHierarchy', array($request->url(null, 'admin', 'editCategory', $category->getId()), $category->getLocalizedName(), true));
}
}
示例11: setupTemplate
/**
* Setup common template variables.
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
*/
function setupTemplate($request, $subclass = false)
{
parent::setupTemplate($request);
$templateMgr =& TemplateManager::getManager($request);
$pageHierarchy = array(array($request->url('admin'), 'admin.siteAdmin'));
if ($subclass) {
$pageHierarchy[] = array($request->url('admin', 'sortOrders'), 'admin.sortOrders');
}
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}