Gitlab CSE Unil

Commit a2807291 authored by M. Chardon's avatar M. Chardon
Browse files

creation formulaire admin custom tool type

parent ceb16053
......@@ -289,7 +289,10 @@ class admin_editor {
$typetools = array();
$records = $DB->get_records('assignfeedback_editpp_typet', array('configurable' => 1));
foreach ($records as $record) {
array_push($typetools, new type_tool($record));
$newTypeTool = page_editor::custom_type_tool(new type_tool($record));
if ($newTypeTool->configurable > 0) {
array_push($typetools, $newTypeTool);
}
}
return $typetools;
}
......
......@@ -106,6 +106,7 @@ class combined_document {
case \core_files\conversion::STATUS_IN_PROGRESS:
case \core_files\conversion::STATUS_PENDING:
$pending = true;
break;
case \core_files\conversion::STATUS_FAILED:
return self::STATUS_FAILED;
......
......@@ -91,7 +91,8 @@ class page_editor {
global $DB;
$record = $DB->get_record('assignfeedback_editpp_typet', array('id' => $tooltypeid));
if ($record) {
return new type_tool($record);
$newTypeTool = new type_tool($record);
return page_editor::custom_type_tool($newTypeTool);
}
return false;
}
......@@ -110,7 +111,8 @@ class page_editor {
$records = $DB->get_records('assignfeedback_editpp_typet');
}
foreach ($records as $record) {
array_push($typetools, new type_tool($record));
$newToolType = new type_tool($record);
array_push($typetools, page_editor::custom_type_tool($newToolType));
}
return $typetools;
}
......@@ -395,10 +397,10 @@ class page_editor {
$annotation->gradeid = $grade->id;
$DB->insert_record('assignfeedback_editpp_annot', $annotation);
}
/*foreach ($comments as $comment) {
$comment->gradeid = $grade->id;
$DB->insert_record('assignfeedback_editpp_cmnt', $comment);
}*/
/* foreach ($comments as $comment) {
$comment->gradeid = $grade->id;
$DB->insert_record('assignfeedback_editpp_cmnt', $comment);
} */
$fs = get_file_storage();
......@@ -466,4 +468,127 @@ class page_editor {
return $DB->get_record('assignfeedback_comments', array('grade' => $gradeid));
}
public static function custom_type_tool(type_tool $newToolType) {
global $CFG;
switch ($newToolType->label) {
case 'highlightplus':
if (isset($CFG->highlightplus_configurable) && (intval($CFG->highlightplus_configurable) == 0 || intval($CFG->highlightplus_configurable) == 1)) {
if (intval($CFG->highlightplus_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}
if (isset($CFG->highlightplus_color) && $CFG->highlightplus_color != null && strlen($CFG->highlightplus_color) > 4) {
$newToolType->color = $CFG->highlightplus_color;
}
if (isset($CFG->highlightplus_cartridge_color) && $CFG->highlightplus_cartridge_color != null && strlen($CFG->highlightplus_cartridge_color) > 4) {
$newToolType->cartridge_color = $CFG->highlightplus_cartridge_color;
}
if (isset($CFG->highlightplus_cartridge_x) && (intval($CFG->highlightplus_cartridge_x) || $CFG->highlightplus_cartridge_x == '0')) {
$newToolType->cartridge_x = intval($CFG->highlightplus_cartridge_x);
}
if (isset($CFG->highlightplus_cartridge_y) && (intval($CFG->highlightplus_cartridge_y) || $CFG->highlightplus_cartridge_y == '0')) {
$newToolType->cartridge_y = intval($CFG->highlightplus_cartridge_y);
}
break;
case 'stampplus':
if (isset($CFG->stampplus_configurable) && (intval($CFG->stampplus_configurable) == 0 || intval($CFG->stampplus_configurable) == 1)) {
if (intval($CFG->stampplus_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}
if (isset($CFG->stampplus_color) && $CFG->stampplus_color != null && strlen($CFG->stampplus_color) > 4) {
$newToolType->color = $CFG->stampplus_color;
}
break;
case 'frame':
if (isset($CFG->frame_configurable) && (intval($CFG->frame_configurable) == 0 || intval($CFG->frame_configurable) == 1)) {
if (intval($CFG->frame_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}
if (isset($CFG->frame_cartridge_x) && (intval($CFG->frame_cartridge_x) || $CFG->frame_cartridge_x == '0')) {
$newToolType->cartridge_x = intval($CFG->frame_cartridge_x);
}
if (isset($CFG->frame_cartridge_y) && (intval($CFG->frame_cartridge_y) || $CFG->frame_cartridge_y == '0')) {
$newToolType->cartridge_y = intval($CFG->frame_cartridge_y);
}
break;
case 'verticalline':
if (isset($CFG->verticalline_configurable) && (intval($CFG->verticalline_configurable) == 0 || intval($CFG->verticalline_configurable) == 1)) {
if (intval($CFG->verticalline_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}
if (isset($CFG->verticalline_color) && $CFG->verticalline_color != null && strlen($CFG->verticalline_color) > 4) {
$newToolType->color = $CFG->verticalline_color;
}
if (isset($CFG->verticalline_cartridge_color) && $CFG->verticalline_cartridge_color != null && strlen($CFG->verticalline_cartridge_color) > 4) {
$newToolType->cartridge_color = $CFG->verticalline_cartridge_color;
}
if (isset($CFG->verticalline_cartridge_x) && (intval($CFG->verticalline_cartridge_x) || $CFG->verticalline_cartridge_x == '0')) {
$newToolType->cartridge_x = intval($CFG->verticalline_cartridge_x);
}
if (isset($CFG->verticalline_cartridge_y) && (intval($CFG->verticalline_cartridge_y) || $CFG->verticalline_cartridge_y == '0')) {
$newToolType->cartridge_y = intval($CFG->verticalline_cartridge_y);
}
break;
case 'stampcomment':
if (isset($CFG->stampcomment_configurable) && (intval($CFG->stampcomment_configurable) == 0 || intval($CFG->stampcomment_configurable) == 1)) {
if (intval($CFG->stampcomment_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}
if (isset($CFG->stampcomment_color) && $CFG->stampcomment_color != null && strlen($CFG->stampcomment_color) > 4) {
$newToolType->color = $CFG->stampcomment_color;
}
if (isset($CFG->stampcomment_cartridge_color) && $CFG->stampcomment_cartridge_color != null && strlen($CFG->stampcomment_cartridge_color) > 4) {
$newToolType->cartridge_color = $CFG->stampcomment_cartridge_color;
}
if (isset($CFG->stampcomment_cartridge_x) && (intval($CFG->stampcomment_cartridge_x) || $CFG->stampcomment_cartridge_x == '0')) {
$newToolType->cartridge_x = intval($CFG->stampcomment_cartridge_x);
}
if (isset($CFG->stampcomment_cartridge_y) && (intval($CFG->stampcomment_cartridge_y) || $CFG->stampcomment_cartridge_y == '0')) {
$newToolType->cartridge_y = intval($CFG->stampcomment_cartridge_y);
}
break;
case 'commentplus':
if (isset($CFG->commentplus_configurable) && (intval($CFG->commentplus_configurable) == 0 || intval($CFG->commentplus_configurable) == 1)) {
if (intval($CFG->commentplus_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}
if (isset($CFG->commentplus_cartridge_color) && $CFG->commentplus_cartridge_color != null && strlen($CFG->commentplus_cartridge_color) > 4) {
$newToolType->cartridge_color = intval($CFG->commentplus_cartridge_color);
}
if (isset($CFG->commentplus_cartridge_x) && (intval($CFG->commentplus_cartridge_x) || $CFG->commentplus_cartridge_x == '0')) {
$newToolType->cartridge_x = intval($CFG->commentplus_cartridge_x);
}
if (isset($CFG->commentplus_cartridge_y) && (intval($CFG->commentplus_cartridge_y) || $CFG->commentplus_cartridge_y == '0')) {
$newToolType->cartridge_y = intval($CFG->commentplus_cartridge_y);
}
break;
default:
break;
}
return $newToolType;
}
}
......@@ -149,3 +149,19 @@ $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';
$string['typetool_highlightplus_desc'] = 'Default configuration for tool "highlight with comment"';
$string['typetool_stampplus_desc'] = 'Default configuration for tool "stamp with custom text"';
$string['typetool_frame_desc'] = 'Default configuration for tool "framing elements with comment"';
$string['typetool_verticalline_desc'] = 'Default configuration for tool "vertical line with comment"';
$string['typetool_stampcomment_desc'] = 'Default configuration for tool "double arrow stamp with comment"';
$string['typetool_commentplus_desc'] = 'Default configuration for tool "advanced comment frame"';
$string['is_not_configurable'] = 'Is not configurable';
$string['is_not_configurable_desc'] = 'If checked, users won\'t be eabled to create or custom some tools from this type';
$string['adminplugin_color'] = 'Color';
$string['adminplugin_color_desc'] = 'Annotation\'s color';
$string['adminplugin_cartridge_color'] = 'Cartridge color';
$string['adminplugin_cartridge_color_desc'] = 'Cartridge\'s color';
$string['adminplugin_cartridge_x'] = 'Horizontal relative offset';
$string['adminplugin_cartridge_x_desc'] = 'Horizontal relative offset of the cartridge relative to the annotation in px';
$string['adminplugin_cartridge_y'] = 'Vertical relative offset';
$string['adminplugin_cartridge_y_desc'] = 'Vertical relative offset of the cartridge relative to the annotation in px';
......@@ -149,5 +149,21 @@ $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é';
$string['typetool_highlightplus_desc'] = 'Configuration par défaut de l\'outil "surlignement avec commentaires"';
$string['typetool_stampplus_desc'] = 'Configuration par défaut de l\'outil "tampon avec contenu personalisé"';
$string['typetool_frame_desc'] = 'Configuration par défaut de l\'outil "encadrement d\'éléments avec commentaires"';
$string['typetool_verticalline_desc'] = 'Configuration par défaut de l\'outil "ligne verticale avec commentaires"';
$string['typetool_stampcomment_desc'] = 'Configuration par défaut de l\'outil "tamon double flèche avec commentaires"';
$string['typetool_commentplus_desc'] = 'Configuration par défaut de l\'outil "cadre de commentaire avancé"';
$string['is_not_configurable'] = 'N\'est pas configurable';
$string['is_not_configurable_desc'] = 'Si coché, les utilisateurs ne pouront pas créer ou personaliser des outils à partir de ce type';
$string['adminplugin_color'] = 'Couleur';
$string['adminplugin_color_desc'] = 'Couleur de l\'annotation';
$string['adminplugin_cartridge_color'] = 'Couleur cartouche';
$string['adminplugin_cartridge_color_desc'] = 'Couleur du cartouche';
$string['adminplugin_cartridge_x'] = 'Décalage relatif horizontal';
$string['adminplugin_cartridge_x_desc'] = 'Décalage relatif horizontal du cartouche par rapport à l\'annotation en px';
$string['adminplugin_cartridge_y'] = 'Décalage relatif vertical';
$string['adminplugin_cartridge_y_desc'] = 'Décalage relatif vertical du cartouche par rapport à l\'annotation en px';
......@@ -35,5 +35,40 @@ $link = html_writer::link($url, get_string('testgs', 'assignfeedback_editpdfplus
$settings->add(new admin_setting_heading('testgs', '', $link));
//$settings->add(new admin_setting_configtext("unsetting", "le nom ici", "description", 50, PARAM_INT, 20));
$settings->add(new admin_setting_heading('highlightplus',get_string('typetool_highlightplus','assignfeedback_editpdfplus'),get_string('typetool_highlightplus_desc','assignfeedback_editpdfplus')));
$settings->add(new admin_setting_configcheckbox('highlightplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('highlightplus_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#FFFF40'));
$settings->add(new admin_setting_configcolourpicker('highlightplus_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#FF6F40'));
$settings->add(new admin_setting_configtext('highlightplus_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configtext('highlightplus_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),-24));
$settings->add(new admin_setting_heading('stampplus',get_string('typetool_stampplus','assignfeedback_editpdfplus'),get_string('typetool_stampplus_desc','assignfeedback_editpdfplus')));
$settings->add(new admin_setting_configcheckbox('stampplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('stampplus_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#FF0000'));
$settings->add(new admin_setting_heading('frame',get_string('typetool_frame','assignfeedback_editpdfplus'),get_string('typetool_frame_desc','assignfeedback_editpdfplus')));
$settings->add(new admin_setting_configcheckbox('frame_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configtext('frame_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),5));
$settings->add(new admin_setting_configtext('frame_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),-8));
$settings->add(new admin_setting_heading('verticalline',get_string('typetool_verticalline','assignfeedback_editpdfplus'),get_string('typetool_verticalline_desc','assignfeedback_editpdfplus')));
$settings->add(new admin_setting_configcheckbox('verticalline_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('verticalline_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#0000FF'));
$settings->add(new admin_setting_configcolourpicker('verticalline_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#0000FF'));
$settings->add(new admin_setting_configtext('verticalline_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),5));
$settings->add(new admin_setting_configtext('verticalline_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_heading('stampcomment',get_string('typetool_stampcomment','assignfeedback_editpdfplus'),get_string('typetool_stampcomment_desc','assignfeedback_editpdfplus')));
$settings->add(new admin_setting_configcheckbox('stampcomment_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('stampcomment_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#000099'));
$settings->add(new admin_setting_configcolourpicker('stampcomment_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#000099'));
$settings->add(new admin_setting_configtext('stampcomment_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),35));
$settings->add(new admin_setting_configtext('stampcomment_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),6));
$settings->add(new admin_setting_heading('commentplus',get_string('typetool_commentplus','assignfeedback_editpdfplus'),get_string('typetool_commentplus_desc','assignfeedback_editpdfplus')));
$settings->add(new admin_setting_configcheckbox('commentplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('commentplus_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#000000'));
$settings->add(new admin_setting_configtext('commentplus_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),35));
$settings->add(new admin_setting_configtext('commentplus_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),6));
//get_config("ass:::", "unsetting")
\ No newline at end of file
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