~ubuntu-branches/ubuntu/dapper/moodle/dapper-backports

« back to all changes in this revision

Viewing changes to mod/lesson/tabs.php

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2006-12-01 14:00:21 UTC
  • mfrom: (6.1.5 feisty)
  • Revision ID: james.westby@ubuntu.com-20061201140021-rivugg5tgx6mujzg
Tags: 1.6.3-1ubuntu1~dapper1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php  // $Id: tabs.php,v 1.1 2006/03/25 21:38:57 mark-nielsen Exp $
 
2
/**
 
3
* Sets up the tabs used by the lesson pages for teachers.
 
4
*
 
5
* This file was adapted from the mod/quiz/tabs.php
 
6
*
 
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
 
9
* @package lesson
 
10
*/
 
11
 
 
12
/// This file to be included so we can assume config.php has already been included.
 
13
 
 
14
    if (empty($lesson)) {
 
15
        error('You cannot call this script in that way');
 
16
    }
 
17
    if (!isset($currenttab)) {
 
18
        $currenttab = '';
 
19
    }
 
20
    if (!isset($cm)) {
 
21
        $cm = get_coursemodule_from_instance('lesson', $lesson->id);
 
22
    }
 
23
    if (!isset($course)) {
 
24
        $course = get_record('course', 'id', $lesson->course);
 
25
    }
 
26
 
 
27
    $tabs     = array();
 
28
    $row      = array();
 
29
    $inactive = array();
 
30
 
 
31
 
 
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;
 
36
 
 
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&amp;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&amp;action=essayview", get_string('manualgrading', 'lesson')); 
 
42
    }
 
43
    if ($lesson->highscores) {
 
44
        $row[] = new tabobject('highscores', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&amp;action=highscores", get_string('highscores', 'lesson'));
 
45
    }
 
46
 
 
47
    $tabs[] = $row;
 
48
 
 
49
/// sub tabs for reports (overview and detail)
 
50
    if ($currenttab == 'reports' and isset($mode)) {
 
51
        $inactive[] = 'reports';
 
52
        $currenttab = $mode;
 
53
        
 
54
        $row    = array();
 
55
        $row[]  = new tabobject('view', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&amp;action=view", get_string('overview', 'lesson'));
 
56
        $row[]  = new tabobject('detail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&amp;action=detail", get_string('detailedstats', 'lesson'));
 
57
        $tabs[] = $row;
 
58
    }
 
59
    
 
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
 
63
        if (empty($mode)) {
 
64
            $mode = get_user_preferences('lesson_view', 'collapsed');
 
65
        } else {
 
66
            set_user_preference('lesson_view', $mode);
 
67
        }
 
68
        
 
69
        $inactive[] = 'teacherview';
 
70
        $currenttab = $mode;
 
71
        
 
72
        $row    = array();
 
73
        $row[]  = new tabobject('collapsed', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&amp;action=teacherview&amp;mode=collapsed", get_string('collapsed', 'lesson'));
 
74
        $row[]  = new tabobject('full', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id&amp=teacherview&amp;mode=full", get_string('full', 'lesson'));
 
75
        $tabs[] = $row;
 
76
    }
 
77
 
 
78
    print_tabs($tabs, $currenttab, $inactive);
 
79
 
 
80
?>