Ejemplo n.º 1
0
 /**
  * Returns photo list 
  *
  * @param string $type
  * @param int $page
  * @param int $limit
  * @return array of PHOTO_BOL_Photo
  */
 public function findPhotoList($type, $page, $limit, $checkPrivacy = true)
 {
     if ($type == 'toprated') {
         $first = ($page - 1) * $limit;
         $topRatedList = BOL_RateService::getInstance()->findMostRatedEntityList('photo_rates', $first, $limit);
         if (!$topRatedList) {
             return array();
         }
         $photoArr = $this->advancedphotoDao->findPhotoInfoListByIdList(array_keys($topRatedList));
         $photos = array();
         foreach ($photoArr as $key => $photo) {
             $photos[$key] = $photo;
             $photos[$key]['score'] = $topRatedList[$photo['id']]['avgScore'];
             $photos[$key]['rates'] = $topRatedList[$photo['id']]['ratesCount'];
         }
         usort($photos, array('PHOTO_BOL_PhotoService', 'sortArrayItemByDesc'));
     } else {
         $photos = $this->advancedphotoDao->getPhotoList($type, $page, $limit, $checkPrivacy);
     }
     if ($photos) {
         foreach ($photos as $key => $photo) {
             $photos[$key]['url'] = $this->photoService->getPhotoPreviewUrl($photo['id']);
         }
     }
     return $photos;
 }