pages/author/AuthorHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 // $Id$
00017 
00018 
00019 import ('submission.author.AuthorAction');
00020 import('handler.Handler');
00021 import('handler.validation.HandlerValidatorConference');
00022 import('handler.validation.HandlerValidatorSchedConf');
00023 import('handler.validation.HandlerValidatorRoles');
00024 
00025 class AuthorHandler extends Handler {
00029    function AuthorHandler() {
00030       parent::Handler();
00031 
00032       $this->addCheck(new HandlerValidatorConference($this));
00033       $this->addCheck(new HandlerValidatorSchedConf($this));
00034       $this->addCheck(new HandlerValidatorRoles($this, true, null, array('requiresAuthor' => Request::getUserVar('requiresAuthor')), array(ROLE_ID_AUTHOR)));
00035    }
00036 
00040    function index($args) {
00041       $this->validate();
00042       $this->setupTemplate();
00043       
00044       $conference =& Request::getConference();
00045       $schedConf =& Request::getSchedConf();
00046 
00047       $user =& Request::getUser();
00048       $rangeInfo =& Handler::getRangeInfo('submissions');
00049       $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
00050 
00051       $page = isset($args[0]) ? $args[0] : '';
00052       switch($page) {
00053          case 'completed':
00054             $active = false;
00055             break;
00056          default:
00057             $page = 'active';
00058             $active = true;
00059       }
00060       
00061       $sort = Request::getUserVar('sort');
00062       $sort = isset($sort) ? $sort : 'id';
00063       $sortDirection = Request::getUserVar('sortDirection');
00064 
00065       if ($sort == 'status') {
00066          // FIXME Does not pass $rangeInfo else we only get partial results
00067          $submissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $schedConf->getId(), $active, null, $sort, $sortDirection);
00068 
00069          // Sort all submissions by status, which is too complex to do in the DB
00070          $submissionsArray = $submissions->toArray();
00071          if($sortDirection == 'DESC') {
00072             $submissionsArray = array_reverse($submissionsArray);
00073          }
00074          $compare = create_function('$s1, $s2', 'return strcmp($s1->getSubmissionStatus(), $s2->getSubmissionStatus());');
00075          usort ($submissionsArray, $compare);
00076          
00077          // Convert submission array back to an ItemIterator class
00078          import('core.ArrayItemIterator');
00079          $submissions =& ArrayItemIterator::fromRangeInfo($submissionsArray, $rangeInfo);
00080       } else {
00081          $submissions = $authorSubmissionDao->getAuthorSubmissions($user->getId(), $schedConf->getId(), $active, $rangeInfo, $sort, $sortDirection);
00082       }
00083 
00084       $templateMgr =& TemplateManager::getManager();
00085       $templateMgr->assign('pageToDisplay', $page);
00086       $templateMgr->assign_by_ref('submissions', $submissions);
00087 
00088       $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
00089       $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
00090 
00091       if (Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId()) || Validation::isTrackDirector($schedConf->getConferenceId(), $schedConf->getId())) {
00092          // Directors or track directors may always submit
00093          $acceptingSubmissions = true;
00094       } elseif (!$submissionsOpenDate || !$submissionsCloseDate || time() < $submissionsOpenDate) {
00095          // Too soon
00096          $acceptingSubmissions = false;
00097          $notAcceptingSubmissionsMessage = __('author.submit.notAcceptingYet');
00098       } elseif (time() > $submissionsCloseDate) {
00099          // Too late
00100          $acceptingSubmissions = false;
00101          $notAcceptingSubmissionsMessage = __('author.submit.submissionDeadlinePassed', array('closedDate' => strftime(Config::getVar('general', 'date_format_short'), $submissionsCloseDate)));
00102       } else {
00103          $acceptingSubmissions = true;
00104       }
00105 
00106       $templateMgr->assign('acceptingSubmissions', $acceptingSubmissions);
00107       if(isset($notAcceptingSubmissionsMessage))
00108          $templateMgr->assign('notAcceptingSubmissionsMessage', $notAcceptingSubmissionsMessage);
00109       $templateMgr->assign('helpTopicId', 'editorial.authorsRole.submissions');
00110       $templateMgr->assign('sort', $sort);
00111       $templateMgr->assign('sortDirection', $sortDirection);
00112       $templateMgr->display('author/index.tpl');
00113    }
00114 
00119    function setupTemplate($subclass = false, $paperId = 0, $parentPage = null) {
00120       parent::setupTemplate();
00121       AppLocale::requireComponents(array(
00122          LOCALE_COMPONENT_OCS_AUTHOR,
00123          LOCALE_COMPONENT_PKP_SUBMISSION,
00124          LOCALE_COMPONENT_OCS_DIRECTOR, // FIXME?
00125          LOCALE_COMPONENT_OCS_MANAGER // manager.schedConfSetup.submissions.typeOfSubmission.* FIXME
00126       ));
00127       $templateMgr =& TemplateManager::getManager();
00128 
00129       $pageHierarchy = $subclass ? array(array(Request::url(null, null, 'user'), 'navigation.user'), array(Request::url(null, null, 'author'), 'user.role.author'), array(Request::url(null, null, 'author'), 'paper.submissions'))
00130          : array(array(Request::url(null, null, 'user'), 'navigation.user'), array(Request::url(null, null, 'author'), 'user.role.author'));
00131 
00132       import('submission.trackDirector.TrackDirectorAction');
00133       $submissionCrumb = TrackDirectorAction::submissionBreadcrumb($paperId, $parentPage, 'author');
00134       if (isset($submissionCrumb)) {
00135          $pageHierarchy = array_merge($pageHierarchy, $submissionCrumb);
00136       }
00137       $templateMgr->assign('pageHierarchy', $pageHierarchy);
00138    }
00139 }
00140 
00141 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7