123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- // This file is part of Moodle - http://moodle.org/
- //
- // Moodle is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // Moodle is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
- /**
- * Competence Graph
- *
- * Competence graph format allows the visualization of courses with competencies in a graph.
- * In the course structure, teacher associates activities to competencies. Each course module
- * can have restrictions between them, so a module is opened only when the student accomplish
- * its requirements. In student visualization, the structure of the course is presented as a
- * graph. In such graph, each node is a resource available to the student that can be handled.
- * Subgraphs in the main graph represent competences. As students can have different paths in
- * the course, the plugin registers all the steps that a student produces.
- *
- * @package course/format
- * @subpackage competencegraph
- * @version 0.1
- * @author Laboratório de Informática na Educação <http://www.usp.br/line>
- * @link http://www.usp.br/line/competencegraph
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- */
- defined('MOODLE_INTERNAL') || die();
- require_once($CFG->libdir . '/filelib.php');
- require_once($CFG->libdir . '/completionlib.php');
- if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
- $course->marker = $marker;
- course_set_marker($course->id, $marker);
- }
- $context = context_course::instance($course->id);
- // Retrieve course format option fields and add them to the $course object.
- $courseformat = course_get_format($course);
- $course = $courseformat->get_course();
- if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
- $course->marker = $marker;
- course_set_marker($course->id, $marker);
- }
- // Make sure all sections are created
- //course_create_sections_if_missing($course, range(0, $course->numsections));
- $renderer = $PAGE->get_renderer('format_competencegraph');
- $devicetype = core_useragent::get_device_type(); // In /lib/classes/useragent.php.
- if ($devicetype == "mobile") {
- $portable = 1;
- } else if ($devicetype == "tablet") {
- $portable = 2;
- } else {
- $portable = 0;
- }
- $renderer->set_portable($portable);
- if (!empty($displaysection)) {
- $renderer->print_single_section_page($course, null, null, null, null, $displaysection);
- } else {
- $tcsettings = $courseformat->get_settings();
- // Dynamically changing widths with language.
- /*if ($PAGE->user_is_editing()) {
- echo 'IS EDITING...';
- } else {
- echo 'NOT EDITING';
- }*/
-
- // If user is teacher or sup, display tabs:
- if (has_capability('moodle/course:update', $context)) {
-
- }
- $course->coursedisplay = null;
- if (optional_param('format', NULL, PARAM_TEXT)) {
- if (optional_param('format', NULL, PARAM_TEXT) == 'list') {
- $renderer->print_multiple_section_page($course, null, null, null, null);
- $SESSION->format = 'list';
- } elseif (optional_param('format', NULL, PARAM_TEXT) == 'graph') {
- $renderer->print_graph_teacher_view($course, null, null, null, null);
- $SESSION->format = 'graph';
- }
- } elseif (isset($SESSION->format)) {
- if ($SESSION->format == 'list') {
- $renderer->print_multiple_section_page($course, null, null, null, null);
- } elseif ($SESSION->format == 'graph') {
- $renderer->print_graph_teacher_view($course, null, null, null, null);
- }
- } else {
- $renderer->print_graph_teacher_view($course, null, null, null, null);
- }
- }
- $PAGE->requires->js('/course/format/competencegraph/format.js');
|