示例#1
0
 /**
  * Finds vwvr clips list of specified type 
  *
  * @param string $type
  * @param int $page
  * @param int $limit
  * @return array of VWVR_BOL_Clip
  */
 public function findClipsList($type, $page, $limit)
 {
     if ($type == 'toprated') {
         $first = ($page - 1) * $limit;
         $topRatedList = BOL_RateService::getInstance()->findMostRatedEntityList('vwvr_rates', $first, $limit);
         $clipArr = $this->clipDao->findByIdList(array_keys($topRatedList));
         $clips = array();
         foreach ($clipArr as $key => $clip) {
             $clipArrItem = (array) $clip;
             $clips[$key] = $clipArrItem;
             $clips[$key]['score'] = $topRatedList[$clipArrItem['id']]['avgScore'];
         }
         usort($clips, array('VWVR_BOL_ClipService', 'sortArrayItemByDesc'));
     } else {
         $clips = $this->clipDao->getClipsList($type, $page, $limit);
     }
     $list = array();
     if (is_array($clips)) {
         foreach ($clips as $key => $clip) {
             $clip = (array) $clip;
             $list[$key] = $clip;
             $list[$key]['thumb'] = $this->getClipThumbUrl($clip['id']);
         }
     }
     return $list;
 }