. /** * 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 * @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');