Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/lesson/tabs.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00029 defined('MOODLE_INTERNAL') || die();
00030 
00032 global $DB;
00033 if (empty($lesson)) {
00034     print_error('cannotcallscript');
00035 }
00036 if (!isset($currenttab)) {
00037     $currenttab = '';
00038 }
00039 if (!isset($cm)) {
00040     $cm = get_coursemodule_from_instance('lesson', $lesson->id);
00041     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
00042 }
00043 if (!isset($course)) {
00044     $course = $DB->get_record('course', array('id' => $lesson->course));
00045 }
00046 
00047 $tabs = $row = $inactive = $activated = array();
00048 
00050 $attemptscount = $DB->count_records('lesson_grades', array('lessonid'=>$lesson->id));
00051 
00052 $row[] = new tabobject('view', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name)));
00053 $row[] = new tabobject('edit', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('edit', 'lesson'), get_string('edita', 'moodle', format_string($lesson->name)));
00054 $row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports2', 'lesson', $attemptscount));
00055 if (has_capability('mod/lesson:edit', $context)) {
00056     $row[] = new tabobject('essay', "$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id", get_string('manualgrading', 'lesson'));
00057 }
00058 if ($lesson->highscores) {
00059     $row[] = new tabobject('highscores', "$CFG->wwwroot/mod/lesson/highscores.php?id=$cm->id", get_string('highscores', 'lesson'));
00060 }
00061 
00062 $tabs[] = $row;
00063 
00064 
00065 switch ($currenttab) {
00066     case 'reportoverview':
00067     case 'reportdetail':
00069         $inactive[] = 'reports';
00070         $activated[] = 'reports';
00071 
00072         $row    = array();
00073         $row[]  = new tabobject('reportoverview', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&amp;action=reportoverview", get_string('overview', 'lesson'));
00074         $row[]  = new tabobject('reportdetail', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id&amp;action=reportdetail", get_string('detailedstats', 'lesson'));
00075         $tabs[] = $row;
00076         break;
00077     case 'collapsed':
00078     case 'full':
00079     case 'single':
00081         $inactive[] = 'edit';
00082         $activated[] = 'edit';
00083 
00084         $row    = array();
00085         $row[]  = new tabobject('collapsed', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id&amp;mode=collapsed", get_string('collapsed', 'lesson'));
00086         $row[]  = new tabobject('full', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id&amp;mode=full", get_string('full', 'lesson'));
00087         $tabs[] = $row;
00088         break;
00089 }
00090 
00091 print_tabs($tabs, $currenttab, $inactive, $activated);
 All Data Structures Namespaces Files Functions Variables Enumerations