本文整理汇总了PHP中ManagerHandler::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP ManagerHandler::validate方法的具体用法?PHP ManagerHandler::validate怎么用?PHP ManagerHandler::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagerHandler
的用法示例。
在下文中一共展示了ManagerHandler::validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin
/**
* Perform plugin-specific management functions.
*/
function plugin($args)
{
$category = array_shift($args);
$plugin = array_shift($args);
$verb = array_shift($args);
parent::validate();
$plugins =& PluginRegistry::loadCategory($category);
if (!isset($plugins[$plugin]) || !$plugins[$plugin]->manage($verb, $args)) {
Request::redirect(null, null, 'plugins');
}
}
示例2: validate
/**
* The site setting option 'preventManagerPluginManagement' must not be set for
* journal managers to be able to manage plugins.
* @param $request PKPRequest
*/
function validate($request)
{
parent::validate();
if (!Validation::isSiteAdmin()) {
$site =& $request->getSite();
$preventManagerPluginManagement = $site->getSetting('preventManagerPluginManagement');
if ($preventManagerPluginManagement) {
$request->redirect(null, 'manager', 'plugins');
}
}
}
示例3: validate
/**
* Validate that user has permissions to manage e-mail templates.
* Redirects to user index page if not properly authenticated.
* @param $request PKPRequest
*/
function validate(&$request)
{
parent::validate();
$schedConf =& $request->getSchedConf();
// If the user is a Conference Manager, but has specified a scheduled conference,
// redirect so no scheduled conference is present (otherwise they would end up managing
// scheduled conference e-mails.)
if ($schedConf && !Validation::isConferenceManager()) {
$request->redirect(null, 'index', $request->getRequestedPage(), $request->getRequestedOp());
}
return true;
}
示例4: updateTrack
/**
* Save changes to a track.
*/
function updateTrack()
{
parent::validate();
$this->setupTemplate(true);
import('manager.form.TrackForm');
$trackForm = new TrackForm(Request::getUserVar('trackId'));
$trackForm->readInputData();
if ($trackForm->validate()) {
$trackForm->execute();
Request::redirect(null, null, null, 'tracks');
} else {
$trackForm->display();
}
}
示例5: updateTrack
/**
* Save changes to a track.
*/
function updateTrack($args, &$request)
{
parent::validate();
$this->setupTemplate($request, true);
import('classes.manager.form.TrackForm');
$trackForm = new TrackForm($request->getUserVar('trackId'));
$trackForm->readInputData();
if ($trackForm->validate()) {
$trackForm->execute();
$request->redirect(null, null, null, 'tracks');
} else {
$trackForm->display();
}
}
示例6: index
/**
* Display journal management index page.
*/
function index()
{
ManagerHandler::validate();
ManagerHandler::setupTemplate();
$journal =& Request::getJournal();
$journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
$subscriptionsEnabled = $journalSettingsDao->getSetting($journal->getJournalId(), 'enableSubscriptions');
$announcementsEnabled = $journalSettingsDao->getSetting($journal->getJournalId(), 'enableAnnouncements');
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('subscriptionsEnabled', $subscriptionsEnabled);
$templateMgr->assign('announcementsEnabled', $announcementsEnabled);
$templateMgr->assign('helpTopicId', 'journal.index');
$templateMgr->display('manager/index.tpl');
}
示例7: 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');
}
示例8: 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();
}
}
示例9: 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');
}
示例10: fileDelete
function fileDelete($args)
{
parent::validate();
FilesHandler::parseDirArg($args, $currentDir, $parentDir);
$currentPath = FilesHandler::getRealFilesDir($currentDir);
import('file.FileManager');
$fileMgr =& new FileManager();
if (@is_file($currentPath)) {
$fileMgr->deleteFile($currentPath);
} else {
// TODO Use recursive delete (rmtree) instead?
@$fileMgr->rmdir($currentPath);
}
Request::redirect(null, null, 'files', explode('/', $parentDir));
}
示例11: moveSection
/**
* Change the sequence of a section.
*/
function moveSection()
{
parent::validate();
$journal =& Request::getJournal();
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$section =& $sectionDao->getSection(Request::getUserVar('sectionId'), $journal->getJournalId());
if ($section != null) {
$section->setSequence($section->getSequence() + (Request::getUserVar('d') == 'u' ? -1.5 : 1.5));
$sectionDao->updateSection($section);
$sectionDao->resequenceSections($journal->getJournalId());
}
Request::redirect(null, null, 'sections');
}
示例12: updateAnnouncementType
/**
* Save changes to an announcement type.
*/
function updateAnnouncementType()
{
parent::validate();
import('manager.form.AnnouncementTypeForm');
$journal =& Request::getJournal();
$typeId = Request::getUserVar('typeId') == null ? null : (int) Request::getUserVar('typeId');
$announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
if ($typeId != null && $announcementTypeDao->getAnnouncementTypeJournalId($typeId) == $journal->getJournalId() || $typeId == null) {
$announcementTypeForm =& new AnnouncementTypeForm($typeId);
$announcementTypeForm->readInputData();
if ($announcementTypeForm->validate()) {
$announcementTypeForm->execute();
if (Request::getUserVar('createAnother')) {
Request::redirect(null, null, 'createAnnouncementType');
} else {
Request::redirect(null, null, 'announcementTypes');
}
} else {
AnnouncementHandler::setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
$templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'announcementTypes'), 'manager.announcementTypes'));
if ($typeId == null) {
$templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.createTitle');
} else {
$templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.editTitle');
}
$announcementTypeForm->display();
}
} else {
Request::redirect(null, null, 'announcementTypes');
}
}
示例13: updateTimeBlock
/**
* Save changes to a timeBlock.
*/
function updateTimeBlock()
{
parent::validate();
SchedulerHandler::setupTemplate(true);
import('manager.form.scheduler.TimeBlockForm');
$schedConf =& Request::getSchedConf();
$timeBlockId = Request::getUserVar('timeBlockId') == null ? null : (int) Request::getUserVar('timeBlockId');
$timeBlockDao =& DAORegistry::getDAO('TimeBlockDAO');
if ($timeBlockId != null && $timeBlockDao->getTimeBlockSchedConfId($timeBlockId) == $schedConf->getId() || $timeBlockId == null) {
if (checkPhpVersion('5.0.0')) {
// WARNING: This form needs $this in constructor
$timeBlockForm = new TimeBlockForm($timeBlockId);
} else {
$timeBlockForm =& new TimeBlockForm($timeBlockId);
}
$timeBlockForm->readInputData();
if ($timeBlockForm->validate()) {
$timeBlockForm->execute();
if (Request::getUserVar('createAnother')) {
// Provide last block as template
return $timeBlockForm->display();
} else {
Request::redirect(null, null, null, 'timeBlocks');
}
} else {
$templateMgr =& TemplateManager::getManager();
$templateMgr->append('pageHierarchy', array(Request::url(null, null, 'manager', 'timeBlocks'), 'manager.scheduler.timeBlocks'));
if ($timeBlockId == null) {
$templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.createTimeBlock');
} else {
$templateMgr->assign('timeBlockTitle', 'manager.scheduler.timeBlock.editTimeBlock');
}
$timeBlockForm->display();
}
} else {
Request::redirect(null, null, null, 'timeBlocks');
}
}
示例14: reportGenerator
function reportGenerator($args)
{
parent::validate();
$journal =& Request::getJournal();
$fromDate = Request::getUserDateVar('dateFrom', 1, 1);
if ($fromDate !== null) {
$fromDate = date('Y-m-d H:i:s', $fromDate);
}
$toDate = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
if ($toDate !== null) {
$toDate = date('Y-m-d H:i:s', $toDate);
}
$journalStatisticsDao =& DAORegistry::getDAO('JournalStatisticsDAO');
$reportType = (int) Request::getUserVar('reportType');
switch ($reportType) {
case REPORT_TYPE_EDITOR:
$report =& $journalStatisticsDao->getEditorReport($journal->getJournalId(), $fromDate, $toDate);
break;
case REPORT_TYPE_REVIEWER:
$report =& $journalStatisticsDao->getReviewerReport($journal->getJournalId(), $fromDate, $toDate);
break;
case REPORT_TYPE_SECTION:
$report =& $journalStatisticsDao->getSectionReport($journal->getJournalId(), $fromDate, $toDate);
break;
case REPORT_TYPE_JOURNAL:
default:
$reportType = REPORT_TYPE_JOURNAL;
$report =& $journalStatisticsDao->getJournalReport($journal->getJournalId(), $fromDate, $toDate);
break;
}
$templateMgr =& TemplateManager::getManager();
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=report.csv');
$separator = ',';
// Display the heading row.
switch ($reportType) {
case REPORT_TYPE_EDITOR:
echo Locale::translate('user.role.editor') . $separator;
break;
case REPORT_TYPE_REVIEWER:
echo Locale::translate('user.role.reviewer') . $separator;
echo Locale::translate('manager.statistics.reports.singleScore') . $separator;
echo Locale::translate('user.affiliation') . $separator;
break;
case REPORT_TYPE_SECTION:
echo Locale::translate('section.section') . $separator;
break;
}
echo Locale::translate('article.submissionId');
for ($i = 0; $i < $report->getMaxAuthors(); $i++) {
echo $separator . Locale::translate('manager.statistics.reports.author', array('num' => $i + 1));
echo $separator . Locale::translate('manager.statistics.reports.affiliation', array('num' => $i + 1));
echo $separator . Locale::translate('manager.statistics.reports.country', array('num' => $i + 1));
}
echo $separator . Locale::translate('article.title');
if ($reportType !== REPORT_TYPE_SECTION) {
echo $separator . Locale::translate('section.section');
}
echo $separator . Locale::translate('submissions.submitted');
if ($reportType !== REPORT_TYPE_EDITOR) {
for ($i = 0; $i < $report->getMaxEditors(); $i++) {
echo $separator . Locale::translate('manager.statistics.reports.editor', array('num' => $i + 1));
}
}
if ($reportType !== REPORT_TYPE_REVIEWER) {
for ($i = 0; $i < $report->getMaxReviewers(); $i++) {
echo $separator . Locale::translate('manager.statistics.reports.reviewer', array('num' => $i + 1));
echo $separator . Locale::translate('manager.statistics.reports.score', array('num' => $i + 1));
echo $separator . Locale::translate('manager.statistics.reports.recommendation', array('num' => $i + 1));
}
}
echo $separator . Locale::translate('editor.article.decision');
echo $separator . Locale::translate('manager.statistics.reports.daysToDecision');
echo $separator . Locale::translate('manager.statistics.reports.daysToPublication');
echo "\n";
// Display the report.
$dateFormatShort = Config::getVar('general', 'date_format_short');
while ($row =& $report->next()) {
switch ($reportType) {
case REPORT_TYPE_EDITOR:
echo $row['editor'] . $separator;
break;
case REPORT_TYPE_REVIEWER:
echo $row['reviewer'] . $separator;
echo $row['score'] . $separator;
echo $row['affiliation'] . $separator;
break;
case REPORT_TYPE_SECTION:
echo $row['section'] . $separator;
break;
}
echo $row['articleId'];
for ($i = 0; $i < $report->getMaxAuthors(); $i++) {
echo $separator . StatisticsHandler::csvEscape($row['authors'][$i]);
echo $separator . StatisticsHandler::csvEscape($row['affiliations'][$i]);
echo $separator . StatisticsHandler::csvEscape($row['countries'][$i]);
}
echo $separator . StatisticsHandler::csvEscape($row['title']);
if ($reportType !== REPORT_TYPE_SECTION) {
echo $separator . StatisticsHandler::csvEscape($row['section']);
//.........这里部分代码省略.........
示例15: saveSubscriptionPolicies
/**
* Save subscription policies for the current journal.
*/
function saveSubscriptionPolicies($args = array())
{
parent::validate();
import('subscription.form.SubscriptionPolicyForm');
$subscriptionPolicyForm =& new SubscriptionPolicyForm();
$subscriptionPolicyForm->readInputData();
if ($subscriptionPolicyForm->validate()) {
$subscriptionPolicyForm->execute();
SubscriptionHandler::setupTemplate(true);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'journal.managementPages.subscriptions');
$templateMgr->assign('subscriptionPoliciesSaved', '1');
if (Config::getVar('general', 'scheduled_tasks')) {
$templateMgr->assign('scheduledTasksEnabled', true);
}
$subscriptionPolicyForm->display();
} else {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'journal.managementPages.subscriptions');
if (Config::getVar('general', 'scheduled_tasks')) {
$templateMgr->assign('scheduledTasksEnabled', true);
}
$subscriptionPolicyForm->display();
}
}