/** * Add a file to the search index. * @param $paperId int * @param $type int * @param $fileId int */ function updateFileIndex($paperId, $type, $fileId) { import('classes.file.PaperFileManager'); $fileMgr = new PaperFileManager($paperId); $file =& $fileMgr->getFile($fileId); if (isset($file)) { $parser =& SearchFileParser::fromFile($file); } if (isset($parser)) { if ($parser->open()) { $searchDao =& DAORegistry::getDAO('PaperSearchDAO'); $objectId = $searchDao->insertObject($paperId, $type, $fileId); $position = 0; while (($text = $parser->read()) !== false) { PaperSearchIndex::indexObjectKeywords($objectId, $text, $position); } $parser->close(); } } }
function appendRecord($record) { $paper = $record['paper']; if (array_key_exists('galley', $record)) { $galley = $record['galley']; import('file.PaperFileManager'); $paperFileManager = new PaperFileManager($paper->getId()); $file =& $paperFileManager->getFile($galley->getFileId()); //set the filename $filename = $file->getFileName(); //set the filepath $schedConfId = $paper->getSchedConfId(); $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $schedConf =& $schedConfDao->getSchedConf($schedConfId); $filesDir = Config::getVar('files', 'files_dir') . '/conferences/' . $schedConf->getConferenceId() . '/schedConfs/' . $schedConfId . '/papers/' . $paper->getId() . '/'; $filepath = $filesDir . $file->getType() . '/' . $filename; //add file to the zip if ($this->res) { if (file_exists($filepath)) { $Humanfilename = $this->setPdfFilename($paper->getTitle()); $this->zip->addFile($filepath, $Humanfilename); //put the pdf file with a human readable name } } } }