/**
  * Display reviewer index page.
  */
 function index($args)
 {
     $this->validate();
     $this->setupTemplate();
     $journal =& Request::getJournal();
     //%CBP% redirect or set var as appropriate
     $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
     $workshop = $CBPPlatformDao->getWorkshop($journal->getJournalId());
     if ($workshop != "structured") {
         $workshop = 1;
     }
     if ($workshop == 1) {
         Request::redirect(Request::getRequestedJournalPath(), 'user');
     }
     $user =& Request::getUser();
     $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
     $rangeInfo = Handler::getRangeInfo('submissions');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'title';
     $sortDirection = Request::getUserVar('sortDirection');
     if ($sort == 'decision') {
         $submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $journal->getId(), $active, $rangeInfo);
         // Sort all submissions by status, which is too complex to do in the DB
         $submissionsArray = $submissions->toArray();
         $compare = create_function('$s1, $s2', 'return strcmp($s1->getMostRecentDecision(), $s2->getMostRecentDecision());');
         usort($submissionsArray, $compare);
         if ($sortDirection == SORT_DIRECTION_DESC) {
             $submissionsArray = array_reverse($submissionsArray);
         }
         // Convert submission array back to an ItemIterator class
         import('lib.pkp.classes.core.ArrayItemIterator');
         $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
     } else {
         $submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $journal->getId(), $active, $rangeInfo, $sort, $sortDirection);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign_by_ref('submissions', $submissions);
     import('classes.submission.reviewAssignment.ReviewAssignment');
     $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', 'editorial.reviewersRole.submissions');
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('reviewer/index.tpl');
 }
Esempio n. 2
0
 /**
  * Display a list of the emails within the current press.
  */
 function emails()
 {
     $this->setupTemplate(true);
     $rangeInfo = Handler::getRangeInfo('emails');
     $press =& Request::getPress();
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     $emailTemplates =& $emailTemplateDao->getEmailTemplates(Locale::getLocale(), $press->getId());
     import('lib.pkp.classes.core.ArrayItemIterator');
     $emailTemplates =& ArrayItemIterator::fromRangeInfo($emailTemplates, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'manager'), 'manager.pressManagement')));
     $templateMgr->assign_by_ref('emailTemplates', $emailTemplates);
     $templateMgr->assign('helpTopicId', 'press.managementPages.emails');
     $templateMgr->display('manager/emails/emails.tpl');
 }
 /**
  * Display a list of categories.
  */
 function categories($args, &$request)
 {
     $this->validate();
     $this->setupTemplate($request);
     $rangeInfo =& Handler::getRangeInfo('categories');
     $categoryDao =& DAORegistry::getDAO('CategoryDAO');
     $categoryEntryDao =& $categoryDao->getEntryDAO();
     $categoriesArray =& $categoryDao->getCategories();
     import('lib.pkp.classes.core.ArrayItemIterator');
     $categories =& ArrayItemIterator::fromRangeInfo($categoriesArray, $rangeInfo);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.tablednd.js');
     $templateMgr->addJavaScript('lib/pkp/js/functions/tablednd.js');
     $templateMgr->assign_by_ref('categories', $categories);
     $site =& $request->getSite();
     $templateMgr->assign('categoriesEnabled', $site->getSetting('categoriesEnabled'));
     $templateMgr->display('admin/categories/categories.tpl');
 }
