Beispiel #1
0
 public function table_content()
 {
     $filter = $this->input->post('filter');
     $this->store_filter($filter);
     $participants = new Participant();
     $participants->include_related('student', 'fullname');
     $participants->include_related('student', 'email');
     $participants->include_related('course', 'name');
     $participants->include_related('course/period', 'name');
     $participants->include_related('group', 'name');
     if (isset($filter['student_fullname']) && trim($filter['student_fullname']) != '') {
         $participants->like_related('student', 'fullname', trim($filter['student_fullname']));
     }
     if (isset($filter['course']) && intval($filter['course']) > 0) {
         $participants->where_related('course', 'id', intval($filter['course']));
     }
     if (isset($filter['group']) && intval($filter['group']) > 0) {
         $participants->where_related('group', 'id', intval($filter['group']));
     }
     if (isset($filter['group_set'])) {
         if ($filter['group_set'] == 'none') {
             $participants->where('group_id', NULL);
         } else {
             if ($filter['group_set'] == 'assigned') {
                 $participants->group_start(' NOT', 'AND');
                 $participants->where('group_id', NULL);
                 $participants->group_end();
             }
         }
     }
     $order_by_direction = $filter['order_by_direction'] == 'desc' ? 'desc' : 'asc';
     if ($filter['order_by_field'] == 'student') {
         $participants->order_by_related_as_fullname('student', 'fullname', $order_by_direction);
         $participants->order_by_related('student', 'email', $order_by_direction);
     } elseif ($filter['order_by_field'] == 'course') {
         $participants->order_by_related('course/period', 'sorting', $order_by_direction);
         $participants->order_by_related_with_constant('course', 'name', $order_by_direction);
     } elseif ($filter['order_by_field'] == 'group') {
         $participants->order_by_related_with_constant('group', 'name', $order_by_direction);
     } elseif ($filter['order_by_field'] == 'status') {
         $participants->order_by('allowed', $order_by_direction);
     }
     $participants->get_paged_iterated(isset($filter['page']) ? intval($filter['page']) : 1, isset($filter['rows_per_page']) ? intval($filter['rows_per_page']) : 25);
     $this->parser->parse('backend/participants/table_content.tpl', array('participants' => $participants));
 }