1
<?php // $Id: tabs.php,v 1.1 2006/03/25 21:38:57 mark-nielsen Exp $
3
* Sets up the tabs used by the lesson pages for teachers.
5
* This file was adapted from the mod/quiz/tabs.php
7
* @version $Id: tabs.php,v 1.1 2006/03/25 21:38:57 mark-nielsen Exp $
8
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
12
/// This file to be included so we can assume config.php has already been included.
15
error('You cannot call this script in that way');
17
if (!isset($currenttab)) {
21
$cm = get_coursemodule_from_instance('lesson', $lesson->id);
23
if (!isset($course)) {
24
$course = get_record('course', 'id', $lesson->course);
32
/// user attempt count for reports link hover (completed attempts - much faster)
33
$counts = new stdClass;
34
$counts->attempts = count_records('lesson_grades', 'lessonid', $lesson->id);
35
$counts->student = $course->student;
37
$row[] = new tabobject('teacherview', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('edit'), get_string('editlesson', 'lesson', format_string($lesson->name)));
38
$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)));
39
$row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports', 'lesson', $counts));
40
if (isteacheredit($course->id)) {
41
$row[] = new tabobject('essayview', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=essayview", get_string('manualgrading', 'lesson'));
43
if ($lesson->highscores) {
44
$row[] = new tabobject('highscores', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=highscores", get_string('highscores', 'lesson'));
49
/// sub tabs for reports (overview and detail)
50
if ($currenttab == 'reports' and isset($mode)) {
51
$inactive[] = 'reports';
55
$row[] = new tabobject('view', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=view", get_string('overview', 'lesson'));
56
$row[] = new tabobject('detail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=detail", get_string('detailedstats', 'lesson'));
60
/// sub tabs for teacher view (collapsed and expanded aka full)
61
if ($currenttab == 'teacherview') {
62
// use user preferences to remember which edit mode the user has selected
64
$mode = get_user_preferences('lesson_view', 'collapsed');
66
set_user_preference('lesson_view', $mode);
69
$inactive[] = 'teacherview';
73
$row[] = new tabobject('collapsed', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=teacherview&mode=collapsed", get_string('collapsed', 'lesson'));
74
$row[] = new tabobject('full', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&=teacherview&mode=full", get_string('full', 'lesson'));
78
print_tabs($tabs, $currenttab, $inactive);