$context = context_module::instance($cm->id); //require_capability('mod/blended:deletejob', $context); // Get the strings --------------------------------------------------------------- $strcorrectionpage = get_string('correction', 'blended'); $strscannedJobpage = get_string('scannedJob', 'blended'); $strdeletequizpage = get_string('deletequiz', 'blended'); $strdeletescanjob = get_string('deletescanjob', 'blended'); $strtable = get_string("table", "blended"); // Print the page header --------------------------------------------------------- $navigation = build_navigation(array(array('name' => $blended->name, 'link' => "../../mod/blended/view.php?a={$blended->id}", 'type' => 'misc'), array('name' => $strcorrectionpage, 'link' => "../../mod/blended/correction.php?a={$blended->id}", 'type' => 'misc'), array('name' => $strdeletescanjob, 'link' => null, 'type' => 'misc'))); print_header("{$course->shortname}: {$blended->name}: {$strdeletescanjob}", "{$course->shortname}", $navigation, "", "", true, update_module_button($cm->id, $course->id, $blended->name, $strdeletescanjob), navmenu($course, $cm)); print_spacer(20); print_box(format_text($strtable), 'generalbox', 'intro'); print_spacer(20); // Print the main part of the page ---------------------------------- $scan = blended_getOMRScanJob($scanjobid); $text->jobname = $scan->scan_name; $text->acode = $acode; print_spacer(20); print_heading(format_string(get_string('correction', 'blended'))); print_box(format_text(get_string('deletescanjobdesc', 'blended', $text)), 'generalbox', 'intro'); print_spacer(20); $mform = new deleteForm(); $mform->_form->addElement('hidden', 'id', $id); $mform->_form->addElement('hidden', 'a', $a); $mform->_form->addElement('hidden', 'acode', $acode); $mform->_form->addElement('hidden', 'scanjobid', $scan->id); $mform->_form->addElement('hidden', 'jobname', $scan->scan_name); if (!$mform->is_cancelled() && ($data = $mform->get_data())) { $acode = $data->acode; $continue = "{$CFG->wwwroot}/mod/blended/scan.php?&a={$a}";
/** * Construct a table view of all results related to a quiz * */ function show_quiz_results_table($blended, $quiz, $course, $context) { global $CFG; $currentpage = 'quizJob.php'; if (!($images_view = get_records($table = "blended_images", $field = 'jobid', $value = $jobid, $sort = 'activitycode,pageindex'))) { print_box(get_string('ErrorScannedImageNotFound', 'blended')); } else { $i = 0; $images = array(); $displayed_codes = array(); $iconWarning = '<img src="images/warning.png" width="32" alt="' . get_string('MarkWarning', 'blended') . '"/>'; echo "<form action=\"evaluate.php\" method=\"POST\" >"; echo '<input type="hidden" name="a" value="' . $blended->id . '"/>'; echo '<input type="hidden" name="jobid" value="' . $jobid . '"/>'; foreach ($images_view as $result) { $acode = $result->activitycode; $imgout = $result->imgout; $pageindex = $result->pageindex; if ($acode) { $quiz_already_displayed = in_array($acode, $displayed_codes); if ($quiz_already_displayed == false) { $imagerow = array(); $id_member = find_userid($acode, $jobid); $user_reg = blended_get_user($id_member, $blended); $verresultados = get_string('modulename', 'quiz') . $acode; $quiz_in_course = check_quiz_course($acode, $course); $showdetailslink = "<a href=\"showdetails.php?&a={$blended->id}&acode={$acode}&jobid={$result->jobid}\">{$verresultados}</a>"; $attempts = get_record('blended_attempts', 'id', $acode); $index = $i + 1; if ($user_reg != null && $attempts != false) { $checkbox = "<input type=\"checkbox\" name=\"selectedActivity{$index}\" value=\"{$acode}\" />"; } else { $checkbox = "<input type=\"checkbox\" name=\"selectedActivity{$index}\" disabled=\"true\" value=\"{$acode}\" />"; } $imagerow["index"] = $checkbox . $index; $imagerow["correctionlink"] = $showdetailslink; $imagerow["activitycode"] = $result->activitycode . get_string('page', 'blended') . $pageindex; $imagerow["alumno"] = ''; if ($user_reg !== null) { $imagerow["alumno"] = print_user_picture($user_reg, $course->id, null, null, true) . fullname($user_reg); } else { $imagerow["alumno"] = get_string('ErrorUserIDEmpty', 'blended'); } $imagerow["pasar"] = ''; $imagerow["status"] = ''; $status = ''; $warnings = count_doubtfull_marks($acode, $jobid); if ($warnings > 0) { $warn = $iconWarning . "Hay {$warnings} marcas dudosas!!"; } else { $warn = ''; } $imagerow["activitycode"] = $warn . '<br/>' . $imagerow["activitycode"]; if ($quiz_in_course) { if (has_capability('mod/blended:evaluatequiz', $context)) { if ($result->status == IMAGE_STATUS_PENDING) { $evaluate = get_string('blendedPassToQuiz', 'blended'); $link = "<a href=\"evaluate.php?&a={$blended->id}&acode={$acode}&jobid={$jobid}\">{$evaluate}</a>"; $imagerow["pasar"] = $link; $status = get_string('NotYet', 'blended'); } else { $imagerow["pasar"] = get_string('blendedPassedToQuiz', 'blended'); $link = "<a href=\"evaluate.php?a={$blended->id}&acode={$acode}&jobid={$jobid}\">" . get_string('blendedPassAgainToQuiz', 'blended') . "</a>"; $status = $link; } } else { $imagerow["pasar"] = "Permission Denied" . ($status = ""); } } $imagerow["status"] = $status; if (has_capability('mod/blended:deletequiz', $context)) { $imgdelete = "<img src=\"delete.gif\"/>"; $link = "<a href=\"delete_quiz.php?page={$currentpage}&acode={$acode}&jobid={$jobid}&a={$blended->id}\">{$imgdelete}</a>"; $delete = $link; $imagerow["delete"] = $delete; } if ($attempts == false) { // attempt not found in blended. /* echo"<center>"; mtrace("El cuestionario que ha procesado pertenece a otro curso o no existe en la base de datos de este servidor."); echo"<center><br><br>";*/ $scan = blended_getOMRScanJob($result->jobid); $resultname = $scan->scan_name . "-" . $result->id; $correctionlink = "<a href=\"activitycode.php?&a={$blended->id}&jobid={$result->jobid}&resultid={$result->id}\">{$resultname}</a>"; $imagerow["correctionlink"] = $correctionlink; //$imagerow["correctionlink"]=''; $imagerow["activitycode"] = "ErrĂ³neo." . $result->activitycode . ' ' . get_string('pages', 'blended') . $pageindex; $imagerow["alumno"] = ''; $imagerow["pasar"] = '<img align="left" src="images/warning.png" width="32"/>' . get_string('ErrorActivityCodeNotFound', 'blended', $acode); $status = ""; $key = "{$acode}{$pageindex}"; $images[$key] = $imagerow; } else { $displayed_codes[$acode] = $acode; // avoid using another rows for different pages of the same activity $images[$acode] = $imagerow; } $i++; } else { $images[$acode]["activitycode"] .= ", " . $pageindex; } } // $acode!=null } echo '<input type="hidden" name="numActivities" value="' . $index . '" />'; /** * Add results with no $acode detected ***/ foreach ($images_view as $result) { $scan = blended_getOMRScanJob($result->jobid); $acode = $result->activitycode; $resultname = $scan->scan_name . "-" . $result->id; $page = $result->page; if ($acode == null) { $imagerow = array(); $imagerow["index"] = ""; $correctionlink = "<a href=\"activitycode.php?&a={$blended->id}&jobid={$result->jobid}&resultid={$result->id}\">{$resultname}</a>"; $imagerow["correctionlink"] = $correctionlink; $imagerow["activitycode"] = get_string('UnclassifiedPage', 'blended'); $imagerow["alumno"] = ''; $imagerow["pasar"] = ''; $imagerow["status"] = get_string('NotYet', 'blended'); if (has_capability('mod/blended:deletescanjob', $context)) { $link = "<a href=\"delete_quiz.php?page={$currentpage}&acode={$acode}&jobid={$jobid}&a={$blended->id}\">{$imgdelete}</a>"; $delete = $link; $imagerow["delete"] = $delete; } $images[] = $imagerow; $i++; } } //tabla de resultados $table = new stdClass(); $table->class = 'mytable'; $table->head = array('Seleccionar', 'Ver Resultados', 'ActivityCode', 'Alumno', 'Pasar a QUIZ', 'Evaluado en Moodle', 'Borrar'); $align = "left"; $table->align = array($align, $align, $align, $align, $align, $align, $align); $tablealign = "center"; $table->tablealign = $tablealign; $table->rowclasses = array(); $table->data = $images; print_table($table); echo '<center><input type="submit" name="manyActivities" value="' . get_string('blendedPassSelectedToQuiz', 'blended') . '"/></center>'; echo "</form>"; } return; }