Esempio n. 4
0
 /**
  * Display conference author index page.
  */
 function index($args)
 {
     $this->validate();
     $this->setupTemplate();
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $rangeInfo =& Handler::getRangeInfo('submissions');
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'id';
     $sortDirection = Request::getUserVar('sortDirection');
     if ($sort == 'status') {
         // FIXME Does not pass $rangeInfo else we only get partial results
         $submissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $schedConf->getId(), $active, null, $sort, $sortDirection);
         // Sort all submissions by status, which is too complex to do in the DB
         $submissionsArray = $submissions->toArray();
         if ($sortDirection == 'DESC') {
             $submissionsArray = array_reverse($submissionsArray);
         }
         $compare = create_function('$s1, $s2', 'return strcmp($s1->getSubmissionStatus(), $s2->getSubmissionStatus());');
         usort($submissionsArray, $compare);
         // Convert submission array back to an ItemIterator class
         import('core.ArrayItemIterator');
         $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
     } else {
         $submissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $schedConf->getId(), $active, $rangeInfo, $sort, $sortDirection);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
     $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
     if (Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId()) || Validation::isTrackDirector($schedConf->getConferenceId(), $schedConf->getId())) {
         // Directors or track directors may always submit
         $acceptingSubmissions = true;
     } elseif (!$submissionsOpenDate || !$submissionsCloseDate || time() < $submissionsOpenDate) {
         // Too soon
         $acceptingSubmissions = false;
         $notAcceptingSubmissionsMessage = __('author.submit.notAcceptingYet');
     } elseif (time() > $submissionsCloseDate) {
         // Too late
         $acceptingSubmissions = false;
         $notAcceptingSubmissionsMessage = __('author.submit.submissionDeadlinePassed', array('closedDate' => strftime(Config::getVar('general', 'date_format_short'), $submissionsCloseDate)));
     } else {
         $acceptingSubmissions = true;
     }
     $templateMgr->assign('acceptingSubmissions', $acceptingSubmissions);
     if (isset($notAcceptingSubmissionsMessage)) {
         $templateMgr->assign('notAcceptingSubmissionsMessage', $notAcceptingSubmissionsMessage);
     }
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole.submissions');
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('author/index.tpl');
 }
