Gitlab CSE Unil

Commit 17572fc3 authored by M. Chardon's avatar M. Chardon
Browse files

internationalisation + comment php files

parent dc597514
......@@ -54,7 +54,11 @@ class annotation {
/** @var int ending location in pixels. Image resolution is 100 pixels per inch */
public $endy = 0;
/** @var int starting location of cartridge in pixels. Image resolution is 100 pixels per inch */
public $cartridgex = 0;
/** @var int ending location of cartridge in pixels. Image resolution is 100 pixels per inch */
public $cartridgey = 0;
/** @var string path information for drawing the annotation. */
......
......@@ -23,7 +23,8 @@ class axis {
/** @var int axis for this annotation */
public $label = '';
/** @var int order in toolbar */
public $order = 1000;
/**
......
......@@ -28,6 +28,7 @@ namespace assignfeedback_editpdfplus;
* This class represents a comment box on a page of feedback.
* @copyright 2012 Davo Smith
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated since version 2016101700
*/
class comment {
......
......@@ -31,6 +31,7 @@ namespace assignfeedback_editpdfplus;
* @package assignfeedback_editpdfplus
* @copyright 2012 Davo Smith
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated since version 2016101700
*/
class comments_quick_list {
......
......@@ -653,12 +653,12 @@ EOD;
for ($i = 0; $i < $pagecount; $i++) {
$pdf->copy_page();
$comments = page_editor::get_comments($grade->id, $i, false);
//$comments = page_editor::get_comments($grade->id, $i, false);
$annotations = page_editor::get_annotations($grade->id, $i, false);
foreach ($comments as $comment) {
/*foreach ($comments as $comment) {
$pdf->add_comment($comment->rawtext, $comment->x, $comment->y, $comment->width, $comment->colour);
}
}*/
foreach ($annotations as $annotation) {
$pdf->add_annotation($annotation, $annotation->path, $stamptmpdir, $compteur);
......@@ -668,6 +668,8 @@ EOD;
}
}
}
//add feedback by annotation
$pdf->AddPage();
$pdf->SetTextColor(0, 0, 0);
$pdf->Write(10, "", '', false, 'L', true);
......@@ -708,6 +710,7 @@ EOD;
$pdf->Write(0, "", '', false, 'L', true);
}
}
//add general feedback in last page
$pdf->AddPage();
$pdf->SetTextColor(0, 0, 0);
$pdf->Write(10, "", '', false, 'L', true);
......
......@@ -44,6 +44,7 @@ class page_editor {
* @param int $pageno
* @param bool $draft
* @return comment[]
* @deprecated since version 2016101700
*/
public static function get_comments($gradeid, $pageno, $draft) {
global $DB;
......@@ -67,6 +68,7 @@ class page_editor {
* @param int $pageno
* @param comment[] $comments
* @return int - the number of comments.
* @deprecated since version 2016101700
*/
public static function set_comments($gradeid, $pageno, $comments) {
global $DB;
......@@ -99,6 +101,7 @@ class page_editor {
* Get a single comment by id.
* @param int $commentid
* @return comment or false
* @deprecated since version 2016101700
*/
public static function get_comment($commentid) {
$record = $DB->get_record('assignfeedback_editpp_cmnt', array('id' => $commentid), '*', IGNORE_MISSING);
......@@ -112,6 +115,7 @@ class page_editor {
* Add a comment to a page.
* @param comment $comment
* @return bool
* @deprecated since version 2016101700
*/
public static function add_comment(comment $comment) {
global $DB;
......@@ -123,6 +127,7 @@ class page_editor {
* Remove a comment from a page.
* @param int $commentid
* @return bool
* @deprecated since version 2016101700
*/
public static function remove_comment($commentid) {
global $DB;
......@@ -174,7 +179,7 @@ class page_editor {
}
/**
* Get the tool with id tooltypeid.
* Get the tool type with id tooltypeid.
* @param int $tooltypeid
* @return type_tool
*/
......@@ -187,6 +192,11 @@ class page_editor {
return false;
}
/**
* Get all the type tools.
* @param array $contextidlist
* @return type_tool
*/
public static function get_typetools($contextidlist) {
global $DB;
$typetools = array();
......@@ -202,9 +212,8 @@ class page_editor {
}
/**
* Get all tools for a page.
* @param int $contextid
* @param int $axis
* Get all axis for contextid.
* @param array $contextidlist optional
* @return axis[]
*/
public static function get_axis($contextidlist) {
......@@ -295,7 +304,13 @@ class page_editor {
return $added;
}
public static function update_annotations_status($gradeid, $annotations) {
/**
* Update a set of annotations to database
* @global $DB
* @param annotation[] $annotations
* @return int number of rows updated
*/
public static function update_annotations_status($annotations) {
global $DB;
$added = 0;
foreach ($annotations as $recordtmp) {
......@@ -303,7 +318,7 @@ class page_editor {
$old = $record->studentstatus;
$record->studentstatus = $recordtmp->studentstatus;
$record->studentanswer = $recordtmp->studentanswer;
debugging($recordtmp->id . ' - ' . $record->id . ' - ' . $old . ' | ' . $recordtmp->studentstatus . ' - ' . $record->studentstatus. ' | ' . $recordtmp->studentanswer . ' - ' . $record->studentanswer);
debugging($recordtmp->id . ' - ' . $record->id . ' - ' . $old . ' | ' . $recordtmp->studentstatus . ' - ' . $record->studentstatus . ' | ' . $recordtmp->studentanswer . ' - ' . $record->studentanswer);
$DB->update_record('assignfeedback_editpp_annot', $record);
$added++;
}
......@@ -547,7 +562,7 @@ class page_editor {
*/
public function get_feedback_comments($gradeid) {
global $DB;
return $DB->get_record('assignfeedback_comments', array('grade'=>$gradeid));
return $DB->get_record('assignfeedback_comments', array('grade' => $gradeid));
}
}
......@@ -231,6 +231,7 @@ class pdf extends \FPDI {
* @param int $width the width of the comment (in pixels)
* @param string $colour optional the background colour of the comment (red, yellow, green, blue, white, clear)
* @return bool true if successful (always)
* @deprecated since version 2016101700
*/
public function add_comment($text, $x, $y, $width, $colour = 'yellow') {
if (!$this->filename) {
......@@ -273,6 +274,11 @@ class pdf extends \FPDI {
return true;
}
/**
* Get RGB color from label of color or hexa code
* @param string $colour
* @return array()
*/
private function get_colour_for_pdf($colour) {
if (substr($colour, 0, 1) == '#') {
$colourarray = $this->hex2RGB($colour, false);
......@@ -497,13 +503,13 @@ class pdf extends \FPDI {
case 'stampcomment':
if ($annotation->displayrotation == 1) {
$imgfile = $CFG->dirroot . '/mod/assign/feedback/editpdfplus/pix/twoway_v_pdf.png';
$h = 20;//abs($sy - $ey);
$h = 20; //abs($sy - $ey);
$w = $h * 37 / 96;
$sx = min($sx, $ex) + 8;
$sy = min($sy, $ey) + 2;
} else {
$imgfile = $CFG->dirroot . '/mod/assign/feedback/editpdfplus/pix/twoway_h_pdf.png';
$w = 20;//abs($sx - $ex);
$w = 20; //abs($sx - $ex);
$h = $w * 37 / 96;
$sx = min($sx, $ex) + 2;
$sy = min($sy, $ey) + 8;
......
......@@ -257,9 +257,9 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$toolbaraxis .= "</div><div style='display:inline;margin-left:5px;text-align:left;'>";
}
$toolbaraxis .= "</div></div>";
$questionchoice = html_writer::select(["Question", "Sans", "Avec"], 'questionselection', 0, FALSE);
$axischoice = html_writer::select(["Statut", "Non traité", "OK", "non OK"], 'statutselection', 0, FALSE);
$validatebutton = html_writer::tag('button', 'Envoyer', array('class' => 'button', 'id' => 'student_valide_button'));
$questionchoice = html_writer::select([get_string('question_select', 'assignfeedback_editpdfplus'), get_string('question_select_without', 'assignfeedback_editpdfplus'), get_string('question_select_with', 'assignfeedback_editpdfplus')], 'questionselection', 0, FALSE);
$axischoice = html_writer::select([get_string('statut_select', 'assignfeedback_editpdfplus'), get_string('statut_select_nc', 'assignfeedback_editpdfplus'), get_string('statut_select_ok', 'assignfeedback_editpdfplus'), get_string('statut_select_ko', 'assignfeedback_editpdfplus')], 'statutselection', 0, FALSE);
$validatebutton = html_writer::tag('button', get_string('send_pdf_update', 'assignfeedback_editpdfplus'), array('class' => 'button', 'id' => 'student_valide_button'));
$toolbaraxis .= html_writer::div($validatebutton, 'toolbar ', array('role' => 'toolbar'));
$toolbaraxis .= html_writer::div($axischoice, 'toolbar ', array('role' => 'toolbar'));
$toolbaraxis .= html_writer::div($questionchoice, 'toolbar ', array('role' => 'toolbar'));
......@@ -335,7 +335,9 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
'stamp',
'stamppicker',
'cannotopenpdf',
'pagenumber'
'pagenumber',
'student_statut_nc',
'student_answer_lib'
), 'assignfeedback_editpdfplus');
return $html;
......
......@@ -44,7 +44,11 @@ class tool {
/** @var boolean, allow reply or not */
public $reply = 0;
/** @var boolean, if tool is actived or not */
public $enabled = 1;
/** @var boolean, order in toolbar */
public $order = 1000;
/**
......
......@@ -29,8 +29,11 @@ class type_tool {
/** @var string colors used */
public $cartridge_color = '';
/** @var int starting location of cartridge in pixels. Image resolution is 100 pixels per inch */
public $cartridge_x = 0;
/** @var int ending location of cartridge in pixels. Image resolution is 100 pixels per inch */
public $cartridge_y = 0;
/**
......
......@@ -73,6 +73,8 @@ class assignfeedback_editpdfplus_widget implements renderable {
* @param string[] $stampfiles - The file names of the stamps.
* @param bool $readonly - Show the readonly interface (no tools).
* @param integer $pagetotal - The total number of pages.
* @param tool[] $toolbars - the different tool to display
* @param axis[] $axis - the different axis to display
*/
public function __construct($assignment, $userid, $attemptnumber, $downloadurl, $downloadfilename, $stampfiles, $readonly, $pagetotal, $toolbars, $axis) {
$this->assignment = $assignment;
......
......@@ -103,4 +103,14 @@ $string['yellowlemon'] = 'Lemon yellow';
$string['draftchangessaved'] = 'Draft annotations saved';
$string['nodraftchangessaved'] = 'Changes saved';
$string['preparesubmissionsforannotation'] = 'Prepare submissions for annotation';
$string['mod/assignfeedback_editpdf:use'] = 'Utiliser le plugin';
$string['question_select'] = 'Question';
$string['question_select_with'] = 'With';
$string['question_select_without'] = 'Without';
$string['statut_select'] = 'Status';
$string['statut_select_nc'] = 'Todo';
$string['statut_select_ok'] = 'OK';
$string['statut_select_ko'] = 'no OK';
$string['send_pdf_update'] = 'Send';
$string['student_statut_nc'] = 'Todo';
$string['student_answer_lib'] = 'Answer';
$string['mod/assignfeedback_editpdf:use'] = 'Use the plugin';
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'assignfeedback_editpdfplus', language 'en'
*
* @package assignfeedback_editpdfplus
* @copyright 2012 Davo Smith
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['addtoquicklist'] = 'Add to quicklist';
$string['annotationcolour'] = 'Annotation colour';
$string['black'] = 'Black';
$string['blue'] = 'Blue';
$string['cannotopenpdf'] = 'Cannot open the PDF. The file may be corrupt, or in an unsupported format.';
$string['clear'] = 'Clear';
$string['colourpicker'] = 'Colour picker';
$string['commentcolour'] = 'Comment colour';
$string['comment'] = 'Comments';
$string['command'] = 'Command:';
$string['commentcontextmenu'] = 'Comment context menu';
$string['couldnotsavepage'] = 'Could not save page {$a}';
$string['currentstamp'] = 'Stamp';
$string['deleteannotation'] = 'Delete annotation';
$string['deletecomment'] = 'Delete comment';
$string['deletefeedback'] = 'Delete feedback PDF';
$string['downloadablefilename'] = 'feedback.pdf';
$string['downloadfeedback'] = 'Download feedback PDF';
$string['errorgenerateimage'] = 'Error generating image with ghostscript, debugging info: {$a}';
$string['editpdf'] = 'Annotation PDF avancé';
$string['editpdf_help'] = 'Annotate students submissions directly in the browser and produce an edited downloadable PDF.';
$string['enabled'] = 'Annotation PDF avancé';
$string['enabled_help'] = 'If enabled, the teacher will be able to create annotated PDF files when marking the assignments. This allows the teacher to add comments, drawing and stamps directly on top of the students work. The annotating is done in the browser and no extra software is required.';
$string['filter'] = 'Filter comments...';
$string['generatefeedback'] = 'Générer le feedback PDF';
$string['gotopage'] = 'Aller à la page';
$string['green'] = 'Green';
$string['gsimage'] = 'Ghostscript test image';
$string['pathtogspathdesc'] = 'Please note that annotate PDF requires the path to ghostscript to be set in {$a}.';
$string['pathtounoconvpathdesc'] = 'Please note that annotate PDF requires the path to unoconv to be set in {$a}.';
$string['highlight'] = 'Highlight';
$string['jsrequired'] = 'JavaScript is required to annotate a PDF. Please enable JavaScript in your browser to use this feature.';
$string['launcheditor'] = 'Launch PDF editor...';
$string['line'] = 'Line';
$string['loadingeditor'] = 'Loading PDF editor';
$string['navigatenext'] = 'Next page';
$string['navigateprevious'] = 'Previous page';
$string['oval'] = 'Oval';
$string['output'] = 'Output:';
$string['pagenumber'] = 'Page {$a}';
$string['pagexofy'] = '{$a->page} / {$a->total}';
$string['pen'] = 'Pen';
$string['pluginname'] = 'Annotate PDF advanced';
$string['generatingpdf'] = 'Génération du PDF...';
$string['rectangle'] = 'Rectangle';
$string['red'] = 'Red';
$string['result'] = 'Result:';
$string['searchcomments'] = 'Search comments';
$string['select'] = 'Select';
$string['stamppicker'] = 'Stamp picker';
$string['stampsdesc'] = 'Stamps must be image files (recommended size: 40x40). These images can be used with the stamp tool to annotate the PDF.';
$string['stamps'] = 'Stamps';
$string['stamp'] = 'Stamp';
$string['test_doesnotexist'] = 'The ghostscript path points to a non-existent file';
$string['test_empty'] = 'The ghostscript path is empty - please enter the correct path';
$string['testgs'] = 'Test ghostscript path';
$string['test_isdir'] = 'The ghostscript path points to a folder, please include the ghostscript program in the path you specify';
$string['test_notestfile'] = 'The test PDF is missing';
$string['test_notexecutable'] = 'The ghostscript points to a file that is not executable';
$string['test_ok'] = 'The ghostscript path appears to be OK - please check you can see the message in the image below';
$string['test_doesnotexist'] = 'The ghostscript path points to a non-existent file';
$string['test_empty'] = 'The ghostscript path is empty - please enter the correct path';
$string['test_unoconv'] = 'Test unoconv path';
$string['test_unoconvdoesnotexist'] = 'The unoconv path does not point to the unoconv program. Please review your path settings.';
$string['test_unoconvdownload'] = 'Download the converted pdf test file.';
$string['test_unoconvisdir'] = 'The unoconv path points to a folder, please include the unoconv program in the path you specify';
$string['test_unoconvnotestfile'] = 'The test document to be coverted into a PDF is missing';
$string['test_unoconvnotexecutable'] = 'The unoconv path points to a file that is not executable';
$string['test_unoconvok'] = 'The unoconv path appears to be properly configured.';
$string['test_unoconvversionnotsupported'] = 'The version of unoconv you have installed is not supported. Moodle\'s assignment grading feature requires version 0.7 or higher.';
$string['toolbarbutton'] = '{$a->tool} {$a->shortcut}';
$string['tool'] = 'Tool';
$string['viewfeedbackonline'] = 'Voir le PDF annoté...';
$string['white'] = 'White';
$string['yellow'] = 'Yellow';
$string['yellowlemon'] = 'Lemon yellow';
$string['draftchangessaved'] = 'Annotations sauvées';
$string['nodraftchangessaved'] = 'Changement sauvés';
$string['preparesubmissionsforannotation'] = 'Préparation de la validation des annotations';
$string['question_select'] = 'Question';
$string['question_select_with'] = 'Avec';
$string['question_select_without'] = 'Sans';
$string['statut_select'] = 'Statut';
$string['statut_select_nc'] = 'Non traité';
$string['statut_select_ok'] = 'OK';
$string['statut_select_ko'] = 'non OK';
$string['send_pdf_update'] = 'Envoyer';
$string['student_statut_nc'] = 'non traité';
$string['student_answer_lib'] = 'Réponse';
$string['mod/assignfeedback_editpdf:use'] = 'Utiliser le plugin';
......@@ -958,7 +958,7 @@ Y.extend(ANNOTATION, Y.Base, {
if (this.answerrequested === 1) {
var divinput = Y.Node.create("<div></div>");
var hr = Y.Node.create("<hr style='margin-bottom:0px;'/>");
var label = Y.Node.create("<label style='display:inline;'>Réponse</label>");
var label = Y.Node.create("<label style='display:inline;'>" + M.util.get_string('student_answer_lib', 'assignfeedback_editpdfplus') + "</label>");
var rep = "";
if (this.studentanswer && this.studentanswer !== "0" && this.studentanswer !== "1") {
rep = this.studentanswer;
......@@ -1015,7 +1015,7 @@ Y.extend(ANNOTATION, Y.Base, {
return divconteneurdisplay;
},
get_button_student_status: function () {
var buttonstatus1 = '<label style="padding-left:20px;" class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=0 >non traité</label>';
var buttonstatus1 = '<label style="padding-left:20px;" class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=0 >' + M.util.get_string('student_statut_nc', 'assignfeedback_editpdfplus') + '</label>';
var buttonstatus2 = '<label class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=1 ><img style="width:15px;" src=\'' + M.util.image_url('tick', 'assignfeedback_editpdfplus') + '\' /></label>';
var buttonstatus3 = '<label class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=2 ><img style="width:15px;" src=\'' + M.util.image_url('cross', 'assignfeedback_editpdfplus') + '\' /></label> ';
var buttonstatus1display = Y.Node.create(buttonstatus1);
......
......@@ -958,7 +958,7 @@ Y.extend(ANNOTATION, Y.Base, {
if (this.answerrequested === 1) {
var divinput = Y.Node.create("<div></div>");
var hr = Y.Node.create("<hr style='margin-bottom:0px;'/>");
var label = Y.Node.create("<label style='display:inline;'>Réponse</label>");
var label = Y.Node.create("<label style='display:inline;'>" + M.util.get_string('student_answer_lib', 'assignfeedback_editpdfplus') + "</label>");
var rep = "";
if (this.studentanswer && this.studentanswer !== "0" && this.studentanswer !== "1") {
rep = this.studentanswer;
......@@ -1015,7 +1015,7 @@ Y.extend(ANNOTATION, Y.Base, {
return divconteneurdisplay;
},
get_button_student_status: function () {
var buttonstatus1 = '<label style="padding-left:20px;" class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=0 >non traité</label>';
var buttonstatus1 = '<label style="padding-left:20px;" class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=0 >' + M.util.get_string('student_statut_nc', 'assignfeedback_editpdfplus') + '</label>';
var buttonstatus2 = '<label class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=1 ><img style="width:15px;" src=\'' + M.util.image_url('tick', 'assignfeedback_editpdfplus') + '\' /></label>';
var buttonstatus3 = '<label class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=2 ><img style="width:15px;" src=\'' + M.util.image_url('cross', 'assignfeedback_editpdfplus') + '\' /></label> ';
var buttonstatus1display = Y.Node.create(buttonstatus1);
......
......@@ -411,7 +411,7 @@ Y.extend(ANNOTATION, Y.Base, {
if (this.answerrequested === 1) {
var divinput = Y.Node.create("<div></div>");
var hr = Y.Node.create("<hr style='margin-bottom:0px;'/>");
var label = Y.Node.create("<label style='display:inline;'>Réponse</label>");
var label = Y.Node.create("<label style='display:inline;'>" + M.util.get_string('student_answer_lib', 'assignfeedback_editpdfplus') + "</label>");
var rep = "";
if (this.studentanswer && this.studentanswer !== "0" && this.studentanswer !== "1") {
rep = this.studentanswer;
......@@ -468,7 +468,7 @@ Y.extend(ANNOTATION, Y.Base, {
return divconteneurdisplay;
},
get_button_student_status: function () {
var buttonstatus1 = '<label style="padding-left:20px;" class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=0 >non traité</label>';
var buttonstatus1 = '<label style="padding-left:20px;" class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=0 >' + M.util.get_string('student_statut_nc', 'assignfeedback_editpdfplus') + '</label>';
var buttonstatus2 = '<label class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=1 ><img style="width:15px;" src=\'' + M.util.image_url('tick', 'assignfeedback_editpdfplus') + '\' /></label>';
var buttonstatus3 = '<label class="radio-inline"><input type="radio" name="' + this.divcartridge + '_status" value=2 ><img style="width:15px;" src=\'' + M.util.image_url('cross', 'assignfeedback_editpdfplus') + '\' /></label> ';
var buttonstatus1display = Y.Node.create(buttonstatus1);
......
Supports Markdown
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