예제 #1
0
 /**
  * Display proofreader index page.
  */
 function index($args)
 {
     ProofreaderHandler::validate();
     ProofreaderHandler::setupTemplate();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
     // Get the user's search conditions, if any
     $searchField = Request::getUserVar('searchField');
     $dateSearchField = Request::getUserVar('dateSearchField');
     $searchMatch = Request::getUserVar('searchMatch');
     $search = Request::getUserVar('search');
     $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);
     }
     $rangeInfo = Handler::getRangeInfo('submissions');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     $submissions = $proofreaderSubmissionDao->getSubmissions($user->getUserId(), $journal->getJournalId(), $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $active, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign_by_ref('submissions', $submissions);
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear', 'dateSearchField');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, Request::getUserVar($param));
     }
     $templateMgr->assign('dateFrom', $fromDate);
     $templateMgr->assign('dateTo', $toDate);
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'article.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_EDITOR => 'user.role.editor'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted', SUBMISSION_FIELD_DATE_COPYEDIT_COMPLETE => 'submissions.copyeditComplete', SUBMISSION_FIELD_DATE_LAYOUT_COMPLETE => 'submissions.layoutComplete', SUBMISSION_FIELD_DATE_PROOFREADING_COMPLETE => 'submissions.proofreadingComplete'));
     import('issue.IssueAction');
     $issueAction =& new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', 'editorial.proofreadersRole.submissions');
     $templateMgr->display('proofreader/index.tpl');
 }
 /**
  * Validate that the user is the assigned proofreader for the submission.
  * Redirects to proofreader index page if validation fails.
  */
 function validate($articleId)
 {
     parent::validate();
     $isValid = false;
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $proofreaderDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
     $submission =& $proofreaderDao->getSubmission($articleId, $journal->getJournalId());
     if (isset($submission)) {
         $proofAssignment =& $submission->getProofAssignment();
         if ($proofAssignment->getProofreaderId() == $user->getUserId()) {
             $isValid = true;
         }
     }
     if (!$isValid) {
         Request::redirect(null, Request::getRequestedPage());
     }
     return array($journal, $submission);
 }
 /**
  * Validate that the user is the assigned proofreader for the submission.
  * Redirects to proofreader index page if validation fails.
  */
 function validate($articleId)
 {
     parent::validate();
     $isValid = false;
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $proofreaderDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $submission =& $proofreaderDao->getSubmission($articleId, $journal->getId());
     if (isset($submission)) {
         $proofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
         if ($proofSignoff->getUserId() == $user->getId()) {
             $isValid = true;
         }
     }
     if (!$isValid) {
         Request::redirect(null, Request::getRequestedPage());
     }
     $this->submission =& $submission;
     return true;
 }
 /**
  * Constructor
  */
 function SubmissionCommentsHandler()
 {
     parent::ProofreaderHandler();
 }
 /**
  * Constructor
  */
 function SubmissionProofreadHandler()
 {
     parent::ProofreaderHandler();
 }
 /**
  * Validate that the user is the author of the comment.
  */
 function validate($commentId)
 {
     parent::validate();
     $isValid = true;
     $articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
     $user =& Request::getUser();
     $comment =& $articleCommentDao->getArticleCommentById($commentId);
     if ($comment == null) {
         $isValid = false;
     } else {
         if ($comment->getAuthorId() != $user->getUserId()) {
             $isValid = false;
         }
     }
     if (!$isValid) {
         Request::redirect(null, Request::getRequestedPage());
     }
     return array(&$comment);
 }