Exemple #1
0
 public function show_file_content($task_set_id, $solution_id, $solution_file, $zip_index)
 {
     $this->output->set_content_type('text/plain');
     $task_set = new Task_set();
     $task_set->where_related('solution', 'id', $solution_id);
     $task_set->include_related('solution/student', 'id');
     $task_set->get_by_id($task_set_id);
     if ($task_set->exists()) {
         $file_name = decode_from_url($solution_file);
         $output = $task_set->extract_student_file_by_index($file_name, $zip_index);
         if ($output !== FALSE) {
             $this->output->set_output('<div class="codepreview_container"><pre class="codepreview prettyprint linenums lang-' . strtolower($output['extension']) . '">' . htmlspecialchars($output['content']) . '</pre></div>');
         } else {
             $this->output->set_output($this->lang->line('admin_solutions_valuation_file_content_error_cant_read_file'));
         }
     } else {
         $this->output->set_output($this->lang->line('admin_solutions_valuation_file_content_error_task_set_not_found'));
     }
 }