Ejemplo n.º 1
0
 /**
  * Returns tagged photo list
  *
  * @param $tag
  * @param int $page
  * @param int $limit
  * @internal param string $type
  * @return array of PHOTO_BOL_Photo
  */
 public function findTaggedPhotos($tag, $page, $limit)
 {
     $first = ($page - 1) * $limit;
     $photoIdList = BOL_TagService::getInstance()->findEntityListByTag('photo', $tag, $first, $limit);
     if (!$photoIdList) {
         return array();
     }
     $photos = $this->photoDao->findPhotoInfoListByIdList($photoIdList);
     if ($photos) {
         foreach ($photos as $key => $photo) {
             $photos[$key]['url'] = $this->getPhotoPreviewUrl($photo['id'], $photo['hash']);
         }
     }
     return $photos;
 }
Ejemplo n.º 2
0
 public function getMostDiscussedPhotoIdList()
 {
     static $list = array();
     if (empty($list)) {
         $count = BOL_CommentService::getInstance()->findCommentedEntityCount('photo_comments');
         $mostDiscussedList = BOL_CommentService::getInstance()->findMostCommentedEntityList('photo_comments', 0, $count);
         if (empty($mostDiscussedList)) {
             return array();
         }
         $photoArr = $this->photoDao->findPhotoInfoListByIdList(array_keys($mostDiscussedList), 'most_discussed');
         $photos = array();
         foreach ($photoArr as $key => $photo) {
             $photos[$key] = $photo;
             $photos[$key]['commentCount'] = $mostDiscussedList[$photo['id']]['commentCount'];
         }
         usort($photos, array('PHOTO_BOL_PhotoService', 'sortArrayItemByCommentCount'));
         foreach ($photos as $photo) {
             $list[] = $photo['id'];
         }
     }
     return $list;
 }