本文整理汇总了PHP中Note::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::update方法的具体用法?PHP Note::update怎么用?PHP Note::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_note
public function update_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->editable()) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to edit this note.", "extend"));
}
$files = array();
foreach ($_FILES['attachment'] as $key => $val) {
foreach ($val as $file => $attr) {
$files[$file][$key] = $attr;
}
}
foreach ($files as $attachment) {
if ($attachment['error'] != 4) {
$path = upload($attachment, null, "attachments");
Attachment::add(basename($path), $path, "note", $note->id);
}
}
$note->update($_POST['body']);
Flash::notice(__("Note updated.", "extend"), $note->url(true));
}
示例2: action_publish_post
/**
* Save our data to the database
*/
public function action_publish_post($post, $form)
{
$this->action_form_publish($form, $post);
if ($form->notes->value != NULL) {
$note = new Note($form->note_key->value);
$note->content = $form->notes->value;
$note->update();
// Utils::debug( $note, $note->update(), $this->get_notes() );
$post->info->note_key = $note->key;
}
// exit;
}