Esempio n. 5
0
 /**
  * Display director submission queue pages.
  */
 function submissions($args, $request)
 {
     $this->validate($request);
     $this->setupTemplate($request, DIRECTOR_TRACK_SUBMISSIONS);
     $schedConf =& $request->getSchedConf();
     $schedConfId = $schedConf->getId();
     $user =& $request->getUser();
     $directorSubmissionDao =& DAORegistry::getDAO('DirectorSubmissionDAO');
     $trackDao =& DAORegistry::getDAO('TrackDAO');
     $page = isset($args[0]) ? $args[0] : '';
     $tracks =& $trackDao->getTrackTitles($schedConfId);
     $filterDirectorOptions = array(FILTER_DIRECTOR_ALL => Locale::Translate('director.allDirectors'), FILTER_DIRECTOR_ME => Locale::Translate('director.me'));
     $filterTrackOptions = array(FILTER_TRACK_ALL => Locale::Translate('director.allTracks')) + $tracks;
     // Get the user's search conditions, if any
     $searchField = $request->getUserVar('searchField');
     $searchMatch = $request->getUserVar('searchMatch');
     $search = $request->getUserVar('search');
     $sort = $request->getUserVar('sort');
     $sortDirection = $request->getUserVar('sortDirection');
     switch ($page) {
         case 'submissionsUnassigned':
             $functionName = 'getDirectorSubmissionsUnassigned';
             $helpTopicId = 'editorial.directorsRole.submissions.unassigned';
             $sort = isset($sort) ? $sort : 'id';
             break;
         case 'submissionsAccepted':
             $functionName = 'getDirectorSubmissionsAccepted';
             $helpTopicId = 'editorial.directorsRole.submissions.presentations';
             $sort = isset($sort) ? $sort : 'seq';
             break;
         case 'submissionsArchives':
             $functionName = 'getDirectorSubmissionsArchives';
             $helpTopicId = 'editorial.directorsRole.submissions.archives';
             $sort = isset($sort) ? $sort : 'id';
             break;
         default:
             $page = 'submissionsInReview';
             $functionName = 'getDirectorSubmissionsInReview';
             $helpTopicId = 'editorial.directorsRole.submissions.inReview';
             $sort = isset($sort) ? $sort : 'id';
     }
     $filterDirector = $request->getUserVar('filterDirector');
     if ($filterDirector != '' && array_key_exists($filterDirector, $filterDirectorOptions)) {
         $user->updateSetting('filterDirector', $filterDirector, 'int', $schedConfId);
     } else {
         $filterDirector = $user->getSetting('filterDirector', $schedConfId);
         if ($filterDirector == null) {
             $filterDirector = FILTER_DIRECTOR_ALL;
             $user->updateSetting('filterDirector', $filterDirector, 'int', $schedConfId);
         }
     }
     if ($filterDirector == FILTER_DIRECTOR_ME) {
         $directorId = $user->getId();
     } else {
         $directorId = FILTER_DIRECTOR_ALL;
     }
     $filterTrack = $request->getUserVar('filterTrack');
     if ($filterTrack != '' && array_key_exists($filterTrack, $filterTrackOptions)) {
         $user->updateSetting('filterTrack', $filterTrack, 'int', $schedConfId);
     } else {
         $filterTrack = $user->getSetting('filterTrack', $schedConfId);
         if ($filterTrack == null) {
             $filterTrack = FILTER_TRACK_ALL;
             $user->updateSetting('filterTrack', $filterTrack, 'int', $schedConfId);
         }
     }
     $rangeInfo =& Handler::getRangeInfo('submissions', array($functionName, (string) $searchField, (string) $searchMatch, (string) $search));
     while (true) {
         $submissions =& $directorSubmissionDao->{$functionName}($schedConfId, $filterTrack, $directorId, $searchField, $searchMatch, $search, null, null, null, $sort == 'status' ? null : $rangeInfo, $sort, $sortDirection);
         if ($submissions->isInBounds()) {
             break;
         }
         unset($rangeInfo);
         $rangeInfo =& $submissions->getLastPageRangeInfo();
         unset($submissions);
     }
     if ($sort == 'status') {
         // Sort all submissions by status, which is too complex to do in the DB
         $submissionsArray = $submissions->toArray();
         unset($submissions);
         $compare = create_function('$s1, $s2', 'return strcmp($s1->getSubmissionStatus(), $s2->getSubmissionStatus());');
         usort($submissionsArray, $compare);
         if ($sortDirection == 'DESC') {
             $submissionsArray = array_reverse($submissionsArray);
         }
         // Convert submission array back to an ItemIterator class
         import('lib.pkp.classes.core.ArrayItemIterator');
         $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign('director', $user->getFullName());
     $templateMgr->assign('directorOptions', $filterDirectorOptions);
     $templateMgr->assign('trackOptions', $filterTrackOptions);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $templateMgr->assign('filterDirector', $filterDirector);
     $templateMgr->assign('filterTrack', $filterTrack);
     $templateMgr->assign('yearOffsetFuture', SCHED_CONF_DATE_YEAR_OFFSET_FUTURE);
     $templateMgr->assign('durationOptions', TrackDirectorHandler::_getDurationOptions());
     // Set search parameters
     $duplicateParameters = array('searchField', 'searchMatch', 'search');
     foreach ($duplicateParameters as $param) {
         $templateMgr->assign($param, $request->getUserVar($param));
     }
     $templateMgr->assign('reviewType', array(REVIEW_ROUND_ABSTRACT => Locale::translate('submission.abstract'), REVIEW_ROUND_PRESENTATION => Locale::translate('submission.paper')));
     $templateMgr->assign('fieldOptions', array(SUBMISSION_FIELD_TITLE => 'paper.title', SUBMISSION_FIELD_AUTHOR => 'user.role.author', SUBMISSION_FIELD_DIRECTOR => 'user.role.director', SUBMISSION_FIELD_REVIEWER => 'user.role.reviewer'));
     $templateMgr->assign('helpTopicId', $helpTopicId);
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('director/submissions.tpl');
 }
Esempio n. 6
0
 /**
  * Displays the editor role selection page.
  */
 function index($args, $request)
 {
     $this->validate();
     $this->setupTemplate(EDITOR_SECTION_HOME);
     $templateMgr =& TemplateManager::getManager();
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $user =& $request->getUser();
     $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sections =& $sectionDao->getSectionTitles($journal->getId());
     $templateMgr->assign('sectionOptions', array(0 => AppLocale::Translate('editor.allSections')) + $sections);
     $templateMgr->assign('fieldOptions', $this->_getSearchFieldOptions());
     $templateMgr->assign('dateFieldOptions', $this->_getDateFieldOptions());
     // Bring in the print_issue_id function (FIXME?)
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     // If a search was performed, get the necessary info.
     if (array_shift($args) == 'search') {
         $rangeInfo = $this->getRangeInfo('submissions');
         // Get the user's search conditions, if any
         $searchField = $request->getUserVar('searchField');
         $dateSearchField = $request->getUserVar('dateSearchField');
         $searchMatch = $request->getUserVar('searchMatch');
         $search = $request->getUserVar('search');
         $sort = $request->getUserVar('sort');
         $sort = isset($sort) ? $sort : 'id';
         $sortDirection = $request->getUserVar('sortDirection');
         $sortDirection = isset($sortDirection) && ($sortDirection == 'ASC' || $sortDirection == 'DESC') ? $sortDirection : 'ASC';
         $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);
         }
         if ($sort == 'status') {
             $rawSubmissions =& $editorSubmissionDao->_getUnfilteredEditorSubmissions($journal->getId(), $request->getUserVar('section'), 0, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, null, null, $sort, $sortDirection);
             $submissions = new DAOResultFactory($rawSubmissions, $editorSubmissionDao, '_returnEditorSubmissionFromRow');
             // Sort all submissions by status, which is too complex to do in the DB
             $submissionsArray = $submissions->toArray();
             $compare = create_function('$s1, $s2', 'return strcmp($s1->getSubmissionStatus(), $s2->getSubmissionStatus());');
             usort($submissionsArray, $compare);
             if ($sortDirection == 'DESC') {
                 $submissionsArray = array_reverse($submissionsArray);
             }
             // Convert submission array back to an ItemIterator class
             import('lib.pkp.classes.core.ArrayItemIterator');
             $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
         } else {
             $rawSubmissions =& $editorSubmissionDao->_getUnfilteredEditorSubmissions($journal->getId(), $request->getUserVar('section'), 0, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, null, $rangeInfo, $sort, $sortDirection);
             $submissions = new DAOResultFactory($rawSubmissions, $editorSubmissionDao, '_returnEditorSubmissionFromRow');
         }
         // If only result is returned from a search, fast-forward to it
         if ($search && $submissions && $submissions->getCount() == 1) {
             $submission =& $submissions->next();
             $request->redirect(null, null, 'submission', array($submission->getId()));
         }
         $templateMgr->assign_by_ref('submissions', $submissions);
         $templateMgr->assign('section', $request->getUserVar('section'));
         // Set search parameters
         foreach ($this->_getSearchFormDuplicateParameters() as $param) {
             $templateMgr->assign($param, $request->getUserVar($param));
         }
         $templateMgr->assign('dateFrom', $fromDate);
         $templateMgr->assign('dateTo', $toDate);
         $templateMgr->assign('displayResults', true);
         $templateMgr->assign('sort', $sort);
         $templateMgr->assign('sortDirection', $sortDirection);
     }
     $submissionsCount =& $editorSubmissionDao->getEditorSubmissionsCount($journal->getId());
     $templateMgr->assign('submissionsCount', $submissionsCount);
     $templateMgr->assign('helpTopicId', 'editorial.editorsRole');
     $templateMgr->display('editor/index.tpl');
 }
