当前位置: 首页>>代码示例>>PHP>>正文


PHP ArticleFileManager::getFile方法代码示例

本文整理汇总了PHP中ArticleFileManager::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleFileManager::getFile方法的具体用法?PHP ArticleFileManager::getFile怎么用?PHP ArticleFileManager::getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArticleFileManager的用法示例。


在下文中一共展示了ArticleFileManager::getFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateFileIndex

 /**
  * Add a file to the search index.
  * @param $articleId int
  * @param $type int
  * @param $fileId int
  */
 function updateFileIndex($articleId, $type, $fileId)
 {
     import('classes.file.ArticleFileManager');
     $fileMgr = new ArticleFileManager($articleId);
     $file =& $fileMgr->getFile($fileId);
     if (isset($file)) {
         $parser =& SearchFileParser::fromFile($file);
     }
     if (isset($parser)) {
         if ($parser->open()) {
             $searchDao =& DAORegistry::getDAO('ArticleSearchDAO');
             $objectId = $searchDao->insertObject($articleId, $type, $fileId);
             $position = 0;
             while (($text = $parser->read()) !== false) {
                 ArticleSearchIndex::indexObjectKeywords($objectId, $text, $position);
             }
             $parser->close();
         }
     }
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:26,代码来源:ArticleSearchIndex.inc.php

示例2: isset


//.........这里部分代码省略.........
     XMLCustomWriter::createChildWithText($doc, $issueNode, 'issueno', $issue->getNumber(), false);
     $pubNode =& XMLCustomWriter::createElement($doc, 'pub');
     XMLCustomWriter::appendChild($issueNode, $pubNode);
     XMLCustomWriter::createChildWithText($doc, $pubNode, 'year', $issue->getYear());
     $digPubNode =& XMLCustomWriter::createElement($doc, 'digpub');
     XMLCustomWriter::appendChild($issueNode, $digPubNode);
     if ($issue->getDatePublished()) {
         XMLCustomWriter::createChildWithText($doc, $digPubNode, 'date', EruditExportDom::formatDate($issue->getDatePublished()));
     }
     /* --- Publisher & DTD --- */
     $publisherInstitution =& $journal->getSetting('publisherInstitution');
     $publisherNode =& XMLCustomWriter::createElement($doc, 'publisher');
     XMLCustomWriter::setAttribute($publisherNode, 'id', 'ojs-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId());
     XMLCustomWriter::appendChild($adminNode, $publisherNode);
     $publisherInstitution = $unavailableString;
     if (empty($publisherInstitution)) {
         $publisherInstitution = $unavailableString;
     }
     XMLCustomWriter::createChildWithText($doc, $publisherNode, 'orgname', $publisherInstitution);
     $digprodNode =& XMLCustomWriter::createElement($doc, 'digprod');
     XMLCustomWriter::createChildWithText($doc, $digprodNode, 'orgname', $publisherInstitution);
     XMLCustomWriter::setAttribute($digprodNode, 'id', 'ojs-prod-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId());
     XMLCustomWriter::appendChild($adminNode, $digprodNode);
     $digdistNode =& XMLCustomWriter::createElement($doc, 'digdist');
     XMLCustomWriter::createChildWithText($doc, $digdistNode, 'orgname', $publisherInstitution);
     XMLCustomWriter::setAttribute($digdistNode, 'id', 'ojs-dist-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId());
     XMLCustomWriter::appendChild($adminNode, $digdistNode);
     $dtdNode =& XMLCustomWriter::createElement($doc, 'dtd');
     XMLCustomWriter::appendChild($adminNode, $dtdNode);
     XMLCustomWriter::setAttribute($dtdNode, 'name', 'Erudit Article');
     XMLCustomWriter::setAttribute($dtdNode, 'version', '3.0.0');
     /* --- copyright --- */
     $copyright = $journal->getLocalizedSetting('copyrightNotice');
     XMLCustomWriter::createChildWithText($doc, $adminNode, 'copyright', empty($copyright) ? $unavailableString : $copyright);
     /* --- frontmatter --- */
     $frontMatterNode =& XMLCustomWriter::createElement($doc, 'frontmatter');
     XMLCustomWriter::appendChild($root, $frontMatterNode);
     $titleGroupNode =& XMLCustomWriter::createElement($doc, 'titlegr');
     XMLCustomWriter::appendChild($frontMatterNode, $titleGroupNode);
     XMLCustomWriter::createChildWithText($doc, $titleGroupNode, 'title', strip_tags($article->getLocalizedTitle()));
     /* --- authorgr --- */
     $authorGroupNode =& XMLCustomWriter::createElement($doc, 'authorgr');
     XMLCustomWriter::appendChild($frontMatterNode, $authorGroupNode);
     $authorNum = 1;
     foreach ($article->getAuthors() as $author) {
         $authorNode =& XMLCustomWriter::createElement($doc, 'author');
         XMLCustomWriter::appendChild($authorGroupNode, $authorNode);
         XMLCustomWriter::setAttribute($authorNode, 'id', 'ojs-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId() . '-' . $galley->getId() . '-' . $authorNum);
         $persNameNode =& XMLCustomWriter::createElement($doc, 'persname');
         XMLCustomWriter::appendChild($authorNode, $persNameNode);
         XMLCustomWriter::createChildWithText($doc, $persNameNode, 'firstname', $author->getFirstName());
         XMLCustomWriter::createChildWithText($doc, $persNameNode, 'middlename', $author->getMiddleName(), false);
         XMLCustomWriter::createChildWithText($doc, $persNameNode, 'familyname', $author->getLastName());
         if ($author->getLocalizedAffiliation() != '') {
             $affiliationNode =& XMLCustomWriter::createElement($doc, 'affiliation');
             XMLCustomWriter::appendChild($authorNode, $affiliationNode);
             XMLCustomWriter::createChildWithText($doc, $affiliationNode, 'blocktext', $author->getLocalizedAffiliation(), false);
         }
         $authorNum++;
     }
     /* --- abstract and keywords --- */
     foreach ((array) $article->getAbstract(null) as $locale => $abstract) {
         $abstract = strip_tags($abstract);
         $abstractNode =& XMLCustomWriter::createElement($doc, 'abstract');
         XMLCustomWriter::setAttribute($abstractNode, 'lang', $locale);
         XMLCustomWriter::appendChild($frontMatterNode, $abstractNode);
         XMLCustomWriter::createChildWithText($doc, $abstractNode, 'blocktext', $abstract);
         unset($abstractNode);
     }
     if ($keywords = $article->getLocalizedSubject()) {
         $keywordGroupNode =& XMLCustomWriter::createElement($doc, 'keywordgr');
         XMLCustomWriter::setAttribute($keywordGroupNode, 'lang', ($language = $article->getLanguage()) ? $language : 'en');
         foreach (explode(';', $keywords) as $keyword) {
             XMLCustomWriter::createChildWithText($doc, $keywordGroupNode, 'keyword', trim($keyword), false);
         }
         XMLCustomWriter::appendChild($frontMatterNode, $keywordGroupNode);
     }
     /* --- body --- */
     $bodyNode =& XMLCustomWriter::createElement($doc, 'body');
     XMLCustomWriter::appendChild($root, $bodyNode);
     import('classes.file.ArticleFileManager');
     $articleFileManager = new ArticleFileManager($article->getId());
     $file =& $articleFileManager->getFile($galley->getFileId());
     $parser =& SearchFileParser::fromFile($file);
     if (isset($parser)) {
         if ($parser->open()) {
             // File supports text indexing.
             $textNode =& XMLCustomWriter::createElement($doc, 'text');
             XMLCustomWriter::appendChild($bodyNode, $textNode);
             while (($line = $parser->read()) !== false) {
                 $line = trim($line);
                 if ($line != '') {
                     XMLCustomWriter::createChildWithText($doc, $textNode, 'blocktext', $line, false);
                 }
             }
             $parser->close();
         }
     }
     return $root;
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:101,代码来源:EruditExportDom.inc.php

示例3: articleFileChanged

 /**
  * Signal to the indexing back-end that an article file changed.
  *
  * @see ArticleSearchIndex::articleMetadataChanged() above for more
  * comments.
  *
  * @param $articleId int
  * @param $type int
  * @param $fileId int
  */
 function articleFileChanged($articleId, $type, $fileId)
 {
     // Check whether a search plug-in jumps in.
     $hookResult =& HookRegistry::call('ArticleSearchIndex::articleFileChanged', array($articleId, $type, $fileId));
     // If no search plug-in is activated then fall back to the
     // default database search implementation.
     if ($hookResult === false || is_null($hookResult)) {
         import('classes.file.ArticleFileManager');
         $fileManager = new ArticleFileManager($articleId);
         $file =& $fileManager->getFile($fileId);
         if (isset($file)) {
             $parser =& SearchFileParser::fromFile($file);
         }
         if (isset($parser)) {
             if ($parser->open()) {
                 $searchDao =& DAORegistry::getDAO('ArticleSearchDAO');
                 $objectId = $searchDao->insertObject($articleId, $type, $fileId);
                 $position = 0;
                 while (($text = $parser->read()) !== false) {
                     $this->_indexObjectKeywords($objectId, $text, $position);
                 }
                 $parser->close();
             }
         }
     }
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:36,代码来源:ArticleSearchIndex.inc.php

示例4: execute

 /**
  * Save settings.
  */
 function execute()
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $application =& PKPApplication::getApplication();
     $request =& $application->getRequest();
     $user =& $request->getUser();
     $router =& $request->getRouter();
     $journal =& $router->getContext($request);
     $article = new Article();
     $article->setLocale($journal->getPrimaryLocale());
     // FIXME in bug #5543
     $article->setUserId($user->getId());
     $article->setJournalId($journal->getId());
     $article->setSectionId($this->getData('sectionId'));
     $article->setLanguage(String::substr($journal->getPrimaryLocale(), 0, 2));
     $article->setTitle($this->getData('title'), null);
     // Localized
     $article->setAbstract($this->getData('abstract'), null);
     // Localized
     $article->setDiscipline($this->getData('discipline'), null);
     // Localized
     $article->setSubjectClass($this->getData('subjectClass'), null);
     // Localized
     $article->setSubject($this->getData('subject'), null);
     // Localized
     $article->setCoverageGeo($this->getData('coverageGeo'), null);
     // Localized
     $article->setCoverageChron($this->getData('coverageChron'), null);
     // Localized
     $article->setCoverageSample($this->getData('coverageSample'), null);
     // Localized
     $article->setType($this->getData('type'), null);
     // Localized
     $article->setSponsor($this->getData('sponsor'), null);
     // Localized
     $article->setCitations($this->getData('citations'));
     $article->setPages($this->getData('pages'));
     // Set some default values so the ArticleDAO doesn't complain when adding this article
     $article->setDateSubmitted(Core::getCurrentDate());
     $article->setStatus(STATUS_PUBLISHED);
     $article->setSubmissionProgress(0);
     $article->stampStatusModified();
     $article->setCurrentRound(1);
     $article->setFastTracked(1);
     $article->setHideAuthor(0);
     $article->setCommentsStatus(0);
     // Insert the article to get it's ID
     $articleDao->insertArticle($article);
     $articleId = $article->getId();
     // Add authors
     $authors = $this->getData('authors');
     for ($i = 0, $count = count($authors); $i < $count; $i++) {
         if ($authors[$i]['authorId'] > 0) {
             // Update an existing author
             $author =& $article->getAuthor($authors[$i]['authorId']);
             $isExistingAuthor = true;
         } else {
             // Create a new author
             $author = new Author();
             $isExistingAuthor = false;
         }
         if ($author != null) {
             $author->setSubmissionId($articleId);
             $author->setFirstName($authors[$i]['firstName']);
             $author->setMiddleName($authors[$i]['middleName']);
             $author->setLastName($authors[$i]['lastName']);
             if (array_key_exists('affiliation', $authors[$i])) {
                 $author->setAffiliation($authors[$i]['affiliation'], null);
             }
             $author->setCountry($authors[$i]['country']);
             $author->setEmail($authors[$i]['email']);
             $author->setUrl($authors[$i]['url']);
             if (array_key_exists('competingInterests', $authors[$i])) {
                 $author->setCompetingInterests($authors[$i]['competingInterests'], null);
             }
             $author->setBiography($authors[$i]['biography'], null);
             $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
             $author->setSequence($authors[$i]['seq']);
             if ($isExistingAuthor == false) {
                 $article->addAuthor($author);
             }
         }
     }
     // Add the submission files as galleys
     import('classes.file.TemporaryFileManager');
     import('classes.file.ArticleFileManager');
     $tempFileIds = $this->getData('tempFileId');
     $temporaryFileManager = new TemporaryFileManager();
     $articleFileManager = new ArticleFileManager($articleId);
     foreach (array_keys($tempFileIds) as $locale) {
         $temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId());
         $fileId = null;
         if ($temporaryFile) {
             $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUBMISSION);
             $fileType = $temporaryFile->getFileType();
//.........这里部分代码省略.........
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:101,代码来源:QuickSubmitForm.inc.php


注:本文中的ArticleFileManager::getFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。