Gitlab CSE Unil

Commit 8c1fa150 authored by M. Chardon's avatar M. Chardon
Browse files

migration des cours vers les contextes pour contrôle des formulaires ajax

parent 3ca80b06
This diff is collapsed.
......@@ -242,7 +242,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("input[name^='toolid']").val(currentButtonId);
$("input[name^='nexttoolid']").val(nextButtonId);
var form = $('#assignfeedback_editpdfplus_order_tool');
var data = form.serialize() + "&courseid=" + $("#courseid").val();
var data = form.serialize() + "&contextid=" + contextid;
ajax.call([
{
methodname: 'assignfeedback_editpdfplus_submit_tool_order_form',
......@@ -517,7 +517,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
if (axisimportid && parseInt(axisimportid) > 0) {
$("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(axisimportid);
var form = $('#assignfeedback_editpdfplus_import_axis');
var data = form.serialize() + "&courseid=" + $("#courseid").val();
var data = form.serialize() + "&contextid=" + contextid;
ajax.call([
{
methodname: 'assignfeedback_editpdfplus_submit_axis_import_form',
......
......@@ -187,11 +187,13 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$toolbarAxis = $statuschoice;
// Toolbar pour lien creation palette et aide
$courseid = $this->page->course->id;
$lienAdmin = new moodle_url('/mod/assign/feedback/editpdfplus/view_admin.php', array('id' => $courseid));
$toolbarAdmin = $this->render_toolbar_button_html($this->render_toolbar_button_icon("fa-wrench"), array(
self::HTMLCLASS => 'btn btn-outline-info',
'onclick' => "document.location='" . $lienAdmin->out() . "';"));
$parentContext = $this->page->context->get_parent_context();
if ($parentContext->contextlevel == CONTEXT_COURSE) {
$lienAdmin = new moodle_url('/mod/assign/feedback/editpdfplus/view_admin.php', array('id' => $parentContext->id));
$toolbarAdmin = $this->render_toolbar_button_html($this->render_toolbar_button_icon("fa-wrench"), array(
self::HTMLCLASS => 'btn btn-outline-info',
'onclick' => "document.location='" . $lienAdmin->out() . "';"));
}
$toolbarAdmin .= $this->render_toolbar_button_html($this->render_toolbar_button_icon("fa-question-circle"), array(self::HTMLCLASS => 'btn btn-outline-info helpmessage'));
$toolbarAdminBlock = $this->render_toolbar($toolbarAdmin, "mr-3");
} else {
......@@ -245,7 +247,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
//help message
$helpmessageTitle = html_writer::div(get_string('help_title', self::PLUGIN_NAME), null, array('id' => 'afppHelpmessageTitle'));
$helpmessagecontent=$this->render_from_template('assignfeedback_editpdfplus/help_workspace', array());
$helpmessagecontent = $this->render_from_template('assignfeedback_editpdfplus/help_workspace', array());
$helpmessageBody = html_writer::div($helpmessagecontent, null, array('id' => 'afppHelpmessageBody'));
$helpmessageDiv = html_writer::div($helpmessageTitle . $helpmessageBody, 'helpmessage');
$canvas .= $helpmessageDiv;
......
......@@ -49,16 +49,14 @@ class widget_admin implements renderable, templatable {
/**
* Constructor
* @param type $context
* @param type $course
* @param type $userid - The user id we are grading
* @param type $toolbars
* @param type $axis - the different axis to display
* @param type $typetools
* @param type $toolbarsDispo
*/
public function __construct($context, $course, $userid, $toolbars, $axis, $typetools, $toolbarsDispo) {
public function __construct($context, $userid, $toolbars, $axis, $typetools, $toolbarsDispo) {
$this->context = $context;
$this->course = $course;
$this->userid = $userid;
$this->toolbars = $toolbars;
$this->axis = $axis;
......
......@@ -41,7 +41,7 @@ class assignfeedback_editpdfplus_external extends external_api {
const DATAJSON = 'jsonformdata';
const MESSAGELIB = 'message';
const COURSELIB = "course";
const COURSEID = "courseid";
const CONTEXTID = "contextid";
const AXEID = "axeid";
const AXEIDDESC = "Axe ID";
const AXELIB = "axelabel";
......@@ -122,13 +122,12 @@ class assignfeedback_editpdfplus_external extends external_api {
* Set Page context from the course id given. It returns the context found.
* @global $DB
* @global $PAGE
* @param int $courseid Current course id
* @param int $contextid Current context id
* @return context course's context
*/
public static function setPageContext($courseid) {
global $DB, $PAGE;
$course = $DB->get_record(self::COURSELIB, array('id' => $courseid), '*', MUST_EXIST);
$context = context_course::instance($course->id, MUST_EXIST);
public static function setPageContext($contextid) {
global $PAGE;
$context = context::instance_by_id($contextid, MUST_EXIST);
$PAGE->set_context($context);
return $context;
}
......@@ -153,7 +152,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_axis_form($jsonformdata) {
$data = self::getParseData(self::submit_axis_form_parameters(), $jsonformdata);
$context = self::setPageContext($data[self::COURSEID]);
$context = self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data;
$formparams = array($customdata);
......@@ -206,7 +205,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_axis_del_form($jsonformdata) {
$data = self::getParseData(self::submit_axis_form_parameters(), $jsonformdata);
self::setPageContext($data[self::COURSEID]);
self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data;
$formparams = array($customdata);
......@@ -244,7 +243,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_tool_form($jsonformdata, $mode) {
$data = self::getParseData(self::submit_axis_form_parameters(), $jsonformdata);
$context = self::setPageContext($data[self::COURSEID]);
$context = self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data;
......@@ -334,7 +333,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_tool_del_form($jsonformdata) {
$data = self::getParseData(self::submit_axis_form_parameters(), $jsonformdata);
$context = self::setPageContext($data[self::COURSEID]);
$context = self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data;
......@@ -382,7 +381,7 @@ class assignfeedback_editpdfplus_external extends external_api {
$data = self::getParseData(self::submit_axis_import_form_parameters(), $jsonformdata);
$context = self::setPageContext($data[self::COURSEID]);
$context = self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data;
$formparams = array($customdata);
......@@ -451,7 +450,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_tool_order_form($jsonformdata) {
$data = self::getParseData(self::submit_tool_order_form_parameters(), $jsonformdata);
self::setPageContext($data[self::COURSEID]);
self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data;
......
......@@ -185,6 +185,8 @@ $string['help_highlight'] = 'Highlight an item in the document';
$string['help_verticalline'] = 'Click drag a vertical line in the document';
$string['help_stamp'] = 'Click where to place the stamp';
$string['admin_access_error'] = 'You are not allow to access this page, please contact your teacher or your manager';
$string['basepalette'] = 'Base annotation tools';
$string['basepalette_desc'] = 'The base annotation tool palette is defined <a href="{$a}">here</a> for the whole Moodle site. Teachers can then define their own tool palettes in their courses via the course administration menu.';
$string['assignmentgradedsubject'] = '[Moodle] Assignment updated';
$string['assignmentgradedbody'] = '{$a->coursename} → {$a->modulename} → {$a->assignmentname}
......
......@@ -184,3 +184,11 @@ $string['help_highlight'] = 'Surligner un élément dans le document';
$string['help_verticalline'] = 'Cliquer glisser une ligne verticale dans le document';
$string['help_stamp'] = 'Cliquer à l\'endroit où placer le tampon';
$string['admin_access_error'] = 'Vous n\'avez pas les droits suffisants pour accéder à cette page, contactez votre enseignant ou un responsable de Moodle.';
$string['basepalette'] = 'Base annotation tools';
$string['basepalette_desc'] = 'The base annotation tool palette is defined <a href="{$a}">here</a> for the whole Moodle site. Teachers can then define their own tool palettes in their courses via the course administration menu.';
$string['assignmentgradedsubject'] = '[Moodle] Assignment updated';
$string['assignmentgradedbody'] = '{$a->coursename} → {$a->modulename} → {$a->assignmentname}
The assignment correction has been updated.
You can access the document following this link: {$a->url}';
\ No newline at end of file
......@@ -23,7 +23,6 @@
* The code is based on mod/assign/feedback/editpdf/lib.php by Davo Smith.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
......@@ -39,8 +38,8 @@ defined('MOODLE_INTERNAL') || die();
* @return bool false if file not found, does not return if found - just send the file
*/
function assignfeedback_editpdfplus_pluginfile($course, $cm, context $context, $filearea, $args, $forcedownload, array $options = array()) {
global $USER, $DB, $CFG;
global $DB, $CFG;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
if ($context->contextlevel == CONTEXT_MODULE) {
......@@ -82,7 +81,7 @@ function assignfeedback_editpdfplus_pluginfile($course, $cm, context $context, $
*/
function assignfeedback_editpdfplus_extend_navigation_course(navigation_node $navigation, stdClass $course, context_course $context) {
if (has_capability('assignfeedback/editpdfplus:use', $context, null, false) && has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) {
$url = new moodle_url('/mod/assign/feedback/editpdfplus/view_admin.php', array('id' => $course->id));
$url = new moodle_url('/mod/assign/feedback/editpdfplus/view_admin.php', array('id' => $context->id));
$feedbackadminnode = navigation_node::create('Feedback : configuration', $url, navigation_node::TYPE_CUSTOM, 'Bars d\'outils', 'editpdfplusadmin', new pix_icon('i/grades', ""));
$navigation->add_node($feedbackadminnode);
}
......@@ -90,124 +89,79 @@ function assignfeedback_editpdfplus_extend_navigation_course(navigation_node $na
/**
* Get axis form (add)
* @global $DB
* @param type $args
*/
function assignfeedback_editpdfplus_output_fragment_axisadd($args) {
global $DB;
$context = $args['context'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) {
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getAxisForm();
}
require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
return null;
$editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getAxisForm();
}
/**
* Get axis form (edit)
* @global $DB
* @param type $args
*/
function assignfeedback_editpdfplus_output_fragment_axisedit($args) {
global $DB;
$context = $args['context'];
$axisid = $args['axeid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) {
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getAxisForm($axisid);
}
require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
return null;
$editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getAxisForm($axisid);
}
/**
* Get axis form (delete)
* @global $DB
* @param type $args
*/
function assignfeedback_editpdfplus_output_fragment_axisdel($args) {
global $DB;
$context = $args['context'];
$axisid = $args['axeid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) {
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getAxisDelForm($axisid);
}
require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
return null;
$editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getAxisDelForm($axisid);
}
/**
* Get tool form (edit)
* @global $DB
* @param type $args
*/
function assignfeedback_editpdfplus_output_fragment_tooledit($args) {
global $DB;
$context = $args['context'];
$toolid = $args['toolid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) {
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getToolForm($toolid);
}
require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
return null;
$editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getToolForm($toolid);
}
/**
* Get tool form (add)
* @global $DB
* @param type $args
*/
function assignfeedback_editpdfplus_output_fragment_tooladd($args) {
global $DB;
$context = $args['context'];
$axisid = $args['axisid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) {
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getToolForm(null, $axisid);
}
require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
return null;
$editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getToolForm(null, $axisid);
}
......@@ -37,15 +37,11 @@ class assign_feedback_editpdfplus_admin {
const PLUGIN_NAME = "assignfeedback_editpdfplus";
/** @var stdClass $course current course */
private $course = null;
/** @var stdClass $context current context */
private $context = null;
function __construct(stdClass $context, stdClass $course) {
function __construct(stdClass $context) {
$this->context = $context;
$this->course = $course;
}
/**
......@@ -59,22 +55,21 @@ class assign_feedback_editpdfplus_admin {
$html = '';
$renderer = $PAGE->get_renderer(self::PLUGIN_NAME);
$axisimportform = new axis_import_form(null, array('id' => $this->course->id), null, null, array('id' => "assignfeedback_editpdfplus_import_axis"));
$axisimportform = new axis_import_form(null, array('id' => $this->context->id), null, null, array('id' => "assignfeedback_editpdfplus_import_axis"));
$axisimportform->id = "assignfeedback_editpdfplus_import_axis";
$axisimportform->title = "";
$axisimportform->action = "import";
$toolorderform = new tool_order_form(null, array('id' => $this->course->id), null, null, array('id' => "assignfeedback_editpdfplus_order_tool"));
$toolorderform = new tool_order_form(null, array('id' => $this->context->id), null, null, array('id' => "assignfeedback_editpdfplus_order_tool"));
$toolorderform->id = "assignfeedback_editpdfplus_order_tool";
$toolorderform->title = "";
$toolorderform->action = "order";
$widget = $this->get_widget();
$widget->axisimportform = $axisimportform;
$widget->toolorderform = $toolorderform;
$widget->courseid = $this->course->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin($widget);
return $html;
}
/**
* Buid axis moodleform
* @global $PAGE
......@@ -93,20 +88,20 @@ class assign_feedback_editpdfplus_admin {
$axis = $DB->get_record('assignfeedback_editpp_axis', array('id' => $axeid), '*', MUST_EXIST);
}
if ($axis != null) {
$formAxis = new axis_form(null, array('id' => $this->course->id), null, null, array('id' => "assignfeedback_editpdfplus_edit_axis")); //Form processing and displaying is done here
$formAxis = new axis_form(null, array('id' => $this->context->id), null, null, array('id' => "assignfeedback_editpdfplus_edit_axis")); //Form processing and displaying is done here
$formAxis->set_data(array('axeid' => $axeid, 'label' => $axis->label));
$formAxis->id = "assignfeedback_editpdfplus_edit_axis";
$formAxis->title = "Renommer l'axe";
$formAxis->action = "edit";
} else {
$formAxis = new axis_form(null, array('id' => $this->course->id), null, null, array('id' => "assignfeedback_editpdfplus_add_axis")); //Form processing and displaying is done here
$formAxis = new axis_form(null, array('id' => $this->context->id), null, null, array('id' => "assignfeedback_editpdfplus_add_axis")); //Form processing and displaying is done here
$formAxis->set_data($toform);
$formAxis->id = "assignfeedback_editpdfplus_add_axis";
$formAxis->title = "Ajouter un nouvel axe";
$formAxis->action = "add";
}
$renderer = $PAGE->get_renderer(self::PLUGIN_NAME);
$formAxis->courseid = $this->course->id;
$formAxis->contextid = $this->context->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin_axisform($formAxis);
return $html;
}
......@@ -128,14 +123,14 @@ class assign_feedback_editpdfplus_admin {
$axis = $DB->get_record('assignfeedback_editpp_axis', array('id' => $axeid), '*', MUST_EXIST);
}
if ($axis != null) {
$formAxis = new axis_del_form(null, array('id' => $this->course->id), null, null, array('id' => "assignfeedback_editpdfplus_del_axis")); //Form processing and displaying is done here
$formAxis = new axis_del_form(null, array('id' => $this->context->id), null, null, array('id' => "assignfeedback_editpdfplus_del_axis")); //Form processing and displaying is done here
$formAxis->set_data(array('axeid' => $axeid, 'label' => $axis->label));
}
$formAxis->id = "assignfeedback_editpdfplus_del_axis";
$formAxis->title = "Supprimer l'axe";
$formAxis->action = "del";
$renderer = $PAGE->get_renderer(self::PLUGIN_NAME);
$formAxis->courseid = $this->course->id;
$formAxis->contextid = $this->context->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin_axisdelform($formAxis);
return $html;
}
......@@ -153,7 +148,7 @@ class assign_feedback_editpdfplus_admin {
$html = '';
$data = new stdClass;
$data->courseid = $this->course->id;
$data->contextid = $this->context->id;
$data->sesskey = sesskey();
$data->actionurl = "/moodle/lib/ajax/service.php";
$data->formid = "assignfeedback_editpdfplus_edit_tool";
......@@ -188,45 +183,37 @@ class assign_feedback_editpdfplus_admin {
global $USER;
// get the costum toolbars
$coursecontext = context::instance_by_id($this->context->id);
$coursecontexts = array_filter(explode('/', $coursecontext->path), 'strlen');
$coursecontexts = array_filter(explode('/', $this->context->path), 'strlen');
$tools = page_editor::get_tools($coursecontexts);
$typetools = page_editor::get_typetools(null);
$axis = page_editor::get_axis(array($this->context->id));
$toolbars = $this->prepareToolbar($axis, $tools);
// get all accessibled toolbars
$contextListToCheck = array();
$contextListToCheck[] = 1;
$contextsIdAxes = admin_editor::get_all_different_contexts();
foreach ($contextsIdAxes as $contextTmp) {
$contextObj = context::instance_by_id($contextTmp->contextid);
//$contextObj = context_system::instance_by_id($contextTmp->contextid, IGNORE_MISSING);
if ($contextObj /* && has_capability('assignfeedback/editpdfplus:use', $contextObj) */ && has_capability('assignfeedback/editpdfplus:managetools', $contextObj, null, false) && $contextTmp->contextid != $this->context->id) {
$contextListToCheck[] = $contextTmp->contextid;
if ($this->context->id != SITEID) {
$contextListToCheck = array();
$contextListToCheck[] = 1;
$contextsIdAxes = admin_editor::get_all_different_contexts();
foreach ($contextsIdAxes as $contextTmp) {
$contextObj = context::instance_by_id($contextTmp->contextid);
if ($contextObj && has_capability('assignfeedback/editpdfplus:managetools', $contextObj, null, false) && $contextTmp->contextid != $this->context->id) {
$contextListToCheck[] = $contextTmp->contextid;
}
}
}
/* $courses = get_courses();
$contextListToCheck = array();
foreach ($courses as $course) {
$contextid = context_course::instance($course->id);
$coursecontextsTmp = array_filter(explode('/', $contextid->path), 'strlen');
foreach ($coursecontextsTmp as $value) {
if ($value != $this->context->id && !in_array($value, $contextListToCheck)) {
$contextListToCheck[] = $value;
}
}
} */
$axisDispo = array();
$toolDispo = page_editor::get_tools($contextListToCheck);
foreach ($contextListToCheck as $value) {
$axistmp = page_editor::get_axis(array($value));
if ($axistmp && sizeof($axistmp) > 0) {
$axisDispo = array_merge($axisDispo, $axistmp);
$axisDispo = array();
$toolDispo = page_editor::get_tools($contextListToCheck);
foreach ($contextListToCheck as $value) {
$axistmp = page_editor::get_axis(array($value));
if ($axistmp && sizeof($axistmp) > 0) {
$axisDispo = array_merge($axisDispo, $axistmp);
}
}
$toolbarsDispo = $this->prepareToolbar($axisDispo, $toolDispo);
} else {
$toolbarsDispo = null;
}
$toolbarsDispo = $this->prepareToolbar($axisDispo, $toolDispo);
$widget = new widget_admin($this->context, $this->course, $USER, $toolbars, $axis, $typetools, $toolbarsDispo);
$widget = new widget_admin($this->context, $USER, $toolbars, $axis, $typetools, $toolbarsDispo);
return $widget;
}
......
......@@ -30,6 +30,10 @@ $settings->add(new admin_setting_configcheckbox('assignfeedback_editpdfplus/defa
new lang_string('default', 'assignfeedback_editpdfplus'),
new lang_string('default_help', 'assignfeedback_editpdfplus'), 0));
// Base palette (contextid = 1) link.
$basepaletteurl = $CFG->wwwroot . '/mod/assign/feedback/editpdfplus/view_admin.php?id=' . \context_system::instance()->id;
$settings->add(new admin_setting_heading('basepalette', get_string('basepalette', 'assignfeedback_editpdfplus'), get_string('basepalette_desc', 'assignfeedback_editpdfplus', $basepaletteurl)));
// Ghostscript setting.
$systempathslink = new moodle_url('/admin/settings.php', array('section' => 'systempaths'));
$systempathlink = html_writer::link($systempathslink, get_string('systempaths', 'admin'));
......
......@@ -20,7 +20,6 @@
Admin template for manage axis.
Context variables required for this template:
* courseid - Course id
* context - Context id
* axisimportform - Moodle form to import an axis
* toolbars - All toolbars for the current course
......@@ -42,7 +41,6 @@
<div class="card-block" style="height: 400px;overflow: auto;">
{{# str }} adminaxisimport, assignfeedback_editpdfplus {{/ str }}
{{{ axisimportform.render }}}
<input type="hidden" id="courseid" value="{{courseid}}" />
<table class='table table-bordered table-striped'>
<thead>
<tr>
......
......@@ -20,7 +20,7 @@
Admin template for remove one axis.
Context variables required for this template:
* courseid - Course id
* contextid - Context id
* title - Title of the page (add or edit)
* render - form render for removing the axis
* id - form id
......@@ -39,7 +39,7 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
var formid='{{id}}';
$("#axisDelSubmit").on("click", function () {
var form = $('#'+formid);
var data = form.serialize()+"&courseid="+{{courseid}};
var data = form.serialize()+"&contextid="+{{contextid}};
ajax.call([
{
methodname: 'assignfeedback_editpdfplus_submit_axis_del_form',
......
......@@ -20,7 +20,7 @@
Admin template for add or edit one axis.
Context variables required for this template:
* courseid - Course id
* contextid - Context id
* title - Title of the page (add or edit)
* render - form render for adding or editing axis
* id - form id
......@@ -39,7 +39,7 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
var formid='{{id}}';
$("#axisFormSubmit").on("click", function () {
var form = $('#'+formid);
var data = form.serialize()+"&courseid="+{{courseid}};
var data = form.serialize()+"&contextid="+{{contextid}};
ajax.call([
{
methodname: 'assignfeedback_editpdfplus_submit_axis_form',
......
......@@ -20,7 +20,7 @@
Admin template to manage a tool.
Context variables required for this template:
* courseid - Course id
* contextid - Context id
* tool - current tool object to edit
* formid - id of moodleform
* actionurl - moodle service url to send form
......@@ -187,7 +187,7 @@
<div style='display:none;'>
<input type="hidden" name="toolid" value="{{tool.id}}" />
<input type="hidden" name="axisid" id="axisid" value="{{tool.axis}}" />
<input type="hidden" name="courseid" value="{{courseid}}" />
<input type="hidden" name="contextid" value="{{contextid}}" />
<input type="hidden" name="sesskey" value="{{sesskey}}" />
<input type="hidden" name="enabled" id="toolenabled" value="{{tool.enabled}}" />
</div>
......
......@@ -25,10 +25,10 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018092002;
$plugin->version = 2018121000;
$plugin->requires = 2018050800; // Moodle 3.5
$plugin->maturity = MATURITY_STABLE;
$plugin->release = "2.2.2 (Build: 2018092002)";
$plugin->release = "2.2.3 (Build: 2018121000)";
$plugin->dependencies = array(
'assignfeedback_editpdf' => 2018051400
);
......
......@@ -6,98 +6,36 @@ require_once('locallib_admin.php');
global $PAGE, $OUTPUT, $USER;
$id = optional_param('id', 0, PARAM_INT);
$switchrole = optional_param('switchrole', -1, PARAM_INT); // Deprecated, use course/switchrole.php instead.
$id = required_param('id', PARAM_INT);
$params = array('id' => $id);
$params = array();
if (!empty($id)) {