Commit | Line | Data |
---|---|---|
b7e436b0 CS |
1 | <?php\r |
2 | // This file is part of BasicLTI4Moodle\r | |
3 | //\r | |
4 | // BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)\r | |
5 | // consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web\r | |
6 | // based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI\r | |
7 | // specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS\r | |
8 | // are already supporting or going to support BasicLTI. This project Implements the consumer\r | |
9 | // for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.\r | |
10 | // BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem\r | |
11 | // at the GESSI research group at UPC.\r | |
12 | // SimpleLTI consumer for Moodle is an implementation of the early specification of LTI\r | |
13 | // by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a\r | |
14 | // Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.\r | |
15 | //\r | |
16 | // BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis\r | |
17 | // of the Universitat Politecnica de Catalunya http://www.upc.edu\r | |
18 | // Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu\r | |
19 | //\r | |
20 | // Moodle is free software: you can redistribute it and/or modify\r | |
21 | // it under the terms of the GNU General Public License as published by\r | |
22 | // the Free Software Foundation, either version 3 of the License, or\r | |
23 | // (at your option) any later version.\r | |
24 | //\r | |
25 | // Moodle is distributed in the hope that it will be useful,\r | |
26 | // but WITHOUT ANY WARRANTY; without even the implied warranty of\r | |
27 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r | |
28 | // GNU General Public License for more details.\r | |
29 | //\r | |
30 | // You should have received a copy of the GNU General Public License\r | |
31 | // along with Moodle. If not, see <http://www.gnu.org/licenses/>.\r | |
32 | \r | |
33 | /**\r | |
34 | * This page lists all the instances of basiclti in a particular course\r | |
35 | *\r | |
73300339 | 36 | * @package lti\r |
b7e436b0 CS |
37 | * @copyright 2009 Marc Alier, Jordi Piguillem, Nikolas Galanis\r |
38 | * marc.alier@upc.edu\r | |
39 | * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu\r | |
40 | *\r | |
41 | * @author Marc Alier\r | |
42 | * @author Jordi Piguillem\r | |
43 | * @author Nikolas Galanis\r | |
44 | *\r | |
45 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r | |
46 | */\r | |
47 | require_once("../../config.php");\r | |
73300339 | 48 | require_once($CFG->dirroot.'/mod/lti/lib.php');\r |
b7e436b0 CS |
49 | \r |
50 | $id = required_param('id', PARAM_INT); // course id\r | |
51 | \r | |
52 | if (! $course = $DB->get_record("course", array("id" => $id))) {\r | |
53 | throw new moodle_exception('generalexceptionmessage', 'error', '', 'Course ID is incorrect');\r | |
54 | }\r | |
55 | \r | |
73300339 | 56 | $url = new moodle_url('/mod/lti/index.php', array('id'=>$id));\r |
b7e436b0 CS |
57 | $PAGE->set_url($url);\r |
58 | $PAGE->set_pagelayout('incourse');\r | |
59 | \r | |
60 | require_login($course);\r | |
61 | \r | |
73300339 | 62 | add_to_log($course->id, "lti", "view all", "index.php?id=$course->id", "");\r |
b7e436b0 | 63 | \r |
73300339 | 64 | $pagetitle = strip_tags($course->shortname.': '.get_string("modulenamepluralformatted", "lti"));\r |
b7e436b0 CS |
65 | $PAGE->set_title($pagetitle);\r |
66 | $PAGE->set_heading($course->fullname);\r | |
67 | \r | |
68 | echo $OUTPUT->header();\r | |
69 | \r | |
70 | /// Print the main part of the page\r | |
73300339 | 71 | echo $OUTPUT->heading(get_string("modulenamepluralformatted", "lti"));\r |
b7e436b0 CS |
72 | \r |
73 | /// Get all the appropriate data\r | |
73300339 | 74 | if (! $basicltis = get_all_instances_in_course("lti", $course)) {\r |
b7e436b0 CS |
75 | notice("There are no basicltis", "../../course/view.php?id=$course->id");\r |
76 | die;\r | |
77 | }\r | |
78 | \r | |
79 | /// Print the list of instances (your module will probably extend this)\r | |
80 | $timenow = time();\r | |
81 | $strname = get_string("name");\r | |
82 | $strsectionname = get_string('sectionname', 'format_'.$course->format);\r | |
83 | $usesections = course_format_uses_sections($course->format);\r | |
84 | if ($usesections) {\r | |
85 | $sections = get_all_sections($course->id);\r | |
86 | }\r | |
87 | \r | |
88 | $table = new html_table();\r | |
89 | $table->attributes['class'] = 'generaltable mod_index';\r | |
90 | \r | |
91 | if ($usesections) {\r | |
92 | $table->head = array ($strsectionname, $strname);\r | |
93 | $table->align = array ("center", "left");\r | |
94 | } else {\r | |
95 | $table->head = array ($strname);\r | |
96 | }\r | |
97 | \r | |
98 | foreach ($basicltis as $basiclti) {\r | |
99 | if (!$basiclti->visible) {\r | |
100 | //Show dimmed if the mod is hidden\r | |
101 | $link = "<a class=\"dimmed\" href=\"view.php?id=$basiclti->coursemodule\">$basiclti->name</a>";\r | |
102 | } else {\r | |
103 | //Show normal if the mod is visible\r | |
104 | $link = "<a href=\"view.php?id=$basiclti->coursemodule\">$basiclti->name</a>";\r | |
105 | }\r | |
106 | \r | |
107 | if ($course->format == "weeks" or $course->format == "topics") {\r | |
108 | $table->data[] = array ($basiclti->section, $link);\r | |
109 | } else {\r | |
110 | $table->data[] = array ($link);\r | |
111 | }\r | |
112 | }\r | |
113 | \r | |
114 | echo "<br />";\r | |
115 | \r | |
116 | echo html_writer::table($table);\r | |
117 | \r | |
118 | /// Finish the page\r | |
119 | \r | |
120 | echo $OUTPUT->footer();\r | |
121 | \r |