Gitlab CSE Unil

Commit 7113edc3 authored by M. Chardon's avatar M. Chardon
Browse files

typetool : libellé et configuration enabled

parent c8931d2c
......@@ -186,11 +186,11 @@ class admin_editor {
$tools = array();
$records = $DB->get_records('assignfeedback_editpp_tool', array('axis' => $axisid));
foreach ($records as $record) {
if ($record->id == $tool->id) {
array_push($tools, $tool);
} else {
array_push($tools, new tool($record));
}
//if ($record->id == $tool->id) {
// array_push($tools, $tool);
//} else {
array_push($tools, new tool($record));
//}
}
usort($tools, function($a, $b) {
$al = $a->order_tool;
......@@ -214,7 +214,7 @@ class admin_editor {
global $DB;
$tools = array();
$records = $DB->get_records('assignfeedback_editpp_tool', array('axis' => $data->axisid));
$records = $DB->get_records('assignfeedback_editpp_tool', array('axis' => $toolJson->axisid));
foreach ($records as $record) {
array_push($tools, new tool($record));
}
......@@ -265,4 +265,19 @@ class admin_editor {
return null;
}
/**
* Get all the type tools.
* @param array $contextidlist
* @return type_tool
*/
public static function get_typetools() {
global $DB;
$typetools = array();
$records = $DB->get_records('assignfeedback_editpp_typet', array('configurable' => 1));
foreach ($records as $record) {
array_push($typetools, new type_tool($record));
}
return $typetools;
}
}
......@@ -53,6 +53,9 @@ class type_tool {
/** @var int ending location of cartridge in pixels. Image resolution is 100 pixels per inch */
public $cartridge_y = 0;
/** @var type */
public $configurable = 1;
/**
* Convert a compatible stdClass into an instance of this class.
* @param stdClass $record
......
......@@ -24,6 +24,8 @@
*/
defined('MOODLE_INTERNAL') || die();
use assignfeedback_editpdfplus\type_tool;
/**
* EditPDF upgrade code
* @param int $oldversion
......@@ -36,10 +38,8 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
// 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.
......@@ -67,7 +67,6 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
// 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.
......@@ -87,5 +86,38 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017022700, 'assignfeedback', 'editpdfplus');
}
if ($oldversion < 2017071202) {
$table = new xmldb_table('assignfeedback_editpp_typet');
$field = new xmldb_field('configurable', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 1);
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;
$DB->update_record('assignfeedback_editpp_typet', $typeTool1);
$record2 = $DB->get_record('assignfeedback_editpp_typet', array('label' => 'oval'), '*', MUST_EXIST);
$typeTool2 = new type_tool($record2);
$typeTool2->configurable = 0;
$DB->update_record('assignfeedback_editpp_typet', $typeTool2);
$record3 = $DB->get_record('assignfeedback_editpp_typet', array('label' => 'rectangle'), '*', MUST_EXIST);
$typeTool3 = new type_tool($record3);
$typeTool3->configurable = 0;
$DB->update_record('assignfeedback_editpp_typet', $typeTool3);
$record4 = $DB->get_record('assignfeedback_editpp_typet', array('label' => 'line'), '*', MUST_EXIST);
$typeTool4 = new type_tool($record4);
$typeTool4->configurable = 0;
$DB->update_record('assignfeedback_editpp_typet', $typeTool4);
$record5 = $DB->get_record('assignfeedback_editpp_typet', array('label' => 'pen'), '*', MUST_EXIST);
$typeTool5 = new type_tool($record5);
$typeTool5->configurable = 0;
$DB->update_record('assignfeedback_editpp_typet', $typeTool5);
// Editpdf savepoint reached.
upgrade_plugin_savepoint(true, 2017071202, 'assignfeedback', 'editpdfplus');
}
return true;
}
......@@ -109,3 +109,9 @@ $string['editpdfplus:notify'] = 'Receive notifications';
$string['admintitle'] = 'Feedback configuration';
$string['adminsubtitle'] = 'Configuration of tools bar for advanded PDF annotation';
$string['admincurrenttoolbar'] = 'Current toolbar';
$string['typetool_highlightplus'] = 'Highlight with comment';
$string['typetool_stampplus'] = 'Stamp with custom text';
$string['typetool_frame'] = 'Framing elements with comment';
$string['typetool_verticalline'] = 'Vertical line with comment';
$string['typetool_stampcomment'] = 'Double arrow stamp with comment';
$string['typetool_commentplus'] = 'Advanced comment frame';
......@@ -109,5 +109,11 @@ $string['editpdfplus:notify'] = 'Recevoir les notifications';
$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';
$string['typetool_highlightplus'] = 'Surlignement avec commentaires';
$string['typetool_stampplus'] = 'Tampon avec contenu personalisé';
$string['typetool_frame'] = 'Encadrement d\'éléments avec commentaires';
$string['typetool_verticalline'] = 'Ligne verticale avec commentaires';
$string['typetool_stampcomment'] = 'Tamon double flèche avec commentaires';
$string['typetool_commentplus'] = 'Cadre de commentaire avancé';
......@@ -150,7 +150,10 @@ class assign_feedback_editpdfplus_admin {
$tool->removable = true;
$data->tool = $tool;
}
$data->tools = page_editor::get_typetools(null);
$data->tools = admin_editor::get_typetools();
foreach ($data->tools as $toolRef) {
$toolRef->libelle= get_string('typetool_'.$toolRef->label,'assignfeedback_editpdfplus');
}
$renderer = $PAGE->get_renderer('assignfeedback_editpdfplus');
//$formTool->courseid = $this->course->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin_toolform($data);
......
......@@ -38,7 +38,7 @@
<div class="col-sm-9">
<select class="form-control" id="typetool" name="typetool">
{{# tools }}
<option value='{{id}}'>{{label}}</option>
<option value='{{id}}'>{{libelle}}</option>
{{/ tools }}
</select>
</div>
......
......@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017071100;
$plugin->version = 2017071202;
$plugin->requires = 2017050500; // Requires this Moodle version.
$plugin->dependencies = array(
'assignfeedback_editpdf' => 2017050500
......
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