/** * @param OW_Event $e * @return array */ public function albumPhotosFind(OW_Event $e) { $params = $e->getParams(); $data = $e->getData(); $album = $this->findRequestedAlbum($params); if (empty($album)) { return false; } $offset = !empty($params['offset']) ? (int) $params['offset'] : 0; $limit = !empty($params['limit']) ? (int) $params['limit'] : OW::getConfig()->getValue('photo', 'photos_per_page'); $listType = !empty($params['listType']) ? $params['listType'] : 'latest'; $photos = $this->photoService->findAlbumPhotoList($album->id, $listType, $offset, $limit); if ($photos) { foreach ($photos as $key => $photo) { $id = $photo['id']; $photos[$key]['userId'] = $album->userId; $photos[$key]['url'] = OW::getRouter()->urlForRoute('view_photo', array('id' => $id)); $photos[$key]['photoUrl'] = $this->photoService->getPhotoUrl($id); $photos[$key]['previewUrl'] = $this->photoService->getPhotoUrl($id, true); } } $e->setData($photos); return $photos; }
/** * @param OW_Event $e * @return array */ public function albumPhotosFind(OW_Event $e) { $params = $e->getParams(); $album = $this->findRequestedAlbum($params); if (empty($album)) { return false; } $offset = !empty($params['offset']) ? (int) $params['offset'] : 0; $limit = !empty($params['limit']) ? (int) $params['limit'] : OW::getConfig()->getValue('photo', 'photos_per_page'); $listType = isset($params['listType']) ? $params['listType'] : 'latest'; $privacy = isset($params['privacy']) || $params['privacy'] === null ? $params['privacy'] : 'everybody'; $photos = $this->photoService->findAlbumPhotoList($album->id, $listType, $offset, $limit, $privacy); $list = $this->preparePhotos($photos); $e->setData($list); return $list; }