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));
 }
Esempio n. 2
0
 public function valuation($task_set_id, $solution_id)
 {
     $this->_add_mathjax();
     $solution = new Solution();
     $solution->select('`solutions`.*');
     $solution->select_subquery('(SELECT SUM(`points_total`) AS `points` FROM `task_task_set_rel` WHERE `task_set_id` = `task_sets`.`id` AND `task_task_set_rel`.`bonus_task` = 0)', 'task_set_total_points');
     $solution->include_related('task_set', '*', TRUE, TRUE);
     $solution->include_related('task_set/course', 'name');
     $solution->include_related('task_set/course/period', 'name');
     $solution->include_related('task_set/group', 'name');
     $solution->include_related('student', array('fullname', 'email'));
     $solution->include_related('teacher', array('fullname', 'email'));
     $solution->where('student_id IS NOT NULL');
     $solution->where('task_set_id', $task_set_id);
     $solution->get_by_id($solution_id);
     $group = new Group();
     $group->where_related('participant', 'student_id', $solution->student_id);
     $group->where_related('participant/course/task_set', 'id', $task_set_id);
     $group->get();
     $project_selection = new Project_selection();
     $project_selection->select('`project_selections`.*, `task_task_task_set_rel`.`internal_comment` AS `task_join_internal_comment`');
     $project_selection->include_related('task', '*', TRUE, TRUE);
     $project_selection->include_related('task/task_set', array('id', 'name'));
     $project_selection->where('task_set_id', $solution->task_set_id);
     $project_selection->where('student_id', $solution->student_id);
     $project_selection->where('task_task_sets.id', $solution->task_set_id);
     $project_selection->get();
     $this->load->helper('tests');
     $test_types_subtypes = get_all_supported_test_types_and_subtypes();
     $this->parser->add_js_file('jquery.activeform.js');
     $this->parser->add_js_file('admin_solutions/valuation.js');
     $this->parser->add_css_file('admin_solutions.css', array('media' => ''));
     $this->_add_prettify();
     $this->parser->parse('backend/solutions/valuation.tpl', array('solution' => $solution, 'group' => $group, 'test_types' => $test_types_subtypes['types'], 'test_subtypes' => $test_types_subtypes['subtypes'], 'project_selection' => $project_selection, 'add_url' => $this->uri->assoc_to_uri($this->uri->ruri_to_assoc(5))));
 }
Esempio n. 3
0
 public function task($task_set_id_url = NULL, $task_id_url = NULL)
 {
     $this->_add_mathjax();
     $task_set_id = url_get_id($task_set_id_url);
     $task_id = url_get_id($task_id_url);
     $this->_initialize_student_menu();
     $this->_select_student_menu_pagetag('projects');
     $this->parser->add_css_file('frontend_projects.css');
     $this->parser->add_js_file('projects/task.js');
     $this->_add_prettify();
     $this->_add_jquery_countdown();
     $this->parser->assign('max_filesize', compute_size_with_unit(intval($this->config->item('maximum_solition_filesize') * 1024)));
     $cache_id = $this->usermanager->get_student_cache_id('task_set_' . $task_set_id . '|task_' . $task_id);
     if (!$this->_is_cache_enabled() || !$this->parser->isCached($this->parser->find_view('frontend/projects/task.tpl'), $cache_id)) {
         $project_all = $this->get_task_set($task_set_id, $course, $student);
         $project = $this->filter_valid_task_sets($project_all);
         if ($course->exists()) {
             $this->lang->init_overlays('task_sets', $project, array('name'));
             $project = count($project) == 1 ? $project[0] : new Task_set();
             $this->parser->assign('project', $project);
             $task = $project->task;
             $task->include_join_fields()->order_by('`task_task_set_rel`.`sorting`', 'asc');
             $task->get_by_id($task_id);
             $project_selection = new Project_selection();
             $project_selection->where('task_set_id', $project->id);
             $project_selection->where('student_id', $this->usermanager->get_student_id());
             $project_selection->where('task_id', $task->id);
             $project_selection->get();
             $students = new Student();
             $students->where_related('project_selection', 'task_set_id', $project->id);
             $students->where_related('project_selection', 'task_id', $task->id);
             $students->get_iterated();
             $solution_versions = new Solution_version();
             $solution_versions->where_related('solution/task_set', 'id', $task_set_id);
             $solution_versions->where_related('solution', 'student_id', $this->usermanager->get_student_id());
             $query = $solution_versions->get_raw();
             $versions_metadata = array();
             if ($query->num_rows()) {
                 foreach ($query->result() as $row) {
                     $versions_metadata[$row->version] = clone $row;
                 }
             }
             $query->free_result();
             $this->parser->assign('task', $task);
             $this->parser->assign('students', $students);
             $this->parser->assign('project_selection', $project_selection);
             $this->parser->assign('solution_files', $project->get_student_files($student->id));
             $this->parser->assign('versions_metadata', $versions_metadata);
         }
         $this->parser->assign(array('course' => $course));
     }
     $this->parser->parse('frontend/projects/task.tpl', array(), FALSE, $this->_is_cache_enabled(), $cache_id);
 }