00001 <?php
00002
00015 import('controllers.grid.files.form.LibraryFileForm');
00016
00017 class EditLibraryFileForm extends LibraryFileForm {
00019 var $libraryFile;
00020
00022 var $monographId;
00023
00030 function EditLibraryFileForm($pressId, $fileId, $monographId) {
00031 parent::LibraryFileForm('controllers/grid/files/submissionDocuments/form/editFileForm.tpl', $pressId);
00032
00033 $this->monographId = $monographId;
00034 $libraryFileDao =& DAORegistry::getDAO('LibraryFileDAO');
00035 $this->libraryFile =& $libraryFileDao->getById($fileId);
00036
00037 if (!$this->libraryFile || $this->libraryFile->getPressId() !== $this->pressId || $this->libraryFile->getMonographId() !== $this->getMonographId()) {
00038 fatalError('Invalid library file!');
00039 }
00040 }
00041
00045 function initData() {
00046 $this->_data = array(
00047 'monographId' => $this->libraryFile->getMonographId(),
00048 'libraryFileName' => $this->libraryFile->getName(null),
00049 'libraryFile' => $this->libraryFile
00050 );
00051 }
00052
00056 function execute() {
00057 $this->libraryFile->setName($this->getData('libraryFileName'), null);
00058 $this->libraryFile->setType($this->getData('fileType'));
00059
00060 $libraryFileDao =& DAORegistry::getDAO('LibraryFileDAO');
00061 $libraryFileDao->updateObject($this->libraryFile);
00062 }
00063
00068 function getMonographId() {
00069 return $this->monographId;
00070 }
00071 }
00072
00073 ?>