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


PHP Issue::GetCurrentIssue方法代码示例

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


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

示例1: smarty_function_set_current_issue

/**
 * Campsite set_current_issue function plugin
 *
 * Type:     function
 * Name:     set_current_issue
 * Purpose:
 *
 * @param array
 *     $p_params[name] The Name of the publication to be set
 *     $p_params[identifier] The Identifier of the publication to be set
 * @param object
 *     $p_smarty The Smarty object
 */
function smarty_function_set_current_issue($p_params, &$p_smarty)
{
    // gets the context variable
    $campsite = $p_smarty->getTemplateVars('gimme');
    $currentIssue = Issue::GetCurrentIssue($campsite->publication->identifier, $campsite->language->number);
    if (is_null($currentIssue)) {
        return false;
    }
    // if the current issue was already the context do nothing
    if ($campsite->issue->defined && $campsite->issue->number == $currentIssue->getIssueNumber()) {
        return;
    }
    $issueObj = new MetaIssue($campsite->publication->identifier, $campsite->language->number, $currentIssue->getIssueNumber());
    if ($issueObj->defined) {
        $campsite->issue = $issueObj;
    }
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:30,代码来源:function.set_current_issue.php

示例2: _getIssue

 /**
  * Get issue
  *
  * @param  string $name
  *
  * @return MetaIssue
  */
 private function _getIssue($name, MetaLanguage $language, MetaPublication $publication)
 {
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $issueKey = $cacheService->getCacheKey(array('metaIssue', $name, $publication->identifier, $language->number), 'issue');
     if ($cacheService->contains($issueKey)) {
         return $cacheService->fetch($issueKey);
     }
     $issueObj = Issue::GetCurrentIssue($publication->identifier, $language->number);
     if (!empty($name)) {
         $issueArray = Issue::GetIssues($publication->identifier, $language->number, null, $name, null, !$this->m_preview);
         if (is_array($issueArray) && sizeof($issueArray) == 1) {
             $issue = new MetaIssue($publication->identifier, $language->number, $issueArray[0]->getIssueNumber());
         } else {
             throw new InvalidArgumentException("Invalid issue identifier in URL.", self::INVALID_ISSUE);
         }
     } else {
         $issue = new MetaIssue($publication->identifier, $language->number, $issueObj->getIssueNumber());
         if (!$issue->defined()) {
             throw new InvalidArgumentException("No published issue was found.", self::INVALID_ISSUE);
         }
     }
     $cacheService->save($issueKey, $issue);
     return $issue;
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:31,代码来源:CampURIShortNames.php

示例3: isCurrent

 protected function isCurrent()
 {
     $currentIssue = Issue::GetCurrentIssue($this->m_dbObject->getPublicationId(), $this->m_dbObject->getLanguageId());
     return !is_null($currentIssue) && $currentIssue->getIssueNumber() == $this->m_dbObject->getIssueNumber();
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:5,代码来源:MetaIssue.php

示例4: publishText

 /**
  * Publish text item
  *
  * @param Newscoop\News\NewsItem $item
  * @return Article
  */
 private function publishText(NewsItem $item)
 {
     $issueNumber = $this->settings->getPublicationId() ? \Issue::GetCurrentIssue($this->settings->getPublicationId())->getIssueNumber() : null;
     $type = $this->getArticleType($this->settings->getArticleTypeName());
     $article = new \Article($this->findLanguageId($item->getContentMeta()->getLanguage()));
     $article->create($type->getTypeName(), $item->getContentMeta()->getHeadline(), $this->settings->getPublicationId(), $issueNumber, $this->settings->getSectionNumber());
     $article->setKeywords($item->getContentMeta()->getSlugline());
     $article->setCreationDate($item->getItemMeta()->getFirstCreated()->format(self::DATE_FORMAT));
     $article->setPublishDate(null);
     $article->setProperty('time_updated', date_create('now')->format(self::DATE_FORMAT));
     $this->setArticleData($article, $item);
     $article->commit();
     return $article;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:20,代码来源:ItemService.php

示例5: setURL

    /**
     * Sets the URL values.
     *
     * Algorithm:
	 * - identify object (e.g.: publication, language, issue, section, article)
	 *     - object defined
	 *         - valid object?
	 *             - yes: set
	 *             - no: return error
	 *     - object undefined
	 *         - has default value?
	 *             - yes: set
	 *             - no:
	 *                 - object mandatory?
	 *                     - yes: return error
	 *                     - no: continue
     *
     * @return PEAR_Error
     *
     */
    private function setURL()
    {
        $this->setQueryVar('acid', null);

        $this->m_publication = null;
        $this->m_language = null;
        $this->m_issue = null;
        $this->m_section = null;
        $this->m_article = null;

        // gets the publication object based on site name (URI host)
        $alias = preg_replace('/^'.$this->getScheme().':\/\//', '', $this->getBase());
        $aliasObj = new Alias($alias);
        if ($aliasObj->exists()) {
            $this->m_publication = new MetaPublication($aliasObj->getPublicationId());
        }
        if (is_null($this->m_publication) || !$this->m_publication->defined()) {
            return new PEAR_Error("Invalid site name '$alias' in URL.", self::INVALID_SITE_NAME);
        }

        // reads parameters values if any
        $params = str_replace($this->m_config->getSetting('SUBDIR'), '', $this->getPath());
        $cParams = explode('/', trim($params, '/'));
        $cParamsSize = sizeof($cParams);
        if ($cParamsSize >= 1) {
            $cLangCode = $cParams[0];
        }
        if ($cParamsSize >= 2) {
            $cIssueSName = $cParams[1];
        }
        if ($cParamsSize >= 3) {
            $cSectionSName = $cParams[2];
        }
        if ($cParamsSize >= 4) {
            $cArticleSName = $cParams[3];
        }

        // gets the language identifier and sets the language code
        if (!empty($cLangCode)) {
            $langArray = Language::GetLanguages(null, $cLangCode);
            if (is_array($langArray) && sizeof($langArray) == 1) {
                $this->m_language = new MetaLanguage($langArray[0]->getLanguageId());
            }
        } else {
            $this->m_language = new MetaLanguage($this->m_publication->default_language->number);
        }
        if (is_null($this->m_language) || !$this->m_language->defined()) {
            return new PEAR_Error("Invalid language identifier in URL.", self::INVALID_LANGUAGE);
        }

        // gets the issue number and sets the issue short name
        if (!empty($cIssueSName)) {
        	$publishedOnly = !$this->m_preview;
            $issueArray = Issue::GetIssues($this->m_publication->identifier,
            $this->m_language->number, null, $cIssueSName, null, $publishedOnly);
            if (is_array($issueArray) && sizeof($issueArray) == 1) {
                $this->m_issue = new MetaIssue($this->m_publication->identifier,
                $this->m_language->number,
                $issueArray[0]->getIssueNumber());
            } else {
                return new PEAR_Error("Invalid issue identifier in URL.", self::INVALID_ISSUE);
	        }
        } else {
            $issueObj = Issue::GetCurrentIssue($this->m_publication->identifier,
            $this->m_language->number);
            $this->m_issue = new MetaIssue($this->m_publication->identifier,
            $this->m_language->number, $issueObj->getIssueNumber());
            if (!$this->m_issue->defined()) {
                return new PEAR_Error("No published issue was found.", self::INVALID_ISSUE);
            }
        }

        // gets the section number and sets the section short name
        if (!empty($cSectionSName)) {
            $sectionArray = Section::GetSections($this->m_publication->identifier,
            $this->m_issue->number,
            $this->m_language->number,
            $cSectionSName);
            if (is_array($sectionArray) && sizeof($sectionArray) == 1) {
                $this->m_section = new MetaSection($this->m_publication->identifier,
//.........这里部分代码省略.........
开发者ID:nistormihai,项目名称:Newscoop,代码行数:101,代码来源:CampURIShortNames.php

示例6: setURL

    /**
     * Sets the URL values.
     *
     * @return void
     */
    private function setURL()
    {
        $this->setQueryVar('tpl', null);
        $this->setQueryVar('acid', null);

        $this->m_publication = null;
        $this->m_language = null;
        $this->m_issue = null;
        $this->m_section = null;
        $this->m_article = null;

        // gets the publication object based on site name (URI host)
        $alias = preg_replace('/^'.$this->getScheme().':\/\//', '', $this->getBase());
        $aliasObj = new Alias($alias);
        if ($aliasObj->exists()) {
            $this->m_publication = new MetaPublication($aliasObj->getPublicationId());
        }
        if (is_null($this->m_publication) || !$this->m_publication->defined()) {
            return new PEAR_Error("Invalid site name '$alias' in URL.", self::INVALID_SITE_NAME);
        }

        // sets the language identifier
        if (CampRequest::GetVar(CampRequest::LANGUAGE_ID) > 0) {
            $this->m_language = new MetaLanguage(CampRequest::GetVar(CampRequest::LANGUAGE_ID));
        } else {
            $this->m_language = new MetaLanguage($this->m_publication->default_language->number);
        }
        if (!$this->m_language->defined()) {
            return new PEAR_Error("Invalid language identifier in URL.", self::INVALID_LANGUAGE);
        }

        // sets the issue number
        if (CampRequest::GetVar(CampRequest::ISSUE_NR) > 0) {
            $this->m_issue = new MetaIssue($this->m_publication->identifier,
            $this->m_language->number, CampRequest::GetVar(CampRequest::ISSUE_NR));
        } else {
            $issueObj = Issue::GetCurrentIssue($this->m_publication->identifier,
            $this->m_language->number);
            $this->m_issue = new MetaIssue($this->m_publication->identifier,
            $this->m_language->number, $issueObj->getIssueNumber());
        }
        if (!$this->m_issue->defined()) {
            return new PEAR_Error("Invalid issue identifier in URL.", self::INVALID_ISSUE);
        }

        // sets the section if any
        if (CampRequest::GetVar(CampRequest::SECTION_NR) > 0) {
            $this->m_section = new MetaSection($this->m_publication->identifier,
            $this->m_issue->number, $this->m_language->number,
            CampRequest::GetVar(CampRequest::SECTION_NR));
            if (!$this->m_section->defined()) {
                return new PEAR_Error("Invalid section identifier in URL.", self::INVALID_SECTION);
            }
        }

        // sets the article if any
        if (CampRequest::GetVar(CampRequest::ARTICLE_NR) > 0) {
            $this->m_article = new MetaArticle($this->m_language->number,
            CampRequest::GetVar(CampRequest::ARTICLE_NR));
            if (!$this->m_article->defined()) {
                return new PEAR_Error("Invalid article identifier in URL.", self::INVALID_ARTICLE);
            }
        }

        $this->m_template = new MetaTemplate($this->getTemplate($this->readTemplate()));
        if (!$this->m_template->defined()) {
            return new PEAR_Error("Invalid template in URL or no default template specified.",
            self::INVALID_TEMPLATE);
        }

        $this->m_validURI = true;
        $this->validateCache(false);
    } // fn setURL
开发者ID:nistormihai,项目名称:Newscoop,代码行数:78,代码来源:CampURITemplatePath.php

示例7: _getIssue

 /**
  * Get issue
  *
  * @param string $name
  * @return MetaIssue
  */
 private function _getIssue($name, MetaLanguage $language, MetaPublication $publication)
 {
     if (!empty($name)) {
         $issueArray = Issue::GetIssues($publication->identifier, $language->number, null, $name, null, !$this->m_preview);
         if (is_array($issueArray) && sizeof($issueArray) == 1) {
             $issue = new MetaIssue($publication->identifier, $language->number, $issueArray[0]->getIssueNumber());
         } else {
             throw new InvalidArgumentException("Invalid issue identifier in URL.", self::INVALID_ISSUE);
         }
     } else {
         $issueObj = Issue::GetCurrentIssue($publication->identifier, $language->number);
         $issue = new MetaIssue($publication->identifier, $language->number, $issueObj->getIssueNumber());
         if (!$issue->defined()) {
             throw new InvalidArgumentException("No published issue was found.", self::INVALID_ISSUE);
         }
     }
     return $issue;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:24,代码来源:CampURIShortNames.php

示例8: getIssue

 /**
  * Get issue
  *
  * @return int
  */
 public function getIssue()
 {
     return (int) \Issue::GetCurrentIssue($this->getPublication())->getIssueNumber();
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:9,代码来源:PublisherService.php


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