Example #1
0
 public function action_index()
 {
     $view = View::factory('question/list')->bind('table', $table)->bind('total', $total)->bind('links', $links)->bind('success', $success)->bind('filter_url', $filter_url)->bind('filter_type', $filter_type)->bind('types', $types);
     $filter_type = (string) $this->request->param('filter_type', '');
     $course_id = Session::instance()->get('course_id');
     $course = ORM::factory('course', (int) $course_id);
     $criteria = array('filter_type' => $this->request->param('filter_type', ''), 'course_id' => $course_id);
     $questions = Model_Question::get_questions($criteria);
     $total = Model_Question::get_total_question_count($criteria);
     $sortables = new Sort(array('Question' => '', 'Type' => '', 'Actions' => ''));
     $headings = $sortables->render();
     $table = array('headings' => $headings, 'data' => $questions);
     $types = array_combine(Model_Question::$TYPES, array_map('ucfirst', Model_Question::$TYPES));
     $filter_url = URL::site('question/index');
     $links = array('add' => Html::anchor('/question/add/', 'Create a question', array('class' => 'createButton l')), 'delete' => URL::site('/question/delete/'));
     $success = Session::instance()->get_once('success');
     $this->content = $view;
 }