classes/author/form/submit/AuthorSubmitStep3Form.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00015 //$Id$
00016 
00017 import("author.form.submit.AuthorSubmitForm");
00018 
00019 class AuthorSubmitStep3Form extends AuthorSubmitForm {
00023    function AuthorSubmitStep3Form($paper) {
00024       parent::AuthorSubmitForm($paper, 3);
00025 
00026       // Validation checks for this form
00027       $this->addCheck(new FormValidatorCustom($this, 'authors', 'required', 'author.submit.form.authorRequired', create_function('$authors', 'return count($authors) > 0;')));
00028       $this->addCheck(new FormValidatorArray($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', array('firstName', 'lastName')));
00029       $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', create_function('$email, $regExp', 'return String::regexp_match($regExp, $email);'), array(ValidatorEmail::getRegexp()), false, array('email')));
00030       $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'user.profile.form.urlInvalid', create_function('$url, $regExp', 'return empty($url) ? true : String::regexp_match($regExp, $url);'), array(ValidatorUrl::getRegexp()), false, array('url')));
00031       $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'author.submit.form.titleRequired'));
00032 
00033       $schedConf =& Request::getSchedConf();
00034       $reviewMode = $paper->getReviewMode();
00035       if ($reviewMode != REVIEW_MODE_PRESENTATIONS_ALONE) {
00036          $this->addCheck(new FormValidatorLocale($this, 'abstract', 'required', 'author.submit.form.abstractRequired'));
00037 
00038          $trackDao =& DAORegistry::getDAO('TrackDAO');
00039          $track = $trackDao->getTrack($paper->getTrackId());
00040          $abstractWordCount = $track->getAbstractWordCount();
00041          if (isset($abstractWordCount) && $abstractWordCount > 0) {
00042             $this->addCheck(new FormValidatorCustom($this, 'abstract', 'required', 'author.submit.form.wordCountAlert', create_function('$abstract, $wordCount', 'foreach ($abstract as $localizedAbstract) {return count(explode(" ",strip_tags($localizedAbstract))) < $wordCount; }'), array($abstractWordCount)));
00043          }
00044       }
00045    }
00046 
00050    function initData() {
00051       $trackDao =& DAORegistry::getDAO('TrackDAO');
00052 
00053       if (isset($this->paper)) {
00054          $paper =& $this->paper;
00055          $this->_data = array(
00056             'authors' => array(),
00057             'title' => $paper->getTitle(null), // Localized
00058             'abstract' => $paper->getAbstract(null), // Localized
00059             'discipline' => $paper->getDiscipline(null), // Localized
00060             'subjectClass' => $paper->getSubjectClass(null), // Localized
00061             'subject' => $paper->getSubject(null), // Localized
00062             'coverageGeo' => $paper->getCoverageGeo(null), // Localized
00063             'coverageChron' => $paper->getCoverageChron(null), // Localized
00064             'coverageSample' => $paper->getCoverageSample(null), // Localized
00065             'type' => $paper->getType(null), // Localized
00066             'language' => $paper->getLanguage(),
00067             'sponsor' => $paper->getSponsor(null), // Localized
00068             'citations' => $paper->getCitations(),
00069             'track' => $trackDao->getTrack($paper->getTrackId())
00070          );
00071 
00072          $authors =& $paper->getAuthors();
00073          for ($i=0, $count=count($authors); $i < $count; $i++) {
00074             array_push(
00075                $this->_data['authors'],
00076                array(
00077                   'authorId' => $authors[$i]->getId(),
00078                   'firstName' => $authors[$i]->getFirstName(),
00079                   'middleName' => $authors[$i]->getMiddleName(),
00080                   'lastName' => $authors[$i]->getLastName(),
00081                   'affiliation' => $authors[$i]->getAffiliation(),
00082                   'country' => $authors[$i]->getCountry(),
00083                   'email' => $authors[$i]->getEmail(),
00084                   'url' => $authors[$i]->getUrl(),
00085                   'biography' => $authors[$i]->getBiography(null)
00086                )
00087             );
00088             if ($authors[$i]->getPrimaryContact()) {
00089                $this->setData('primaryContact', $i);
00090             }
00091          }
00092       }
00093    }
00094 
00098    function readInputData() {
00099       $userVars = array(
00100          'authors',
00101          'deletedAuthors',
00102          'primaryContact',
00103          'title',
00104          'discipline',
00105          'subjectClass',
00106          'subject',
00107          'coverageGeo',
00108          'coverageChron',
00109          'coverageSample',
00110          'type',
00111          'language',
00112          'sponsor',
00113          'citations'
00114       );
00115 
00116       $schedConf =& Request::getSchedConf();
00117       $reviewMode = $this->paper->getReviewMode();
00118       if ($reviewMode != REVIEW_MODE_PRESENTATIONS_ALONE) {
00119          $userVars[] = 'abstract';
00120       }
00121       $this->readUserVars($userVars);
00122 
00123       // Load the track. This is used in the step 2 form to
00124       // determine whether or not to display indexing options.
00125       $trackDao =& DAORegistry::getDAO('TrackDAO');
00126       $this->_data['track'] =& $trackDao->getTrack($this->paper->getTrackId());
00127    }
00128 
00133    function getLocaleFieldNames() {
00134       $returner = array('title', 'subjectClass', 'subject', 'coverageGeo', 'coverageChron', 'coverageSample', 'type', 'sponsor');
00135       $schedConf =& Request::getSchedConf();
00136       $reviewMode = $this->paper->getReviewMode();
00137       if ($reviewMode != REVIEW_MODE_PRESENTATIONS_ALONE) {
00138          $returner[] = 'abstract';
00139       }
00140       return $returner;
00141    }
00142 
00146    function display() {
00147       $templateMgr =& TemplateManager::getManager();
00148 
00149       $countryDao =& DAORegistry::getDAO('CountryDAO');
00150       $countries =& $countryDao->getCountries();
00151       $templateMgr->assign_by_ref('countries', $countries);
00152 
00153       if (Request::getUserVar('addAuthor') || Request::getUserVar('delAuthor')  || Request::getUserVar('moveAuthor')) {
00154          $templateMgr->assign('scrollToAuthor', true);
00155       }
00156 
00157       $schedConf =& Request::getSchedConf();
00158       $reviewMode = $this->paper->getReviewMode();
00159       $templateMgr->assign('collectAbstracts', $reviewMode != REVIEW_MODE_PRESENTATIONS_ALONE);
00160       parent::display();
00161    }
00162 
00167    function execute() {
00168       $paperDao =& DAORegistry::getDAO('PaperDAO');
00169       $authorDao =& DAORegistry::getDAO('AuthorDAO');
00170       $paper =& $this->paper;
00171       $conference =& Request::getConference();
00172       $schedConf =& Request::getSchedConf();
00173       $user =& Request::getUser();
00174 
00175       // Update paper
00176       $paper->setTitle($this->getData('title'), null); // Localized
00177 
00178       $reviewMode = $this->paper->getReviewMode();
00179       if ($reviewMode != REVIEW_MODE_PRESENTATIONS_ALONE) {
00180          $paper->setAbstract($this->getData('abstract'), null); // Localized
00181       }
00182 
00183       $paper->setDiscipline($this->getData('discipline'), null); // Localized
00184       $paper->setSubjectClass($this->getData('subjectClass'), null); // Localized
00185       $paper->setSubject($this->getData('subject'), null); // Localized
00186       $paper->setCoverageGeo($this->getData('coverageGeo'), null); // Localized
00187       $paper->setCoverageChron($this->getData('coverageChron'), null); // Localized
00188       $paper->setCoverageSample($this->getData('coverageSample'), null); // Localized
00189       $paper->setType($this->getData('type'), null); // Localized
00190       $paper->setLanguage($this->getData('language')); // Localized
00191       $paper->setSponsor($this->getData('sponsor'), null); // Localized
00192       $paper->setCitations($this->getData('citations'));
00193 
00194       // Update the submission progress if necessary.
00195       if ($paper->getSubmissionProgress() <= $this->step) {
00196          $paper->stampStatusModified();
00197 
00198          // If we aren't about to collect the paper, the submission is complete
00199          // (for now)
00200          $reviewMode = $this->paper->getReviewMode();
00201          if($reviewMode == REVIEW_MODE_BOTH_SIMULTANEOUS || $reviewMode == REVIEW_MODE_PRESENTATIONS_ALONE) {
00202             if (!$schedConf->getSetting('acceptSupplementaryReviewMaterials')) $paper->setSubmissionProgress($this->step + 2); // Skip supp files
00203             else $paper->setSubmissionProgress($this->step + 1);
00204             // The line below is necessary to ensure that
00205             // the paper upload goes in with the correct
00206             // stage number (i.e. paper).
00207             $paper->setCurrentStage(REVIEW_STAGE_PRESENTATION);
00208          } else {
00209             $paper->setDateSubmitted(Core::getCurrentDate());
00210             $paper->stampStatusModified();
00211             $paper->setCurrentStage(REVIEW_STAGE_ABSTRACT);
00212             $this->assignDirectors($paper);
00213 
00214             if ($schedConf->getSetting('acceptSupplementaryReviewMaterials')) {
00215                $paper->setSubmissionProgress($this->step + 2);
00216             } else {
00217                $paper->setSubmissionProgress(0);
00218                $this->confirmSubmission($paper, $user, $schedConf, $conference, 'SUBMISSION_ACK');
00219             }
00220          }
00221       }
00222 
00223       // Update authors
00224       $authors = $this->getData('authors');
00225       for ($i=0, $count=count($authors); $i < $count; $i++) {
00226          if ($authors[$i]['authorId'] > 0) {
00227             // Update an existing author
00228             $author =& $paper->getAuthor($authors[$i]['authorId']);
00229             $isExistingAuthor = true;
00230 
00231          } else {
00232             // Create a new author
00233             $author = new Author();
00234             $isExistingAuthor = false;
00235          }
00236 
00237          if ($author != null) {
00238             $author->setFirstName($authors[$i]['firstName']);
00239             $author->setMiddleName($authors[$i]['middleName']);
00240             $author->setLastName($authors[$i]['lastName']);
00241             $author->setAffiliation($authors[$i]['affiliation']);
00242             $author->setCountry($authors[$i]['country']);
00243             $author->setEmail($authors[$i]['email']);
00244             $author->setUrl($authors[$i]['url']);
00245             $author->setBiography($authors[$i]['biography'], null); // Localized
00246             $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
00247             $author->setSequence($authors[$i]['seq']);
00248 
00249             if ($isExistingAuthor == false) {
00250                $paper->addAuthor($author);
00251             }
00252          }
00253          unset($author);
00254       }
00255 
00256       // Remove deleted authors
00257       $deletedAuthors = explode(':', $this->getData('deletedAuthors'));
00258       for ($i=0, $count=count($deletedAuthors); $i < $count; $i++) {
00259          $paper->removeAuthor($deletedAuthors[$i]);
00260       }
00261 
00262       // Save the paper
00263       $paperDao->updatePaper($paper);
00264 
00265       // Log the submission, even though it may not be "complete"
00266       // at this step. This is important because we don't otherwise
00267       // capture changes in review process.
00268       import('paper.log.PaperLog');
00269       import('paper.log.PaperEventLogEntry');
00270       PaperLog::logEvent($this->paperId, PAPER_LOG_ABSTRACT_SUBMIT, LOG_TYPE_AUTHOR, $user->getId(), 'log.author.abstractSubmitted', array('submissionId' => $paper->getId(), 'authorName' => $user->getFullName()));
00271       return $this->paperId;
00272    }
00273 }
00274 
00275 ?>

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