Open Journal Systems  3.3.0
DepositObject.inc.php
1 <?php
2 
14 class DepositObject extends DataObject {
19  public function getContent() {
20  switch ($this->getObjectType()) {
21  case PLN_PLUGIN_DEPOSIT_OBJECT_ISSUE:
22  $issueDao = DAORegistry::getDAO('IssueDAO');
23  return $issueDao->getIssueById($this->getObjectId(),$this->getJournalId());
24  case 'PublishedArticle': // Legacy (OJS pre-3.2)
25  case PLN_PLUGIN_DEPOSIT_OBJECT_SUBMISSION:
26  $submissionDao = DAORegistry::getDAO('SubmissionDAO');
27  $submission = $submissionDao->getById($this->getObjectId());
28  if ($submission->getContextId() != $this->getJournalId()) throw new Exception('Submission context and context ID do not agree!');
29  return $submission;
30  }
31  throw new Exception('Unknown object type!');
32  }
33 
38  public function setContent($content) {
39  if (is_a($content, PLN_PLUGIN_DEPOSIT_OBJECT_ISSUE) || is_a($content, PLN_PLUGIN_DEPOSIT_OBJECT_SUBMISSION)) {
40  $this->setObjectId($content->getId());
41  $this->setObjectType(get_class($content));
42  } else {
43  throw new Exception('Unknown content type!');
44  }
45  }
46 
51  public function getObjectType() {
52  return $this->getData('objectType');
53  }
54 
59  public function setObjectType($objectType) {
60  $this->setData('objectType', $objectType);
61  }
62 
67  public function getObjectId() {
68  return $this->getData('objectId');
69  }
70 
75  public function setObjectId($objectId) {
76  $this->setData('objectId', $objectId);
77  }
78 
83  public function getJournalId() {
84  return $this->getData('journalId');
85  }
86 
91  public function setJournalId($journalId) {
92  $this->setData('journalId', $journalId);
93  }
94 
99  public function getDepositId() {
100  return $this->getData('depositId');
101  }
102 
107  public function setDepositId($depositId) {
108  $this->setData('depositId', $depositId);
109  }
110 
115  public function getDateCreated() {
116  return $this->getData('dateCreated');
117  }
118 
123  public function setDateCreated($dateCreated) {
124  $this->setData('dateCreated', $dateCreated);
125  }
126 
131  public function getDateModified() {
132  return $this->getData('dateModified');
133  }
134 
139  public function setDateModified($dateModified) {
140  $this->setData('dateModified', $dateModified);
141  }
142 }
DepositObject\getJournalId
getJournalId()
Definition: DepositObject.inc.php:83
DataObject\getData
& getData($key, $locale=null)
Definition: DataObject.inc.php:100
DepositObject\getContent
getContent()
Definition: DepositObject.inc.php:19
DataObject
Any class with an associated DAO should extend this class.
Definition: DataObject.inc.php:18
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
DepositObject\setObjectId
setObjectId($objectId)
Definition: DepositObject.inc.php:75
DepositObject\getObjectType
getObjectType()
Definition: DepositObject.inc.php:51
DepositObject
Basic class describing a deposit stored in the PLN.
Definition: DepositObject.inc.php:14
DepositObject\getDateModified
getDateModified()
Definition: DepositObject.inc.php:131
DepositObject\setDateModified
setDateModified($dateModified)
Definition: DepositObject.inc.php:139
DepositObject\setDateCreated
setDateCreated($dateCreated)
Definition: DepositObject.inc.php:123
DepositObject\setJournalId
setJournalId($journalId)
Definition: DepositObject.inc.php:91
DepositObject\setDepositId
setDepositId($depositId)
Definition: DepositObject.inc.php:107
DepositObject\setObjectType
setObjectType($objectType)
Definition: DepositObject.inc.php:59
DepositObject\getDepositId
getDepositId()
Definition: DepositObject.inc.php:99
DepositObject\setContent
setContent($content)
Definition: DepositObject.inc.php:38
DepositObject\getObjectId
getObjectId()
Definition: DepositObject.inc.php:67
DataObject\setData
setData($key, $value, $locale=null)
Definition: DataObject.inc.php:132
DepositObject\getDateCreated
getDateCreated()
Definition: DepositObject.inc.php:115