/** * @see Form::execute() * @return MonographFile if successful, otherwise null */ function &execute() { // Identify the file genre. $revisedFileId = $this->getRevisedFileId(); if ($revisedFileId) { // The file genre will be copied over from the revised file. $fileGenre = null; } else { // This is a new file so we need the file genre from the form. $fileGenre = $this->getData('genreId') ? (int) $this->getData('genreId') : null; } // Upload the file. import('classes.file.MonographFileManager'); return MonographFileManager::uploadMonographFile($this->getData('monographId'), 'uploadedFile', $this->getFileStage(), $revisedFileId, $fileGenre); }
/** * @see Form::execute() * @param $request Request * @return MonographFile if successful, otherwise null */ function &execute($request) { // Identify the file genre. $revisedFileId = $this->getRevisedFileId(); if ($revisedFileId) { // The file genre will be copied over from the revised file. $fileGenre = null; } else { // This is a new file so we need the file genre from the form. $fileGenre = $this->getData('genreId') ? (int) $this->getData('genreId') : null; } // Retrieve the uploader's user group. $uploaderUserGroupId = $this->getData('uploaderUserGroupId'); if (!$uploaderUserGroupId) { fatalError('Invalid uploader user group!'); } // Identify the uploading user. $user =& $request->getUser(); assert(is_a($user, 'User')); // Upload the file. import('classes.file.MonographFileManager'); return MonographFileManager::uploadMonographFile($this->getData('monographId'), 'uploadedFile', $this->getData('fileStage'), $user->getId(), $uploaderUserGroupId, $revisedFileId, $fileGenre); }