public static function get_announcements() { return Mod_forum::all(array('select' => 'mod_forum.*, users.username as username, users.display_name as display_name', 'order' => 'time desc', 'joins' => "LEFT JOIN users ON mod_forum.user_id = users.id", 'limit' => 20)); }
function shoutboard() { $this->data['subtitle'] = "Mod Shoutboard"; if ($this->input->post()) { if ($this->form_validation->run('announcement') == FALSE) { $this->content_view = "admin/announcement"; $this->data['error'] = true; } else { $this->content_view = "admin/announcement_success"; $attributes = array("title" => $this->input->post('title'), "text" => $this->input->post('text'), "user_id" => $this->session->userdata('user_id')); $new_announcement = new Mod_forum($attributes); $new_announcement->save(); } } $this->data['mod_posts'] = Mod_forum::get_announcements(); $this->content_view = "mod/shoutboard"; }