public function get_student_test_queue_all($task_set_id, $student_id) { $task_set = new Task_set(); $task_set->get_by_id((int) $task_set_id); $student = new Student(); $student->get_by_id((int) $student_id); $test_queue = new Test_queue(); if ($task_set->exists() && $student->exists()) { $test = new Test(); $test->select_func('COUNT', array('@id'), 'tests_count'); $test->where_related('test_queue', 'id', '${parent}.id'); $test_queue->select('*'); //$test_queue->select_func('COUNT', array('@test/id'), 'tests_count'); $test_queue->select_subquery($test, 'tests_count'); $test_queue->where_related($task_set); $test_queue->where_related($student); $test_queue->order_by('status', 'desc'); $test_queue->order_by('finish', 'desc'); $test_queue->order_by('start', 'asc'); $test_queue->get_iterated(); } //$test_queue->check_last_query(); $this->load->helper('tests'); $test_types = get_all_supported_test_types(); $this->parser->parse('backend/tests/get_student_test_queue_all.tpl', array('test_queue' => $test_queue, 'task_set' => $task_set, 'student' => $student, 'test_types' => $test_types)); }