00001 <?php
00002
00015
00016
00017 import("author.form.submit.AuthorSubmitForm");
00018
00019 class AuthorSubmitStep1Form extends AuthorSubmitForm {
00020
00024 function AuthorSubmitStep1Form($paper = null) {
00025 parent::AuthorSubmitForm($paper, 1);
00026
00027 $schedConf =& Request::getSchedConf();
00028
00029
00030 $this->addCheck(new FormValidator($this, 'trackId', 'required', 'author.submit.form.trackRequired'));
00031 $this->addCheck(new FormValidatorCustom($this, 'trackId', 'required', 'author.submit.form.trackRequired', array(DAORegistry::getDAO('TrackDAO'), 'trackExists'), array($schedConf->getId())));
00032 $this->addCheck(new FormValidatorControlledVocab($this, 'sessionType', 'optional', 'author.submit.form.sessionTypeRequired', 'paperType', ASSOC_TYPE_SCHED_CONF, $schedConf->getId()));
00033 }
00034
00038 function display() {
00039 $conference =& Request::getConference();
00040 $schedConf =& Request::getSchedConf();
00041
00042 $user =& Request::getUser();
00043
00044 $templateMgr =& TemplateManager::getManager();
00045
00046
00047 $trackDao =& DAORegistry::getDAO('TrackDAO');
00048
00049
00050
00051
00052
00053 $roleDao =& DAORegistry::getDAO('RoleDAO');
00054 $isDirector = $roleDao->roleExists($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_DIRECTOR) ||
00055 $roleDao->roleExists($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_TRACK_DIRECTOR) ||
00056 $roleDao->roleExists($conference->getId(), 0, $user->getId(), ROLE_ID_DIRECTOR) ||
00057 $roleDao->roleExists($conference->getId(), 0, $user->getId(), ROLE_ID_TRACK_DIRECTOR);
00058
00059 $templateMgr->assign('trackOptions', array('0' => __('author.submit.selectTrack')) + $trackDao->getTrackTitles($schedConf->getId(), !$isDirector));
00060
00061 $paperTypeDao =& DAORegistry::getDAO('PaperTypeDAO');
00062 $sessionTypes = $paperTypeDao->getPaperTypes($schedConf->getId());
00063 $templateMgr->assign('sessionTypes', $sessionTypes->toArray());
00064
00065 parent::display();
00066 }
00067
00071 function initData() {
00072 if (isset($this->paper)) {
00073 $this->_data = array(
00074 'trackId' => $this->paper->getTrackId(),
00075 'sessionType' => $this->paper->getData('sessionType'),
00076 'commentsToDirector' => $this->paper->getCommentsToDirector()
00077 );
00078 }
00079 }
00080
00084 function readInputData() {
00085 $this->readUserVars(array('submissionChecklist', 'copyrightNoticeAgree', 'trackId', 'commentsToDirector', 'sessionType'));
00086 }
00087
00092 function execute() {
00093 $paperDao =& DAORegistry::getDAO('PaperDAO');
00094
00095 if (isset($this->paper)) {
00096 $reviewMode = $this->paper->getReviewMode();
00097
00098 $this->paper->setTrackId($this->getData('trackId'));
00099 $this->paper->setCommentsToDirector($this->getData('commentsToDirector'));
00100 $this->paper->setData('sessionType', $this->getData('sessionType'));
00101 if ($this->paper->getSubmissionProgress() <= $this->step) {
00102 $this->paper->stampStatusModified();
00103 if($reviewMode == REVIEW_MODE_ABSTRACTS_ALONE) {
00104 $this->paper->setSubmissionProgress($this->step + 2);
00105 }
00106 else {
00107 $this->paper->setSubmissionProgress($this->step + 1);
00108 }
00109 }
00110 $paperDao->updatePaper($this->paper);
00111
00112 } else {
00113
00114 $conference =& Request::getConference();
00115 $schedConf =& Request::getSchedConf();
00116 $user =& Request::getUser();
00117
00118 $this->paper = new Paper();
00119 $this->paper->setUserId($user->getId());
00120 $this->paper->setSchedConfId($schedConf->getId());
00121 $this->paper->setTrackId($this->getData('trackId'));
00122 $this->paper->stampStatusModified();
00123 $reviewMode = $schedConf->getSetting('reviewMode');
00124 $this->paper->setReviewMode($reviewMode);
00125 $this->paper->setLanguage(String::substr($conference->getPrimaryLocale(), 0, 2));
00126 $this->paper->setCommentsToDirector($this->getData('commentsToDirector'));
00127
00128 switch($reviewMode) {
00129 case REVIEW_MODE_ABSTRACTS_ALONE:
00130 case REVIEW_MODE_BOTH_SEQUENTIAL:
00131 $this->paper->setSubmissionProgress($this->step + 2);
00132 $this->paper->setCurrentStage(REVIEW_STAGE_ABSTRACT);
00133 break;
00134 case REVIEW_MODE_PRESENTATIONS_ALONE:
00135 case REVIEW_MODE_BOTH_SIMULTANEOUS:
00136 $this->paper->setSubmissionProgress($this->step + 1);
00137 $this->paper->setCurrentStage(REVIEW_STAGE_PRESENTATION);
00138 break;
00139 }
00140
00141
00142 $user =& Request::getUser();
00143 $author = new Author();
00144 $author->setFirstName($user->getFirstName());
00145 $author->setMiddleName($user->getMiddleName());
00146 $author->setLastName($user->getLastName());
00147 $author->setAffiliation($user->getAffiliation());
00148 $author->setCountry($user->getCountry());
00149 $author->setEmail($user->getEmail());
00150 $author->setUrl($user->getUrl());
00151 $author->setBiography($user->getBiography(null), null);
00152 $author->setPrimaryContact(1);
00153 $this->paper->addAuthor($author);
00154
00155 $this->paper->setData('sessionType', $this->getData('sessionType'));
00156
00157 $paperDao->insertPaper($this->paper);
00158 $this->paperId = $this->paper->getPaperId();
00159 }
00160
00161 return $this->paperId;
00162 }
00163
00164 }
00165
00166 ?>