本文整理汇总了PHP中Album::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::delete方法的具体用法?PHP Album::delete怎么用?PHP Album::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Sql
case 'files':
//Создаем и инициализируем экземпляр класса для работы с файлами
$sql = new Sql('fotorama');
$album = new Album($_REQUEST, array('tableName' => 'fotorama', 'files' => array(array('field' => 'full', 'dir' => 'files_original/', 'fit' => true, 'width' => 1200, 'height' => 1200, 'ext' => 'jpg'), array('field' => 'img', 'dir' => 'files_image/', 'fit' => 'contain', 'width' => 800, 'height' => 800, 'ext' => 'jpg'), array('field' => 'thumb', 'dir' => 'files_thumb/', 'fit' => 'cover', 'width' => 160, 'height' => 160, 'ext' => 'png')), 'maxSize' => '4M', 'maxSpace' => '100M', 'maxNumberOfFiles' => 100, 'allowedType' => array('jpeg', 'jpg', 'png', 'gif', 'bmp', 'psd', 'psp', 'ai', 'eps', 'cdr', 'mp3', 'mp4', 'wav', 'aac', 'aiff', 'midi', 'avi', 'mov', 'mpg', 'flv', 'mpa', 'pdf', 'txt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'djvu', 'djv', 'bat', 'cmd', 'dll', 'inf', 'ini', 'ocx', 'sys', 'htm', 'html', 'write', 'none', 'zip', 'rar', 'dmg', 'sitx')));
switch ($method) {
case 'GET':
$res = isset($id) ? $album->getOne($id) : $album->get();
break;
case 'PUT':
$res = $album->add();
break;
case 'POST':
$res = isset($id) ? $album->update($id, $r) : $sql->savesort($r['sort']);
break;
case 'DELETE':
$res = $album->delete($id);
break;
}
break;
default:
throw new Exception('Не получен тип действия', 15);
}
if (isset($res)) {
echo json_encode($res);
}
} catch (Exception $e) {
Header('HTTP/1.1 503 Service Unavailable');
echo json_encode(array('error' => array('msg' => $e->getMessage(), 'code' => $e->getCode())));
}
/**
* Класс для работы с файлами
示例2: index
//.........这里部分代码省略.........
$locked = true;
} else {
$locked = false;
}
try {
$a->from_array($_POST, array(), true);
} catch (Exception $e) {
$this->error('400', $e->getMessage());
return;
}
if ($locked) {
$this->db->query('UNLOCK TABLES');
}
if (isset($_POST['tags'])) {
$a->_format_tags($_POST['tags']);
} else {
if ($this->method === 'put' && isset($_POST['visibility'])) {
$a->_update_tag_counts();
}
}
$arr = $a->to_array();
if ($this->method === 'post') {
Shutter::hook('album.create', $arr);
} else {
Shutter::hook('album.update', $arr);
}
if (isset($content_ids)) {
$clean = new Album();
$clean = $clean->get_by_id($a->id);
$clean->manage_content(join(',', $content_ids), 'post', true);
}
$this->redirect("/albums/{$a->id}");
break;
case 'delete':
if (is_null($id)) {
$this->error('403', 'Required parameter "id" not present.');
return;
} else {
$prefix = preg_replace('/albums$/', '', $a->table);
if ($id === 'trash') {
$id = array();
$trash = new Trash();
$trash->like('id', 'album-')->select_func('REPLACE', '@id', 'album-', '', 'actual_id')->get_iterated();
foreach ($trash as $item) {
$id[] = (int) $item->actual_id;
}
} else {
if (is_numeric($id)) {
$id = array($id);
} else {
$id = explode(',', $id);
}
}
$tags = array();
// Need to loop individually here, otherwise tree can break down
foreach ($id as $album_id) {
$al = new Album();
$al->get_by_id($album_id);
if ($al->exists()) {
$tags = array_merge($tags, $al->tags);
$this->db->query("DELETE FROM {$prefix}trash WHERE id = 'album-{$al->id}'");
if ($al->right_id - $al->left_id > 1) {
$children = new Album();
$subs = $children->where('deleted', $al->deleted)->where('visibility', $al->visibility)->where('left_id >', $al->left_id)->where('right_id <', $al->right_id)->where('level >', $al->level)->get_iterated();
foreach ($subs as $sub_album) {
Shutter::hook('album.delete', $sub_album->to_array());
示例3: deleteAlbum
private function deleteAlbum()
{
Module::dependencies(isset($_POST['albumIDs']));
$album = new Album($this->database, $this->plugins, $this->settings, $_POST['albumIDs']);
echo $album->delete();
}
示例4: Album
$last_name = $user->last_name;
$email = $user->email;
$user_picture = $user->picture;
if ($user->picture) {
$img_path = $base_url . "/files/" . $user->picture;
} else {
$img_path = $base_url . "/images/default.jpg";
}
// Image album delete
try {
if ($_GET['action'] == 'delete_album' && $uid == $_SESSION['user']['id']) {
$type = "VIDEO_ALBUM";
$album = new Album($type);
$album->collection_id = $_GET['alb_id'];
$album->album_type = $type;
$album->delete();
}
} catch (PAException $e) {
$msg = "{$e->message}";
$error = TRUE;
}
// deleting images
try {
if ($_GET['action'] == 'delete') {
foreach ($_POST as $k => $v) {
$delete_videos_id[] = $k;
}
array_pop($delete_videos_id);
foreach ($delete_videos_id as $id) {
$new_image = new Video();
$new_image->content_id = $id;
示例5: topics
function topics()
{
list($params, $id) = $this->parse_params(func_get_args());
if ($this->method === 'get') {
$a = new Album();
$params['auth'] = $this->auth;
$params['flat'] = true;
$final = $a->where_related('text', 'id', $id)->listing($params);
$this->set_response_data($final);
} else {
list($text_id, $album_id) = $id;
$text = new Text();
$t = $text->get_by_id($text_id);
if (is_numeric($album_id)) {
$album_id = array($album_id);
} else {
$album_id = explode(',', $album_id);
}
$album = new Album();
$albums = $album->where_in('id', $album_id)->get_iterated();
foreach ($albums as $a) {
if ($this->method === 'post') {
$a->save($t);
} else {
$a->delete($t);
}
}
$this->redirect("/text/{$text_id}");
exit;
}
}
示例6: Album
if (!$api->checkAuth()) {
//User not authentified/authorized
return;
}
if (!$api->checkScope('admin')) {
$api->output(403, 'Admin scope is required for deleting album');
//indicate the requester do not have the required scope for deleting album
return;
}
if (!$api->checkParameterExists('id', $id)) {
$api->output(400, 'Album identifier must be provided');
//Album was not provided, return an error
return;
}
$album = new Album($id);
if (!$album->delete()) {
$api->output(500, 'Error during album deletion');
//something gone wrong :(
return;
}
$api->output(204, null);
break;
case 'PUT':
//update album
if (!$api->checkAuth()) {
//User not authentified/authorized
return;
}
if (!$api->checkScope('admin')) {
$api->output(403, 'Admin scope is required for editing album');
//indicate the requester do not have the required scope for updating album
示例7: deleteAlbum
/**
* Deletes the album in database and their thumbnails associated.
* Used in /album/actions/executeRefreshAlbumCollection
*
* @param Album $album_object
*/
public static function deleteAlbum($album_object, $user)
{
$album_object->delete();
Util::deleteThumbnail($album_object, $user);
}
示例8: Notarizealbum
$data = $data . $date . "," . $row[4] . "," . $row[5] . ";";
}
$stmt->closeCursor();
$data = convertToUTF8($data);
echo $data;
}
//partie suppression
if (isset($_GET['action']) && $_GET['action'] == 1) {
$notarizealbum = new Notarizealbum($_GET['user'], $_GET['id']);
$notarizealbum->delete($_GET['user'], $_GET['id']);
}
if (isset($_GET['action']) && $_GET['action'] == 2) {
$notarizeartist = new Notarizeartist($_GET['user'], $_GET['id']);
$notarizeartist->delete($_GET['user'], $_GET['id']);
}
if (isset($_GET['action']) && $_GET['action'] == 3) {
$comment = new Comment($_GET['user'], $_GET['id']);
$comment->delete($_GET['user'], $_GET['id']);
}
if (isset($_GET['type']) && $_GET['type'] == 'artist') {
$artist = new Artist($_GET['id']);
$artist->delete($_GET['id']);
}
if (isset($_GET['type']) && $_GET['type'] == 'album') {
$album = new Album($_GET['id']);
$album->delete($_GET['id']);
}
if (isset($_GET['type']) && $_GET['type'] == 'song') {
$song = new Song($_GET['id']);
$song->delete($_GET['id']);
}