本文整理汇总了PHP中TemplateManager类的典型用法代码示例。如果您正苦于以下问题:PHP TemplateManager类的具体用法?PHP TemplateManager怎么用?PHP TemplateManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TemplateManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Perform installation.
*/
function execute()
{
define('RUNNING_UPGRADE', 1);
$templateMgr = TemplateManager::getManager($this->_request);
$installer = new Upgrade($this->_data);
// FIXME Use logger?
// FIXME Mostly common with InstallForm
if ($installer->execute()) {
if (!$installer->wroteConfig()) {
// Display config file contents for manual replacement
$templateMgr->assign(array('writeConfigFailed' => true, 'configFileContents' => $installer->getConfigContents()));
}
$templateMgr->assign('notes', $installer->getNotes());
$templateMgr->assign('newVersion', $installer->getNewVersion());
$templateMgr->display('install/upgradeComplete.tpl');
} else {
switch ($installer->getErrorType()) {
case INSTALLER_ERROR_DB:
$this->dbInstallError($installer->getErrorMsg());
break;
default:
$this->installError($installer->getErrorMsg());
break;
}
}
$installer->destroy();
}
示例2: evaluate
public function evaluate(TemplateManager $manager, $context, $value)
{
$filter = $manager->filter($this->m_name);
if (!$filter) {
throw new \Exception("Unknown filter `{$this->m_name}`");
}
return $filter($this->m_options, $context, $value);
}
示例3: setupTemplate
/**
* @see PKPHandler::setupTemplate()
* @param $request PKPKRequest
*/
function setupTemplate($request)
{
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('oldUserId', (int) $request->getUserVar('oldUserId'));
// for merging users.
parent::setupTemplate($request);
}
示例4: fetchReviewRoundInfo
/**
* Fetch information for the author on the specified review round
* @param $args array
* @param $request Request
* @return JSONMessage JSON object
*/
function fetchReviewRoundInfo($args, $request)
{
$this->setupTemplate($request);
$templateMgr = TemplateManager::getManager($request);
$stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
fatalError('Invalid Stage Id');
}
$templateMgr->assign('stageId', $stageId);
$reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
$templateMgr->assign('reviewRoundId', $reviewRound->getId());
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$templateMgr->assign('submission', $submission);
// Review round request notification options.
$notificationRequestOptions = array(NOTIFICATION_LEVEL_NORMAL => array(NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())), NOTIFICATION_LEVEL_TRIVIAL => array());
$templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions);
// Editor has taken an action and sent an email; Display the email
import('classes.workflow.EditorDecisionActionsManager');
if (EditorDecisionActionsManager::getEditorTakenActionInReviewRound($reviewRound)) {
$submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO');
$user = $request->getUser();
$submissionEmailFactory = $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId());
$templateMgr->assign('submissionEmails', $submissionEmailFactory);
$templateMgr->assign('showReviewAttachments', true);
}
return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl');
}
示例5: display
/**
* Display the form.
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('paperId', $this->paperId);
$templateMgr->assign('submitStep', $this->step);
switch ($this->step) {
case 3:
$helpTopicId = 'submission.indexingMetadata';
break;
case 4:
$helpTopicId = 'submission.supplementaryFiles';
break;
default:
$helpTopicId = 'submission.index';
}
$templateMgr->assign('helpTopicId', $helpTopicId);
$schedConf =& Request::getSchedConf();
$settingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO');
// Determine which submission steps should be shown
$progress = isset($this->paper) ? $this->paper->getCurrentStage() : REVIEW_STAGE_ABSTRACT;
$reviewMode = isset($this->paper) ? $this->paper->getReviewMode() : $schedConf->getSetting('reviewMode');
$showAbstractSteps = $progress == REVIEW_STAGE_ABSTRACT || $reviewMode != REVIEW_MODE_BOTH_SEQUENTIAL;
$showPaperSteps = $progress == REVIEW_STAGE_PRESENTATION || $reviewMode == REVIEW_MODE_BOTH_SIMULTANEOUS || $reviewMode == REVIEW_MODE_PRESENTATIONS_ALONE;
$templateMgr->assign('showAbstractSteps', $showAbstractSteps);
$templateMgr->assign('showPaperSteps', $showPaperSteps);
$templateMgr->assign('addSuppFileMessage', $schedConf->getLocalizedSetting("addSuppFileMessage"));
$templateMgr->assign('stepFinalMessage', $schedConf->getLocalizedSetting("stepFinalMessage"));
$templateMgr->assign('uploadInstructions', $schedConf->getLocalizedSetting("uploadInstructions"));
if (isset($this->paper)) {
$templateMgr->assign('submissionProgress', $this->paper->getSubmissionProgress());
}
parent::display();
}
示例6: display
/**
* Display the form.
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('group', $this->group);
$templateMgr->assign('helpTopicId', 'conference.currentConferences.organizingTeam');
parent::display();
}
示例7: fetch
/**
* @copydoc Form::fetch()
*/
function fetch($request)
{
$urnNamespaces = array('' => '', 'urn:nbn:de' => 'urn:nbn:de', 'urn:nbn:at' => 'urn:nbn:at', 'urn:nbn:ch' => 'urn:nbn:ch', 'urn:nbn' => 'urn:nbn', 'urn' => 'urn');
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('urnNamespaces', $urnNamespaces);
return parent::fetch($request);
}
示例8: updateReferral
/**
* Save changes to an announcement type.
*/
function updateReferral()
{
$referralId = (int) Request::getUserVar('referralId');
if ($referralId === 0) {
$referralId = null;
}
list($plugin, $referral, $article) = $this->validate($referralId);
// If it's an insert, ensure that it's allowed for this article
if (!isset($referral)) {
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$journal =& Request::getJournal();
$article =& $publishedArticleDao->getPublishedArticleByArticleId((int) Request::getUserVar('articleId'));
if (!$article || $article->getUserId() != $user->getId() && !Validation::isSectionEditor($journal->getId()) && !Validation::isEditor($journal->getId())) {
Request::redirect(null, 'author');
}
}
$this->setupTemplate();
$plugin->import('ReferralForm');
$referralForm = new ReferralForm($plugin, $article, $referralId);
$referralForm->readInputData();
if ($referralForm->validate()) {
$referralForm->execute();
Request::redirect(null, 'author');
} else {
$templateMgr =& TemplateManager::getManager();
if ($referralId == null) {
$templateMgr->assign('referralTitle', 'plugins.generic.referral.createReferral');
} else {
$templateMgr->assign('referralTitle', 'plugins.generic.referral.editReferral');
}
$referralForm->display();
}
}
示例9: display
/**
* Display the form.
*/
function display()
{
$conference =& Request::getConference();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('enablePublicSuppFileId', $conference->getSetting('enablePublicSuppFileId'));
$templateMgr->assign('rolePath', Request::getRequestedPage());
$templateMgr->assign('paperId', $this->paper->getPaperId());
$templateMgr->assign('suppFileId', $this->suppFileId);
$typeOptionsOutput = array('author.submit.suppFile.researchInstrument', 'author.submit.suppFile.researchMaterials', 'author.submit.suppFile.researchResults', 'author.submit.suppFile.transcripts', 'author.submit.suppFile.dataAnalysis', 'author.submit.suppFile.dataSet', 'author.submit.suppFile.sourceText');
$typeOptionsValues = $typeOptionsOutput;
array_push($typeOptionsOutput, 'common.other');
array_push($typeOptionsValues, '');
$templateMgr->assign('typeOptionsOutput', $typeOptionsOutput);
$templateMgr->assign('typeOptionsValues', $typeOptionsValues);
// Sometimes it's necessary to track the page we came from in
// order to redirect back to the right place
$templateMgr->assign('from', Request::getUserVar('from'));
if (isset($this->paper)) {
$templateMgr->assign('submissionProgress', $this->paper->getSubmissionProgress());
}
if (isset($this->suppFile)) {
$templateMgr->assign_by_ref('suppFile', $this->suppFile);
}
$templateMgr->assign('helpTopicId', 'submission.supplementaryFiles');
parent::display();
}
示例10: fetch
/**
* Fetch the form
* @param $request Request
*/
function fetch($request)
{
$templateMgr = TemplateManager::getManager($request);
$baseUrl = $templateMgr->_request->getBaseUrl();
// Add extra java script required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
// NOTE: I believe this needs attention. jquery.validate.min.js is
// loaded with our minifiedScripts.tpl list and includes some i18n
// features.
$templateMgr->addJavaScript('citation', $baseUrl . '/lib/pkp/js/functions/citation.js', array('contexts' => 'backend'));
$templateMgr->addJavaScript('jqueryValidate', $baseUrl . '/lib/pkp/js/lib/jquery/plugins/validate/jquery.validate.min.js', array('contexts' => 'backend'));
$templateMgr->addJavaScript('jqueryValidatorI18n', $baseUrl . '/lib/pkp/js/functions/jqueryValidatorI18n.js', array('contexts' => 'backend'));
//
// Citation editor filter configuration
//
// 1) Add the filter grid URLs
$dispatcher = $request->getDispatcher();
$parserFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.ParserFilterGridHandler', 'fetchGrid');
$templateMgr->assign('parserFilterGridUrl', $parserFilterGridUrl);
$lookupFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.LookupFilterGridHandler', 'fetchGrid');
$templateMgr->assign('lookupFilterGridUrl', $lookupFilterGridUrl);
// 2) Create a list of all available citation output filters.
$router = $request->getRouter();
$journal = $router->getContext($request);
$filterDao = DAORegistry::getDAO('FilterDAO');
/* @var $filterDao FilterDAO */
$metaCitationOutputFilterObjects = $filterDao->getObjectsByGroup('nlm30-element-citation=>plaintext', $journal->getId());
foreach ($metaCitationOutputFilterObjects as $metaCitationOutputFilterObject) {
$metaCitationOutputFilters[$metaCitationOutputFilterObject->getId()] = $metaCitationOutputFilterObject->getDisplayName();
}
$templateMgr->assign_by_ref('metaCitationOutputFilters', $metaCitationOutputFilters);
return parent::fetch($request);
}
示例11: display
function display()
{
$templateMgr = TemplateManager::getManager();
$templateMgr->assign('depositPointId', $this->depositPointId);
$templateMgr->assign('depositPointTypes', $this->plugin->getTypeMap());
parent::display();
}
示例12: addTinyMCE
/**
* Add the tinyMCE script for editing sidebar blocks with a WYSIWYG editor
*/
function addTinyMCE()
{
$journalId = $this->journalId;
$plugin =& $this->plugin;
$templateMgr =& TemplateManager::getManager();
// Enable TinyMCE with specific params
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
import('classes.file.JournalFileManager');
$publicFileManager = new PublicFileManager();
$tinyMCE_script = '
<script language="javascript" type="text/javascript" src="' . Request::getBaseUrl() . '/' . TINYMCE_JS_PATH . '/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
plugins : "style,paste",
theme : "advanced",
theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,|,cleanup,help,code,",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "left",
content_css : "' . Request::getBaseUrl() . '/styles/common.css",
relative_urls : false,
document_base_url : "' . Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/",
extended_valid_elements : "span[*], div[*]"
});
</script>';
$templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $tinyMCE_script);
}
示例13: saveProgramSettings
/**
* Save changes to program settings.
*/
function saveProgramSettings()
{
$this->validate();
$this->setupTemplate(true);
$schedConf =& Request::getSchedConf();
if (!$schedConf) {
Request::redirect(null, null, 'index');
}
import('classes.manager.form.ProgramSettingsForm');
$settingsForm = new ProgramSettingsForm();
$settingsForm->readInputData();
$formLocale = $settingsForm->getFormLocale();
$programTitle = Request::getUserVar('programFileTitle');
$editData = false;
if (Request::getUserVar('uploadProgramFile')) {
if (!$settingsForm->uploadProgram('programFile', $formLocale)) {
$settingsForm->addError('programFile', Locale::translate('common.uploadFailed'));
}
$editData = true;
} elseif (Request::getUserVar('deleteProgramFile')) {
$settingsForm->deleteProgram('programFile', $formLocale);
$editData = true;
}
if (!$editData && $settingsForm->validate()) {
$settingsForm->execute();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'program'), 'pageTitle' => 'schedConf.program', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement'));
$templateMgr->display('common/message.tpl');
} else {
$settingsForm->display();
}
}
示例14: display
/**
* Display the form.
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
$site =& Request::getSite();
$templateMgr->assign('minPasswordLength', $site->getMinPasswordLength());
parent::display();
}
示例15: index
/**
* Displays the issue listings in a tabbed interface.
* @param $args array
* @param $request PKPRequest
*/
function index($args, $request)
{
$this->setupTemplate($request);
AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR);
$templateMgr = TemplateManager::getManager($request);
$templateMgr->display('manageIssues/issues.tpl');
}