/** * @param int $examgroup_id */ public function __construct($examgroup_id) { // keep everything fetched from the db $this->_examgroup = ORM::factory('examgroup', $examgroup_id); // get all the exams in this exam group $this->_exams = Model_Examgroup::get_exams($examgroup_id); $this->_exams_arr = $this->_exams->as_array('id', 'name'); $this->_students = Model_Examgroup::get_students($examgroup_id); $this->_results = Model_Examgroup::get_results($examgroup_id); $this->_exam_wise_students = self::exam_wise_students($this->_exams); }
public function action_publish() { $examgroup_id = $this->request->param('examgroup_id'); $examgroups = ORM::factory('examgroup', $examgroup_id); $examgroups->publish = 1; $examgroups->save(); $users = Model_Examgroup::get_students($examgroup_id, 'object'); $feed = new Feed_Exam(); $feed->set_action('publish_result'); $feed->set_respective_id($examgroup_id); $feed->set_actor_id(Auth::instance()->get_user()->id); $feed->save(); $feed->subscribe_users($users); Request::current()->redirect('examresult/edit/examgroup_id/' . $examgroup_id); exit; }