Esempio n. 7
0
 /**
  * Display journal author index page.
  */
 function index($args)
 {
     $this->validate();
     $this->setupTemplate();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $rangeInfo =& Handler::getRangeInfo('submissions');
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'title';
     $sortDirection = Request::getUserVar('sortDirection');
     $sortDirection = isset($sortDirection) && ($sortDirection == SORT_DIRECTION_ASC || $sortDirection == SORT_DIRECTION_DESC) ? $sortDirection : SORT_DIRECTION_ASC;
     if ($sort == 'status') {
         // FIXME Does not pass $rangeInfo else we only get partial results
         $unsortedSubmissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $journal->getId(), $active, null, $sort, $sortDirection);
         // Sort all submissions by status, which is too complex to do in the DB
         $submissionsArray = $unsortedSubmissions->toArray();
         $compare = create_function('$s1, $s2', 'return strcmp($s1->getSubmissionStatus(), $s2->getSubmissionStatus());');
         usort($submissionsArray, $compare);
         if ($sortDirection == SORT_DIRECTION_DESC) {
             $submissionsArray = array_reverse($submissionsArray);
         }
         // Convert submission array back to an ItemIterator class
         import('core.ArrayItemIterator');
         $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
     } else {
         $submissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $journal->getId(), $active, $rangeInfo, $sort, $sortDirection);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageToDisplay', $page);
     if (!$active) {
         // Make view counts available if enabled.
         $templateMgr->assign('statViews', $journal->getSetting('statViews'));
     }
     $templateMgr->assign_by_ref('submissions', $submissions);
     // assign payment
     import('payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     if ($paymentManager->isConfigured()) {
         $templateMgr->assign('submissionEnabled', $paymentManager->submissionEnabled());
         $templateMgr->assign('fastTrackEnabled', $paymentManager->fastTrackEnabled());
         $templateMgr->assign('publicationEnabled', $paymentManager->publicationEnabled());
         $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
         $templateMgr->assign_by_ref('completedPaymentDAO', $completedPaymentDAO);
     }
     import('issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole.submissions');
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('author/index.tpl');
 }
 /**
  * Get all submissions in editing for a journal.
  * @param $journalId int
  * @param $sectionId int
  * @param $searchField int Symbolic SUBMISSION_FIELD_... identifier
  * @param $searchMatch string "is" or "contains"
  * @param $search String to look in $searchField for
  * @param $dateField int Symbolic SUBMISSION_FIELD_DATE_... identifier
  * @param $dateFrom String date to search from
  * @param $dateTo String date to search to
  * @param $rangeInfo object
  * @return array EditorSubmission
  */
 function &getSectionEditorSubmissionsInEditing($sectionEditorId, $journalId, $sectionId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null)
 {
     $submissions = array();
     // FIXME Does not pass $rangeInfo else we only get partial results
     $result = $this->getUnfilteredSectionEditorSubmissions($sectionEditorId, $journalId, $sectionId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, true, 'e.can_edit = 1');
     while (!$result->EOF) {
         $row = $result->GetRowAssoc(false);
         $submission =& $this->_returnSectionEditorSubmissionFromRow($row);
         // check if submission is still in review
         $inReview = true;
         $decisions = $submission->getDecisions();
         $decision = array_pop($decisions);
         if (!empty($decision)) {
             $latestDecision = array_pop($decision);
             if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
                 $inReview = false;
             }
         }
         if (!$inReview) {
             $submissions[] =& $submission;
         }
         unset($submission);
         $result->MoveNext();
     }
     $result->Close();
     unset($result);
     import('core.ArrayItemIterator');
     $returner =& ArrayItemIterator::fromRangeInfo($submissions, $rangeInfo);
     return $returner;
 }
