Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
files/submissionDocuments/form/EditLibraryFileForm.inc.php
1 <?php
2 
16 import('lib.pkp.controllers.grid.files.form.LibraryFileForm');
17 
21 
24 
32  parent::LibraryFileForm('controllers/grid/files/submissionDocuments/form/editFileForm.tpl', $contextId);
33 
34  $this->submissionId = $submissionId;
35  $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO');
36  $this->libraryFile = $libraryFileDao->getById($fileId);
37 
38  if (!$this->libraryFile || $this->libraryFile->getContextId() !== $this->contextId || $this->libraryFile->getSubmissionId() !== $this->getSubmissionId()) {
39  fatalError('Invalid library file!');
40  }
41  }
42 
46  function initData() {
47  $this->_data = array(
48  'submissionId' => $this->libraryFile->getSubmissionId(),
49  'libraryFileName' => $this->libraryFile->getName(null), // Localized
50  'libraryFile' => $this->libraryFile // For read-only info
51  );
52  }
53 
57  function execute() {
58  $this->libraryFile->setName($this->getData('libraryFileName'), null); // Localized
59  $this->libraryFile->setType($this->getData('fileType'));
60 
61  $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO');
62  $libraryFileDao->updateObject($this->libraryFile);
63  }
64 
69  function getSubmissionId() {
70  return $this->submissionId;
71  }
72 }
73 
74 ?>
static & getDAO($name, $dbconn=null)
EditLibraryFileForm($contextId, $fileId, $submissionId)
getData($key)
Definition: Form.inc.php:210
Form for adding/editing a file.