mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 11:56:40 +02:00

Changed: now need to enter password on password protected lessons before being able to view high scores Added logs to high scores and reworked logic
82 lines
3.3 KiB
PHP
82 lines
3.3 KiB
PHP
<?php // $Id$
|
|
/**
|
|
* Sets up the tabs used by the lesson pages for teachers.
|
|
*
|
|
* This file was adapted from the mod/quiz/tabs.php
|
|
*
|
|
* @version $Id$
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
|
* @package lesson
|
|
*/
|
|
|
|
/// This file to be included so we can assume config.php has already been included.
|
|
|
|
if (empty($lesson)) {
|
|
error('You cannot call this script in that way');
|
|
}
|
|
if (!isset($currenttab)) {
|
|
$currenttab = '';
|
|
}
|
|
if (!isset($cm)) {
|
|
$cm = get_coursemodule_from_instance('lesson', $lesson->id);
|
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
|
}
|
|
if (!isset($course)) {
|
|
$course = get_record('course', 'id', $lesson->course);
|
|
}
|
|
|
|
$tabs = array();
|
|
$row = array();
|
|
$inactive = array();
|
|
|
|
|
|
/// user attempt count for reports link hover (completed attempts - much faster)
|
|
$counts = new stdClass;
|
|
$counts->attempts = count_records('lesson_grades', 'lessonid', $lesson->id);
|
|
$counts->student = $course->student;
|
|
|
|
|
|
$row[] = new tabobject('teacherview', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('edit'), get_string('editlesson', 'lesson', format_string($lesson->name)));
|
|
$row[] = new tabobject('navigation', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=navigation", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name)));
|
|
$row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports', 'lesson', $counts));
|
|
if (has_capability('mod/lesson:edit', $context)) {
|
|
$row[] = new tabobject('essay', "$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id", get_string('manualgrading', 'lesson'));
|
|
}
|
|
if ($lesson->highscores) {
|
|
$row[] = new tabobject('highscores', "$CFG->wwwroot/mod/lesson/highscores.php?id=$cm->id", get_string('highscores', 'lesson'));
|
|
}
|
|
|
|
$tabs[] = $row;
|
|
|
|
/// sub tabs for reports (overview and detail)
|
|
if ($currenttab == 'reports' and isset($mode)) {
|
|
$inactive[] = 'reports';
|
|
$currenttab = $mode;
|
|
|
|
$row = array();
|
|
$row[] = new tabobject('view', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=view", get_string('overview', 'lesson'));
|
|
$row[] = new tabobject('detail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=detail", get_string('detailedstats', 'lesson'));
|
|
$tabs[] = $row;
|
|
}
|
|
|
|
/// sub tabs for teacher view (collapsed and expanded aka full)
|
|
if ($currenttab == 'teacherview') {
|
|
// use user preferences to remember which edit mode the user has selected
|
|
if (empty($mode)) {
|
|
$mode = get_user_preferences('lesson_view', 'collapsed');
|
|
} else {
|
|
set_user_preference('lesson_view', $mode);
|
|
}
|
|
|
|
$inactive[] = 'teacherview';
|
|
$currenttab = $mode;
|
|
|
|
$row = array();
|
|
$row[] = new tabobject('collapsed', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=teacherview&mode=collapsed", get_string('collapsed', 'lesson'));
|
|
$row[] = new tabobject('full', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&=teacherview&mode=full", get_string('full', 'lesson'));
|
|
$tabs[] = $row;
|
|
}
|
|
|
|
print_tabs($tabs, $currenttab, $inactive);
|
|
|
|
?>
|