Open Journal Systems  3.3.0
SupplementaryFileDAODelegate.inc.php
1 <?php
2 
20 import('lib.pkp.classes.submission.SubmissionFileDAODelegate');
21 import('lib.pkp.classes.submission.SupplementaryFile');
22 
24 
25 
26  //
27  // Public methods
28  //
34  function insertObject($supplementaryFile, $sourceFile, $isUpload = false) {
35  // First insert the data for the super-class.
36  $supplementaryFile = parent::insertObject($supplementaryFile, $sourceFile, $isUpload);
37  if (!$supplementaryFile) return null;
38 
39  // Now insert the supplementary-specific data.
40  $this->update(
41  'INSERT INTO submission_supplementary_files
42  (file_id, revision)
43  VALUES
44  (?, ?)',
45  array(
46  (int) $supplementaryFile->getFileId(),
47  (int) $supplementaryFile->getRevision(),
48  )
49  );
50 
51  return $supplementaryFile;
52  }
53 
60  function updateObject($suppFile, $previousFile) {
61  // Update the parent class table first.
62  if (!parent::updateObject($suppFile, $previousFile)) return false;
63 
64  // Now update the supplementary file table.
65  $this->update(
66  'UPDATE submission_supplementary_files
67  SET
68  file_id = ?,
69  revision = ?
70  WHERE file_id = ? AND revision = ?',
71  array(
72  (int)$suppFile->getFileId(),
73  (int)$suppFile->getRevision(),
74  (int)$previousFile->getFileId(),
75  (int)$previousFile->getRevision()
76  )
77  );
78  return true;
79  }
80 
84  function deleteObject($submissionFile) {
85  // First delete the submission file entry.
86  if (!parent::deleteObject($submissionFile)) return false;
87 
88  // Delete the supplementary file entry.
89  $this->update(
90  'DELETE FROM submission_supplementary_files
91  WHERE file_id = ? AND revision = ?',
92  array(
93  (int) $submissionFile->getFileId(),
94  (int) $submissionFile->getRevision()
95  )
96  );
97  return true;
98  }
99 
103  function getLocaleFieldNames() {
104  return array_merge(
105  parent::getLocaleFieldNames(),
106  array(
107  'creator', 'subject', 'description', 'publisher', 'sponsor', 'source',
108  )
109  );
110  }
111 
116  return array_merge(
117  parent::getAdditionalFieldNames(),
118  array(
119  'dateCreated', 'language',
120  )
121  );
122  }
123 
127  function newDataObject() {
128  return new SupplementaryFile();
129  }
130 
131 }
132 
133 
SupplementaryFile
Supplementary file class. This represents submission files that support a complete Dublin Core metada...
Definition: SupplementaryFile.inc.php:22
SupplementaryFileDAODelegate
Base class for operations for retrieving and modifying SupplementaryFile objects.
Definition: SupplementaryFileDAODelegate.inc.php:23
SupplementaryFileDAODelegate\updateObject
updateObject($suppFile, $previousFile)
Definition: SupplementaryFileDAODelegate.inc.php:60
SupplementaryFileDAODelegate\getAdditionalFieldNames
getAdditionalFieldNames()
Definition: SupplementaryFileDAODelegate.inc.php:115
DAO\update
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:214
SubmissionFileDAODelegate
Abstract class to support DAO delegates that provide operations to retrieve and modify SubmissionFile...
Definition: SubmissionFileDAODelegate.inc.php:21
SupplementaryFileDAODelegate\insertObject
insertObject($supplementaryFile, $sourceFile, $isUpload=false)
Definition: SupplementaryFileDAODelegate.inc.php:34
SupplementaryFileDAODelegate\deleteObject
deleteObject($submissionFile)
Definition: SupplementaryFileDAODelegate.inc.php:84
SupplementaryFileDAODelegate\getLocaleFieldNames
getLocaleFieldNames()
Definition: SupplementaryFileDAODelegate.inc.php:103
SupplementaryFileDAODelegate\newDataObject
newDataObject()
Definition: SupplementaryFileDAODelegate.inc.php:127