CampSystem::GetInvalidURLTemplate PHP Méthode

GetInvalidURLTemplate() public static méthode

fn setArticle
public static GetInvalidURLTemplate ( $p_pubId, $p_issNr = NULL, $p_lngId = NULL, $p_isPublished = true )
    public static function GetInvalidURLTemplate($p_pubId, $p_issNr = NULL, $p_lngId = NULL, $p_isPublished = true)
    {
        $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
        $issueTemplateKey = $cacheService->getCacheKey(array(__CLASS__, 'IssueTemplate', $p_lngId, $p_pubId, $p_issNr), 'templates');
        if ($cacheService->contains($issueTemplateKey)) {
            $issueTemplate = $cacheService->fetch($issueTemplateKey);
            if ($issueTemplate !== false && !empty($issueTemplate)) {
                return $issueTemplate;
            }
        }
        $publication = null;
        if (is_null($p_lngId)) {
            $publication = new Publication($p_pubId);
            if (!$publication->exists()) {
                $template = null;
            }
            $p_lngId = $publication->getLanguageId();
        }
        if (is_null($p_issNr) && (!is_null($publication) || !is_null($p_pubId))) {
            if (is_null($publication)) {
                $publication = new Publication($p_pubId);
            }
            $lastIssue = self::GetLastIssue($publication, $p_lngId, $p_isPublished);
            if (is_null($lastIssue)) {
                $template = null;
            }
            $p_issNr = $lastIssue[0];
        }
        if (!is_null($p_issNr)) {
            $resourceId = new ResourceId('template_engine/classes/CampSystem');
            $outputService = $resourceId->getService(IOutputService::NAME);
            if (!\Zend_Registry::isRegistered('webOutput')) {
                $webOutput = $outputService->findByName('Web');
                \Zend_Registry::set('webOutput', $webOutput);
            }
            $templateSearchService = $resourceId->getService(ITemplateSearchService::NAME);
            $issueObj = new Issue($p_pubId, $p_lngId, $p_issNr);
            $template = $templateSearchService->getErrorPage($issueObj->getIssueId(), Zend_Registry::get('webOutput'));
        }
        if (empty($template)) {
            $template = null;
        }
        $cacheService->save($issueTemplateKey, $template);
        return $template;
    }

Usage Example

 /**
  * Class constructor
  *
  * @param string $p_uri
  *                      The full URI string
  */
 public function __construct($p_uri = null)
 {
     parent::__construct($p_uri);
     try {
         $this->setURLType(URLTYPE_SHORT_NAMES);
         // HUGE TODO: rewrite this - remove globals controller usage!
         if (array_key_exists('controller', $GLOBALS)) {
             if (is_object($GLOBALS['controller'])) {
                 $this->setURL($GLOBALS['controller']->getRequest());
             } else {
                 $this->setURLFromSymfony(Zend_Registry::get('container')->getService('request'));
             }
         } else {
             $this->setURL(new Zend_Controller_Request_Http());
         }
         $this->m_validURI = true;
         $this->validateCache(false);
     } catch (Exception $e) {
         $this->m_validURI = false;
         $this->m_errorCode = $e->getCode();
         if (!is_null($this->m_publication)) {
             $tplId = CampSystem::GetInvalidURLTemplate($this->m_publication->identifier, null, null, !$this->m_preview);
             $themePath = $this->getThemePath();
             $tplId = substr($tplId, strlen($themePath));
             $template = new MetaTemplate($tplId, $themePath);
             if ($template->defined()) {
                 $this->m_template = $template;
             }
             CampTemplate::singleton()->config_dir = APPLICATION_PATH . '/../themes/' . $themePath . '_conf';
         }
         CampTemplate::singleton()->trigger_error($e->getMessage());
     }
 }
All Usage Examples Of CampSystem::GetInvalidURLTemplate