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


PHP Section::setIdentifyType方法代码示例

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


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

示例1: handleSectionNode


//.........这里部分代码省略.........
     foreach ($titles as $locale => $title) {
         $section = $sectionDao->getSectionByTitle($title, $journal->getId());
         if ($section) {
             $sectionId = $section->getId();
             if ($foundSectionId) {
                 if ($foundSectionId != $sectionId) {
                     // Mismatching sections found. Throw an error.
                     $errors[] = array('plugins.importexport.native.import.error.sectionTitleMismatch', array('section1Title' => $title, 'section2Title' => $foundSectionTitle, 'issueTitle' => $issue->getIssueIdentification()));
                     return false;
                 }
             } else {
                 if ($index > 0) {
                     // the current title matches, but the prev titles didn't => error
                     $errors[] = array('plugins.importexport.native.import.error.sectionTitleMatch', array('sectionTitle' => $title, 'issueTitle' => $issue->getIssueIdentification()));
                     return false;
                 }
             }
             $foundSectionId = $sectionId;
             $foundSectionTitle = $title;
         } else {
             if ($foundSectionId) {
                 // a prev title matched, but the current doesn't => error
                 $errors[] = array('plugins.importexport.native.import.error.sectionTitleMatch', array('sectionTitle' => $foundSectionTitle, 'issueTitle' => $issue->getIssueIdentification()));
                 return false;
             }
         }
         $index++;
     }
     // check abbrevs:
     $abbrevSection = null;
     $foundSectionId = $foundSectionAbbrev = null;
     $index = 0;
     foreach ($abbrevs as $locale => $abbrev) {
         $abbrevSection = $sectionDao->getSectionByAbbrev($abbrev, $journal->getId());
         if ($abbrevSection) {
             $sectionId = $abbrevSection->getSectionId();
             if ($foundSectionId) {
                 if ($foundSectionId != $sectionId) {
                     // Mismatching sections found. Throw an error.
                     $errors[] = array('plugins.importexport.native.import.error.sectionAbbrevMismatch', array('section1Abbrev' => $abbrev, 'section2Abbrev' => $foundSectionAbbrev, 'issueTitle' => $issue->getIssueIdentification()));
                     return false;
                 }
             } else {
                 if ($index > 0) {
                     // the current abbrev matches, but the prev abbrevs didn't => error
                     $errors[] = array('plugins.importexport.native.import.error.sectionAbbrevMatch', array('sectionAbbrev' => $sectionAbbrev, 'issueTitle' => $issue->getIssueIdentification()));
                     return false;
                 }
             }
             $foundSectionId = $sectionId;
             $foundSectionAbbrev = $abbrev;
         } else {
             if ($foundSectionId) {
                 // a prev abbrev matched, but the current doesn't => error
                 $errors[] = array('plugins.importexport.native.import.error.sectionAbbrevMatch', array('sectionAbbrev' => $foundSectionAbbrev, 'issueTitle' => $issue->getIssueIdentification()));
                 return false;
             }
         }
         $index++;
     }
     if (!$section && !$abbrevSection) {
         // The section was not matched. Create one.
         // Note that because sections are global-ish,
         // we're not maintaining a list of created
         // sections to delete in case the import fails.
         unset($section);
         $section = new Section();
         $section->setTitle($titles, null);
         $section->setAbbrev($abbrevs, null);
         $section->setIdentifyType($identifyTypes, null);
         $section->setPolicy($policies, null);
         $section->setJournalId($journal->getId());
         $section->setSequence(REALLY_BIG_NUMBER);
         $section->setMetaIndexed(1);
         $section->setEditorRestricted(1);
         $section->setSectionId($sectionDao->insertSection($section));
         $sectionDao->resequenceSections($journal->getId());
     }
     if (!$section && $abbrevSection) {
         unset($section);
         $section =& $abbrevSection;
     }
     // $section *must* now contain a valid section, whether it was
     // found amongst existing sections or created anew.
     // Handle custom ordering, if necessary.
     if ($sectionIndex !== null) {
         $sectionDao->insertCustomSectionOrder($issue->getId(), $section->getId(), $sectionIndex);
     }
     $hasErrors = false;
     for ($index = 0; $node = $sectionNode->getChildByName('article', $index); $index++) {
         if (!NativeImportDom::handleArticleNode($journal, $node, $issue, $section, $article, $publishedArticle, $articleErrors, $user, $isCommandLine, $dependentItems)) {
             $errors = array_merge($errors, $articleErrors);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         return false;
     }
     return true;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:101,代码来源:NativeImportDom.inc.php

示例2: testToXml

 /**
  * @covers OAIMetadataFormat_DC
  * @covers Dc11SchemaArticleAdapter
  */
 public function testToXml()
 {
     $this->markTestSkipped('Skipped because of weird class interaction with ControlledVocabDAO.');
     //
     // Create test data.
     //
     $journalId = 1;
     // Enable the DOI plugin.
     $pluginSettingsDao = DAORegistry::getDAO('PluginSettingsDAO');
     /* @var $pluginSettingsDao PluginSettingsDAO */
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enabled', 1);
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableIssueDoi', 1);
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableArticleDoi', 1);
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableGalleyDoi', 1);
     // Author
     import('classes.article.Author');
     $author = new Author();
     $author->setFirstName('author-firstname');
     $author->setLastName('author-lastname');
     $author->setAffiliation('author-affiliation', 'en_US');
     $author->setEmail('someone@example.com');
     // Article
     import('classes.article.PublishedArticle');
     $article = $this->getMock('PublishedArticle', array('getBestArticleId'));
     /* @var $article PublishedArticle */
     $article->expects($this->any())->method('getBestArticleId')->will($this->returnValue(9));
     $article->setId(9);
     $article->setJournalId($journalId);
     $author->setSubmissionId($article->getId());
     $article->setPages(15);
     $article->setType('art-type', 'en_US');
     $article->setTitle('article-title-en', 'en_US');
     $article->setTitle('article-title-de', 'de_DE');
     $article->setDiscipline('article-discipline', 'en_US');
     $article->setSubject('article-subject', 'en_US');
     $article->setAbstract('article-abstract', 'en_US');
     $article->setSponsor('article-sponsor', 'en_US');
     $article->setStoredPubId('doi', 'article-doi');
     $article->setLanguage('en_US');
     // Galleys
     import('classes.article.ArticleGalley');
     $galley = new ArticleGalley();
     $galley->setId(98);
     $galley->setStoredPubId('doi', 'galley-doi');
     $galleys = array($galley);
     // Journal
     import('classes.journal.Journal');
     $journal = $this->getMock('Journal', array('getSetting'));
     /* @var $journal Journal */
     $journal->expects($this->any())->method('getSetting')->will($this->returnCallback(array($this, 'getJournalSetting')));
     $journal->setPrimaryLocale('en_US');
     $journal->setPath('journal-path');
     $journal->setId($journalId);
     // Section
     import('classes.journal.Section');
     $section = new Section();
     $section->setIdentifyType('section-identify-type', 'en_US');
     // Issue
     import('classes.issue.Issue');
     $issue = $this->getMock('Issue', array('getIssueIdentification'));
     /* @var $issue Issue */
     $issue->expects($this->any())->method('getIssueIdentification')->will($this->returnValue('issue-identification'));
     $issue->setId(96);
     $issue->setDatePublished('2010-11-05');
     $issue->setStoredPubId('doi', 'issue-doi');
     $issue->setJournalId($journalId);
     //
     // Create infrastructural support objects
     //
     // Router
     import('lib.pkp.classes.core.PKPRouter');
     $router = $this->getMock('PKPRouter', array('url'));
     $application = PKPApplication::getApplication();
     $router->setApplication($application);
     $router->expects($this->any())->method('url')->will($this->returnCallback(array($this, 'routerUrl')));
     // Request
     import('classes.core.Request');
     $request = $this->getMock('Request', array('getRouter'));
     $request->expects($this->any())->method('getRouter')->will($this->returnValue($router));
     Registry::set('request', $request);
     //
     // Create mock DAOs
     //
     // Create a mocked AuthorDAO that returns our test author.
     import('classes.article.AuthorDAO');
     $authorDao = $this->getMock('AuthorDAO', array('getBySubmissionId'));
     $authorDao->expects($this->any())->method('getBySubmissionId')->will($this->returnValue(array($author)));
     DAORegistry::registerDAO('AuthorDAO', $authorDao);
     // Create a mocked OAIDAO that returns our test data.
     import('classes.oai.ojs.OAIDAO');
     $oaiDao = $this->getMock('OAIDAO', array('getJournal', 'getSection', 'getIssue'));
     $oaiDao->expects($this->any())->method('getJournal')->will($this->returnValue($journal));
     $oaiDao->expects($this->any())->method('getSection')->will($this->returnValue($section));
     $oaiDao->expects($this->any())->method('getIssue')->will($this->returnValue($issue));
     DAORegistry::registerDAO('OAIDAO', $oaiDao);
     // Create a mocked ArticleGalleyDAO that returns our test data.
//.........这里部分代码省略.........
开发者ID:utslibrary,项目名称:ojs,代码行数:101,代码来源:OAIMetadataFormat_DCTest.php

示例3: testToXml

 /**
  * @covers OAIMetadataFormat_DC
  * @covers Dc11SchemaArticleAdapter
  */
 public function testToXml()
 {
     //
     // Create test data.
     //
     // Author
     import('classes.article.Author');
     $author = new Author();
     $author->setFirstName('author-firstname');
     $author->setLastName('author-lastname');
     $author->setAffiliation('author-affiliation', 'en_US');
     // Supplementary file
     import('classes.article.SuppFile');
     $suppFile = new SuppFile();
     $suppFile->setFileId(999);
     // Article
     import('classes.article.PublishedArticle');
     $article = $this->getMock('PublishedArticle', array('getBestArticleId'));
     /* @var $article PublishedArticle */
     $article->expects($this->any())->method('getBestArticleId')->will($this->returnValue(9));
     $article->setId(9);
     $article->addAuthor($author);
     $article->setSuppFiles(array($suppFile));
     $article->setPages(15);
     $article->setType('art-type', 'en_US');
     $article->setTitle('article-title-en', 'en_US');
     $article->setTitle('article-title-de', 'de_DE');
     $article->setDiscipline('article-discipline', 'en_US');
     $article->setSubject('article-subject', 'en_US');
     $article->setSubjectClass('article-subject-class', 'en_US');
     $article->setAbstract('article-abstract', 'en_US');
     $article->setSponsor('article-sponsor', 'en_US');
     $article->setStoredDOI('article-doi');
     $article->setLanguage('en_US');
     $article->setCoverageGeo('article-coverage-geo', 'en_US');
     $article->setCoverageChron('article-coverage-chron', 'en_US');
     $article->setCoverageSample('article-coverage-sample', 'en_US');
     // Galleys
     import('classes.article.ArticleGalley');
     $galley = new ArticleGalley();
     $galley->setFileType('galley-filetype');
     $galleys = array($galley);
     // Journal
     import('classes.journal.Journal');
     $journal = $this->getMock('Journal', array('getSetting'));
     /* @var $journal Journal */
     $journal->expects($this->any())->method('getSetting')->will($this->returnCallback(array($this, 'getJournalSetting')));
     $journal->setPrimaryLocale('en_US');
     $journal->setPath('journal-path');
     // Section
     import('classes.journal.Section');
     $section = new Section();
     $section->setIdentifyType('section-identify-type', 'en_US');
     // Issue
     import('classes.issue.Issue');
     $issue = $this->getMock('Issue', array('getIssueIdentification'));
     /* @var $issue Issue */
     $issue->expects($this->any())->method('getIssueIdentification')->will($this->returnValue('issue-identification'));
     $issue->setDatePublished('2010-11-05');
     //
     // Create infrastructural support objects
     //
     // Router
     import('lib.pkp.classes.core.PKPRouter');
     $router = $this->getMock('PKPRouter', array('url'));
     $application = PKPApplication::getApplication();
     $router->setApplication($application);
     $router->expects($this->any())->method('url')->will($this->returnValue('router-url'));
     // Request
     import('classes.core.Request');
     $request = $this->getMock('Request', array('getRouter'));
     $request->expects($this->any())->method('getRouter')->will($this->returnValue($router));
     Registry::set('request', $request);
     //
     // Create mock DAOs
     //
     // Create a mocked OAIDAO that returns our test data.
     import('classes.oai.ojs.OAIDAO');
     $oaiDao = $this->getMock('OAIDAO', array('getJournal', 'getSection', 'getIssue'));
     $oaiDao->expects($this->any())->method('getJournal')->will($this->returnValue($journal));
     $oaiDao->expects($this->any())->method('getSection')->will($this->returnValue($section));
     $oaiDao->expects($this->any())->method('getIssue')->will($this->returnValue($issue));
     DAORegistry::registerDAO('OAIDAO', $oaiDao);
     // Create a mocked ArticleGalleyDAO that returns our test data.
     import('classes.article.ArticleGalleyDAO');
     $articleGalleyDao = $this->getMock('OAIDAO', array('getGalleysByArticle'));
     $articleGalleyDao->expects($this->any())->method('getGalleysByArticle')->will($this->returnValue($galleys));
     DAORegistry::registerDAO('ArticleGalleyDAO', $articleGalleyDao);
     //
     // Test
     //
     // OAI record
     $record = new OAIRecord();
     $record->setData('article', $article);
     $record->setData('galleys', $galleys);
     $record->setData('journal', $journal);
//.........这里部分代码省略.........
开发者ID:ramonsodoma,项目名称:ojs,代码行数:101,代码来源:OAIMetadataFormat_DCTest.inc.php

示例4: execute

 /**
  * Save section.
  */
 function execute()
 {
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     // We get the section DAO early on so that
     // the section class will be imported.
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $section =& $this->section;
     if (!is_a($section, 'Section')) {
         $section = new Section();
         $section->setJournalId($journalId);
         $section->setSequence(REALLY_BIG_NUMBER);
     }
     $section->setTitle($this->getData('title'), null);
     // Localized
     $section->setAbbrev($this->getData('abbrev'), null);
     // Localized
     $reviewFormId = $this->getData('reviewFormId');
     if ($reviewFormId === '') {
         $reviewFormId = null;
     }
     $section->setReviewFormId($reviewFormId);
     $section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1);
     // #2066: Inverted
     $section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1);
     // #2066: Inverted
     $section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0);
     $section->setIdentifyType($this->getData('identifyType'), null);
     // Localized
     $section->setEditorRestricted($this->getData('editorRestriction') ? 1 : 0);
     $section->setHideTitle($this->getData('hideTitle') ? 1 : 0);
     $section->setHideAuthor($this->getData('hideAuthor') ? 1 : 0);
     $section->setHideAbout($this->getData('hideAbout') ? 1 : 0);
     $section->setDisableComments($this->getData('disableComments') ? 1 : 0);
     $section->setPolicy($this->getData('policy'), null);
     // Localized
     $section->setAbstractWordCount($this->getData('wordCount'));
     $section =& parent::execute($section);
     if ($section->getId() != null) {
         $sectionDao->updateSection($section);
         $sectionId = $section->getId();
     } else {
         $sectionId = $sectionDao->insertSection($section);
         $sectionDao->resequenceSections($journalId);
     }
     // Save assigned editors
     $assignedEditorIds = Request::getUserVar('assignedEditorIds');
     if (empty($assignedEditorIds)) {
         $assignedEditorIds = array();
     } elseif (!is_array($assignedEditorIds)) {
         $assignedEditorIds = array($assignedEditorIds);
     }
     $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
     $sectionEditorsDao->deleteEditorsBySectionId($sectionId, $journalId);
     foreach ($this->sectionEditors as $key => $junk) {
         $sectionEditor =& $this->sectionEditors[$key];
         $userId = $sectionEditor->getId();
         // We don't have to worry about omit- and include-
         // section editors because this function is only called
         // when the Save button is pressed and those are only
         // used in other cases.
         if (in_array($userId, $assignedEditorIds)) {
             $sectionEditorsDao->insertEditor($journalId, $sectionId, $userId, Request::getUserVar('canReview' . $userId), Request::getUserVar('canEdit' . $userId));
         }
         unset($sectionEditor);
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:70,代码来源:SectionForm.inc.php

示例5: execute

 /**
  * Save section.
  */
 function execute()
 {
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     if (isset($this->sectionId)) {
         $section =& $sectionDao->getSection($this->sectionId, $journalId);
     }
     if (!isset($section)) {
         $section = new Section();
         $section->setJournalId($journalId);
         $section->setSequence(REALLY_BIG_NUMBER);
     }
     $section->setTitle($this->getData('title'), null);
     // Localized
     $section->setAbbrev($this->getData('abbrev'), null);
     // Localized
     // Added region
     // EL on Febraurt 11th 2013
     $section->setRegion($this->getData('region'), null);
     $reviewFormId = $this->getData('reviewFormId');
     if ($reviewFormId === '') {
         $reviewFormId = null;
     }
     $section->setReviewFormId($reviewFormId);
     $section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1);
     // #2066: Inverted
     $section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1);
     // #2066: Inverted
     $section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0);
     $section->setIdentifyType($this->getData('identifyType'), null);
     // Localized
     $section->setEditorRestricted($this->getData('editorRestriction') ? 1 : 0);
     $section->setHideTitle($this->getData('hideTitle') ? 1 : 0);
     $section->setHideAuthor($this->getData('hideAuthor') ? 1 : 0);
     $section->setHideAbout($this->getData('hideAbout') ? 1 : 0);
     $section->setDisableComments($this->getData('disableComments') ? 1 : 0);
     $section->setPolicy($this->getData('policy'), null);
     // Localized
     $section->setAbstractWordCount($this->getData('wordCount'));
     if ($section->getId() != null) {
         $sectionDao->updateSection($section);
         $sectionId = $section->getId();
     } else {
         $sectionId = $sectionDao->insertSection($section);
         $sectionDao->resequenceSections($journalId);
     }
 }
开发者ID:elavaud,项目名称:hrp_ct,代码行数:51,代码来源:SectionForm.inc.php


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