Esempio n. 1
0
 public function edit()
 {
     $this->_select_teacher_menu_pagetag('task_sets');
     $url = $this->uri->ruri_to_assoc(3);
     $task_set_id = isset($url['task_set_id']) ? intval($url['task_set_id']) : intval($this->input->post('task_set_id'));
     $task_set = new Task_set();
     $task_set->get_by_id($task_set_id);
     $ps_data = array();
     $nps_data = array();
     if ($task_set->exists() && $task_set->content_type == 'project') {
         $project_selections = new Project_selection();
         $project_selections->select('*');
         $project_selections->include_related('student', array('fullname', 'email'));
         $project_selections->where_related($task_set);
         $project_selections->include_related('task', 'name');
         $project_selections->include_related('task/task_set', 'id');
         $project_selections->where_related('task/task_set', 'id', $task_set->id);
         $project_selections->order_by('task_task_task_set_rel.sorting', 'ASC');
         $project_selections->order_by_related_as_fullname('student', 'fullname', 'asc');
         $project_selections->get();
         if ($project_selections->exists()) {
             foreach ($project_selections->all as $project_selection) {
                 $ps_data[$project_selection->task_id][] = $project_selection;
             }
         }
         $project_selections->select_func('COUNT', '@id', 'count');
         $project_selections->where('task_set_id', 'participant_course_task_sets.id', false);
         $project_selections->where_related('student', 'id', '${parent}.id');
         $students = new Student();
         $students->where_related('participant/course/task_set', $task_set);
         $students->where_related('participant', 'allowed', 1);
         $students->where_subquery(0, $project_selections);
         $students->order_by_as_fullname('fullname', 'asc');
         $students->get();
         if ($students->exists()) {
             $nps_data = $students->all;
         }
     }
     $this->_add_tinymce4();
     $this->parser->add_js_file('jquery.activeform.js');
     $this->parser->add_js_file('admin_task_sets/edit.js');
     $this->parser->add_js_file('admin_task_sets/form.js');
     $this->parser->add_css_file('admin_task_sets.css');
     $this->inject_courses();
     $this->inject_languages();
     $this->inject_test_types();
     $this->inject_course_groups();
     $this->inject_course_group_rooms();
     $this->inject_course_task_set_types();
     $this->parser->parse('backend/task_sets/edit.tpl', array('task_set' => $task_set, 'project_selections' => $ps_data, 'not_project_selections' => $nps_data));
 }