public static function set_sort_direction($sort_direction) { if ($sort_direction == 'ASC') { Model_Kwalbum_Comment::$_sort_direction = 'ASC'; Model_Kwalbum_Comment::$_gtlt = '<'; } else { Model_Kwalbum_Comment::$_sort_direction = 'DESC'; Model_Kwalbum_Comment::$_gtlt = '>'; } }
public function action_comments() { $view = new View('kwalbum/browse/comments'); Model_Kwalbum_Comment::set_sort_field('create'); Model_Kwalbum_Comment::set_sort_direction('DESC'); $view->items = Model_Kwalbum_Comment::get_thumbnails($this->page_number, $this->in_edit_mode); $this->template->content = $view; $this->template->title = 'browsing newest comments'; }
public function action_AddComment() { $item = Model::factory('kwalbum_item')->load((int) $_POST['item']); if (!$this->user->can_view_item($item)) { echo 'no commenting for you'; return; } $comment = new Model_Kwalbum_Comment(); $comment->name = $this->user->name; $comment->text = htmlspecialchars(trim($_POST['comment'])); $comment->item_id = $item->id; $comment->save(); echo $comment->name . ' : ' . $comment->date . '<br/>' . $comment->text . '<hr/>'; }