public function collectAlbumsForAvatar(BASE_CLASS_EventCollector $e) { if (!OW::getUser()->isAuthenticated()) { return; } $params = $e->getParams(); $userId = OW::getUser()->getId(); $total = $this->albumService->countUserAlbums($userId); $albums = $this->albumService->findUserAlbums($userId, 0, $total); if (!$albums) { return; } foreach ($albums as $album) { $photoCount = $this->photoService->countAlbumPhotos($album->id, array()); if (!$photoCount) { continue; } $photos = $this->photoService->getAlbumPhotos($album->id, 1, $params['limit']); $list = array(); foreach ($photos as $photo) { $list[] = array('id' => $photo['id'], 'entityId' => $album->id, 'entityType' => 'photo_album', 'url' => $photo['url'], 'bigUrl' => $this->photoService->getPhotoUrlByType($photo['id'], PHOTO_BOL_PhotoService::TYPE_MAIN, $photo['dto']->hash, $photo['dto']->dimension)); } $section = array('entityId' => $album->id, 'entityType' => 'photo_album', 'label' => $album->name, 'count' => $photoCount, 'list' => $list); $e->add($section); } }