Example #1
0
 public function collectAlbumPhotosForAvatar(BASE_CLASS_EventCollector $e)
 {
     if (!OW::getUser()->isAuthenticated()) {
         return;
     }
     $params = $e->getParams();
     if ($params['entityType'] != 'photo_album') {
         return;
     }
     $albumId = $params['entityId'];
     $page = floor($params['offset'] / $params['limit']) + 1;
     $photos = $this->photoService->getAlbumPhotos($albumId, $page, $params['limit']);
     if (!$photos) {
         return;
     }
     $list = array();
     foreach ($photos as $photo) {
         $list[] = array('id' => $photo['id'], 'url' => $photo['url'], 'bigUrl' => $this->photoService->getPhotoUrlByType($photo['id'], PHOTO_BOL_PhotoService::TYPE_MAIN, $photo['dto']->hash, $photo['dto']->dimension));
     }
     $section = array('count' => $this->photoService->countAlbumPhotos($albumId, array()), 'list' => $list);
     $e->add($section);
 }