/** * Constructor. */ function PaperNote() { parent::DataObject(); }
/** * PRIVATE routine to copy a paper file and add it to the database. * @param $url original filename/url of the file * @param $mimeType string the mime type of the file * @param $type string identifying type * @param $fileId int ID of an existing file to update * @param $overwrite boolean overwrite all previous revisions of the file (revision number is still incremented) * @return int the file ID (false if upload failed) */ function handleCopy($url, $mimeType, $type, $fileId = null, $overwrite = false) { $paperFileDao =& DAORegistry::getDAO('PaperFileDAO'); $typePath = $this->typeToPath($type); $dir = $this->filesDir . $typePath . '/'; if (!$fileId) { // Insert dummy file to generate file id FIXME? $dummyFile = true; $paperFile =& $this->generateDummyFile($this->paper); } else { $dummyFile = false; $paperFile = new PaperFile(); $paperFile->setRevision($paperFileDao->getRevisionNumber($fileId) + 1); $paperFile->setPaperId($this->paperId); $paperFile->setFileId($fileId); $paperFile->setDateUploaded(Core::getCurrentDate()); $paperFile->setDateModified(Core::getCurrentDate()); } $paperFile->setFileType($mimeType); $paperFile->setOriginalFileName(PaperFileManager::truncateFileName(basename($url), 127)); $paperFile->setType($typePath); $paperFile->setStage($this->paper->getCurrentStage()); $newFileName = $this->generateFilename($paperFile, $type, $paperFile->getOriginalFileName()); if (!$this->copyFile($url, $dir . $newFileName)) { // Delete the dummy file we inserted $paperFileDao->deletePaperFileById($paperFile->getFileId()); return false; } $paperFile->setFileSize(filesize($dir . $newFileName)); if ($dummyFile) { $paperFileDao->updatePaperFile($paperFile); } else { $paperFileDao->insertPaperFile($paperFile); } if ($overwrite) { $this->removePriorRevisions($paperFile->getFileId(), $paperFile->getRevision()); } return $paperFile->getFileId(); }
/** * Internal function to return an PaperFile object from a row. * @param $row array * @return PaperFile */ function &_returnPaperFileFromRow(&$row) { $paperFile = new PaperFile(); $paperFile->setFileId($row['file_id']); $paperFile->setRevision($row['revision']); $paperFile->setPaperId($row['paper_id']); $paperFile->setFileName($row['file_name']); $paperFile->setFileType($row['file_type']); $paperFile->setFileSize($row['file_size']); $paperFile->setOriginalFileName($row['original_file_name']); $paperFile->setFileStage($row['file_stage']); $paperFile->setRound($row['round']); $paperFile->setDateUploaded($this->datetimeFromDB($row['date_uploaded'])); $paperFile->setDateModified($this->datetimeFromDB($row['date_modified'])); $paperFile->setViewable($row['viewable']); HookRegistry::call('PaperFileDAO::_returnPaperFileFromRow', array(&$paperFile, &$row)); return $paperFile; }
/** * Constructor. */ function PaperGalley() { parent::DataObject(); }
/** * Constructor. */ function SuppFile() { parent::DataObject(); }