Select Git revision
-
Matthew X. Economou authored
In some MySQL server configurations (e.g., Amazon RDS), the root account may not be available. Instead, one may need to use a different account in order to perform database administration. This change replaced hard- coded references to the root account with a Pillar lookup that defaults to 'root'. Existing users of this formula should see no change in its behavior.
Matthew X. Economou authoredIn some MySQL server configurations (e.g., Amazon RDS), the root account may not be available. Instead, one may need to use a different account in order to perform database administration. This change replaced hard- coded references to the root account with a Pillar lookup that defaults to 'root'. Existing users of this formula should see no change in its behavior.
controller.php 25.04 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');
require_course_login($pdfannotator->course, true, $cm);
/* * ********************************************** Display overview page *********************************************** */
if ($action === 'overview') {
// Go to question-overview by default.
$action = 'overviewquestions';
}
if ($action === 'forwardquestion') {
require_sesskey();
require_capability('mod/pdfannotator:forwardquestions', $context);
require_once($CFG->dirroot . '/mod/pdfannotator/forward_form.php');
global $USER;
$commentid = required_param('commentid', PARAM_INT);
$fromoverview = optional_param('fromoverview', 0, PARAM_INT);
$cminfo = pdfannotator_instance::get_cm_info($cm->course);
// Make sure user is allowed to see cm with the question. (Might happen if user changes commentid in url).
list($insql, $inparams) = $DB->get_in_or_equal(array_keys($cminfo));
$sql = "SELECT c.*, a.page, cm.id AS cmid "
. "FROM {pdfannotator_comments} c "
. "JOIN {pdfannotator_annotations} a ON c.annotationid = a.id "
. "JOIN {pdfannotator} p ON a.pdfannotatorid = p.id "
. "JOIN {course_modules} cm ON p.id = cm.instance "
. "WHERE c.isdeleted = 0 AND c.id = ? AND cm.id $insql";
$params = array_merge([$commentid], $inparams);
$comments = $DB->get_records_sql($sql, $params);
$error = false;
if (!$comments) {
$error = true;
} else {
$comment = $comments[$commentid];
if (!$error && $comment->ishidden && !has_capability('mod/pdfannotator:seehiddencomments', $context)) {
$error = true;
}
}
$possiblerecipients = get_enrolled_users($context, 'mod/pdfannotator:getforwardedquestions');
$recipientslist = [];