Esempio n. 9
0
 /**
  * Get all submissions in editing for a journal.
  * @param $journalId int
  * @param $sectionId int
  * @param $editorId int
  * @param $searchField int Symbolic SUBMISSION_FIELD_... identifier
  * @param $searchMatch string "is" or "contains"
  * @param $search String to look in $searchField for
  * @param $dateField int Symbolic SUBMISSION_FIELD_DATE_... identifier
  * @param $dateFrom String date to search from
  * @param $dateTo String date to search to
  * @param $rangeInfo object
  * @return array EditorSubmission
  */
 function &getEditorSubmissionsInEditing($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null)
 {
     $editorSubmissions = array();
     // FIXME Does not pass $rangeInfo else we only get partial results
     $result = $this->getUnfilteredEditorSubmissions($journalId, $sectionId, $editorId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, true);
     while (!$result->EOF) {
         $editorSubmission =& $this->_returnEditorSubmissionFromRow($result->GetRowAssoc(false));
         $articleId = $editorSubmission->getArticleId();
         // get copyedit final data
         $copyedAssignment = $this->getCopyedAssignment($articleId);
         $row = $copyedAssignment->GetRowAssoc(false);
         $editorSubmission->setCopyeditorDateFinalCompleted($this->datetimeFromDB($row['date_final_completed']));
         // get layout assignment data
         $layoutAssignmentDao =& DAORegistry::getDAO('LayoutAssignmentDAO');
         $layoutAssignment =& $layoutAssignmentDao->getLayoutAssignmentByArticleId($articleId);
         $editorSubmission->setLayoutAssignment($layoutAssignment);
         // get proof assignment data
         $proofAssignmentDao =& DAORegistry::getDAO('ProofAssignmentDAO');
         $proofAssignment =& $proofAssignmentDao->getProofAssignmentByArticleId($articleId);
         $editorSubmission->setProofAssignment($proofAssignment);
         // check if submission is still in review
         $inEditing = false;
         $decisions = $editorSubmission->getDecisions();
         $decision = array_pop($decisions);
         if (!empty($decision)) {
             $latestDecision = array_pop($decision);
             if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
                 $inEditing = true;
             }
         }
         // used to check if editor exists for this submission
         $editAssignments = $editorSubmission->getEditAssignments();
         if ($inEditing && !empty($editAssignments)) {
             $editorSubmissions[] =& $editorSubmission;
         }
         unset($editorSubmission);
         $result->MoveNext();
     }
     $result->Close();
     unset($result);
     import('core.ArrayItemIterator');
     $returner =& ArrayItemIterator::fromRangeInfo($editorSubmissions, $rangeInfo);
     return $returner;
 }
