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;
}