• Main Page
  • Modules
  • Classes
  • Files
  • File List

controllers/grid/files/fileSignoff/AuthorSignoffFilesGridDataProvider.inc.php

00001 <?php
00002 
00016 import('controllers.grid.files.SubmissionFilesGridDataProvider');
00017 
00018 // Import file stage constants.
00019 import('classes.monograph.MonographFile');
00020 
00021 class AuthorSignoffFilesGridDataProvider extends SubmissionFilesGridDataProvider {
00022 
00024    var $_userId;
00025 
00026    /* @var string */
00027    var $_symbolic;
00028 
00032    function AuthorSignoffFilesGridDataProvider($symbolic, $stageId) {
00033       parent::SubmissionFilesGridDataProvider(MONOGRAPH_FILE_PROOF);
00034 
00035       $this->setStageId($stageId);
00036       $this->_symbolic = $symbolic;
00037    }
00038 
00043    function getSymbolic() {
00044       return $this->_symbolic;
00045    }
00046 
00051    function getUserId() {
00052       return $this->_userId;
00053    }
00054 
00059    function setUserId($userId) {
00060       $this->_userId = $userId;
00061    }
00062 
00063    //
00064    // Implement template methods from GridDataProvider
00065    //
00069    function &loadData() {
00070       $monographFileSignoffDao =& DAORegistry::getDAO('MonographFileSignoffDAO');
00071       $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00072       $signoffs =& $monographFileSignoffDao->getAllByMonograph($monograph->getId(), $this->getSymbolic(), $this->getUserId());
00073 
00074       $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */
00075       while ($signoff =& $signoffs->next()) {
00076          $monographFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId(), null, $monograph->getId());
00077          $preparedData[$signoff->getId()]['signoff'] =& $signoff;
00078          $preparedData[$signoff->getId()]['submissionFile'] =& $monographFile;
00079          unset($signoff, $monographFile);
00080       }
00081 
00082       return $preparedData;
00083    }
00084 
00085    //
00086    // Public methods.
00087    //
00093    function &getAddSignoffFile(&$request) {
00094       $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00095       $signoffDao =& DAORegistry::getDAO('MonographFileSignoffDAO'); /* @var $signoffDao MonographFileSignoffDAO */
00096       $signoffFactory =& $signoffDao->getAllByMonograph($monograph->getId(), $this->getSymbolic(), $this->getUserId(), null, true);
00097 
00098       $action = false;
00099       if (!$signoffFactory->wasEmpty()) {
00100          import('controllers.api.signoff.linkAction.AddSignoffFileLinkAction');
00101          $action = new AddSignoffFileLinkAction(
00102                            $request, $monograph->getId(),
00103                            $this->getStageId(), $this->getSymbolic(), null,
00104                            __('submission.upload.signoff'), __('submission.upload.signoff')
00105                            );
00106       }
00107 
00108       return $action;
00109    }
00110 }
00111 
00112 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1