本文整理汇总了PHP中PHOTO_BOL_PhotoAlbumService::deleteAlbum方法的典型用法代码示例。如果您正苦于以下问题:PHP PHOTO_BOL_PhotoAlbumService::deleteAlbum方法的具体用法?PHP PHOTO_BOL_PhotoAlbumService::deleteAlbum怎么用?PHP PHOTO_BOL_PhotoAlbumService::deleteAlbum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHOTO_BOL_PhotoAlbumService
的用法示例。
在下文中一共展示了PHOTO_BOL_PhotoAlbumService::deleteAlbum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: albumDelete
public function albumDelete(OW_Event $e)
{
$params = $e->getParams();
$data = $e->getData();
if (empty($params['albumId'])) {
return false;
}
$album = $this->albumService->findAlbumById($params['albumId']);
if (!$album) {
return false;
}
$this->albumService->deleteAlbum($album->id);
return $data;
}
示例2: ajaxDeletePhotoAlbum
/**
* Deletes photo album
*
* @param array $params
* @return array
*/
public function ajaxDeletePhotoAlbum(array $params)
{
$albumId = $params['albumId'];
$lang = OW::getLanguage();
$album = $this->photoAlbumService->findAlbumById($albumId);
if ($album) {
// check permissions
$canEdit = OW::getUser()->isAuthorized('photo', 'upload', $album->userId);
$canModerate = OW::getUser()->isAuthorized('photo');
$authorized = $canEdit || $canModerate;
if ($authorized) {
$delResult = $this->photoAlbumService->deleteAlbum($albumId);
if ($delResult) {
$url = OW_Router::getInstance()->urlForRoute('photo_user_albums', array('user' => BOL_UserService::getInstance()->getUserName($album->userId)));
return array('result' => true, 'msg' => $lang->text('photo', 'album_deleted'), 'url' => $url);
}
} else {
$url = OW_Router::getInstance()->urlForRoute('photo_user_album', array('user' => BOL_UserService::getInstance()->getUserName($album->userId), 'album' => $album->id));
return array('result' => false, 'error' => $lang->text('photo', 'album_delete_not_allowed'), 'url' => $url);
}
}
return array('result' => false);
}