2006-03-25 21:38:57 +00:00
|
|
|
<?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);
|
2006-09-08 23:17:18 +00:00
|
|
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
2006-03-25 21:38:57 +00:00
|
|
|
}
|
|
|
|
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;
|
2006-09-10 02:38:09 +00:00
|
|
|
|
|
|
|
$row[] = new tabobject('view', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&action=navigation", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name)));
|
2006-09-10 02:09:14 +00:00
|
|
|
$row[] = new tabobject('edit', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('edit'), get_string('editlesson', 'lesson', format_string($lesson->name)));
|
2006-03-25 21:38:57 +00:00
|
|
|
$row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports', 'lesson', $counts));
|
2006-09-08 23:17:18 +00:00
|
|
|
if (has_capability('mod/lesson:edit', $context)) {
|
2006-09-09 01:58:48 +00:00
|
|
|
$row[] = new tabobject('essay', "$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id", get_string('manualgrading', 'lesson'));
|
2006-03-25 21:38:57 +00:00
|
|
|
}
|
|
|
|
if ($lesson->highscores) {
|
2006-09-10 01:20:00 +00:00
|
|
|
$row[] = new tabobject('highscores', "$CFG->wwwroot/mod/lesson/highscores.php?id=$cm->id", get_string('highscores', 'lesson'));
|
2006-03-25 21:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$tabs[] = $row;
|
|
|
|
|
2006-09-10 02:09:14 +00:00
|
|
|
|
2006-09-10 01:30:57 +00:00
|
|
|
switch ($currenttab) {
|
|
|
|
case 'reportoverview':
|
|
|
|
case 'reportdetail':
|
2006-09-10 02:09:14 +00:00
|
|
|
/// sub tabs for reports (overview and detail)
|
2006-09-10 01:30:57 +00:00
|
|
|
$inactive[] = 'reports';
|
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row[] = new tabobject('reportoverview', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=reportoverview", get_string('overview', 'lesson'));
|
|
|
|
$row[] = new tabobject('reportdetail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&action=reportdetail", get_string('detailedstats', 'lesson'));
|
|
|
|
$tabs[] = $row;
|
|
|
|
break;
|
2006-09-10 02:09:14 +00:00
|
|
|
case 'collapsed':
|
|
|
|
case 'full':
|
|
|
|
/// sub tabs for edit view (collapsed and expanded aka full)
|
|
|
|
$inactive[] = 'edit';
|
|
|
|
|
|
|
|
$row = array();
|
|
|
|
$row[] = new tabobject('collapsed', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id&mode=collapsed", get_string('collapsed', 'lesson'));
|
|
|
|
$row[] = new tabobject('full', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id&mode=full", get_string('full', 'lesson'));
|
|
|
|
$tabs[] = $row;
|
|
|
|
break;
|
2006-03-25 21:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print_tabs($tabs, $currenttab, $inactive);
|
|
|
|
|
|
|
|
?>
|