'context' => $context, 'courseid' => $course->id, )); $event->trigger(); $lesson->add_message(get_string('postsuccess', 'lesson'), 'notifysuccess'); redirect("$CFG->wwwroot/mod/lesson/highscores.php?id=$cm->id&link=1"); } else { print_error('invalidformdata'); } break; } // Trigger highscore viewed event. $event = \mod_lesson\event\highscores_viewed::create(array( 'objectid' => $lesson->properties()->id, 'context' => $context, 'courseid' => $course->id )); $event->trigger(); $lessonoutput = $PAGE->get_renderer('mod_lesson'); echo $lessonoutput->header($lesson, $cm, 'highscores', false, null, get_string('viewhighscores', 'lesson')); switch ($mode) { case 'add': echo $lessonoutput->add_highscores_form($lesson); break; default: $params = array ("lessonid" => $lesson->id); if (!$grades = $DB->get_records_select("lesson_grades", "lessonid = :lessonid", $params, "completed")) {
/** * Returns HTML to show the start of a slideshow * @param lesson $lesson */ public function slideshow_start(lesson $lesson) { $attributes = array(); $attributes['class'] = 'slideshow'; $attributes['style'] = 'background-color:' . $lesson->properties()->bgcolor . ';height:' . $lesson->properties()->height . 'px;width:' . $lesson->properties()->width . 'px;'; $output = html_writer::start_tag('div', $attributes); return $output; }
$newhighscore->userid = $USER->id; $newhighscore->gradeid = $newgrade->id; $newhighscore->nickname = $name; $newhighscore->id = $DB->insert_record('lesson_high_scores', $newhighscore); // Trigger highscore updated event. $event = \mod_lesson\event\highscore_added::create(array('objectid' => $newhighscore->id, 'context' => $context, 'courseid' => $course->id, 'other' => array('lessonid' => $lesson->id, 'nickname' => $newhighscore->nickname))); $event->trigger(); $lesson->add_message(get_string('postsuccess', 'lesson'), 'notifysuccess'); redirect("{$CFG->wwwroot}/mod/lesson/highscores.php?id={$cm->id}&link=1"); } else { print_error('invalidformdata'); } break; } // Trigger highscore viewed event. $event = \mod_lesson\event\highscores_viewed::create(array('objectid' => $lesson->properties()->id, 'context' => $context, 'courseid' => $course->id)); $event->trigger(); $lessonoutput = $PAGE->get_renderer('mod_lesson'); echo $lessonoutput->header($lesson, $cm, 'highscores', false, null, get_string('viewhighscores', 'lesson')); switch ($mode) { case 'add': echo $lessonoutput->add_highscores_form($lesson); break; default: $params = array("lessonid" => $lesson->id); if (!($grades = $DB->get_records_select("lesson_grades", "lessonid = :lessonid", $params, "completed"))) { $grades = array(); } echo $OUTPUT->heading(get_string("topscorestitle", "lesson", $lesson->maxhighscores), 4); if (!($highscores = $DB->get_records_select("lesson_high_scores", "lessonid = :lessonid", $params))) { echo $OUTPUT->heading(get_string("nohighscores", "lesson"), 3);