Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
AuthorSignoffFilesGridDataProvider.inc.php
1 <?php
2 
16 import('lib.pkp.controllers.grid.files.SubmissionFilesGridDataProvider');
17 
18 // Import file stage constants.
19 import('lib.pkp.classes.submission.SubmissionFile');
20 
21 class AuthorSignoffFilesGridDataProvider extends SubmissionFilesGridDataProvider {
22 
24  var $_userId;
25 
26  /* @var string */
27  var $_symbolic;
28 
32  function AuthorSignoffFilesGridDataProvider($symbolic, $stageId) {
33  parent::SubmissionFilesGridDataProvider(SUBMISSION_FILE_PROOF);
34 
35  $this->setStageId($stageId);
36  $this->_symbolic = $symbolic;
37  }
38 
43  function getSymbolic() {
44  return $this->_symbolic;
45  }
46 
51  function getUserId() {
52  return $this->_userId;
53  }
54 
59  function setUserId($userId) {
60  $this->_userId = $userId;
61  }
62 
63  //
64  // Implement template methods from GridDataProvider
65  //
69  function loadData() {
70  $submissionFileSignoffDao = DAORegistry::getDAO('SubmissionFileSignoffDAO');
71  $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
72  $signoffs = $submissionFileSignoffDao->getAllBySubmission($submission->getId(), $this->getSymbolic(), $this->getUserId());
73 
74  $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */
75  $preparedData = array();
76  while ($signoff = $signoffs->next()) {
77  $submissionFile = $submissionFileDao->getLatestRevision($signoff->getAssocId(), null, $submission->getId());
78  $preparedData[$signoff->getId()]['signoff'] = $signoff;
79  $preparedData[$signoff->getId()]['submissionFile'] = $submissionFile;
80  }
81 
82  return $preparedData;
83  }
84 
85  //
86  // Public methods.
87  //
93  function getAddSignoffFile($request) {
94  $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
95  $signoffDao = DAORegistry::getDAO('SubmissionFileSignoffDAO'); /* @var $signoffDao SubmissionFileSignoffDAO */
96  $signoffFactory = $signoffDao->getAllBySubmission($submission->getId(), $this->getSymbolic(), $this->getUserId(), null, true);
97 
98  $action = false;
99  if (!$signoffFactory->wasEmpty()) {
100  import('lib.pkp.controllers.api.signoff.linkAction.AddSignoffFileLinkAction');
101  $action = new AddSignoffFileLinkAction(
102  $request, $submission->getId(),
103  $this->getStageId(), $this->getSymbolic(), null,
104  __('submission.upload.signoff'), __('submission.upload.signoff')
105  );
106  }
107 
108  return $action;
109  }
110 }
111 
112 ?>
static & getDAO($name, $dbconn=null)
Provide data for author signoff file grids.
Class for signoff file upload actions.
& getAuthorizedContextObject($assocType)