本文整理汇总了PHP中PHOTO_BOL_PhotoAlbumService::findUserAlbumList方法的典型用法代码示例。如果您正苦于以下问题:PHP PHOTO_BOL_PhotoAlbumService::findUserAlbumList方法的具体用法?PHP PHOTO_BOL_PhotoAlbumService::findUserAlbumList怎么用?PHP PHOTO_BOL_PhotoAlbumService::findUserAlbumList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHOTO_BOL_PhotoAlbumService
的用法示例。
在下文中一共展示了PHOTO_BOL_PhotoAlbumService::findUserAlbumList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($userId, $limit, $exclude)
{
parent::__construct();
$this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
$user = BOL_UserService::getInstance()->findUserById($userId);
$this->assign('username', $user->getUsername());
$albums = $this->photoAlbumService->findUserAlbumList($user->id, 1, $limit, $exclude, true);
$this->assign('albums', $albums);
foreach ($albums as $album) {
array_push($exclude, $album['dto']->id);
}
$loadMore = $this->photoAlbumService->countUserAlbums($userId, $exclude);
if (!$loadMore) {
$script = "OWM.trigger('photo.hide_load_more', {});";
OW::getDocument()->addOnloadScript($script);
}
}
示例2: userAlbums
/**
* Controller action for user albums list
*
* @param array $params
* @throws Redirect404Exception
*/
public function userAlbums(array $params)
{
if (empty($params['user']) || !mb_strlen($username = trim($params['user']))) {
throw new Redirect404Exception();
}
$user = BOL_UserService::getInstance()->findByUsername($username);
if (!$user) {
throw new Redirect404Exception();
}
$userId = $user->id;
$ownerMode = $userId == OW::getUser()->getId();
// is moderator
$modPermissions = OW::getUser()->isAuthorized('photo');
if (!OW::getUser()->isAuthorized('photo', 'view') && !$modPermissions && !$ownerMode) {
$this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
return;
}
// permissions check
if (!$ownerMode && !$modPermissions) {
$privacyParams = array('action' => 'photo_view_album', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
$event = new OW_Event('privacy_check_permission', $privacyParams);
OW::getEventManager()->trigger($event);
}
$this->assign('username', $username);
$displayName = BOL_UserService::getInstance()->getDisplayName($userId);
$this->assign('displayName', $displayName);
$total = $this->photoAlbumService->countUserAlbums($userId);
$page = !empty($_GET['page']) && (int) $_GET['page'] ? abs((int) $_GET['page']) : 1;
$config = OW::getConfig();
$albumPerPage = $config->getValue('photo', 'photos_per_page');
$albums = $this->photoAlbumService->findUserAlbumList($userId, $page, $albumPerPage);
$this->assign('albums', $albums);
$this->assign('total', $total);
$this->assign('userId', $userId);
// Paging
$pages = (int) ceil($total / $albumPerPage);
$paging = new BASE_CMP_Paging($page, $pages, $albumPerPage);
$this->assign('paging', $paging->render());
$this->assign('widthConfig', $config->getValue('photo', 'preview_image_width'));
$this->assign('heightConfig', $config->getValue('photo', 'preview_image_height'));
OW::getDocument()->setHeading(OW::getLanguage()->text('photo', 'page_title_user_albums', array('user' => $displayName)));
OW::getDocument()->setHeadingIconClass('ow_ic_picture');
OW::getDocument()->setTitle(OW::getLanguage()->text('photo', 'meta_title_photo_useralbums', array('displayName' => $displayName)));
if ($albums) {
$albumTitles = array();
$i = 0;
foreach ($albums as $album) {
$albumTitles[] = $album['dto']->name;
if ($i == 10) {
break;
}
$i++;
}
$albumTitles = implode(', ', $albumTitles);
OW::getDocument()->setDescription(OW::getLanguage()->text('photo', 'meta_description_photo_useralbums', array('displayName' => $displayName, 'albums' => $albumTitles)));
}
}