本文整理汇总了PHP中Note::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::delete方法的具体用法?PHP Note::delete怎么用?PHP Note::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
$res = self::query("UPDATE `notes` SET `title` = '{$title}', `message` = '{$message}' WHERE `notes`.`id` = {$id}");
}
// Return query result
return json_encode($res);
}
public static function delete($id)
{
$res = self::query("DELETE FROM notes WHERE `id` = {$id}");
return $res;
}
}
// Our script requires JSON data format
// Set Content-Type to JSON
header('Content-Type: application/json');
// if GET request then return the list of all items
// if POST request then add, edit or delete
switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
echo Note::getAll();
break;
case 'POST':
if (isset($_POST['action'])) {
echo Note::delete($_POST['id']);
} else {
print_r(Note::save($_POST));
}
break;
default:
echo 'Unknown operation';
break;
}
示例2: destroy_note
public function destroy_note()
{
if (!isset($_POST['note_id'])) {
error(__("Error"), __("No note ID specified.", "extend"));
}
$note = new Note($_POST['note_id']);
if ($note->no_results) {
error(__("Error"), __("Invalid note ID specified.", "extend"));
}
if (!$note->deletable()) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to delete this note.", "extend"));
}
Note::delete($note->id);
Flash::notice(__("Note deleted.", "extend"), $note->version->url());
}
示例3: rename
public function rename()
{
$from = $this->params->from;
$to = $this->params->to;
if ($this->username && !$this->is_owner) {
return $this->redirect($from);
}
$orig = new Note(array('url' => "/{$from}"));
if ($orig->load()) {
// Check that the destination is missing or empty of words
$dest = new Note(array('url' => "/{$to}"));
if ($dest->load()) {
if (strlen($dest->words)) {
return $this->redirect($from);
}
$dest->delete();
}
$orig->url = "/{$to}";
$orig->status = STATUS_RENAMED;
if ($orig->save()) {
return $this->redirect($to);
}
}
}
示例4: delete
public function delete()
{
$hash_Str = $this->input->get('hash');
$noteid_Num = $this->input->get('noteid');
$noteid_Arr = $this->input->post('noteid_Arr[]');
if (empty($noteid_Arr) && empty($noteid_Num)) {
$this->load->model('Message');
$this->Message->show(['message' => '未選擇要刪除的文章', 'url' => 'admin/base/note/note/tablelist']);
}
//CSRF過濾
if ($hash_Str == $this->security->get_csrf_hash()) {
if (!empty($noteid_Num)) {
$Note = new Note(['noteid_Num' => $noteid_Num]);
$Note->delete();
}
if (!empty($noteid_Arr)) {
foreach ($noteid_Arr as $key => $value_note) {
$Note = new Note(['noteid_Num' => $value_note]);
$Note->delete();
}
}
$this->load->model('Message');
$this->Message->show(['message' => '刪除成功', 'url' => 'admin/base/note/note/tablelist']);
} else {
$this->load->model('Message');
$this->Message->show(['message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/note/note/tablelist']);
}
}
示例5: delete
/**
* Function: delete
* Deletes the given version, including its notes. Calls the "delete_version" trigger and passes the <Version> as an argument.
*
* Parameters:
* $id - The version to delete.
*/
static function delete($id)
{
$version = new self($id);
foreach ($version->notes as $note) {
Note::delete($note->id);
}
foreach ($version->attachments as $attachment) {
Attachment::delete($attachment->id);
}
@unlink(uploaded($version->filename, false));
@unlink(uploaded($version->preview, false));
parent::destroy(get_class(), $id);
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}