Esempio n. 10
0
 /**
  * Display reviewer index page.
  * Last update: EL on March 1st 2013
  */
 function index($args)
 {
     $this->validate();
     $this->setupTemplate();
     /**
      * Get user search fields
      * Added by: Ayvee Mallare
      * Last Updated: Sept 25, 2011
      */
     $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);
     }
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
     $rangeInfo = Handler::getRangeInfo('submissions');
     $page = isset($args[0]) ? $args[0] : '';
     switch ($page) {
         case 'completed':
             $active = false;
             break;
         default:
             $page = 'active';
             $active = true;
     }
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'title';
     $sortDirection = Request::getUserVar('sortDirection');
     if ($sort == 'decision') {
         $submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $journal->getId(), $active, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo);
         // Sort all submissions by status, which is too complex to do in the DB
         $submissionsArray = $submissions->toArray();
         $compare = create_function('$s1, $s2', 'return strcmp($s1->getMostRecentDecisionValue(), $s2->getMostRecentDecisionValue());');
         usort($submissionsArray, $compare);
         if ($sortDirection == SORT_DIRECTION_DESC) {
             $submissionsArray = array_reverse($submissionsArray);
         }
         // Convert submission array back to an ItemIterator class
         import('lib.pkp.classes.core.ArrayItemIterator');
         //TODO change to array instead of iterator
         $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
     } else {
         $submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $journal->getId(), $active, $searchField, $searchMatch, $search, $dateSearchField, $fromDate, $toDate, $rangeInfo, $sort, $sortDirection);
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     $templateMgr->assign('pageToDisplay', $page);
     $templateMgr->assign_by_ref('submissions', $submissions);
     $templateMgr->assign('rangeInfo', $rangeInfo);
     import('classes.submission.reviewAssignment.ReviewAssignment');
     $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     /*********************************************************************
      * Add search fields to template
      * Added by:  Ayvee Mallare
      * Last Updated: Sept 25, 2011
      *********************************************************************/
     $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'));
     $templateMgr->assign('dateFieldOptions', array(SUBMISSION_FIELD_DATE_SUBMITTED => 'submissions.submitted'));
     import('classes.issue.IssueAction');
     $issueAction = new IssueAction();
     $templateMgr->register_function('print_issue_id', array($issueAction, 'smartyPrintIssueId'));
     $templateMgr->assign('helpTopicId', 'editorial.reviewersRole.submissions');
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->display('reviewer/submissionsIndex.tpl');
 }