Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/workshop/index.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 
00027 require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
00028 require_once(dirname(__FILE__).'/lib.php');
00029 
00030 $id = required_param('id', PARAM_INT);   // course
00031 
00032 $course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
00033 
00034 require_course_login($course);
00035 
00036 add_to_log($course->id, 'workshop', 'view all', "index.php?id=$course->id", '');
00037 
00038 $PAGE->set_pagelayout('incourse');
00039 $PAGE->set_url('/mod/workshop/index.php', array('id' => $course->id));
00040 $PAGE->set_title($course->fullname);
00041 $PAGE->set_heading($course->shortname);
00042 $PAGE->navbar->add(get_string('modulenameplural', 'workshop'));
00043 
00045 
00046 echo $OUTPUT->header();
00047 
00049 
00050 if (! $workshops = get_all_instances_in_course('workshop', $course)) {
00051     echo $OUTPUT->heading(get_string('noworkshops', 'workshop'), 2);
00052     echo $OUTPUT->continue_button(new moodle_url('/course/view.php', array('id' => $course->id)));
00053     echo $OUTPUT->footer();
00054     die();
00055 }
00056 
00057 $usesections = course_format_uses_sections($course->format);
00058 if ($usesections) {
00059     $sections = get_all_sections($course->id);
00060 }
00061 
00062 $timenow        = time();
00063 $strsectionname = get_string('sectionname', 'format_'.$course->format);
00064 $strname        = get_string('name');
00065 $table          = new html_table();
00066 
00067 if ($usesections) {
00068     $table->head  = array ($strsectionname, $strname);
00069     $table->align = array ('center', 'left');
00070 } else {
00071     $table->head  = array ($strname);
00072     $table->align = array ('left');
00073 }
00074 
00075 foreach ($workshops as $workshop) {
00076     if (empty($workshop->visible)) {
00077         $link = html_writer::link(new moodle_url('/mod/workshop/view.php', array('id' => $workshop->coursemodule)),
00078                                   $workshop->name, array('class' => 'dimmed'));
00079     } else {
00080         $link = html_writer::link(new moodle_url('/mod/workshop/view.php', array('id' => $workshop->coursemodule)),
00081                                   $workshop->name);
00082     }
00083 
00084     if ($usesections) {
00085         $table->data[] = array(get_section_name($course, $sections[$workshop->section]), $link);
00086     } else {
00087         $table->data[] = array($link);
00088     }
00089 }
00090 
00091 echo $OUTPUT->heading(get_string('modulenameplural', 'workshop'), 2);
00092 echo html_writer::table($table);
00093 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations