00001 <?php
00002
00020
00021
00022
00023
00024 define('STATUS_ARCHIVED', 0);
00025 define('STATUS_QUEUED', 1);
00026
00027 define('STATUS_PUBLISHED', 3);
00028 define('STATUS_DECLINED', 4);
00029
00030
00031 define ('STATUS_QUEUED_UNASSIGNED', 5);
00032 define ('STATUS_QUEUED_REVIEW', 6);
00033 define ('STATUS_QUEUED_EDITING', 7);
00034 define ('STATUS_INCOMPLETE', 8);
00035
00036
00037 define ('AUTHOR_TOC_DEFAULT', 0);
00038 define ('AUTHOR_TOC_HIDE', 1);
00039 define ('AUTHOR_TOC_SHOW', 2);
00040
00041
00042 define ('COMMENTS_SECTION_DEFAULT', 0);
00043 define ('COMMENTS_DISABLE', 1);
00044 define ('COMMENTS_ENABLE', 2);
00045
00046 class Article extends DataObject {
00047
00049 var $authors;
00050
00052 var $removedAuthors;
00053
00057 function Article() {
00058 parent::DataObject();
00059 $this->authors = array();
00060 $this->removedAuthors = array();
00061 }
00062
00067 function addAuthor($author) {
00068 if ($author->getArticleId() == null) {
00069 $author->setArticleId($this->getArticleId());
00070 }
00071 if ($author->getSequence() == null) {
00072 $author->setSequence(count($this->authors) + 1);
00073 }
00074 array_push($this->authors, $author);
00075 }
00076
00082 function removeAuthor($authorId) {
00083 $found = false;
00084
00085 if ($authorId != 0) {
00086
00087 $authors = array();
00088 for ($i=0, $count=count($this->authors); $i < $count; $i++) {
00089 if ($this->authors[$i]->getAuthorId() == $authorId) {
00090 array_push($this->removedAuthors, $authorId);
00091 $found = true;
00092 } else {
00093 array_push($authors, $this->authors[$i]);
00094 }
00095 }
00096 $this->authors = $authors;
00097 }
00098 return $found;
00099 }
00100
00105 function getArticleTitle() {
00106 return $this->getLocalizedData('title');
00107 }
00108
00113 function getArticleAbstract() {
00114 return $this->getLocalizedData('abstract');
00115 }
00116
00123 function getAuthorString($lastOnly = false, $separator = ', ') {
00124 $str = '';
00125 foreach ($this->authors as $a) {
00126 if (!empty($str)) {
00127 $str .= $separator;
00128 }
00129 $str .= $lastOnly ? $a->getLastName() : $a->getFullName();
00130 }
00131 return $str;
00132 }
00133
00138 function getAuthorEmails() {
00139 import('mail.Mail');
00140 $returner = array();
00141 foreach ($this->authors as $a) {
00142 $returner[] = Mail::encodeDisplayName($a->getFullName()) . ' <' . $a->getEmail() . '>';
00143 }
00144 return $returner;
00145 }
00146
00152 function getFirstAuthor($lastOnly = false) {
00153 $author = $this->authors[0];
00154 return $lastOnly ? $author->getLastName() : $author->getFullName();
00155 }
00156
00157
00158
00159
00160
00161
00166 function &getAuthors() {
00167 return $this->authors;
00168 }
00169
00175 function &getAuthor($authorId) {
00176 $author = null;
00177
00178 if ($authorId != 0) {
00179 for ($i=0, $count=count($this->authors); $i < $count && $author == null; $i++) {
00180 if ($this->authors[$i]->getAuthorId() == $authorId) {
00181 $author = &$this->authors[$i];
00182 }
00183 }
00184 }
00185 return $author;
00186 }
00187
00192 function &getRemovedAuthors() {
00193 return $this->removedAuthors;
00194 }
00195
00200 function setAuthors($authors) {
00201 return $this->authors = $authors;
00202 }
00203
00208 function getArticleId() {
00209 return $this->getData('articleId');
00210 }
00211
00216 function setArticleId($articleId) {
00217 return $this->setData('articleId', $articleId);
00218 }
00219
00224 function getUserId() {
00225 return $this->getData('userId');
00226 }
00227
00232 function setUserId($userId) {
00233 return $this->setData('userId', $userId);
00234 }
00235
00240 function getUser() {
00241 $userDao = &DAORegistry::getDAO('UserDAO');
00242 return $userDao->getUser($this->getUserId(), true);
00243 }
00244
00249 function getJournalId() {
00250 return $this->getData('journalId');
00251 }
00252
00257 function setJournalId($journalId) {
00258 return $this->setData('journalId', $journalId);
00259 }
00260
00265 function getSectionId() {
00266 return $this->getData('sectionId');
00267 }
00268
00273 function setSectionId($sectionId) {
00274 return $this->setData('sectionId', $sectionId);
00275 }
00276
00281 function getSectionTitle() {
00282 return $this->getData('sectionTitle');
00283 }
00284
00289 function setSectionTitle($sectionTitle) {
00290 return $this->setData('sectionTitle', $sectionTitle);
00291 }
00292
00297 function getSectionAbbrev() {
00298 return $this->getData('sectionAbbrev');
00299 }
00300
00305 function setSectionAbbrev($sectionAbbrev) {
00306 return $this->setData('sectionAbbrev', $sectionAbbrev);
00307 }
00308
00314 function getTitle($locale) {
00315 return $this->getData('title', $locale);
00316 }
00317
00323 function setTitle($title, $locale) {
00324 return $this->setData('title', $title, $locale);
00325 }
00326
00332 function getAbstract($locale) {
00333 return $this->getData('abstract', $locale);
00334 }
00335
00341 function setAbstract($abstract, $locale) {
00342 return $this->setData('abstract', $abstract, $locale);
00343 }
00344
00349 function getArticleDiscipline() {
00350 return $this->getLocalizedData('discipline');
00351 }
00352
00358 function getDiscipline($locale) {
00359 return $this->getData('discipline', $locale);
00360 }
00361
00367 function setDiscipline($discipline, $locale) {
00368 return $this->setData('discipline', $discipline, $locale);
00369 }
00370
00375 function getArticleSubjectClass() {
00376 return $this->getLocalizedData('subjectClass');
00377 }
00378
00384 function getSubjectClass($locale) {
00385 return $this->getData('subjectClass', $locale);
00386 }
00387
00393 function setSubjectClass($subjectClass, $locale) {
00394 return $this->setData('subjectClass', $subjectClass, $locale);
00395 }
00396
00401 function getArticleSubject() {
00402 return $this->getLocalizedData('subject');
00403 }
00404
00410 function getSubject($locale) {
00411 return $this->getData('subject', $locale);
00412 }
00413
00419 function setSubject($subject, $locale) {
00420 return $this->setData('subject', $subject, $locale);
00421 }
00422
00427 function getArticleCoverageGeo() {
00428 return $this->getLocalizedData('coverageGeo');
00429 }
00430
00436 function getCoverageGeo($locale) {
00437 return $this->getData('coverageGeo', $locale);
00438 }
00439
00445 function setCoverageGeo($coverageGeo, $locale) {
00446 return $this->setData('coverageGeo', $coverageGeo, $locale);
00447 }
00448
00453 function getArticleCoverageChron() {
00454 return $this->getLocalizedData('coverageChron');
00455 }
00456
00462 function getCoverageChron($locale) {
00463 return $this->getData('coverageChron', $locale);
00464 }
00465
00471 function setCoverageChron($coverageChron, $locale) {
00472 return $this->setData('coverageChron', $coverageChron, $locale);
00473 }
00474
00479 function getArticleCoverageSample() {
00480 return $this->getLocalizedData('coverageSample');
00481 }
00482
00488 function getCoverageSample($locale) {
00489 return $this->getData('coverageSample', $locale);
00490 }
00491
00497 function setCoverageSample($coverageSample, $locale) {
00498 return $this->setData('coverageSample', $coverageSample, $locale);
00499 }
00500
00505 function getArticleType() {
00506 return $this->getLocalizedData('type');
00507 }
00508
00514 function getType($locale) {
00515 return $this->getData('type', $locale);
00516 }
00517
00523 function setType($type, $locale) {
00524 return $this->setData('type', $type, $locale);
00525 }
00526
00531 function getLanguage() {
00532 return $this->getData('language');
00533 }
00534
00539 function setLanguage($language) {
00540 return $this->setData('language', $language);
00541 }
00542
00547 function getArticleSponsor() {
00548 return $this->getLocalizedData('sponsor');
00549 }
00550
00556 function getSponsor($locale) {
00557 return $this->getData('sponsor', $locale);
00558 }
00559
00565 function setSponsor($sponsor, $locale) {
00566 return $this->setData('sponsor', $sponsor, $locale);
00567 }
00568
00573 function getArticleFileName() {
00574 return $this->getLocalizedData('fileName');
00575 }
00576
00582 function getFileName($locale) {
00583 return $this->getData('fileName', $locale);
00584 }
00585
00591 function setFileName($fileName, $locale) {
00592 return $this->setData('fileName', $fileName, $locale);
00593 }
00594
00599 function getArticleWidth() {
00600 return $this->getLocalizedData('width');
00601 }
00602
00608 function getWidth($locale) {
00609 return $this->getData('width', $locale);
00610 }
00611
00617 function setWidth($width, $locale) {
00618 return $this->setData('width', $width, $locale);
00619 }
00620
00625 function getArticleHeight() {
00626 return $this->getLocalizedData('height');
00627 }
00628
00634 function getHeight($locale) {
00635 return $this->getData('height', $locale);
00636 }
00637
00643 function setHeight($height, $locale) {
00644 return $this->setData('height', $height, $locale);
00645 }
00646
00651 function getArticleOriginalFileName() {
00652 return $this->getLocalizedData('originalFileName');
00653 }
00654
00660 function getOriginalFileName($locale) {
00661 return $this->getData('originalFileName', $locale);
00662 }
00663
00669 function setOriginalFileName($originalFileName, $locale) {
00670 return $this->setData('originalFileName', $originalFileName, $locale);
00671 }
00672
00677 function getArticleCoverPageAltText() {
00678 return $this->getLocalizedData('coverPageAltText');
00679 }
00680
00686 function getCoverPageAltText($locale) {
00687 return $this->getData('coverPageAltText', $locale);
00688 }
00689
00695 function setCoverPageAltText($coverPageAltText, $locale) {
00696 return $this->setData('coverPageAltText', $coverPageAltText, $locale);
00697 }
00698
00703 function getArticleShowCoverPage() {
00704 return $this->getLocalizedData('showCoverPage');
00705 }
00706
00712 function getShowCoverPage($locale) {
00713 return $this->getData('showCoverPage', $locale);
00714 }
00715
00721 function setShowCoverPage($showCoverPage, $locale) {
00722 return $this->setData('showCoverPage', $showCoverPage, $locale);
00723 }
00724
00730 function getHideCoverPageToc($locale) {
00731 return $this->getData('hideCoverPageToc', $locale);
00732 }
00733
00739 function setHideCoverPageToc($hideCoverPageToc, $locale) {
00740 return $this->setData('hideCoverPageToc', $hideCoverPageToc, $locale);
00741 }
00742
00748 function getHideCoverPageAbstract($locale) {
00749 return $this->getData('hideCoverPageAbstract', $locale);
00750 }
00751
00757 function setHideCoverPageAbstract($hideCoverPageAbstract, $locale) {
00758 return $this->setData('hideCoverPageAbstract', $hideCoverPageAbstract, $locale);
00759 }
00760
00765 function getCommentsToEditor() {
00766 return $this->getData('commentsToEditor');
00767 }
00768
00773 function setCommentsToEditor($commentsToEditor) {
00774 return $this->setData('commentsToEditor', $commentsToEditor);
00775 }
00776
00781 function getDateSubmitted() {
00782 return $this->getData('dateSubmitted');
00783 }
00784
00789 function setDateSubmitted($dateSubmitted) {
00790 return $this->setData('dateSubmitted', $dateSubmitted);
00791 }
00792
00797 function getDateStatusModified() {
00798 return $this->getData('dateStatusModified');
00799 }
00800
00805 function setDateStatusModified($dateModified) {
00806 return $this->setData('dateStatusModified', $dateModified);
00807 }
00808
00813 function getLastModified() {
00814 return $this->getData('lastModified');
00815 }
00816
00821 function setLastModified($dateModified) {
00822 return $this->setData('lastModified', $dateModified);
00823 }
00824
00828 function stampModified() {
00829 return $this->setLastModified(Core::getCurrentDate());
00830 }
00831
00835 function stampStatusModified() {
00836 return $this->setDateStatusModified(Core::getCurrentDate());
00837 }
00838
00843 function getStatus() {
00844 return $this->getData('status');
00845 }
00846
00851 function setStatus($status) {
00852 return $this->setData('status', $status);
00853 }
00854
00859 function getSubmissionProgress() {
00860 return $this->getData('submissionProgress');
00861 }
00862
00867 function getCurrentRound() {
00868 return $this->getData('currentRound');
00869 }
00870
00875 function setCurrentRound($currentRound) {
00876 return $this->setData('currentRound', $currentRound);
00877 }
00878
00883 function setSubmissionProgress($submissionProgress) {
00884 return $this->setData('submissionProgress', $submissionProgress);
00885 }
00886
00891 function getSubmissionFileId() {
00892 return $this->getData('submissionFileId');
00893 }
00894
00899 function setSubmissionFileId($submissionFileId) {
00900 return $this->setData('submissionFileId', $submissionFileId);
00901 }
00902
00907 function getRevisedFileId() {
00908 return $this->getData('revisedFileId');
00909 }
00910
00915 function setRevisedFileId($revisedFileId) {
00916 return $this->setData('revisedFileId', $revisedFileId);
00917 }
00918
00923 function getReviewFileId() {
00924 return $this->getData('reviewFileId');
00925 }
00926
00931 function setReviewFileId($reviewFileId) {
00932 return $this->setData('reviewFileId', $reviewFileId);
00933 }
00934
00939 function getEditorFileId() {
00940 return $this->getData('editorFileId');
00941 }
00942
00947 function setEditorFileId($editorFileId) {
00948 return $this->setData('editorFileId', $editorFileId);
00949 }
00950
00955 function getCopyeditFileId() {
00956 return $this->getData('copyeditFileId');
00957 }
00958
00963 function setCopyeditFileId($copyeditFileId) {
00964 return $this->setData('copyeditFileId', $copyeditFileId);
00965 }
00966
00971 function getPages() {
00972 return $this->getData('pages');
00973 }
00974
00979 function setPages($pages) {
00980 return $this->setData('pages',$pages);
00981 }
00982
00987 function getFastTracked() {
00988 return $this->getData('fastTracked');
00989 }
00990
00995 function setFastTracked($fastTracked) {
00996 return $this->setData('fastTracked',$fastTracked);
00997 }
00998
01003 function getHideAuthor() {
01004 return $this->getData('hideAuthor');
01005 }
01006
01011 function setHideAuthor($hideAuthor) {
01012 return $this->setData('hideAuthor', $hideAuthor);
01013 }
01014
01019 function getCommentsStatus() {
01020 return $this->getData('commentsStatus');
01021 }
01022
01027 function setCommentsStatus($commentsStatus) {
01028 return $this->setData('commentsStatus', $commentsStatus);
01029 }
01030
01035 function getCommentsStatusString() {
01036 switch ($this->getCommentsStatus()) {
01037 case COMMENTS_DISABLE:
01038 return 'article.comments.disable';
01039 case COMMENTS_ENABLE:
01040 return 'article.comments.enable';
01041 default:
01042 return 'article.comments.sectionDefault';
01043 }
01044 }
01045
01052 function getEnableComments() {
01053 switch ($this->getCommentsStatus()) {
01054 case COMMENTS_DISABLE:
01055 return false;
01056 case COMMENTS_ENABLE:
01057 return true;
01058 case COMMENTS_SECTION_DEFAULT:
01059 $sectionDao =& DAORegistry::getDAO('SectionDAO');
01060 $section =& $sectionDao->getSection($this->getSectionId(), $this->getJournalId());
01061 if ($section->getDisableComments()) {
01062 return false;
01063 } else {
01064 return true;
01065 }
01066 }
01067 }
01068
01073 function &getCommentsStatusOptions() {
01074 static $commentsStatusOptions = array(
01075 COMMENTS_SECTION_DEFAULT => 'article.comments.sectionDefault',
01076 COMMENTS_DISABLE => 'article.comments.disable',
01077 COMMENTS_ENABLE => 'article.comments.enable'
01078 );
01079 return $commentsStatusOptions;
01080 }
01081 }
01082
01083 ?>