function get_quiz($acode) { if (($reg = get_record($table = 'blended_attempts', $field = 'id', $value = $acode)) == false) { throw new EvaluationError(get_string('ErrorActivityCodeNotFound', 'blended', $acode), EvaluationError::MISSING_BLENDED_ATTEMPT); } else { $quiz_id = $reg->quiz; } $quiz = get_quiz_module($quizid); return $quiz; }
require_login($cm->course, false, $cm); $context_course = context_course::instance($cm->course); $context = context_module::instance($cm->id); require_capability('mod/blended:viewscannedjobs', $context); // Get the strings --------------------------------------------------------------- $strcorrectionpage = get_string('correction', 'blended'); $strQuizJobpage = get_string('quizJob', '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' => $strQuizJobpage, 'link' => null, 'type' => 'misc'))); print_header("{$course->shortname}: {$blended->name}: {$strQuizJobpage}", "{$course->shortname}", $navigation, "", "", true, update_module_button($cm->id, $course->id, $blended->name, $strQuizJobpage), navmenu($course, $cm)); print_spacer(20); print_box(format_text($strtable), 'generalbox', 'intro'); print_spacer(20); // Print the main part of the page ---------------------------------- $quiz = get_quiz_module($quizid); if ($quiz == false) { error("Bad Quizid: {$quizid}"); } $jobname = $quiz - name; //$jobpath = create_quiz_url($quiz,$course->id); $job->href = $jobpath; $job->hrefText = $jobname; print_spacer(20); print_heading(format_string(get_string('correction', 'blended'))); print_box(format_text(get_string('scannedjobpagedesc', 'blended', $job)), 'generalbox', 'intro'); print_spacer(20); show_quiz_results_table($blended, $quizid, $course, $context); echo "<BR><BR><center>"; helpbutton($page = 'quizjob', get_string('pagehelp', 'blended'), $module = 'blended', $image = true, $linktext = true, $text = '', $return = false, $imagetext = ''); echo "</center>";
/** * show a list of quizzes that are generated by this blended instance * @param unknown_type $currentpage * @param unknown_type $context * @param unknown_type $blended */ function show_quizzes($currentpage, $context, $blended) { global $CFG; global $USER; global $DB, $OUTPUT; $userid = $USER->id; if (has_capability('mod/blended:managealljobs', $context)) { // if (($quizzes_jobs = get_records_select($table="blended_jobs", $select="blended=$blended->id group by quiz")) == false) if (($quizzes_jobs = $DB->get_records_select('blended_jobs', $select = "blended={$blended->id} group by quiz")) == false) { echo $OUTPUT->box("There are no quiz jobs in the course."); } } else { if (has_capability('mod/blended:viewscannedjobs', $context)) { // if (($quizzes_jobs = get_records_select($table="blended_jobs", $select= "blended=$blended->id group by quiz")) == false) if (($quizzes_jobs = $DB->get_records_select('blended_jobs', $select = "blended={$blended->id} group by quiz")) == false) { echo $OUTPUT->box("There are no quiz jobs created by the current user in the course."); } } } if ($quizzes_jobs != false) { $i = 0; $rows = array(); foreach ($quizzes_jobs as $quiz_job) { $row = array(); $quiz = get_quiz_module($quiz_job->quiz); $closeTime = $quiz->timeclose == 0 ? get_string('pending', 'blended') : date("d-m-y h:i:s", $quiz->timeclose); $quizJobUrl = "quizJob.php?&a={$blended->id}&quizid={$quiz->id}"; $row["name"] = '<a href="' . $quizJobUrl . '">' . $quiz->name . '</a>'; $row["numPublished"] = count_records('blended_attempts', 'quiz', $quiz->id); $row["numCompleted"] = count_records('blended_attempts', 'quiz', $quiz->id, 'status', JOB_STATE_FINISHED); $row["date"] = $closeTime; $rows[] = $row; } //tabla de escaneos $table = new stdClass(); $table->class = 'mytable'; $table->head = array(get_string('modulename', 'quiz'), get_string('numquiz', 'blended'), get_string('jobstatus', 'blended'), get_string('date')); $align = "left"; $table->align = array($align, $align, $align, $align, $align); $tablealign = "center"; $table->tablealign = $tablealign; $table->rowclasses = array(); $table->data = $rows; print_table($table); } return false; }