Gitlab CSE Unil

Commit 1daa79c5 authored by M. Chardon's avatar M. Chardon
Browse files

droits spécial pour modification de la barre d'outil

parent 27ebde12
......@@ -49,7 +49,7 @@ See this <a href="https://gitlabriset.unil.ch/Marion.Chardon/editpdfplus/wikis/c
An administrator profile will be able to give to a course the right to use this plugin or not.
1. Go to the course (or course category) permissions settings
2. Look for the ***mod/assignfeedback_editpdfplus:use*** capability
2. Look for the ***assignfeedback/editpdfplus:use*** capability
3. Add the manager, teacher and student roles to it
The 'Annotate PDF advanced' plugin will then be used in place of the standard 'Annotate PDF' plugin in the corresponding course (or course category), or wherever you give users this capability.
......
......@@ -167,7 +167,7 @@ if ($action === 'pollconversions') {
}
if ($refresh) {
$teachers = get_users_by_capability($context, 'mod/assignfeedback_editpdfplus:notify');
$teachers = get_users_by_capability($context, 'assignfeedback/editpdfplus:notify');
$contextb = $assignment->get_context();
$course = $assignment->get_course();
$coursemodule = $assignment->get_course_module();
......
......@@ -26,19 +26,47 @@
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'mod/assignfeedback_editpdfplus:use' => array(
/*'mod/assignfeedback_editpdfplus:use' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
)
),*/
/*'mod/assignfeedback_editpdfplus:notify' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW
)
),*/
/*'mod/assignfeedback_editpdfplus:managetools' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW
)
),*/
'assignfeedback/editpdfplus:use' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
)
),
'mod/assignfeedback_editpdfplus:notify' => array(
'assignfeedback/editpdfplus:notify' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW
)
),
'assignfeedback/editpdfplus:managetools' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW
)
)
);
......@@ -30,7 +30,7 @@ $functions = array(
'description' => 'Test add axis',
'type' => 'write',
'ajax' => true,
'requiredcapability' => 'mod/assignfeedback_editpdfplus:use',
'requiredcapability' => 'assignfeedback/editpdfplus:managetools',
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
......@@ -41,7 +41,7 @@ $functions = array(
'description' => 'Edit an axis',
'type' => 'write',
'ajax' => true,
'requiredcapability' => 'mod/assignfeedback_editpdfplus:use',
'requiredcapability' => 'assignfeedback/editpdfplus:managetools',
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
......@@ -52,7 +52,7 @@ $functions = array(
'description' => 'Remove an axis',
'type' => 'write',
'ajax' => true,
'requiredcapability' => 'mod/assignfeedback_editpdfplus:use',
'requiredcapability' => 'assignfeedback/editpdfplus:managetools',
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
......@@ -63,7 +63,7 @@ $functions = array(
'description' => 'Edit a tool',
'type' => 'write',
'ajax' => true,
'requiredcapability' => 'mod/assignfeedback_editpdfplus:use',
'requiredcapability' => 'assignfeedback/editpdfplus:managetools',
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
......@@ -74,7 +74,7 @@ $functions = array(
'description' => 'Add a tool',
'type' => 'write',
'ajax' => true,
'requiredcapability' => 'mod/assignfeedback_editpdfplus:use',
'requiredcapability' => 'assignfeedback/editpdfplus:managetools',
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
......@@ -85,7 +85,7 @@ $functions = array(
'description' => 'Remove a tool',
'type' => 'write',
'ajax' => true,
'requiredcapability' => 'mod/assignfeedback_editpdfplus:use',
'requiredcapability' => 'assignfeedback/editpdfplus:managetools',
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
......
......@@ -36,13 +36,7 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016021600) {
// Define table assignfeedback_editpdfplus_queue to be created.
......@@ -65,11 +59,7 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2016021600, 'assignfeedback', 'editpdfplus');
}
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2017022700) {
// Get orphaned, duplicate files and delete them.
......@@ -93,7 +83,7 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$record1 = $DB->get_record('assignfeedback_editpp_typet', array('label' => 'highlight'), '*', MUST_EXIST);
$typeTool1 = new type_tool($record1);
$typeTool1->configurable = 0;
......
......@@ -10,7 +10,7 @@ index a9a74e5..b87f347 100644
+ global $CFG;
+ if (file_exists($CFG->dirroot . '/mod/assign/feedback/editpdfplus/version.php')) {
+ if ($this->assignment->get_context()) {
+ return !has_capability('mod/assignfeedback_editpdfplus:use', $this->assignment->get_context(), null, false);
+ return !has_capability('assignfeedback/editpdfplus:use', $this->assignment->get_context(), null, false);
+ }
+ return false;
+ }
......
......@@ -106,6 +106,7 @@ $string['student_statut_nc'] = 'Todo';
$string['student_answer_lib'] = 'Answer';
$string['editpdfplus:use'] = 'Use the plugin';
$string['editpdfplus:notify'] = 'Receive notifications';
$string['editpdfplus:managetools'] = 'Manage toolbars';
$string['admintitle'] = 'Feedback configuration';
$string['adminsubtitle'] = 'Configuration of tools bar for advanded PDF annotation';
$string['admincurrenttoolbar'] = 'Current toolbar';
......
......@@ -65,7 +65,7 @@ $string['output'] = 'Output:';
$string['pagenumber'] = 'Page {$a}';
$string['pagexofy'] = '{$a->page} / {$a->total}';
$string['pen'] = 'Pen';
$string['pluginname'] = 'Annotate PDF advanced';
$string['pluginname'] = 'Annotation PDF avancé';
$string['generatingpdf'] = 'Génération du PDF...';
$string['rectangle'] = 'Rectangle';
$string['red'] = 'Red';
......@@ -106,6 +106,7 @@ $string['student_statut_nc'] = 'non traité';
$string['student_answer_lib'] = 'Réponse';
$string['editpdfplus:use'] = 'Utiliser le plugin';
$string['editpdfplus:notify'] = 'Recevoir les notifications';
$string['editpdfplus:managetools'] = 'Gérer les barres d\'outils';
$string['admintitle'] = 'Feedback configuration';
$string['adminsubtitle'] = 'Configuration de la barre d\'outils de l\'annotation PDF avancée';
$string['admincurrenttoolbar'] = 'Barre d\'outils en cours';
......
......@@ -101,7 +101,7 @@ function assignfeedback_editpdfplus_output_fragment_axisadd($args) {
}
require_once('locallib_admin.php');
if (has_capability('mod/assignfeedback_editpdfplus:use', $context, null, false)) {
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();
......@@ -121,7 +121,7 @@ function assignfeedback_editpdfplus_output_fragment_axisedit($args) {
}
require_once('locallib_admin.php');
if (has_capability('mod/assignfeedback_editpdfplus:use', $context, null, false)) {
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);
......@@ -141,7 +141,7 @@ function assignfeedback_editpdfplus_output_fragment_axisdel($args) {
}
require_once('locallib_admin.php');
if (has_capability('mod/assignfeedback_editpdfplus:use', $context, null, false)) {
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);
......@@ -161,7 +161,7 @@ function assignfeedback_editpdfplus_output_fragment_tooledit($args) {
}
require_once('locallib_admin.php');
if (has_capability('mod/assignfeedback_editpdfplus:use', $context, null, false)) {
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);
......@@ -181,7 +181,7 @@ function assignfeedback_editpdfplus_output_fragment_tooladd($args) {
}
require_once('locallib_admin.php');
if (has_capability('mod/assignfeedback_editpdfplus:use', $context, null, false)) {
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);
......
......@@ -295,7 +295,7 @@ class assign_feedback_editpdfplus extends assign_feedback_plugin {
if ($this->enabledcache === null) {
$testpath = assignfeedback_editpdfplus\pdf::test_gs_path(false);
if ($this->assignment->get_context()) {
$this->enabledcache = ($testpath->status == assignfeedback_editpdfplus\pdf::GSPATH_OK) && has_capability('mod/assignfeedback_editpdfplus:use', $this->assignment->get_context(), null, false);
$this->enabledcache = ($testpath->status == assignfeedback_editpdfplus\pdf::GSPATH_OK) && has_capability('assignfeedback/editpdfplus:use', $this->assignment->get_context(), null, false);
} else {
$this->enabledcache = false;
}
......
......@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017071202;
$plugin->version = 2017080910;
$plugin->requires = 2017050500; // Requires this Moodle version.
$plugin->dependencies = array(
'assignfeedback_editpdf' => 2017050500
......
......@@ -93,7 +93,7 @@ $PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
//$PAGE->start_collecting_javascript_requirements();
if (has_capability('mod/assignfeedback_editpdfplus:use', $context, null, false)) {
if (has_capability('assignfeedback/editpdfplus:managetools', $context, null, false)) {
$editpdfplus = new assign_feedback_editpdfplus_admin($context, $course);
echo $editpdfplus->view();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment