getImageArticleIndex() public method

public getImageArticleIndex ( ) : integer
return integer
コード例 #1
0
ファイル: MetaArticle.php プロジェクト: nistormihai/Newscoop
 /**
  * Returns the index of the current image inside the article.
  * If the image doesn't belong to the article returns null.
  *
  * @return int
  */
 protected function getImageIndex() {
     $image = CampTemplate::singleton()->context()->image;
     if (!$image->defined) {
         return null;
     }
     $articleImage = new ArticleImage($this->m_dbObject->getArticleNumber(),
     $image->number);
     if (!$articleImage->exists()) {
         return null;
     }
     return $articleImage->getImageArticleIndex();
 }
コード例 #2
0
ファイル: MetaArticle.php プロジェクト: sourcefabric/newscoop
 /**
  * Returns the index of the current image inside the article.
  * If the image doesn't belong to the article returns null.
  *
  * @return int
  */
 protected function getImageIndex()
 {
     $image = CampTemplate::singleton()->context()->image;
     if (!$image->defined) {
         return null;
     }
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $cacheKey = $cacheService->getCacheKey(array('ArticleImageIndex', $this->m_dbObject->getArticleNumber(), $image->number), 'article');
     if ($cacheService->contains($cacheKey)) {
         return $cacheService->fetch($cacheKey);
     }
     $articleImage = new ArticleImage($this->m_dbObject->getArticleNumber(), $image->number);
     if (!$articleImage->exists()) {
         $index = null;
     } else {
         $index = $articleImage->getImageArticleIndex();
     }
     $cacheService->save($cacheKey, $index);
     return $index;
 }