function confirmSubmission(&$paper, &$user, &$schedConf, &$conference, $mailTemplate = 'SUBMISSION_ACK') { // Update search index import('classes.search.PaperSearchIndex'); PaperSearchIndex::indexPaperMetadata($paper); PaperSearchIndex::indexPaperFiles($paper); // Send author notification email import('classes.mail.PaperMailTemplate'); $mail = new PaperMailTemplate($paper, $mailTemplate, null, null, null, null, false, true); $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName')); if ($mail->isEnabled()) { $mail->addRecipient($user->getEmail(), $user->getFullName()); // If necessary, BCC the acknowledgement to someone. if ($schedConf->getSetting('copySubmissionAckPrimaryContact')) { $mail->addBcc($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName')); } if ($schedConf->getSetting('copySubmissionAckSpecified')) { $copyAddress = $schedConf->getSetting('copySubmissionAckAddress'); if (!empty($copyAddress)) { $mail->addBcc($copyAddress); } } $editAssignmentDao = DAORegistry::getDAO('EditAssignmentDAO'); $editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paper->getId()); while ($editAssignment =& $editAssignments->next()) { $mail->addBcc($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName()); unset($editAssignment); } $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $schedConf->getSetting('contactName') . "\n" . $conference->getLocalizedName(), 'submissionUrl' => Request::url(null, null, 'author', 'submission', $paper->getId()))); $mail->send(); } }
/** * Save changes to the supplementary file. * @return int the supplementary file ID */ function execute($fileName = null) { import("file.PaperFileManager"); $paperFileManager = new PaperFileManager($this->paper->getPaperId()); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $fileName = isset($fileName) ? $fileName : 'uploadSuppFile'; if (isset($this->suppFile)) { $suppFile =& $this->suppFile; // Upload file, if file selected. if ($paperFileManager->uploadedFileExists($fileName)) { $paperFileManager->uploadSuppFile($fileName, $suppFile->getFileId()); import('search.PaperSearchIndex'); PaperSearchIndex::updateFileIndex($this->paper->getPaperId(), PAPER_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId()); } // Index metadata PaperSearchIndex::indexSuppFileMetadata($suppFile); // Update existing supplementary file $this->setSuppFileData($suppFile); $suppFileDao->updateSuppFile($suppFile); } else { // Upload file, if file selected. if ($paperFileManager->uploadedFileExists($fileName)) { $fileId = $paperFileManager->uploadSuppFile($fileName); import('search.PaperSearchIndex'); PaperSearchIndex::updateFileIndex($this->paper->getPaperId(), PAPER_SEARCH_SUPPLEMENTARY_FILE, $fileId); } else { $fileId = 0; } // Insert new supplementary file $suppFile = new SuppFile(); $suppFile->setPaperId($this->paper->getPaperId()); $suppFile->setFileId($fileId); $this->setSuppFileData($suppFile); $suppFileDao->insertSuppFile($suppFile); $this->suppFileId = $suppFile->getId(); } return $this->suppFileId; }
function confirmSubmissionBBC(&$paper, $user, &$schedConf, &$conference, $mailTemplate = 'SUBMISSION_ACK_BCC') { // Update search index import('search.PaperSearchIndex'); PaperSearchIndex::indexPaperMetadata($paper); PaperSearchIndex::indexPaperFiles($paper); $roleDao =& DAORegistry::getDAO('RoleDAO'); $directors =& $roleDao->getUsersArrayByRoleId(ROLE_ID_DIRECTOR, $conference->getId(), $schedConf->getId()); //print_r($users->toArray()); //echo count($users); // 嘗試找看看有沒有這位使用者 //$userDao =& DAORegistry::getDAO('UserDAO'); //$contactUser = $userDao->getUserByEmail($schedConf->getSetting('contactEmail')); // if (isset($contactUser)) { // $submissionUrl = $submissionUrl . "?u=" . $contactUser->getUserId(); // } // $contactName = $schedConf->getSetting('contactName'); // $contactEmail = $schedConf->getSetting('contactEmail'); // if (isset($contactUser)) { // $contactName = $contactUser->getFullName(); // $contactEmail = $contactUser->getEmail(); // } // Send author notification email import('mail.PaperMailTemplate'); $mail = new PaperMailTemplate($paper, $mailTemplate, null, false, $conference, $schedConf, true, true); $mail->setBccSender(false); $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName')); if ($mail->isEnabled() && count($directors > 0)) { $contactName = ""; foreach ($directors as $director) { $mail->addRecipient($director->getEmail(), $director->getFullName()); if ($contactName !== "") { $contactName .= ", "; } $contactName .= $director->getFullName(); } // $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO'); // $editAssignments =& $editAssignmentDao->getEditAssignmentsByPaperId($paper->getId()); // while ($editAssignment =& $editAssignments->next()) { // $mail->addBcc($editAssignment->getDirectorEmail(), $editAssignment->getDirectorFullName()); // unset($editAssignment); // } $submissionUrl = Request::url(null, null, 'director', 'submissionReview', $paper->getId()); $mail->assignParams(array('contactName' => $contactName, 'authorName' => trim($user->getFullName()), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $schedConf->getSetting('contactName') . "\n" . $conference->getConferenceTitle(), 'submissionUrl' => $submissionUrl)); $mail->send(); } }
function handlePaperNode(&$conference, &$schedConf, &$paperNode, &$track, &$paper, &$publishedPaper, &$errors, &$user, $isCommandLine, &$dependentItems) { $errors = array(); $conferenceSupportedLocales = array_keys($conference->getSupportedLocaleNames()); // => locales must be set up before $conferencePrimaryLocale = $conference->getPrimaryLocale(); $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO'); $paperDao =& DAORegistry::getDAO('PaperDAO'); $paper = new Paper(); $paper->setSchedConfId($schedConf->getId()); $paper->setUserId($user->getId()); $paper->setTrackId($track->getId()); $paper->setStatus(STATUS_PUBLISHED); $paper->setSubmissionProgress(0); $paper->setCurrentStage(REVIEW_STAGE_ABSTRACT); $paper->setReviewMode(REVIEW_MODE_ABSTRACTS_ALONE); $paper->setDateSubmitted(Core::getCurrentDate()); $paper->stampStatusModified(); $titleExists = false; for ($index = 0; $node = $paperNode->getChildByName('title', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperTitleLocaleUnsupported', array('paperTitle' => $node->getValue(), 'locale' => $locale)); return false; } $paper->setTitle($node->getValue(), $locale); $titleExists = true; } if (!$titleExists || $paper->getTitle($conferencePrimaryLocale) == "") { $errors[] = array('plugins.importexport.native.import.error.paperTitleMissing', array('trackTitle' => $track->getLocalizedTitle())); return false; } for ($index = 0; $node = $paperNode->getChildByName('abstract', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperAbstractLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setAbstract($node->getValue(), $locale); } if ($indexingNode = $paperNode->getChildByName('indexing')) { for ($index = 0; $node = $indexingNode->getChildByName('discipline', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperDisciplineLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setDiscipline($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('type', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperTypeLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setType($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('subject', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperSubjectLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setSubject($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('subject_class', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperSubjectClassLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setSubjectClass($node->getValue(), $locale); } if ($coverageNode = $indexingNode->getChildByName('coverage')) { for ($index = 0; $node = $coverageNode->getChildByName('geographical', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperCoverageGeoLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setCoverageGeo($node->getValue(), $locale); } for ($index = 0; $node = $coverageNode->getChildByName('chronological', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperCoverageChronLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setCoverageChron($node->getValue(), $locale); } for ($index = 0; $node = $coverageNode->getChildByName('sample', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperCoverageSampleLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setCoverageSample($node->getValue(), $locale); } } } for ($index = 0; $node = $paperNode->getChildByName('sponsor', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $conferencePrimaryLocale; } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperSponsorLocaleUnsupported', array('paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $paper->setSponsor($node->getValue(), $locale); } if ($node = $paperNode->getChildByName('pages')) { $paper->setPages($node->getValue()); } if ($language = $paperNode->getAttribute('language')) { $paper->setLanguage($language); } /* --- Handle authors --- */ $hasErrors = false; for ($index = 0; $node = $paperNode->getChildByName('author', $index); $index++) { if (!NativeImportDom::handleAuthorNode($conference, $schedConf, $node, $track, $paper, $authorErrors)) { $errors = array_merge($errors, $authorErrors); $hasErrors = true; } } if ($hasErrors) { return false; } $paperDao->insertPaper($paper); $dependentItems[] = array('paper', $paper); // Log the import in the paper event log. import('paper.log.PaperLog'); import('paper.log.PaperEventLogEntry'); PaperLog::logEvent($paper->getId(), PAPER_LOG_PAPER_IMPORT, PAPER_LOG_DEFAULT, 0, 'log.imported', array('userName' => $user->getFullName(), 'paperId' => $paper->getId())); // Insert published paper entry. $publishedPaper = new PublishedPaper(); $publishedPaper->setPaperId($paper->getId()); $publishedPaper->setSchedConfId($schedConf->getId()); if ($node = $paperNode->getChildByName('date_published')) { $publishedDate = strtotime($node->getValue()); if ($publishedDate === -1) { $errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue())); return false; } else { $publishedPaper->setDatePublished($publishedDate); } } $node = $paperNode->getChildByName('open_access'); $publishedPaper->setSeq(REALLY_BIG_NUMBER); $publishedPaper->setViews(0); $publishedPaper->setPublicPaperId($paperNode->getAttribute('public_id')); $publishedPaper->setPubId($publishedPaperDao->insertPublishedPaper($publishedPaper)); $publishedPaperDao->resequencePublishedPapers($track->getId(), $schedConf->getId()); /* --- Galleys (html or otherwise handled simultaneously) --- */ import('file.PaperFileManager'); $paperFileManager = new PaperFileManager($paper->getId()); /* --- Handle galleys --- */ $hasErrors = false; $galleyCount = 0; for ($index = 0; $index < count($paperNode->children); $index++) { $node =& $paperNode->children[$index]; if ($node->getName() == 'htmlgalley') { $isHtml = true; } elseif ($node->getName() == 'galley') { $isHtml = false; } else { continue; } if (!NativeImportDom::handleGalleyNode($conference, $schedConf, $node, $track, $paper, $galleyErrors, $isCommandLine, $isHtml, $galleyCount, $paperFileManager)) { $errors = array_merge($errors, $galleyErrors); $hasErrors = true; } $galleyCount++; } if ($hasErrors) { return false; } /* --- Handle supplemental files --- */ $hasErrors = false; for ($index = 0; $node = $paperNode->getChildByName('supplemental_file', $index); $index++) { if (!NativeImportDom::handleSuppFileNode($conference, $schedConf, $node, $track, $paper, $suppFileErrors, $isCommandLine, $paperFileManager)) { $errors = array_merge($errors, $suppFileErrors); $hasErrors = true; } } if ($hasErrors) { return false; } // Index the inserted paper. import('search.PaperSearchIndex'); PaperSearchIndex::indexPaperMetadata($paper); PaperSearchIndex::indexPaperFiles($paper); return true; }
/** * Query parsing helper routine. * Returned structure is based on that used by the Search::QueryParser Perl module. */ function _parseQuery($signTokens, $tokens, &$pos, $total) { $return = array('+' => array(), '' => array(), '-' => array()); $postBool = $preBool = ''; $notOperator = String::strtolower(__('search.operator.not')); $andOperator = String::strtolower(__('search.operator.and')); $orOperator = String::strtolower(__('search.operator.or')); while ($pos < $total) { if (!empty($signTokens[$pos])) { $sign = $signTokens[$pos]; } else { if (empty($sign)) { $sign = '+'; } } $token = String::strtolower($tokens[$pos++]); switch ($token) { case $notOperator: $sign = '-'; break; case ')': return $return; case '(': $token = PaperSearch::_parseQuery($signTokens, $tokens, $pos, $total); default: $postBool = ''; if ($pos < $total) { $peek = String::strtolower($tokens[$pos]); if ($peek == $orOperator) { $postBool = 'or'; $pos++; } else { if ($peek == $andOperator) { $postBool = 'and'; $pos++; } } } $bool = empty($postBool) ? $preBool : $postBool; $preBool = $postBool; if ($bool == 'or') { $sign = ''; } if (is_array($token)) { $k = $token; } else { $k = PaperSearchIndex::filterKeywords($token, true); } if (!empty($k)) { $return[$sign][] = $k; } $sign = ''; break; } } return $return; }
/** * Rebuild the paper search index. * Note: Rebuilds index for _all_ conferences (non-optimal, but shouldn't be a problem) * Based on code from tools/rebuildSearchIndex.php */ function rebuildSearchIndex() { if ($this->hasOption('verbose')) { printf("Rebuilding search index\n"); } PaperSearchIndex::rebuildIndex(); }
/** * Delete a supplementary file. * @param $paper object * @param $suppFileId int */ function deleteSuppFile($paper, $suppFileId) { import('file.PaperFileManager'); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $suppFile =& $suppFileDao->getSuppFile($suppFileId, $paper->getId()); if (isset($suppFile) && !HookRegistry::call('TrackDirectorAction::deleteSuppFile', array(&$paper, &$suppFile))) { if ($suppFile->getFileId()) { $paperFileManager = new PaperFileManager($paper->getId()); $paperFileManager->deleteFile($suppFile->getFileId()); import('search.PaperSearchIndex'); PaperSearchIndex::deleteTextIndex($paper->getId(), PAPER_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId()); } $suppFileDao->deleteSuppFile($suppFile); } }
/** * Rebuild the search index for all papers in all conferences. */ function execute() { PaperSearchIndex::rebuildIndex(true); }
/** * Save changes to the galley. * @return int the galley ID */ function execute($fileName = null) { import('classes.file.PaperFileManager'); $paperFileManager = new PaperFileManager($this->paperId); $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO'); $fileName = isset($fileName) ? $fileName : 'galleyFile'; if (isset($this->galley)) { $galley =& $this->galley; // Upload galley file if ($paperFileManager->uploadedFileExists($fileName)) { if ($galley->getFileId()) { $paperFileManager->uploadPublicFile($fileName, $galley->getFileId()); } else { $fileId = $paperFileManager->uploadPublicFile($fileName); $galley->setFileId($fileId); } // Update file search index import('classes.search.PaperSearchIndex'); PaperSearchIndex::updateFileIndex($this->paperId, PAPER_SEARCH_GALLEY_FILE, $galley->getFileId()); } if ($paperFileManager->uploadedFileExists('styleFile')) { // Upload stylesheet file $styleFileId = $paperFileManager->uploadPublicFile('styleFile', $galley->getStyleFileId()); $galley->setStyleFileId($styleFileId); } else { if ($this->getData('deleteStyleFile')) { // Delete stylesheet file $styleFile =& $galley->getStyleFile(); if (isset($styleFile)) { $paperFileManager->deleteFile($styleFile->getFileId()); } } } // Update existing galley $galley->setLabel($this->getData('label')); $galley->setLocale($this->getData('galleyLocale')); $galleyDao->updateGalley($galley); } else { // Upload galley file if ($paperFileManager->uploadedFileExists($fileName)) { $fileType = $paperFileManager->getUploadedFileType($fileName); $fileId = $paperFileManager->uploadPublicFile($fileName); // Update file search index import('classes.search.PaperSearchIndex'); PaperSearchIndex::updateFileIndex($this->paperId, PAPER_SEARCH_GALLEY_FILE, $fileId); } else { $fileId = 0; } if (isset($fileType) && strstr($fileType, 'html')) { // Assume HTML galley $galley = new PaperHTMLGalley(); } else { $galley = new PaperGalley(); } $galley->setPaperId($this->paperId); $galley->setFileId($fileId); if ($this->getData('label') == null) { // Generate initial label based on file type if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); } else { if (isset($fileType)) { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('PostScript'); } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); } else { if (strstr($fileType, 'audio')) { $galley->setLabel('Audio'); } else { if (strstr($fileType, 'powerpoint')) { $galley->setLabel('Slideshow'); } } } } } } } if ($galley->getLabel() == null) { $galley->setLabel(Locale::translate('common.untitled')); } } else { $galley->setLabel($this->getData('label')); } $galley->setLocale($this->getData('galleyLocale')); // Insert new galley $galleyDao->insertGalley($galley); $this->galleyId = $galley->getId(); } return $this->galleyId; }
/** * Rebuild the search index. * @return boolean */ function rebuildSearchIndex() { import('classes.search.PaperSearchIndex'); PaperSearchIndex::rebuildIndex(); return true; }
/** * Rebuild the search index for all conferences. */ function rebuildIndex($log = false) { // Clear index if ($log) { echo 'Clearing index ... '; } $searchDao =& DAORegistry::getDAO('PaperSearchDAO'); // FIXME Abstract into PaperSearchDAO? $searchDao->update('DELETE FROM paper_search_object_keywords'); $searchDao->update('DELETE FROM paper_search_objects'); $searchDao->update('DELETE FROM paper_search_keyword_list'); $searchDao->setCacheDir(Config::getVar('files', 'files_dir') . '/_db'); $searchDao->_dataSource->CacheFlush(); if ($log) { echo "done\n"; } // Build index $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $paperDao =& DAORegistry::getDAO('PaperDAO'); $schedConfs =& $schedConfDao->getSchedConfs(); while (!$schedConfs->eof()) { $schedConf =& $schedConfs->next(); $numIndexed = 0; if ($log) { echo "Indexing \"", $schedConf->getFullTitle(), "\" ... "; } $papers =& $paperDao->getPapersBySchedConfId($schedConf->getId()); while (!$papers->eof()) { $paper =& $papers->next(); if ($paper->getDateSubmitted()) { PaperSearchIndex::indexPaperMetadata($paper); PaperSearchIndex::indexPaperFiles($paper); $numIndexed++; } unset($paper); } if ($log) { echo $numIndexed, " papers indexed\n"; } unset($schedConf); } }
/** * Save changes to paper. * @return int the paper ID */ function execute() { $paperDao =& DAORegistry::getDAO('PaperDAO'); $authorDao =& DAORegistry::getDAO('AuthorDAO'); $trackDao =& DAORegistry::getDAO('TrackDAO'); // Update paper $paper =& $this->paper; $paper->setTitle($this->getData('title'), null); // Localized $track =& $trackDao->getTrack($paper->getTrackId()); $paper->setAbstract($this->getData('abstract'), null); // Localized $paper->setDiscipline($this->getData('discipline'), null); // Localized $paper->setSubjectClass($this->getData('subjectClass'), null); // Localized $paper->setSubject($this->getData('subject'), null); // Localized $paper->setCoverageGeo($this->getData('coverageGeo'), null); // Localized $paper->setCoverageChron($this->getData('coverageChron'), null); // Localized $paper->setCoverageSample($this->getData('coverageSample'), null); // Localized $paper->setType($this->getData('type'), null); // Localized $paper->setLanguage($this->getData('language')); $paper->setSponsor($this->getData('sponsor'), null); // Localized $paper->setCitations($this->getData('citations')); // Update authors $authors = $this->getData('authors'); for ($i = 0, $count = count($authors); $i < $count; $i++) { if ($authors[$i]['authorId'] > 0) { // Update an existing author $author =& $paper->getAuthor($authors[$i]['authorId']); $isExistingAuthor = true; } else { // Create a new author $author = new Author(); $isExistingAuthor = false; } if ($author != null) { $author->setFirstName($authors[$i]['firstName']); $author->setMiddleName($authors[$i]['middleName']); $author->setLastName($authors[$i]['lastName']); $author->setAffiliation($authors[$i]['affiliation']); $author->setCountry($authors[$i]['country']); $author->setEmail($authors[$i]['email']); $author->setUrl($authors[$i]['url']); $author->setBiography($authors[$i]['biography'], null); // Localized $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $paper->addAuthor($author); } } } // Remove deleted authors $deletedAuthors = explode(':', $this->getData('deletedAuthors')); for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) { $paper->removeAuthor($deletedAuthors[$i]); } // Save the paper $paperDao->updatePaper($paper); // Update search index import('search.PaperSearchIndex'); PaperSearchIndex::indexPaperMetadata($paper); return $paper->getId(); }