Select Git revision
renderer.php
-
Chris Sangwin authoredChris Sangwin authored
controller.php 20.27 KiB
<?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/>.
/**
* @package mod_pdfannotator
* @copyright 2018 RWTH Aachen (see README.md)
* @authors Anna Heynkes, Friederike Schwager
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$action = optional_param('action', 'view', PARAM_ALPHA); // The default action is 'view'.
$taburl = new moodle_url('/mod/pdfannotator/view.php', array('id' => $id));
$myrenderer = $PAGE->get_renderer('mod_pdfannotator');
/* *********************************************** Display overview page *********************************************** */
if ($action === 'overview') {
// Go to question-overview by default.
$action = 'overviewquestions';
}
/*
* This section prints a subpage of overview called 'unsolved questions'.
*/
if ($action === 'overviewquestions') {
global $OUTPUT, $CFG;
require_once($CFG->libdir . '/tablelib.php');
require_once($CFG->dirroot . '/mod/pdfannotator/locallib.php');
$currentpage = optional_param('page', 0, PARAM_INT);
$itemsperpage = optional_param('itemsperpage', 5, PARAM_INT);
$questionfilter = optional_param('questionfilter', 0, PARAM_INT); // Default 0 means: Display only unsolved/open questions.
$thisannotator = $pdfannotator->id;
$thiscourse = $pdfannotator->course;
$cmid = get_coursemodule_from_instance('pdfannotator', $thisannotator, $thiscourse, false, MUST_EXIST)->id;
pdfannotator_prepare_overviewpage($id, $myrenderer, $taburl, ['tab' => 'overview', 'action' => $action], $pdfannotator, $context);
echo $OUTPUT->heading(get_string('questionstab', 'pdfannotator') . ' ' . $OUTPUT->help_icon('questionstabicon', 'mod_pdfannotator')) . " <span id='pdfannotator-filter'></span>";
$questions = pdfannotator_get_questions($thiscourse, $context, $questionfilter);
if (empty($questions)) {
if ($questionfilter == 1) {
$info = get_string('noquestionsclosed_overview', 'pdfannotator');
} else if ($questionfilter == 2) {
$info = get_string('noquestions_overview', 'pdfannotator');
} else {
$info = get_string('noquestionsopen_overview', 'pdfannotator');
}
echo "<span class='notification'><div class='alert alert-info alert-block fade in' role='alert'>$info</div></span>";
} else {