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 ...@@ -242,7 +242,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("input[name^='toolid']").val(currentButtonId); $("input[name^='toolid']").val(currentButtonId);
$("input[name^='nexttoolid']").val(nextButtonId); $("input[name^='nexttoolid']").val(nextButtonId);
var form = $('#assignfeedback_editpdfplus_order_tool'); var form = $('#assignfeedback_editpdfplus_order_tool');
var data = form.serialize() + "&courseid=" + $("#courseid").val(); var data = form.serialize() + "&contextid=" + contextid;
ajax.call([ ajax.call([
{ {
methodname: 'assignfeedback_editpdfplus_submit_tool_order_form', methodname: 'assignfeedback_editpdfplus_submit_tool_order_form',
...@@ -517,7 +517,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -517,7 +517,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
if (axisimportid && parseInt(axisimportid) > 0) { if (axisimportid && parseInt(axisimportid) > 0) {
$("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(axisimportid); $("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(axisimportid);
var form = $('#assignfeedback_editpdfplus_import_axis'); var form = $('#assignfeedback_editpdfplus_import_axis');
var data = form.serialize() + "&courseid=" + $("#courseid").val(); var data = form.serialize() + "&contextid=" + contextid;
ajax.call([ ajax.call([
{ {
methodname: 'assignfeedback_editpdfplus_submit_axis_import_form', methodname: 'assignfeedback_editpdfplus_submit_axis_import_form',
......
...@@ -187,11 +187,13 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -187,11 +187,13 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$toolbarAxis = $statuschoice; $toolbarAxis = $statuschoice;
// Toolbar pour lien creation palette et aide // Toolbar pour lien creation palette et aide
$courseid = $this->page->course->id; $parentContext = $this->page->context->get_parent_context();
$lienAdmin = new moodle_url('/mod/assign/feedback/editpdfplus/view_admin.php', array('id' => $courseid)); if ($parentContext->contextlevel == CONTEXT_COURSE) {
$toolbarAdmin = $this->render_toolbar_button_html($this->render_toolbar_button_icon("fa-wrench"), array( $lienAdmin = new moodle_url('/mod/assign/feedback/editpdfplus/view_admin.php', array('id' => $parentContext->id));
self::HTMLCLASS => 'btn btn-outline-info', $toolbarAdmin = $this->render_toolbar_button_html($this->render_toolbar_button_icon("fa-wrench"), array(
'onclick' => "document.location='" . $lienAdmin->out() . "';")); 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')); $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"); $toolbarAdminBlock = $this->render_toolbar($toolbarAdmin, "mr-3");
} else { } else {
...@@ -245,7 +247,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -245,7 +247,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
//help message //help message
$helpmessageTitle = html_writer::div(get_string('help_title', self::PLUGIN_NAME), null, array('id' => 'afppHelpmessageTitle')); $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')); $helpmessageBody = html_writer::div($helpmessagecontent, null, array('id' => 'afppHelpmessageBody'));
$helpmessageDiv = html_writer::div($helpmessageTitle . $helpmessageBody, 'helpmessage'); $helpmessageDiv = html_writer::div($helpmessageTitle . $helpmessageBody, 'helpmessage');
$canvas .= $helpmessageDiv; $canvas .= $helpmessageDiv;
......
...@@ -49,16 +49,14 @@ class widget_admin implements renderable, templatable { ...@@ -49,16 +49,14 @@ class widget_admin implements renderable, templatable {
/** /**
* Constructor * Constructor
* @param type $context * @param type $context
* @param type $course
* @param type $userid - The user id we are grading * @param type $userid - The user id we are grading
* @param type $toolbars * @param type $toolbars
* @param type $axis - the different axis to display * @param type $axis - the different axis to display
* @param type $typetools * @param type $typetools
* @param type $toolbarsDispo * @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->context = $context;
$this->course = $course;
$this->userid = $userid; $this->userid = $userid;
$this->toolbars = $toolbars; $this->toolbars = $toolbars;
$this->axis = $axis; $this->axis = $axis;
......
...@@ -41,7 +41,7 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -41,7 +41,7 @@ class assignfeedback_editpdfplus_external extends external_api {
const DATAJSON = 'jsonformdata'; const DATAJSON = 'jsonformdata';
const MESSAGELIB = 'message'; const MESSAGELIB = 'message';
const COURSELIB = "course"; const COURSELIB = "course";
const COURSEID = "courseid"; const CONTEXTID = "contextid";
const AXEID = "axeid"; const AXEID = "axeid";
const AXEIDDESC = "Axe ID"; const AXEIDDESC = "Axe ID";
const AXELIB = "axelabel"; const AXELIB = "axelabel";
...@@ -122,13 +122,12 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -122,13 +122,12 @@ class assignfeedback_editpdfplus_external extends external_api {
* Set Page context from the course id given. It returns the context found. * Set Page context from the course id given. It returns the context found.
* @global $DB * @global $DB
* @global $PAGE * @global $PAGE
* @param int $courseid Current course id * @param int $contextid Current context id
* @return context course's context * @return context course's context
*/ */
public static function setPageContext($courseid) { public static function setPageContext($contextid) {
global $DB, $PAGE; global $PAGE;
$course = $DB->get_record(self::COURSELIB, array('id' => $courseid), '*', MUST_EXIST); $context = context::instance_by_id($contextid, MUST_EXIST);
$context = context_course::instance($course->id, MUST_EXIST);
$PAGE->set_context($context); $PAGE->set_context($context);
return $context; return $context;
} }
...@@ -153,7 +152,7 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -153,7 +152,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_axis_form($jsonformdata) { public static function submit_axis_form($jsonformdata) {
$data = self::getParseData(self::submit_axis_form_parameters(), $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; $customdata = (object) $data;
$formparams = array($customdata); $formparams = array($customdata);
...@@ -206,7 +205,7 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -206,7 +205,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_axis_del_form($jsonformdata) { public static function submit_axis_del_form($jsonformdata) {
$data = self::getParseData(self::submit_axis_form_parameters(), $jsonformdata); $data = self::getParseData(self::submit_axis_form_parameters(), $jsonformdata);
self::setPageContext($data[self::COURSEID]); self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data; $customdata = (object) $data;
$formparams = array($customdata); $formparams = array($customdata);
...@@ -244,7 +243,7 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -244,7 +243,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_tool_form($jsonformdata, $mode) { public static function submit_tool_form($jsonformdata, $mode) {
$data = self::getParseData(self::submit_axis_form_parameters(), $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; $customdata = (object) $data;
...@@ -334,7 +333,7 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -334,7 +333,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_tool_del_form($jsonformdata) { public static function submit_tool_del_form($jsonformdata) {
$data = self::getParseData(self::submit_axis_form_parameters(), $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; $customdata = (object) $data;
...@@ -382,7 +381,7 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -382,7 +381,7 @@ class assignfeedback_editpdfplus_external extends external_api {
$data = self::getParseData(self::submit_axis_import_form_parameters(), $jsonformdata); $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; $customdata = (object) $data;
$formparams = array($customdata); $formparams = array($customdata);
...@@ -451,7 +450,7 @@ class assignfeedback_editpdfplus_external extends external_api { ...@@ -451,7 +450,7 @@ class assignfeedback_editpdfplus_external extends external_api {
public static function submit_tool_order_form($jsonformdata) { public static function submit_tool_order_form($jsonformdata) {
$data = self::getParseData(self::submit_tool_order_form_parameters(), $jsonformdata); $data = self::getParseData(self::submit_tool_order_form_parameters(), $jsonformdata);
self::setPageContext($data[self::COURSEID]); self::setPageContext($data[self::CONTEXTID]);
$customdata = (object) $data; $customdata = (object) $data;
......
...@@ -185,6 +185,8 @@ $string['help_highlight'] = 'Highlight an item in the document'; ...@@ -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_verticalline'] = 'Click drag a vertical line in the document';
$string['help_stamp'] = 'Click where to place the stamp'; $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['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['assignmentgradedsubject'] = '[Moodle] Assignment updated';
$string['assignmentgradedbody'] = '{$a->coursename} → {$a->modulename} → {$a->assignmentname} $string['assignmentgradedbody'] = '{$a->coursename} → {$a->modulename} → {$a->assignmentname}
......
...@@ -184,3 +184,11 @@ $string['help_highlight'] = 'Surligner un élément dans le document'; ...@@ -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_verticalline'] = 'Cliquer glisser une ligne verticale dans le document';
$string['help_stamp'] = 'Cliquer à l\'endroit où placer le tampon'; $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['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 @@ ...@@ -23,7 +23,6 @@
* The code is based on mod/assign/feedback/editpdf/lib.php by Davo Smith. * 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 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
/** /**
...@@ -39,8 +38,8 @@ 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 * @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()) { 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'); require_once($CFG->dirroot . '/mod/assign/locallib.php');
if ($context->contextlevel == CONTEXT_MODULE) { if ($context->contextlevel == CONTEXT_MODULE) {
...@@ -82,7 +81,7 @@ function assignfeedback_editpdfplus_pluginfile($course, $cm, context $context, $ ...@@ -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) { 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)) { 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', "")); $feedbackadminnode = navigation_node::create('Feedback : configuration', $url, navigation_node::TYPE_CUSTOM, 'Bars d\'outils', 'editpdfplusadmin', new pix_icon('i/grades', ""));
$navigation->add_node($feedbackadminnode); $navigation->add_node($feedbackadminnode);
} }
...@@ -90,124 +89,79 @@ function assignfeedback_editpdfplus_extend_navigation_course(navigation_node $na ...@@ -90,124 +89,79 @@ function assignfeedback_editpdfplus_extend_navigation_course(navigation_node $na
/** /**
* Get axis form (add) * Get axis form (add)
* @global $DB
* @param type $args * @param type $args
*/ */
function assignfeedback_editpdfplus_output_fragment_axisadd($args) { function assignfeedback_editpdfplus_output_fragment_axisadd($args) {
global $DB;
$context = $args['context']; $context = $args['context'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php'); require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) { require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getAxisForm();
}
return null; $editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getAxisForm();
} }
/** /**
* Get axis form (edit) * Get axis form (edit)
* @global $DB
* @param type $args * @param type $args
*/ */
function assignfeedback_editpdfplus_output_fragment_axisedit($args) { function assignfeedback_editpdfplus_output_fragment_axisedit($args) {
global $DB;
$context = $args['context']; $context = $args['context'];
$axisid = $args['axeid']; $axisid = $args['axeid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php'); require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) { require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getAxisForm($axisid);
}
return null; $editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getAxisForm($axisid);
} }
/** /**
* Get axis form (delete) * Get axis form (delete)
* @global $DB
* @param type $args * @param type $args
*/ */
function assignfeedback_editpdfplus_output_fragment_axisdel($args) { function assignfeedback_editpdfplus_output_fragment_axisdel($args) {
global $DB;
$context = $args['context']; $context = $args['context'];
$axisid = $args['axeid']; $axisid = $args['axeid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php'); require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) { require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getAxisDelForm($axisid);
}
return null; $editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getAxisDelForm($axisid);
} }
/** /**
* Get tool form (edit) * Get tool form (edit)
* @global $DB
* @param type $args * @param type $args
*/ */
function assignfeedback_editpdfplus_output_fragment_tooledit($args) { function assignfeedback_editpdfplus_output_fragment_tooledit($args) {
global $DB;
$context = $args['context']; $context = $args['context'];
$toolid = $args['toolid']; $toolid = $args['toolid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php'); require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) { require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getToolForm($toolid);
}
return null; $editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getToolForm($toolid);
} }
/** /**
* Get tool form (add) * Get tool form (add)
* @global $DB
* @param type $args * @param type $args
*/ */
function assignfeedback_editpdfplus_output_fragment_tooladd($args) { function assignfeedback_editpdfplus_output_fragment_tooladd($args) {
global $DB;
$context = $args['context']; $context = $args['context'];
$axisid = $args['axisid']; $axisid = $args['axisid'];
if ($context->contextlevel != CONTEXT_COURSE) {
return null;
}
require_once('locallib_admin.php'); require_once('locallib_admin.php');
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) { require_capability('assignfeedback/editpdfplus:managetools', $context, null, true, get_string('admin_access_error', 'assignfeedback_editpdfplus'));
$course = $DB->get_record('course', array('id' => $context->instanceid), '*', MUST_EXIST);
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
return $editpdfplus->getToolForm(null, $axisid);
}
return null; $editpdfplus = new assign_feedback_editpdfplus_admin($context);
return $editpdfplus->getToolForm(null, $axisid);
} }
...@@ -37,15 +37,11 @@ class assign_feedback_editpdfplus_admin { ...@@ -37,15 +37,11 @@ class assign_feedback_editpdfplus_admin {
const PLUGIN_NAME = "assignfeedback_editpdfplus"; const PLUGIN_NAME = "assignfeedback_editpdfplus";
/** @var stdClass $course current course */
private $course = null;
/** @var stdClass $context current context */ /** @var stdClass $context current context */
private $context = null; private $context = null;
function __construct(stdClass $context, stdClass $course) { function __construct(stdClass $context) {
$this->context = $context; $this->context = $context;
$this->course = $course;
} }
/** /**
...@@ -59,22 +55,21 @@ class assign_feedback_editpdfplus_admin { ...@@ -59,22 +55,21 @@ class assign_feedback_editpdfplus_admin {
$html = ''; $html = '';
$renderer = $PAGE->get_renderer(self::PLUGIN_NAME); $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->id = "assignfeedback_editpdfplus_import_axis";
$axisimportform->title = ""; $axisimportform->title = "";
$axisimportform->action = "import"; $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->id = "assignfeedback_editpdfplus_order_tool";
$toolorderform->title = ""; $toolorderform->title = "";
$toolorderform->action = "order"; $toolorderform->action = "order";
$widget = $this->get_widget(); $widget = $this->get_widget();
$widget->axisimportform = $axisimportform; $widget->axisimportform = $axisimportform;
$widget->toolorderform = $toolorderform; $widget->toolorderform = $toolorderform;
$widget->courseid = $this->course->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin($widget); $html .= $renderer->render_assignfeedback_editpdfplus_widget_admin($widget);
return $html; return $html;
} }
/** /**
* Buid axis moodleform * Buid axis moodleform
* @global $PAGE * @global $PAGE
...@@ -93,20 +88,20 @@ class assign_feedback_editpdfplus_admin { ...@@ -93,20 +88,20 @@ class assign_feedback_editpdfplus_admin {
$axis = $DB->get_record('assignfeedback_editpp_axis', array('id' => $axeid), '*', MUST_EXIST); $axis = $DB->get_record('assignfeedback_editpp_axis', array('id' => $axeid), '*', MUST_EXIST);
} }
if ($axis != null) { 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->set_data(array('axeid' => $axeid, 'label' => $axis->label));
$formAxis->id = "assignfeedback_editpdfplus_edit_axis"; $formAxis->id = "assignfeedback_editpdfplus_edit_axis";
$formAxis->title = "Renommer l'axe"; $formAxis->title = "Renommer l'axe";
$formAxis->action = "edit"; $formAxis->action = "edit";
} else { } 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->set_data($toform);
$formAxis->id = "assignfeedback_editpdfplus_add_axis"; $formAxis->id = "assignfeedback_editpdfplus_add_axis";
$formAxis->title = "Ajouter un nouvel axe"; $formAxis->title = "Ajouter un nouvel axe";
$formAxis->action = "add"; $formAxis->action = "add";
} }
$renderer = $PAGE->get_renderer(self::PLUGIN_NAME); $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); $html .= $renderer->render_assignfeedback_editpdfplus_widget_admin_axisform($formAxis);
return $html; return $html;
} }
...@@ -128,14 +123,14 @@ class assign_feedback_editpdfplus_admin { ...@@ -128,14 +123,14 @@ class assign_feedback_editpdfplus_admin {
$axis = $DB->get_record('assignfeedback_editpp_axis', array('id' => $axeid), '*', MUST_EXIST); $axis = $DB->get_record('assignfeedback_editpp_axis', array('id' => $axeid), '*', MUST_EXIST);
} }
if ($axis != null) { 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->set_data(array('axeid' => $axeid, 'label' => $axis->label));
} }
$formAxis->id = "assignfeedback_editpdfplus_del_axis"; $formAxis->id = "assignfeedback_editpdfplus_del_axis";
$formAxis->title = "Supprimer l'axe"; $formAxis->title = "Supprimer l'axe";
$formAxis->action = "del"; $formAxis->action = "del";
$renderer = $PAGE->get_renderer(self::PLUGIN_NAME); $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); $html .= $renderer->render_assignfeedback_editpdfplus_widget_admin_axisdelform($formAxis);
return $html; return $html;
} }
...@@ -153,7 +148,7 @@ class assign_feedback_editpdfplus_admin { ...@@ -153,7 +148,7 @@ class assign_feedback_editpdfplus_admin {