function __construct($id) { $this->note = Note::load(array('id' => $id)); if (!$this->note) { error_exit("That note does not exist"); } $this->note->load_creator(); note_add_to_menu($this->note); }
function update_note($title) { Note::save($title, $_POST['note']); if (!$GLOBALS['ajax']) { return view_note($title); } $note = Note::load($title); echo $note->note; }
public function data_for($url) { load_models('Note'); $url = preg_replace('/\\.\\w+$/', '', $url); $note = new Note(array('url' => $url)); return $note->load() ? $note->to_text() : NULL; }