本文整理汇总了PHP中Validation::isEditor方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isEditor方法的具体用法?PHP Validation::isEditor怎么用?PHP Validation::isEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::isEditor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display the form.
* @param $request Request
*/
function display($request)
{
$canOnlyRead = true;
$canOnlyReview = false;
if (Validation::isReviewer()) {
$canOnlyRead = false;
$canOnlyReview = true;
}
if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) {
$canOnlyRead = false;
$canOnlyReview = false;
}
$templateMgr =& TemplateManager::getManager();
// Remove the notification setting categories that the user will not be receiving (to simplify the form)
$notificationSettingCategories = $this->_getNotificationSettingCategories();
if ($canOnlyRead || $canOnlyReview) {
unset($notificationSettingCategories['submissions']);
}
if ($canOnlyRead) {
unset($notificationSettingCategories['reviewing']);
}
$templateMgr->assign('notificationSettingCategories', $notificationSettingCategories);
$templateMgr->assign('notificationSettings', $this->_getNotificationSettingsMap());
$templateMgr->assign('titleVar', __('common.title'));
return parent::display($request);
}
示例2: setupTemplate
/**
* Setup common template variables.
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
*/
function setupTemplate()
{
parent::setupTemplate();
Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OJS_AUTHOR, LOCALE_COMPONENT_OJS_MANAGER));
$templateMgr =& TemplateManager::getManager();
$isEditor = Validation::isEditor();
if (Request::getRequestedPage() == 'editor') {
$templateMgr->assign('helpTopicId', 'editorial.editorsRole');
} else {
$templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole');
}
$roleSymbolic = $isEditor ? 'editor' : 'sectionEditor';
$roleKey = $isEditor ? 'user.role.coordinator' : 'user.role.sectionEditor';
$pageHierarchy = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'user'), $roleKey), array(Request::url(null, $roleSymbolic, 'submissionsReport'), 'editor.reports.reportGenerator'));
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}
示例3: display
/**
* Display the form.
*/
function display()
{
$canOnlyRead = true;
$canOnlyReview = false;
if (Validation::isReviewer()) {
$canOnlyRead = false;
$canOnlyReview = true;
}
if (Validation::isSiteAdmin() || Validation::isJournalManager() || Validation::isEditor() || Validation::isSectionEditor()) {
$canOnlyRead = false;
$canOnlyReview = false;
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('canOnlyRead', $canOnlyRead);
$templateMgr->assign('canOnlyReview', $canOnlyReview);
return parent::display();
}
示例4: setupTemplate
/**
* Setup common template variables.
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
*/
function setupTemplate($subclass = false, $meetingId = 0, $parentPage = null, $showSidebar = true)
{
parent::setupTemplate();
Locale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_OJS_AUTHOR, LOCALE_COMPONENT_OJS_MANAGER));
$templateMgr =& TemplateManager::getManager();
$isEditor = Validation::isEditor();
if (Request::getRequestedPage() == 'editor') {
$templateMgr->assign('helpTopicId', 'editorial.editorsRole');
} else {
$templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole');
}
$roleSymbolic = $isEditor ? 'editor' : 'sectionEditor';
$roleKey = $isEditor ? 'user.role.editor' : 'user.role.sectionEditor';
$pageHierarchy = $subclass ? array(array(Request::url(null, 'user'), $roleKey), array(Request::url(null, $roleSymbolic, 'meetings'), 'editor.meetings')) : array(array(Request::url(null, 'user'), $roleKey));
if ($meetingId != 0) {
$meetingDao =& DAORegistry::getDAO('MeetingDAO');
$meeting =& $meetingDao->getMeetingById($meetingId);
$publicId = $meeting->getPublicId();
$pageHierarchy[] = array(Request::url(null, 'sectionEditor', 'viewMeeting', $meetingId), "#{$publicId}", true);
}
$templateMgr->assign('pageHierarchy', $pageHierarchy);
}
示例5: wizard
/**
* Display submission monograph submission.
* Displays submission index page if a valid step is not specified.
* @param $args array
* @param $request Request
*/
function wizard($args, &$request)
{
$step = isset($args[0]) ? (int) $args[0] : 1;
$router =& $request->getRouter();
$press =& $router->getContext($request);
$monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
$this->setupTemplate($request);
if ($step < 4) {
$formClass = "SubmissionSubmitStep{$step}Form";
import("classes.submission.form.submit.{$formClass}");
$submitForm = new $formClass($monograph);
if ($submitForm->isLocaleResubmit()) {
$submitForm->readInputData();
} else {
$submitForm->initData();
}
$submitForm->display();
} elseif ($step == 4) {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('press', $press);
// If this is an editor and there is a
// submission file, monograph can be expedited.
if (Validation::isEditor($press->getId()) && $monograph->getSubmissionFileId()) {
$templateMgr->assign('canExpedite', true);
}
$templateMgr->assign('monographId', $monograph->getId());
$templateMgr->assign('submitStep', $step);
$templateMgr->assign('submissionProgress', $monograph->getSubmissionProgress());
$templateMgr->assign('helpTopicId', 'submission.index');
$templateMgr->display('submission/form/submit/complete.tpl');
}
}
示例6: _getRoleDataForJournal
/**
* Gather information about a user's role within a journal.
* @param $userId int
* @param $journalId int
* @param $submissionsCount array reference
* @param $isValid array reference
*/
function _getRoleDataForJournal($userId, $journalId, &$submissionsCount, &$isValid)
{
if (Validation::isJournalManager($journalId)) {
$journalDao =& DAORegistry::getDAO('JournalDAO');
$isValid["JournalManager"][$journalId] = true;
}
if (Validation::isSubscriptionManager($journalId)) {
$isValid["SubscriptionManager"][$journalId] = true;
}
if (Validation::isAuthor($journalId)) {
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$submissionsCount["Author"][$journalId] = $authorSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Author"][$journalId] = true;
}
if (Validation::isCopyeditor($journalId)) {
$copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
$submissionsCount["Copyeditor"][$journalId] = $copyeditorSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Copyeditor"][$journalId] = true;
}
if (Validation::isLayoutEditor($journalId)) {
$layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
$submissionsCount["LayoutEditor"][$journalId] = $layoutEditorSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["LayoutEditor"][$journalId] = true;
}
if (Validation::isEditor($journalId)) {
$editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
$submissionsCount["Editor"][$journalId] = $editorSubmissionDao->getEditorSubmissionsCount($journalId);
$isValid["Editor"][$journalId] = true;
}
if (Validation::isSectionEditor($journalId)) {
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$submissionsCount["SectionEditor"][$journalId] = $sectionEditorSubmissionDao->getSectionEditorSubmissionsCount($userId, $journalId);
$isValid["SectionEditor"][$journalId] = true;
}
if (Validation::isProofreader($journalId)) {
$proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
$submissionsCount["Proofreader"][$journalId] = $proofreaderSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Proofreader"][$journalId] = true;
}
if (Validation::isReviewer($journalId)) {
$reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
$submissionsCount["Reviewer"][$journalId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $journalId);
$isValid["Reviewer"][$journalId] = true;
}
}
示例7: validate
/**
* Validate that the user is the assigned section editor for
* the citation's article, or is a managing editor. Raises a
* fatal error if validation fails.
* @param $requiredContexts array
* @param $request PKPRequest
* @return boolean
*/
function validate($requiredContexts, $request)
{
// Retrieve the request context
$router =& $request->getRouter();
$journal =& $router->getContext($request);
// Authorization and validation checks
// NB: Error messages are in plain English as they directly go to fatal errors.
// (Validation errors in components are either programming errors or somebody
// trying to call components directly which is no legal use case anyway.)
// 1) restricted site access
if (isset($journal) && $journal->getSetting('restrictSiteAccess')) {
import('handler.validation.HandlerValidatorCustom');
$this->addCheck(new HandlerValidatorCustom($this, false, 'Restricted site access!', null, create_function('', 'if (!Validation::isLoggedIn()) return false; else return true;')));
}
// 2) we need a journal
$this->addCheck(new HandlerValidatorJournal($this, false, 'No journal in context!'));
// 3) only editors or section editors may access
$this->addCheck(new HandlerValidatorRoles($this, false, 'Insufficient privileges!', null, array(ROLE_ID_EDITOR, ROLE_ID_SECTION_EDITOR)));
// Execute standard checks
if (!parent::validate($requiredContexts, $request)) {
return false;
}
// Retrieve and validate the article id
$articleId =& $request->getUserVar('articleId');
if (!is_numeric($articleId)) {
return false;
}
// Retrieve the article associated with this citation grid
$articleDAO =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDAO->getArticle($articleId);
// Article and editor validation
if (!is_a($article, 'Article')) {
return false;
}
if ($article->getJournalId() != $journal->getId()) {
return false;
}
// Editors have access to all articles, section editors will be
// checked individually.
if (!Validation::isEditor()) {
// Retrieve the edit assignments
$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
$editAssignments =& $editAssignmentDao->getEditAssignmentsByArticleId($article->getId());
assert(is_a($editAssignments, 'DAOResultFactory'));
$editAssignmentsArray =& $editAssignments->toArray();
// Check whether the user is the article's editor,
// otherwise deny access.
$user =& $request->getUser();
$userId = $user->getId();
$wasFound = false;
foreach ($editAssignmentsArray as $editAssignment) {
if ($editAssignment->getEditorId() == $userId) {
if ($editAssignment->getCanEdit()) {
$wasFound = true;
}
break;
}
}
if (!$wasFound) {
return false;
}
}
// Validation successful
$this->_article =& $article;
return true;
}
示例8: _isVisibleIssue
/**
* Given an issue and journal id, return whether the current user can view the issue in the journal
* @param $issue object The issue to display
* @param $journalId int The id of the journal
*/
function _isVisibleIssue($issue, $journalId)
{
if (isset($issue) && ($issue->getPublished() || Validation::isEditor($journalId) || Validation::isLayoutEditor($journalId) || Validation::isProofreader($journalId)) && $issue->getJournalId() == $journalId) {
return true;
} else {
return false;
}
}
示例9: validate
function validate($referralId = null)
{
parent::validate();
if ($referralId) {
$referralDao =& DAORegistry::getDAO('ReferralDAO');
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$referral =& $referralDao->getReferral($referralId);
if (!$referral) {
Request::redirect(null, 'index');
}
$user =& Request::getUser();
$journal =& Request::getJournal();
$article =& $publishedArticleDao->getPublishedArticleByArticleId($referral->getArticleId());
if (!$article || !$journal) {
Request::redirect(null, 'index');
}
if ($article->getJournalId() != $journal->getId()) {
Request::redirect(null, 'index');
}
// The article's submitter, journal SE, and journal Editors are allowed.
if ($article->getUserId() != $user->getId() && !Validation::isSectionEditor($journal->getId()) && !Validation::isEditor($journal->getId())) {
Request::redirect(null, 'index');
}
} else {
$referral = $article = null;
}
$plugin =& Registry::get('plugin');
return array(&$plugin, &$referral, &$article);
}
示例10: validate
/**
* Validate that the user is the assigned section editor for
* the article, or is a managing editor.
* Redirects to sectionEditor index page if validation fails.
* @param $articleId int Article ID to validate
* @param $access int Optional name of access level required -- see SECTION_EDITOR_ACCESS_... constants
*/
function validate($articleId, $access = null)
{
parent::validate();
$isValid = true;
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$journal =& Request::getJournal();
$user =& Request::getUser();
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
if ($sectionEditorSubmission == null) {
$isValid = false;
} else {
if ($sectionEditorSubmission->getJournalId() != $journal->getJournalId()) {
$isValid = false;
} else {
if ($sectionEditorSubmission->getDateSubmitted() == null) {
$isValid = false;
} else {
$templateMgr =& TemplateManager::getManager();
if (Validation::isEditor()) {
// Make canReview and canEdit available to templates.
// Since this user is an editor, both are available.
$templateMgr->assign('canReview', true);
$templateMgr->assign('canEdit', true);
} else {
// If this user isn't the submission's editor, they don't have access.
$editAssignments =& $sectionEditorSubmission->getEditAssignments();
$wasFound = false;
foreach ($editAssignments as $editAssignment) {
if ($editAssignment->getEditorId() == $user->getUserId()) {
$templateMgr->assign('canReview', $editAssignment->getCanReview());
$templateMgr->assign('canEdit', $editAssignment->getCanEdit());
switch ($access) {
case SECTION_EDITOR_ACCESS_EDIT:
if ($editAssignment->getCanEdit()) {
$wasFound = true;
}
break;
case SECTION_EDITOR_ACCESS_REVIEW:
if ($editAssignment->getCanReview()) {
$wasFound = true;
}
break;
default:
$wasFound = true;
}
break;
}
}
if (!$wasFound) {
$isValid = false;
}
}
}
}
}
if (!$isValid) {
Request::redirect(null, Request::getRequestedPage());
}
// If necessary, note the current date and time as the "underway" date/time
$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
$editAssignments =& $sectionEditorSubmission->getEditAssignments();
foreach ($editAssignments as $editAssignment) {
if ($editAssignment->getEditorId() == $user->getUserId() && $editAssignment->getDateUnderway() === null) {
$editAssignment->setDateUnderway(Core::getCurrentDate());
$editAssignmentDao->updateEditAssignment($editAssignment);
}
}
return array(&$journal, &$sectionEditorSubmission);
}
示例11: validate
/**
* Validate that user is an editor in the selected journal and if the issue id is valid
* Redirects to issue create issue page if not properly authenticated.
* NOTE: As of OJS 2.2, Layout Editors are allowed if specified in args.
*/
function validate($issueId = null, $allowLayoutEditor = false)
{
$issue = null;
$journal =& Request::getJournal();
if (!isset($journal)) {
Validation::redirectLogin();
}
if (isset($issueId)) {
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue = $issueDao->getIssueById($issueId, $journal->getJournalId());
if (!$issue) {
Request::redirect(null, null, 'createIssue');
}
}
if (!Validation::isEditor($journal->getJournalId())) {
if (isset($journal) && $allowLayoutEditor && Validation::isLayoutEditor($journal->getJournalId())) {
// We're a Layout Editor. If specified, make sure that the issue is not published.
if ($issue && !$issue->getPublished()) {
Validation::redirectLogin();
}
} else {
Validation::redirectLogin();
}
}
return $issue;
}
示例12: authorize
/**
* Ensure that we have a journal, plugin is enabled, and user is editor.
*/
function authorize(&$request, &$args, $roleAssignments)
{
$journal =& $request->getJournal();
if (!isset($journal)) {
return false;
}
$bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
if (!isset($bfrPlugin)) {
return false;
}
if (!$bfrPlugin->getEnabled()) {
return false;
}
if (!Validation::isEditor($journal->getId())) {
Validation::redirectLogin();
}
return parent::authorize($request, $args, $roleAssignments);
}
示例13: postProofreadComment
/**
* Post proofread comment.
* @param $article object
* @param $emailComment boolean
*/
function postProofreadComment($article, $emailComment)
{
if (HookRegistry::call('SectionEditorAction::postProofreadComment', array(&$article, &$emailComment))) {
return;
}
import('submission.form.comment.ProofreadCommentForm');
$commentForm =& new ProofreadCommentForm($article, Validation::isEditor() ? ROLE_ID_EDITOR : ROLE_ID_SECTION_EDITOR);
$commentForm->readInputData();
if ($commentForm->validate()) {
$commentForm->execute();
if ($emailComment) {
$commentForm->email();
}
} else {
$commentForm->display();
return false;
}
return true;
}
示例14: expediteSubmission
function expediteSubmission()
{
$articleId = (int) Request::getUserVar('articleId');
list($journal, $article) = SubmitHandler::validate($articleId);
// The author must also be an editor to perform this task.
if (Validation::isEditor($journal->getJournalId()) && $article->getSubmissionFileId()) {
import('submission.editor.EditorAction');
EditorAction::expediteSubmission($article);
Request::redirect(null, 'editor', 'submissionEditing', array($article->getArticleId()));
}
Request::redirect(null, null, 'track');
}
示例15: validate
/**
* Validate that the user is the assigned section editor for
* the article, or is a managing editor.
* Redirects to sectionEditor index page if validation fails.
* @param $articleId int Article ID to validate
* @param $access int Optional name of access level required -- see SECTION_EDITOR_ACCESS_... constants
*/
function validate($articleId, $access = null)
{
parent::validate();
$isValid = true;
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$journal =& Request::getJournal();
$user =& Request::getUser();
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
if ($sectionEditorSubmission == null) {
$isValid = false;
} else {
if ($sectionEditorSubmission->getJournalId() != $journal->getId()) {
$isValid = false;
} else {
if ($sectionEditorSubmission->getDateSubmitted() == null) {
$isValid = false;
} else {
$templateMgr =& TemplateManager::getManager();
if (Validation::isEditor() || Validation::isSectionEditor()) {
// Make canReview and canEdit available to templates.
// Since this user is an editor, both are available.
$templateMgr->assign('canReview', true);
$templateMgr->assign('canEdit', true);
} else {
// If this user isn't the submission's editor, they don't have access.
$sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
$sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $sectionEditorSubmission->getSectionId());
$wasFound = false;
foreach ($sectionEditors as $sectionEditor) {
if ($sectionEditor->getId() == $user->getId()) {
$templateMgr->assign('canReview', true);
$templateMgr->assign('canEdit', true);
switch ($access) {
case SECTION_EDITOR_ACCESS_EDIT:
$wasFound = true;
break;
case SECTION_EDITOR_ACCESS_REVIEW:
$wasFound = true;
break;
default:
$wasFound = true;
break;
}
}
}
if (!$wasFound) {
$isValid = false;
}
}
}
}
}
if (!$isValid) {
Request::redirect(null, Request::getRequestedPage());
}
$this->submission =& $sectionEditorSubmission;
return true;
}