diff --git a/.gitignore b/.gitignore index e95a47a..b785235 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ CVS /.project /.buildpath /.cache -phpunit.xml \ No newline at end of file +phpunit.xml +/moodle/nbproject/private/ \ No newline at end of file diff --git a/0001-Actualizaci-n-del-proyecto-domingo-2-12.patch b/0001-Actualizaci-n-del-proyecto-domingo-2-12.patch new file mode 100644 index 0000000..cf35d8d --- /dev/null +++ b/0001-Actualizaci-n-del-proyecto-domingo-2-12.patch @@ -0,0 +1,395 @@ +From 9b87c400e70216292b3d432d017bebc8247e1c1c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Victor=20Mu=C3=B1oz?= +Date: Sun, 2 Dec 2012 16:23:04 +0100 +Subject: [PATCH 1/3] =?UTF-8?q?Actualizaci=C3=B3n=20del=20proyecto,=20doming?= + =?UTF-8?q?o=202/12?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + .gitignore | 3 +- + course/view.php | 4 +- + .../backup_gradingform_guide_plugin.class.php | 2 +- + grade/grading/form/guide/db/install.xml | 3 +- + grade/grading/form/guide/edit_form.php | 5 +++ + grade/grading/form/guide/guideeditor.php | 18 ++++++++++++- + grade/grading/form/guide/js/guideeditor.js | 6 +++- + .../form/guide/lang/en/gradingform_guide.php | 4 +++ + grade/grading/form/guide/lib.php | 12 +++++--- + grade/grading/form/guide/renderer.php | 28 +++++++++++++++++--- + grade/grading/form/guide/styles.css | 6 +++- + moodle/nbproject/project.properties | 7 +++++ + moodle/nbproject/project.xml | 9 ++++++ + 13 files changed, 89 insertions(+), 18 deletions(-) + create mode 100644 moodle/nbproject/project.properties + create mode 100644 moodle/nbproject/project.xml + +diff --git a/.gitignore b/.gitignore +index e95a47a..b785235 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -25,4 +25,5 @@ CVS + /.project + /.buildpath + /.cache +-phpunit.xml +\ No newline at end of file ++phpunit.xml ++/moodle/nbproject/private/ +\ No newline at end of file +diff --git a/course/view.php b/course/view.php +index 00c6754..7df977b 100644 +--- a/course/view.php ++++ b/course/view.php +@@ -34,7 +34,7 @@ + } + + $course = $DB->get_record('course', $params, '*', MUST_EXIST); +- ++ echo("PRUEBA2"); + $urlparams = array('id' => $course->id); + + // Sectionid should get priority over section number +@@ -228,7 +228,7 @@ + $PAGE->set_title(get_string('course') . ': ' . $course->fullname); + $PAGE->set_heading($course->fullname); + echo $OUTPUT->header(); +- ++ + if ($completion->is_enabled() && ajaxenabled()) { + // This value tracks whether there has been a dynamic change to the page. + // It is used so that if a user does this - (a) set some tickmarks, (b) +diff --git a/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php b/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php +index 75af83a..ba0c51d 100644 +--- a/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php ++++ b/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php +@@ -54,7 +54,7 @@ class backup_gradingform_guide_plugin extends backup_gradingform_plugin { + + $criterion = new backup_nested_element('guidecriterion', array('id'), array( + 'sortorder', 'shortname', 'description', 'descriptionformat', +- 'descriptionmarkers', 'descriptionmarkersformat', 'maxscore')); ++ 'descriptionmarkers', 'descriptionmarkersformat', 'maxscore','percentatge')); + + $comments = new backup_nested_element('guidecomments'); + +diff --git a/grade/grading/form/guide/db/install.xml b/grade/grading/form/guide/db/install.xml +index d8aa0b6..15fbef3 100644 +--- a/grade/grading/form/guide/db/install.xml ++++ b/grade/grading/form/guide/db/install.xml +@@ -14,7 +14,8 @@ + + + +- ++ ++ + + + +diff --git a/grade/grading/form/guide/edit_form.php b/grade/grading/form/guide/edit_form.php +index ff2e86d..22997d7 100644 +--- a/grade/grading/form/guide/edit_form.php ++++ b/grade/grading/form/guide/edit_form.php +@@ -59,6 +59,8 @@ class gradingform_guide_editguide extends moodleform { + $form->addElement('editor', 'description_editor', get_string('description'), null, $options); + $form->setType('description_editor', PARAM_RAW); + ++ ++ + // Guide completion status. + $choices = array(); + $choices[gradingform_controller::DEFINITION_STATUS_DRAFT] = html_writer::tag('span', +@@ -70,6 +72,9 @@ class gradingform_guide_editguide extends moodleform { + // Guide editor. + $element = $form->addElement('guideeditor', 'guide', get_string('pluginname', 'gradingform_guide')); + $form->setType('guide', PARAM_RAW); ++ ++ ++ + + $buttonarray = array(); + $buttonarray[] = &$form->createElement('submit', 'saveguide', get_string('saveguide', 'gradingform_guide')); +diff --git a/grade/grading/form/guide/guideeditor.php b/grade/grading/form/guide/guideeditor.php +index aebb982..bdc13c9 100644 +--- a/grade/grading/form/guide/guideeditor.php ++++ b/grade/grading/form/guide/guideeditor.php +@@ -184,6 +184,7 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { + // Iterate through criteria. + $lastaction = null; + $lastid = null; ++ $suma = 0; + foreach ($value['criteria'] as $id => $criterion) { + if ($id == 'addcriterion') { + $id = $this->get_next_id(array_keys($value['criteria'])); +@@ -203,6 +204,16 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { + $errors['err_maxscorenotnumeric'] = 1; + $criterion['error_description'] = true; + } ++ if (!strlen(trim($criterion['percentatge']))) { ++ $errors['err_nopercentatge'] = 1; ++ $criterion['error_description'] = true; ++ } else if (!is_numeric($criterion['percentatge']) || $criterion['percentatge'] < 0 || $criterion['percentatge'] > 100) { ++ $errors['err_percentatgenotnumeric'] = 1; ++ $criterion['error_description'] = true; ++ } ++ else { ++ $suma = $suma + $criterion['percentatge']; ++ } + } + if (array_key_exists('moveup', $criterion) || $lastaction == 'movedown') { + unset($criterion['moveup']); +@@ -229,7 +240,12 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { + $lastid = $id; + } + } +- ++ if ($suma != 100) ++ { ++ $errors['err_suma100'] = 1; ++ $criterion['error_description'] = true; ++ } ++ + // Add sort order field to criteria. + $csortorder = 1; + foreach (array_keys($return['criteria']) as $id) { +diff --git a/grade/grading/form/guide/js/guideeditor.js b/grade/grading/form/guide/js/guideeditor.js +index 3aeb83b..c4ade11 100644 +--- a/grade/grading/form/guide/js/guideeditor.js ++++ b/grade/grading/form/guide/js/guideeditor.js +@@ -52,7 +52,7 @@ M.gradingform_guideeditor.clickanywhere = function(e) { + } + // if clicked on description item and this item is not enabled - enable it + var container = null +- if ((container = el.ancestor('.criterionname')) || (container = el.ancestor('.criterionmaxscore'))) { ++ if (((container = el.ancestor('.criterionname')) || (container = el.ancestor('.criterionmaxscore')))|| (container = el.ancestor('.criterionpercentatge'))) { + el = container.one('input[type=text]') + } else if ((container = el.ancestor('.criteriondesc')) || (container = el.ancestor('.criteriondescmarkers'))) { + el = container.one('textarea') +@@ -128,12 +128,16 @@ M.gradingform_guideeditor.editmode = function(el, editmode) { + if (ta.get('name').indexOf('[maxscore]') > 1) { + ta.setStyle('width', '25px'); + } else { ++ if (ta.get('name').indexOf('[percentatge]') > 1) { ++ ta.setStyle('width', '25px'); ++ } else { + var width = parseFloat(ta.get('parentNode').getComputedStyle('width'))-10, + height = parseFloat(ta.get('parentNode').getComputedStyle('height')) + ta.setStyle('width', Math.max(width,50)+'px') + ta.setStyle('height', Math.max(height,30)+'px') + } + } ++ } + catch (err) { + // this browser do not support 'computedStyle', leave the default size of the textbox + } +diff --git a/grade/grading/form/guide/lang/en/gradingform_guide.php b/grade/grading/form/guide/lang/en/gradingform_guide.php +index 6bbfb40..6fbac48 100644 +--- a/grade/grading/form/guide/lang/en/gradingform_guide.php ++++ b/grade/grading/form/guide/lang/en/gradingform_guide.php +@@ -49,6 +49,9 @@ $string['description'] = 'Description'; + $string['descriptionmarkers'] = 'Description for Markers'; + $string['descriptionstudents'] = 'Description for Students'; + $string['err_maxscorenotnumeric'] = 'Criterion max score must be numeric'; ++$string['err_suma100'] = 'La suma de porcentajes debe sumar 100'; ++$string['err_nopercentatge'] = 'Criterion percentatge can not be empty'; ++$string['err_percentatgenotnumeric']='Criterion percentatge must be numeric and lower than 100'; + $string['err_nocomment'] = 'Comment can not be empty'; + $string['err_nodescription'] = 'Student description can not be empty'; + $string['err_nodescriptionmarkers'] = 'Marker description can not be empty'; +@@ -66,6 +69,7 @@ $string['hidestudentdesc'] = 'Hide student criterion descriptions'; + $string['maxscore'] = 'Maximum mark'; + $string['name'] = 'Name'; + $string['needregrademessage'] = 'The marking guide definition was changed after this student had been graded. The student can not see this marking guide until you check the marking guide and update the grade.'; ++$string['percentatge'] = 'Percentatge'; + $string['pluginname'] = 'Marking guide'; + $string['previewmarkingguide'] = 'Preview marking guide'; + $string['regrademessage1'] = 'You are about to save changes to a marking guide that has already been used for grading. Please indicate if existing grades need to be reviewed. If you set this then the marking guide will be hidden from students until their item is regraded.'; +diff --git a/grade/grading/form/guide/lib.php b/grade/grading/form/guide/lib.php +index 15ef0d7..80f7e6c 100644 +--- a/grade/grading/form/guide/lib.php ++++ b/grade/grading/form/guide/lib.php +@@ -157,7 +157,7 @@ class gradingform_guide_controller extends gradingform_controller { + } + $currentcriteria = $currentdefinition->guide_criteria; + $criteriafields = array('sortorder', 'description', 'descriptionformat', 'descriptionmarkers', +- 'descriptionmarkersformat', 'shortname', 'maxscore'); ++ 'descriptionmarkersformat', 'shortname', 'maxscore','percentatge'); + foreach ($newcriteria as $id => $criterion) { + if (preg_match('/^NEWID\d+$/', $id)) { + // Insert criterion into DB. +@@ -313,8 +313,8 @@ class gradingform_guide_controller extends gradingform_controller { + $criteria = $DB->get_recordset('gradingform_guide_criteria', array('definitionid' => $this->definition->id), 'sortorder'); + foreach ($criteria as $criterion) { + foreach (array('id', 'sortorder', 'description', 'descriptionformat', +- 'maxscore', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname') as $fieldname) { +- if ($fieldname == 'maxscore') { // Strip any trailing 0. ++ 'maxscore','percentatge', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname') as $fieldname) { ++ if ($fieldname == 'maxscore'|| $fieldname == 'percentatge') { // Strip any trailing 0. + $this->definition->guide_criteria[$criterion->id][$fieldname] = (float)$criterion->{$fieldname}; + } else { + $this->definition->guide_criteria[$criterion->id][$fieldname] = $criterion->{$fieldname}; +@@ -634,7 +634,7 @@ class gradingform_guide_controller extends gradingform_controller { + $returnvalue = array('minscore' => 0, 'maxscore' => 0); + $maxscore = 0; + foreach ($this->get_definition()->guide_criteria as $id => $criterion) { +- $maxscore += $criterion['maxscore']; ++ $maxscore += $criterion['maxscore']*($criterion['percentatge']/100); + } + $returnvalue['maxscore'] = $maxscore; + $returnvalue['minscore'] = 0; +@@ -803,7 +803,8 @@ class gradingform_guide_instance extends gradingform_instance { + $curscore += $record['score']; + } + return round(($curscore-$scores['minscore'])/($scores['maxscore']-$scores['minscore'])* +- ($maxgrade-$mingrade), 0) + $mingrade; ++ ($maxgrade-$mingrade), 0) + $mingrade; ++ + } + + /** +@@ -841,6 +842,7 @@ class gradingform_guide_instance extends gradingform_instance { + $a = new stdClass(); + $a->criterianame = $criteria[$id]['shortname']; + $a->maxscore = $criteria[$id]['maxscore']; ++ $a->percentatge = $criteria[$id]['percentatge']; + $html .= html_writer::tag('div', get_string('err_scoreinvalid', 'gradingform_guide', $a), + array('class' => 'gradingform_guide-error')); + } +diff --git a/grade/grading/form/guide/renderer.php b/grade/grading/form/guide/renderer.php +index 360e1b9..945f5ff 100644 +--- a/grade/grading/form/guide/renderer.php ++++ b/grade/grading/form/guide/renderer.php +@@ -66,9 +66,10 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'class' => '{CRITERION-class}', + 'descriptionmarkers' => '{CRITERION-descriptionmarkers}', + 'shortname' => '{CRITERION-shortname}', +- 'maxscore' => '{CRITERION-maxscore}'); ++ 'maxscore' => '{CRITERION-maxscore}', ++ 'percentatge' => '{CRITERION-percentatge}'); + } else { +- foreach (array('sortorder', 'description', 'class', 'shortname', 'descriptionmarkers', 'maxscore') as $key) { ++ foreach (array('sortorder', 'description', 'class', 'shortname', 'descriptionmarkers', 'maxscore','percentatge') as $key) { + // Set missing array elements to empty strings to avoid warnings. + if (!array_key_exists($key, $criterion)) { + $criterion[$key] = ''; +@@ -109,6 +110,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'value' => htmlspecialchars($criterion['maxscore']), + 'id' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); + $maxscore = html_writer::tag('div', $maxscore, array('class'=>'criterionmaxscore')); ++ ++ $percentatge = html_writer::empty_tag('input', array('type'=> 'text', ++ 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]', 'size' => '3', ++ 'value' => htmlspecialchars($criterion['percentatge']), ++ 'id' => '{NAME}[criteria][{CRITERION-id}][percentatge]')); ++ $percentatge = html_writer::tag('div', $percentatge, array('class'=>'criterionpercentatge')); + } else { + if ($mode == gradingform_guide_controller::DISPLAY_EDIT_FROZEN) { + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', +@@ -121,6 +128,8 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]', 'value' => $criterion['descriptionmarkers'])); + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', + 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]', 'value' => $criterion['maxscore'])); ++ $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', ++ 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge', 'value' => $criterion['percentatge'])); + } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL || + $mode == gradingform_guide_controller::DISPLAY_VIEW) { + $descriptionclass = 'descriptionreadonly'; +@@ -129,6 +138,8 @@ class gradingform_guide_renderer extends plugin_renderer_base { + array('class'=>'criterionshortname', 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]')); + $descmarkerclass = ''; + $descstudentclass = ''; ++ $maxscoreclass = ''; ++ $percentatgeclass = ''; + if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { + if (!get_user_preferences('gradingform_guide-showmarkerdesc', true)) { + $descmarkerclass = ' hide'; +@@ -144,7 +155,11 @@ class gradingform_guide_renderer extends plugin_renderer_base { + array('class'=>'criteriondescriptionmarkers'.$descmarkerclass, + 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]')); + $maxscore = html_writer::tag('div', $criterion['maxscore'], +- array('class'=>'criteriondescriptionscore', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); ++ array('class'=>'criteriondescriptionscore'.$maxscoreclass, ++ 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); ++ $percentatge = html_writer::tag('div', $criterion['percentatge'], ++ array('class'=>'criteriondescriptionpercentatge'.$percentatgeclass, ++ 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]')); + } + + if (isset($criterion['error_description'])) { +@@ -165,6 +180,9 @@ class gradingform_guide_renderer extends plugin_renderer_base { + $title .= html_writer::tag('label', get_string('maxscore', 'gradingform_guide'), + array('for'=>'{NAME}[criteria][{CRITERION-id}][maxscore]')); + $title .= $maxscore; ++ $title .= html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), ++ array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]')); ++ $title .= $percentatge; + } else if ($mode == gradingform_guide_controller::DISPLAY_PREVIEW_GRADED || + $mode == gradingform_guide_controller::DISPLAY_VIEW) { + $title .= $description; +@@ -199,8 +217,10 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'id' => '{NAME}[criteria][{CRITERION-id}][score]', + 'size' => '3', 'value' => htmlspecialchars($currentscore))); + $score .= '/'.$maxscore; +- + $criteriontemplate .= html_writer::tag('td', $score, array('class' => 'score')); ++ $percentatge = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), ++ array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass)); ++ $criteriontemplate .= html_writer::tag('td', $percentatge, array('class' => 'percentatge')); + } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL_FROZEN) { + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', + 'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark)); +diff --git a/grade/grading/form/guide/styles.css b/grade/grading/form/guide/styles.css +index 9a18aea..d07eb68 100644 +--- a/grade/grading/form/guide/styles.css ++++ b/grade/grading/form/guide/styles.css +@@ -19,7 +19,8 @@ + .gradingform_guide .criterion.even {background:#F0F0F0;} + + .gradingform_guide .criterion .description {width:100%;} +-.gradingform_guide .criterion .description .criterionmaxscore input {width:20px;} ++.gradingform_guide .criterion .description .criterionmaxscore input {width:20000px;} ++.gradingform_guide .criterion .description .criterionpercentatge input {width:20000px;} + .gradingform_guide .criterion .description .criterionname {font-weight:bold;} + .gradingform_guide .criterion label {font-weight:bold; padding-right: 5px} + +@@ -64,4 +65,5 @@ + .gradingform_guide table {width: 100%} + .gradingform_guide .criteriondescriptionmarkers {width: 300px;} + .gradingform_guide .markingguideremark {width: 100%;} +-.gradingform_guide .criteriondescriptionscore {display: inline;} +\ No newline at end of file ++.gradingform_guide .criteriondescriptionscore {display: inline;} ++.gradingform_guide .criteriondescriptionpercentatge {display: inline;} +\ No newline at end of file +diff --git a/moodle/nbproject/project.properties b/moodle/nbproject/project.properties +new file mode 100644 +index 0000000..d2735b5 +--- /dev/null ++++ b/moodle/nbproject/project.properties +@@ -0,0 +1,7 @@ ++include.path=${php.global.include.path} ++php.version=PHP_53 ++source.encoding=UTF-8 ++src.dir=.. ++tags.asp=false ++tags.short=true ++web.root=. +diff --git a/moodle/nbproject/project.xml b/moodle/nbproject/project.xml +new file mode 100644 +index 0000000..2dc1068 +--- /dev/null ++++ b/moodle/nbproject/project.xml +@@ -0,0 +1,9 @@ ++ ++ ++ org.netbeans.modules.php.project ++ ++ ++ moodle ++ ++ ++ +-- +1.7.5.4 + diff --git a/0002-Actualizaci-n-del-proyecto-V2-lunes-3-12.patch b/0002-Actualizaci-n-del-proyecto-V2-lunes-3-12.patch new file mode 100644 index 0000000..4c7f217 --- /dev/null +++ b/0002-Actualizaci-n-del-proyecto-V2-lunes-3-12.patch @@ -0,0 +1,124 @@ +From ea3b1e8bc48146651dcff5041b1398220be57fa7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Victor=20Mu=C3=B1oz?= +Date: Mon, 3 Dec 2012 17:55:50 +0100 +Subject: [PATCH 2/3] =?UTF-8?q?Actualizaci=C3=B3n=20del=20proyecto=20V2,=20l?= + =?UTF-8?q?unes=203/12?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + course/view.php | 2 +- + grade/grading/form/guide/db/install.xml | 2 +- + grade/grading/form/guide/lib.php | 33 ++++++++++++++++++++++++++++-- + 3 files changed, 32 insertions(+), 5 deletions(-) + +diff --git a/course/view.php b/course/view.php +index 7df977b..07036e8 100644 +--- a/course/view.php ++++ b/course/view.php +@@ -34,7 +34,7 @@ + } + + $course = $DB->get_record('course', $params, '*', MUST_EXIST); +- echo("PRUEBA2"); ++ //echo("PRUEBA2"); + $urlparams = array('id' => $course->id); + + // Sectionid should get priority over section number +diff --git a/grade/grading/form/guide/db/install.xml b/grade/grading/form/guide/db/install.xml +index 15fbef3..1587c58 100644 +--- a/grade/grading/form/guide/db/install.xml ++++ b/grade/grading/form/guide/db/install.xml +@@ -15,7 +15,7 @@ + + + +- ++ + + + +diff --git a/grade/grading/form/guide/lib.php b/grade/grading/form/guide/lib.php +index 80f7e6c..05db5f0 100644 +--- a/grade/grading/form/guide/lib.php ++++ b/grade/grading/form/guide/lib.php +@@ -157,9 +157,13 @@ class gradingform_guide_controller extends gradingform_controller { + } + $currentcriteria = $currentdefinition->guide_criteria; + $criteriafields = array('sortorder', 'description', 'descriptionformat', 'descriptionmarkers', +- 'descriptionmarkersformat', 'shortname', 'maxscore','percentatge'); ++ 'descriptionmarkersformat', 'shortname', 'maxscore', 'percentatge'); + foreach ($newcriteria as $id => $criterion) { + if (preg_match('/^NEWID\d+$/', $id)) { ++ //echo("maxscore"); ++ //echo($criterion['maxscore']); ++ //echo("percentatge"); ++ //echo($criterion['percentatge']); + // Insert criterion into DB. + $data = array('definitionid' => $this->definition->id, 'descriptionformat' => FORMAT_MOODLE, + 'descriptionmarkersformat' => FORMAT_MOODLE); // TODO format is not supported yet. +@@ -169,6 +173,10 @@ class gradingform_guide_controller extends gradingform_controller { + } + } + if ($doupdate) { ++ //echo("guardando p"); ++ //echo($data['percentatge']); ++ //echo("guardando s"); ++ //echo($data['maxscore']); + $id = $DB->insert_record('gradingform_guide_criteria', $data); + } + $haschanges[5] = true; +@@ -313,9 +321,10 @@ class gradingform_guide_controller extends gradingform_controller { + $criteria = $DB->get_recordset('gradingform_guide_criteria', array('definitionid' => $this->definition->id), 'sortorder'); + foreach ($criteria as $criterion) { + foreach (array('id', 'sortorder', 'description', 'descriptionformat', +- 'maxscore','percentatge', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname') as $fieldname) { ++ 'maxscore', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname','percentatge') as $fieldname) { + if ($fieldname == 'maxscore'|| $fieldname == 'percentatge') { // Strip any trailing 0. + $this->definition->guide_criteria[$criterion->id][$fieldname] = (float)$criterion->{$fieldname}; ++ //echo("Cargando"+$this->definition->guide_criteria[$criterion->id]['percentatge']); + } else { + $this->definition->guide_criteria[$criterion->id][$fieldname] = $criterion->{$fieldname}; + } +@@ -635,7 +644,9 @@ class gradingform_guide_controller extends gradingform_controller { + $maxscore = 0; + foreach ($this->get_definition()->guide_criteria as $id => $criterion) { + $maxscore += $criterion['maxscore']*($criterion['percentatge']/100); ++ //echo($criterion['maxscore']*$criterion['percentatge']/100); + } ++ echo($criterion['maxscore']); + $returnvalue['maxscore'] = $maxscore; + $returnvalue['minscore'] = 0; + if (!empty($this->moduleinstance->grade)) { +@@ -798,10 +809,26 @@ class gradingform_guide_instance extends gradingform_instance { + $mingrade = $graderange[0]; + $maxgrade = $graderange[count($graderange) - 1]; + ++ + $curscore = 0; ++ $i=0; ++ $j=0; + foreach ($grade['criteria'] as $record) { +- $curscore += $record['score']; ++ //echo ("antes segun for"); ++ foreach ($this->get_controller()->get_definition()->guide_criteria as $id => $criterion) { ++ //echo("antes del if"); ++ if($i==$j) ++ { ++ //echo("enta en la comparacion"); ++ $curscore += $record['score']*($criterion['percentatge']/100); ++ } ++ $j=$j+1; ++ } ++ $j=0; ++ $i=$i+1; ++ + } ++ + return round(($curscore-$scores['minscore'])/($scores['maxscore']-$scores['minscore'])* + ($maxgrade-$mingrade), 0) + $mingrade; + +-- +1.7.5.4 + diff --git a/0003-Actualizaci-n-del-proyecto-V3-martes-4-12.patch b/0003-Actualizaci-n-del-proyecto-V3-martes-4-12.patch new file mode 100644 index 0000000..c1dd52b --- /dev/null +++ b/0003-Actualizaci-n-del-proyecto-V3-martes-4-12.patch @@ -0,0 +1,166 @@ +From 7612d2ddecd233c052b34e229f3d41883adfe88b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Victor=20Mu=C3=B1oz?= +Date: Tue, 4 Dec 2012 16:51:15 +0100 +Subject: [PATCH 3/3] =?UTF-8?q?Actualizaci=C3=B3n=20del=20proyecto=20V3,=20m?= + =?UTF-8?q?artes=204/12?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + .../form/guide/lang/en/gradingform_guide.php | 2 +- + grade/grading/form/guide/lib.php | 14 --------- + grade/grading/form/guide/renderer.php | 31 ++++++++++++++------ + 3 files changed, 23 insertions(+), 24 deletions(-) + +diff --git a/grade/grading/form/guide/lang/en/gradingform_guide.php b/grade/grading/form/guide/lang/en/gradingform_guide.php +index 6fbac48..39ffdfc 100644 +--- a/grade/grading/form/guide/lang/en/gradingform_guide.php ++++ b/grade/grading/form/guide/lang/en/gradingform_guide.php +@@ -69,7 +69,7 @@ $string['hidestudentdesc'] = 'Hide student criterion descriptions'; + $string['maxscore'] = 'Maximum mark'; + $string['name'] = 'Name'; + $string['needregrademessage'] = 'The marking guide definition was changed after this student had been graded. The student can not see this marking guide until you check the marking guide and update the grade.'; +-$string['percentatge'] = 'Percentatge'; ++$string['percentatge'] = 'Percentage'; + $string['pluginname'] = 'Marking guide'; + $string['previewmarkingguide'] = 'Preview marking guide'; + $string['regrademessage1'] = 'You are about to save changes to a marking guide that has already been used for grading. Please indicate if existing grades need to be reviewed. If you set this then the marking guide will be hidden from students until their item is regraded.'; +diff --git a/grade/grading/form/guide/lib.php b/grade/grading/form/guide/lib.php +index 05db5f0..6545546 100644 +--- a/grade/grading/form/guide/lib.php ++++ b/grade/grading/form/guide/lib.php +@@ -160,10 +160,6 @@ class gradingform_guide_controller extends gradingform_controller { + 'descriptionmarkersformat', 'shortname', 'maxscore', 'percentatge'); + foreach ($newcriteria as $id => $criterion) { + if (preg_match('/^NEWID\d+$/', $id)) { +- //echo("maxscore"); +- //echo($criterion['maxscore']); +- //echo("percentatge"); +- //echo($criterion['percentatge']); + // Insert criterion into DB. + $data = array('definitionid' => $this->definition->id, 'descriptionformat' => FORMAT_MOODLE, + 'descriptionmarkersformat' => FORMAT_MOODLE); // TODO format is not supported yet. +@@ -173,10 +169,6 @@ class gradingform_guide_controller extends gradingform_controller { + } + } + if ($doupdate) { +- //echo("guardando p"); +- //echo($data['percentatge']); +- //echo("guardando s"); +- //echo($data['maxscore']); + $id = $DB->insert_record('gradingform_guide_criteria', $data); + } + $haschanges[5] = true; +@@ -324,7 +316,6 @@ class gradingform_guide_controller extends gradingform_controller { + 'maxscore', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname','percentatge') as $fieldname) { + if ($fieldname == 'maxscore'|| $fieldname == 'percentatge') { // Strip any trailing 0. + $this->definition->guide_criteria[$criterion->id][$fieldname] = (float)$criterion->{$fieldname}; +- //echo("Cargando"+$this->definition->guide_criteria[$criterion->id]['percentatge']); + } else { + $this->definition->guide_criteria[$criterion->id][$fieldname] = $criterion->{$fieldname}; + } +@@ -644,9 +635,7 @@ class gradingform_guide_controller extends gradingform_controller { + $maxscore = 0; + foreach ($this->get_definition()->guide_criteria as $id => $criterion) { + $maxscore += $criterion['maxscore']*($criterion['percentatge']/100); +- //echo($criterion['maxscore']*$criterion['percentatge']/100); + } +- echo($criterion['maxscore']); + $returnvalue['maxscore'] = $maxscore; + $returnvalue['minscore'] = 0; + if (!empty($this->moduleinstance->grade)) { +@@ -814,12 +803,9 @@ class gradingform_guide_instance extends gradingform_instance { + $i=0; + $j=0; + foreach ($grade['criteria'] as $record) { +- //echo ("antes segun for"); + foreach ($this->get_controller()->get_definition()->guide_criteria as $id => $criterion) { +- //echo("antes del if"); + if($i==$j) + { +- //echo("enta en la comparacion"); + $curscore += $record['score']*($criterion['percentatge']/100); + } + $j=$j+1; +diff --git a/grade/grading/form/guide/renderer.php b/grade/grading/form/guide/renderer.php +index 945f5ff..b204eeb 100644 +--- a/grade/grading/form/guide/renderer.php ++++ b/grade/grading/form/guide/renderer.php +@@ -129,17 +129,17 @@ class gradingform_guide_renderer extends plugin_renderer_base { + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', + 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]', 'value' => $criterion['maxscore'])); + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', +- 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge', 'value' => $criterion['percentatge'])); ++ 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]', 'value' => $criterion['percentatge'])); + } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL || + $mode == gradingform_guide_controller::DISPLAY_VIEW) { + $descriptionclass = 'descriptionreadonly'; + } + $shortname = html_writer::tag('div', $criterion['shortname'], + array('class'=>'criterionshortname', 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]')); +- $descmarkerclass = ''; +- $descstudentclass = ''; +- $maxscoreclass = ''; +- $percentatgeclass = ''; ++ $descmarkerclass = 'a'; ++ $descstudentclass = 'b'; ++ $maxscoreclass = 'x'; ++ $percentatgeclass = 'y'; + if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { + if (!get_user_preferences('gradingform_guide-showmarkerdesc', true)) { + $descmarkerclass = ' hide'; +@@ -180,9 +180,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { + $title .= html_writer::tag('label', get_string('maxscore', 'gradingform_guide'), + array('for'=>'{NAME}[criteria][{CRITERION-id}][maxscore]')); + $title .= $maxscore; ++ //$title .= html_writer::tag('br'); + $title .= html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), + array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]')); +- $title .= $percentatge; ++ $title .= $percentatge; //contenido ++ //$title .= '%'; ++ //saltos de linea + } else if ($mode == gradingform_guide_controller::DISPLAY_PREVIEW_GRADED || + $mode == gradingform_guide_controller::DISPLAY_VIEW) { + $title .= $description; +@@ -202,6 +205,7 @@ class gradingform_guide_renderer extends plugin_renderer_base { + } + if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { + $scoreclass = ''; ++ $percentatgeclass2 = ''; + if (!empty($validationerrors[$criterion['id']]['score'])) { + $scoreclass = 'error'; + $currentscore = $validationerrors[$criterion['id']]['score']; // Show invalid score in form. +@@ -218,9 +222,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'size' => '3', 'value' => htmlspecialchars($currentscore))); + $score .= '/'.$maxscore; + $criteriontemplate .= html_writer::tag('td', $score, array('class' => 'score')); +- $percentatge = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), +- array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass)); +- $criteriontemplate .= html_writer::tag('td', $percentatge, array('class' => 'percentatge')); ++ $percentatge2 = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), ++ array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass2)); ++ $percentatge2 .= $percentatge; ++ $percentatge2 .= '%'; ++ $criteriontemplate .= html_writer::tag('td', $percentatge2, array('class' => 'percentatge2')); ++ + } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL_FROZEN) { + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', + 'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark)); +@@ -230,6 +237,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { + if (!empty($options['showmarkspercriterionstudents'])) { + $criteriontemplate .= html_writer::tag('td', htmlspecialchars($currentscore). ' / '.$maxscore, + array('class' => 'score')); ++ $percentatge2 = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), ++ array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass)); ++ $percentatge2 .= $percentatge; ++ $percentatge2 .= '%'; ++ $criteriontemplate .= html_writer::tag('td', $percentatge2, array('class' => 'percentatge2')); ++ + } + } + $criteriontemplate .= html_writer::end_tag('tr'); // Criterion. +-- +1.7.5.4 + diff --git a/course/view.php b/course/view.php index 00c6754..07036e8 100644 --- a/course/view.php +++ b/course/view.php @@ -34,7 +34,7 @@ } $course = $DB->get_record('course', $params, '*', MUST_EXIST); - + //echo("PRUEBA2"); $urlparams = array('id' => $course->id); // Sectionid should get priority over section number @@ -228,7 +228,7 @@ $PAGE->set_title(get_string('course') . ': ' . $course->fullname); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); - + if ($completion->is_enabled() && ajaxenabled()) { // This value tracks whether there has been a dynamic change to the page. // It is used so that if a user does this - (a) set some tickmarks, (b) diff --git a/file.patch b/file.patch new file mode 100644 index 0000000..5873f50 --- /dev/null +++ b/file.patch @@ -0,0 +1,414 @@ +diff --git a/.gitignore b/.gitignore +index e95a47a..b785235 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -25,4 +25,5 @@ CVS + /.project + /.buildpath + /.cache +-phpunit.xml +\ No newline at end of file ++phpunit.xml ++/moodle/nbproject/private/ +\ No newline at end of file +diff --git a/course/view.php b/course/view.php +index 00c6754..07036e8 100644 +--- a/course/view.php ++++ b/course/view.php +@@ -34,7 +34,7 @@ + } + + $course = $DB->get_record('course', $params, '*', MUST_EXIST); +- ++ //echo("PRUEBA2"); + $urlparams = array('id' => $course->id); + + // Sectionid should get priority over section number +@@ -228,7 +228,7 @@ + $PAGE->set_title(get_string('course') . ': ' . $course->fullname); + $PAGE->set_heading($course->fullname); + echo $OUTPUT->header(); +- ++ + if ($completion->is_enabled() && ajaxenabled()) { + // This value tracks whether there has been a dynamic change to the page. + // It is used so that if a user does this - (a) set some tickmarks, (b) +diff --git a/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php b/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php +index 75af83a..ba0c51d 100644 +--- a/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php ++++ b/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php +@@ -54,7 +54,7 @@ class backup_gradingform_guide_plugin extends backup_gradingform_plugin { + + $criterion = new backup_nested_element('guidecriterion', array('id'), array( + 'sortorder', 'shortname', 'description', 'descriptionformat', +- 'descriptionmarkers', 'descriptionmarkersformat', 'maxscore')); ++ 'descriptionmarkers', 'descriptionmarkersformat', 'maxscore','percentatge')); + + $comments = new backup_nested_element('guidecomments'); + +diff --git a/grade/grading/form/guide/db/install.xml b/grade/grading/form/guide/db/install.xml +index d8aa0b6..1587c58 100644 +--- a/grade/grading/form/guide/db/install.xml ++++ b/grade/grading/form/guide/db/install.xml +@@ -14,7 +14,8 @@ + + + +- ++ ++ + + + +diff --git a/grade/grading/form/guide/edit_form.php b/grade/grading/form/guide/edit_form.php +index ff2e86d..22997d7 100644 +--- a/grade/grading/form/guide/edit_form.php ++++ b/grade/grading/form/guide/edit_form.php +@@ -59,6 +59,8 @@ class gradingform_guide_editguide extends moodleform { + $form->addElement('editor', 'description_editor', get_string('description'), null, $options); + $form->setType('description_editor', PARAM_RAW); + ++ ++ + // Guide completion status. + $choices = array(); + $choices[gradingform_controller::DEFINITION_STATUS_DRAFT] = html_writer::tag('span', +@@ -70,6 +72,9 @@ class gradingform_guide_editguide extends moodleform { + // Guide editor. + $element = $form->addElement('guideeditor', 'guide', get_string('pluginname', 'gradingform_guide')); + $form->setType('guide', PARAM_RAW); ++ ++ ++ + + $buttonarray = array(); + $buttonarray[] = &$form->createElement('submit', 'saveguide', get_string('saveguide', 'gradingform_guide')); +diff --git a/grade/grading/form/guide/guideeditor.php b/grade/grading/form/guide/guideeditor.php +index aebb982..bdc13c9 100644 +--- a/grade/grading/form/guide/guideeditor.php ++++ b/grade/grading/form/guide/guideeditor.php +@@ -184,6 +184,7 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { + // Iterate through criteria. + $lastaction = null; + $lastid = null; ++ $suma = 0; + foreach ($value['criteria'] as $id => $criterion) { + if ($id == 'addcriterion') { + $id = $this->get_next_id(array_keys($value['criteria'])); +@@ -203,6 +204,16 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { + $errors['err_maxscorenotnumeric'] = 1; + $criterion['error_description'] = true; + } ++ if (!strlen(trim($criterion['percentatge']))) { ++ $errors['err_nopercentatge'] = 1; ++ $criterion['error_description'] = true; ++ } else if (!is_numeric($criterion['percentatge']) || $criterion['percentatge'] < 0 || $criterion['percentatge'] > 100) { ++ $errors['err_percentatgenotnumeric'] = 1; ++ $criterion['error_description'] = true; ++ } ++ else { ++ $suma = $suma + $criterion['percentatge']; ++ } + } + if (array_key_exists('moveup', $criterion) || $lastaction == 'movedown') { + unset($criterion['moveup']); +@@ -229,7 +240,12 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { + $lastid = $id; + } + } +- ++ if ($suma != 100) ++ { ++ $errors['err_suma100'] = 1; ++ $criterion['error_description'] = true; ++ } ++ + // Add sort order field to criteria. + $csortorder = 1; + foreach (array_keys($return['criteria']) as $id) { +diff --git a/grade/grading/form/guide/js/guideeditor.js b/grade/grading/form/guide/js/guideeditor.js +index 3aeb83b..c4ade11 100644 +--- a/grade/grading/form/guide/js/guideeditor.js ++++ b/grade/grading/form/guide/js/guideeditor.js +@@ -52,7 +52,7 @@ M.gradingform_guideeditor.clickanywhere = function(e) { + } + // if clicked on description item and this item is not enabled - enable it + var container = null +- if ((container = el.ancestor('.criterionname')) || (container = el.ancestor('.criterionmaxscore'))) { ++ if (((container = el.ancestor('.criterionname')) || (container = el.ancestor('.criterionmaxscore')))|| (container = el.ancestor('.criterionpercentatge'))) { + el = container.one('input[type=text]') + } else if ((container = el.ancestor('.criteriondesc')) || (container = el.ancestor('.criteriondescmarkers'))) { + el = container.one('textarea') +@@ -128,12 +128,16 @@ M.gradingform_guideeditor.editmode = function(el, editmode) { + if (ta.get('name').indexOf('[maxscore]') > 1) { + ta.setStyle('width', '25px'); + } else { ++ if (ta.get('name').indexOf('[percentatge]') > 1) { ++ ta.setStyle('width', '25px'); ++ } else { + var width = parseFloat(ta.get('parentNode').getComputedStyle('width'))-10, + height = parseFloat(ta.get('parentNode').getComputedStyle('height')) + ta.setStyle('width', Math.max(width,50)+'px') + ta.setStyle('height', Math.max(height,30)+'px') + } + } ++ } + catch (err) { + // this browser do not support 'computedStyle', leave the default size of the textbox + } +diff --git a/grade/grading/form/guide/lang/en/gradingform_guide.php b/grade/grading/form/guide/lang/en/gradingform_guide.php +index 6bbfb40..39ffdfc 100644 +--- a/grade/grading/form/guide/lang/en/gradingform_guide.php ++++ b/grade/grading/form/guide/lang/en/gradingform_guide.php +@@ -49,6 +49,9 @@ $string['description'] = 'Description'; + $string['descriptionmarkers'] = 'Description for Markers'; + $string['descriptionstudents'] = 'Description for Students'; + $string['err_maxscorenotnumeric'] = 'Criterion max score must be numeric'; ++$string['err_suma100'] = 'La suma de porcentajes debe sumar 100'; ++$string['err_nopercentatge'] = 'Criterion percentatge can not be empty'; ++$string['err_percentatgenotnumeric']='Criterion percentatge must be numeric and lower than 100'; + $string['err_nocomment'] = 'Comment can not be empty'; + $string['err_nodescription'] = 'Student description can not be empty'; + $string['err_nodescriptionmarkers'] = 'Marker description can not be empty'; +@@ -66,6 +69,7 @@ $string['hidestudentdesc'] = 'Hide student criterion descriptions'; + $string['maxscore'] = 'Maximum mark'; + $string['name'] = 'Name'; + $string['needregrademessage'] = 'The marking guide definition was changed after this student had been graded. The student can not see this marking guide until you check the marking guide and update the grade.'; ++$string['percentatge'] = 'Percentage'; + $string['pluginname'] = 'Marking guide'; + $string['previewmarkingguide'] = 'Preview marking guide'; + $string['regrademessage1'] = 'You are about to save changes to a marking guide that has already been used for grading. Please indicate if existing grades need to be reviewed. If you set this then the marking guide will be hidden from students until their item is regraded.'; +diff --git a/grade/grading/form/guide/lib.php b/grade/grading/form/guide/lib.php +index 15ef0d7..6545546 100644 +--- a/grade/grading/form/guide/lib.php ++++ b/grade/grading/form/guide/lib.php +@@ -157,7 +157,7 @@ class gradingform_guide_controller extends gradingform_controller { + } + $currentcriteria = $currentdefinition->guide_criteria; + $criteriafields = array('sortorder', 'description', 'descriptionformat', 'descriptionmarkers', +- 'descriptionmarkersformat', 'shortname', 'maxscore'); ++ 'descriptionmarkersformat', 'shortname', 'maxscore', 'percentatge'); + foreach ($newcriteria as $id => $criterion) { + if (preg_match('/^NEWID\d+$/', $id)) { + // Insert criterion into DB. +@@ -313,8 +313,8 @@ class gradingform_guide_controller extends gradingform_controller { + $criteria = $DB->get_recordset('gradingform_guide_criteria', array('definitionid' => $this->definition->id), 'sortorder'); + foreach ($criteria as $criterion) { + foreach (array('id', 'sortorder', 'description', 'descriptionformat', +- 'maxscore', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname') as $fieldname) { +- if ($fieldname == 'maxscore') { // Strip any trailing 0. ++ 'maxscore', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname','percentatge') as $fieldname) { ++ if ($fieldname == 'maxscore'|| $fieldname == 'percentatge') { // Strip any trailing 0. + $this->definition->guide_criteria[$criterion->id][$fieldname] = (float)$criterion->{$fieldname}; + } else { + $this->definition->guide_criteria[$criterion->id][$fieldname] = $criterion->{$fieldname}; +@@ -634,7 +634,7 @@ class gradingform_guide_controller extends gradingform_controller { + $returnvalue = array('minscore' => 0, 'maxscore' => 0); + $maxscore = 0; + foreach ($this->get_definition()->guide_criteria as $id => $criterion) { +- $maxscore += $criterion['maxscore']; ++ $maxscore += $criterion['maxscore']*($criterion['percentatge']/100); + } + $returnvalue['maxscore'] = $maxscore; + $returnvalue['minscore'] = 0; +@@ -798,12 +798,26 @@ class gradingform_guide_instance extends gradingform_instance { + $mingrade = $graderange[0]; + $maxgrade = $graderange[count($graderange) - 1]; + ++ + $curscore = 0; ++ $i=0; ++ $j=0; + foreach ($grade['criteria'] as $record) { +- $curscore += $record['score']; ++ foreach ($this->get_controller()->get_definition()->guide_criteria as $id => $criterion) { ++ if($i==$j) ++ { ++ $curscore += $record['score']*($criterion['percentatge']/100); ++ } ++ $j=$j+1; ++ } ++ $j=0; ++ $i=$i+1; ++ + } ++ + return round(($curscore-$scores['minscore'])/($scores['maxscore']-$scores['minscore'])* +- ($maxgrade-$mingrade), 0) + $mingrade; ++ ($maxgrade-$mingrade), 0) + $mingrade; ++ + } + + /** +@@ -841,6 +855,7 @@ class gradingform_guide_instance extends gradingform_instance { + $a = new stdClass(); + $a->criterianame = $criteria[$id]['shortname']; + $a->maxscore = $criteria[$id]['maxscore']; ++ $a->percentatge = $criteria[$id]['percentatge']; + $html .= html_writer::tag('div', get_string('err_scoreinvalid', 'gradingform_guide', $a), + array('class' => 'gradingform_guide-error')); + } +diff --git a/grade/grading/form/guide/renderer.php b/grade/grading/form/guide/renderer.php +index 360e1b9..b204eeb 100644 +--- a/grade/grading/form/guide/renderer.php ++++ b/grade/grading/form/guide/renderer.php +@@ -66,9 +66,10 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'class' => '{CRITERION-class}', + 'descriptionmarkers' => '{CRITERION-descriptionmarkers}', + 'shortname' => '{CRITERION-shortname}', +- 'maxscore' => '{CRITERION-maxscore}'); ++ 'maxscore' => '{CRITERION-maxscore}', ++ 'percentatge' => '{CRITERION-percentatge}'); + } else { +- foreach (array('sortorder', 'description', 'class', 'shortname', 'descriptionmarkers', 'maxscore') as $key) { ++ foreach (array('sortorder', 'description', 'class', 'shortname', 'descriptionmarkers', 'maxscore','percentatge') as $key) { + // Set missing array elements to empty strings to avoid warnings. + if (!array_key_exists($key, $criterion)) { + $criterion[$key] = ''; +@@ -109,6 +110,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'value' => htmlspecialchars($criterion['maxscore']), + 'id' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); + $maxscore = html_writer::tag('div', $maxscore, array('class'=>'criterionmaxscore')); ++ ++ $percentatge = html_writer::empty_tag('input', array('type'=> 'text', ++ 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]', 'size' => '3', ++ 'value' => htmlspecialchars($criterion['percentatge']), ++ 'id' => '{NAME}[criteria][{CRITERION-id}][percentatge]')); ++ $percentatge = html_writer::tag('div', $percentatge, array('class'=>'criterionpercentatge')); + } else { + if ($mode == gradingform_guide_controller::DISPLAY_EDIT_FROZEN) { + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', +@@ -121,14 +128,18 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]', 'value' => $criterion['descriptionmarkers'])); + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', + 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]', 'value' => $criterion['maxscore'])); ++ $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', ++ 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]', 'value' => $criterion['percentatge'])); + } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL || + $mode == gradingform_guide_controller::DISPLAY_VIEW) { + $descriptionclass = 'descriptionreadonly'; + } + $shortname = html_writer::tag('div', $criterion['shortname'], + array('class'=>'criterionshortname', 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]')); +- $descmarkerclass = ''; +- $descstudentclass = ''; ++ $descmarkerclass = 'a'; ++ $descstudentclass = 'b'; ++ $maxscoreclass = 'x'; ++ $percentatgeclass = 'y'; + if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { + if (!get_user_preferences('gradingform_guide-showmarkerdesc', true)) { + $descmarkerclass = ' hide'; +@@ -144,7 +155,11 @@ class gradingform_guide_renderer extends plugin_renderer_base { + array('class'=>'criteriondescriptionmarkers'.$descmarkerclass, + 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]')); + $maxscore = html_writer::tag('div', $criterion['maxscore'], +- array('class'=>'criteriondescriptionscore', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); ++ array('class'=>'criteriondescriptionscore'.$maxscoreclass, ++ 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); ++ $percentatge = html_writer::tag('div', $criterion['percentatge'], ++ array('class'=>'criteriondescriptionpercentatge'.$percentatgeclass, ++ 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]')); + } + + if (isset($criterion['error_description'])) { +@@ -165,6 +180,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { + $title .= html_writer::tag('label', get_string('maxscore', 'gradingform_guide'), + array('for'=>'{NAME}[criteria][{CRITERION-id}][maxscore]')); + $title .= $maxscore; ++ //$title .= html_writer::tag('br'); ++ $title .= html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), ++ array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]')); ++ $title .= $percentatge; //contenido ++ //$title .= '%'; ++ //saltos de linea + } else if ($mode == gradingform_guide_controller::DISPLAY_PREVIEW_GRADED || + $mode == gradingform_guide_controller::DISPLAY_VIEW) { + $title .= $description; +@@ -184,6 +205,7 @@ class gradingform_guide_renderer extends plugin_renderer_base { + } + if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { + $scoreclass = ''; ++ $percentatgeclass2 = ''; + if (!empty($validationerrors[$criterion['id']]['score'])) { + $scoreclass = 'error'; + $currentscore = $validationerrors[$criterion['id']]['score']; // Show invalid score in form. +@@ -199,8 +221,13 @@ class gradingform_guide_renderer extends plugin_renderer_base { + 'id' => '{NAME}[criteria][{CRITERION-id}][score]', + 'size' => '3', 'value' => htmlspecialchars($currentscore))); + $score .= '/'.$maxscore; +- + $criteriontemplate .= html_writer::tag('td', $score, array('class' => 'score')); ++ $percentatge2 = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), ++ array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass2)); ++ $percentatge2 .= $percentatge; ++ $percentatge2 .= '%'; ++ $criteriontemplate .= html_writer::tag('td', $percentatge2, array('class' => 'percentatge2')); ++ + } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL_FROZEN) { + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', + 'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark)); +@@ -210,6 +237,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { + if (!empty($options['showmarkspercriterionstudents'])) { + $criteriontemplate .= html_writer::tag('td', htmlspecialchars($currentscore). ' / '.$maxscore, + array('class' => 'score')); ++ $percentatge2 = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), ++ array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass)); ++ $percentatge2 .= $percentatge; ++ $percentatge2 .= '%'; ++ $criteriontemplate .= html_writer::tag('td', $percentatge2, array('class' => 'percentatge2')); ++ + } + } + $criteriontemplate .= html_writer::end_tag('tr'); // Criterion. +diff --git a/grade/grading/form/guide/styles.css b/grade/grading/form/guide/styles.css +index 9a18aea..d07eb68 100644 +--- a/grade/grading/form/guide/styles.css ++++ b/grade/grading/form/guide/styles.css +@@ -19,7 +19,8 @@ + .gradingform_guide .criterion.even {background:#F0F0F0;} + + .gradingform_guide .criterion .description {width:100%;} +-.gradingform_guide .criterion .description .criterionmaxscore input {width:20px;} ++.gradingform_guide .criterion .description .criterionmaxscore input {width:20000px;} ++.gradingform_guide .criterion .description .criterionpercentatge input {width:20000px;} + .gradingform_guide .criterion .description .criterionname {font-weight:bold;} + .gradingform_guide .criterion label {font-weight:bold; padding-right: 5px} + +@@ -64,4 +65,5 @@ + .gradingform_guide table {width: 100%} + .gradingform_guide .criteriondescriptionmarkers {width: 300px;} + .gradingform_guide .markingguideremark {width: 100%;} +-.gradingform_guide .criteriondescriptionscore {display: inline;} +\ No newline at end of file ++.gradingform_guide .criteriondescriptionscore {display: inline;} ++.gradingform_guide .criteriondescriptionpercentatge {display: inline;} +\ No newline at end of file +diff --git a/moodle/nbproject/project.properties b/moodle/nbproject/project.properties +new file mode 100644 +index 0000000..d2735b5 +--- /dev/null ++++ b/moodle/nbproject/project.properties +@@ -0,0 +1,7 @@ ++include.path=${php.global.include.path} ++php.version=PHP_53 ++source.encoding=UTF-8 ++src.dir=.. ++tags.asp=false ++tags.short=true ++web.root=. +diff --git a/moodle/nbproject/project.xml b/moodle/nbproject/project.xml +new file mode 100644 +index 0000000..2dc1068 +--- /dev/null ++++ b/moodle/nbproject/project.xml +@@ -0,0 +1,9 @@ ++ ++ ++ org.netbeans.modules.php.project ++ ++ ++ moodle ++ ++ ++ diff --git a/fix_empty_poster.patch b/fix_empty_poster.patch new file mode 100644 index 0000000..e69de29 diff --git a/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php b/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php index 75af83a..ba0c51d 100644 --- a/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php +++ b/grade/grading/form/guide/backup/moodle2/backup_gradingform_guide_plugin.class.php @@ -54,7 +54,7 @@ class backup_gradingform_guide_plugin extends backup_gradingform_plugin { $criterion = new backup_nested_element('guidecriterion', array('id'), array( 'sortorder', 'shortname', 'description', 'descriptionformat', - 'descriptionmarkers', 'descriptionmarkersformat', 'maxscore')); + 'descriptionmarkers', 'descriptionmarkersformat', 'maxscore','percentatge')); $comments = new backup_nested_element('guidecomments'); diff --git a/grade/grading/form/guide/db/install.xml b/grade/grading/form/guide/db/install.xml index d8aa0b6..1587c58 100644 --- a/grade/grading/form/guide/db/install.xml +++ b/grade/grading/form/guide/db/install.xml @@ -14,7 +14,8 @@ - + + diff --git a/grade/grading/form/guide/edit_form.php b/grade/grading/form/guide/edit_form.php index ff2e86d..22997d7 100644 --- a/grade/grading/form/guide/edit_form.php +++ b/grade/grading/form/guide/edit_form.php @@ -59,6 +59,8 @@ class gradingform_guide_editguide extends moodleform { $form->addElement('editor', 'description_editor', get_string('description'), null, $options); $form->setType('description_editor', PARAM_RAW); + + // Guide completion status. $choices = array(); $choices[gradingform_controller::DEFINITION_STATUS_DRAFT] = html_writer::tag('span', @@ -70,6 +72,9 @@ class gradingform_guide_editguide extends moodleform { // Guide editor. $element = $form->addElement('guideeditor', 'guide', get_string('pluginname', 'gradingform_guide')); $form->setType('guide', PARAM_RAW); + + + $buttonarray = array(); $buttonarray[] = &$form->createElement('submit', 'saveguide', get_string('saveguide', 'gradingform_guide')); diff --git a/grade/grading/form/guide/guideeditor.php b/grade/grading/form/guide/guideeditor.php index aebb982..bdc13c9 100644 --- a/grade/grading/form/guide/guideeditor.php +++ b/grade/grading/form/guide/guideeditor.php @@ -184,6 +184,7 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { // Iterate through criteria. $lastaction = null; $lastid = null; + $suma = 0; foreach ($value['criteria'] as $id => $criterion) { if ($id == 'addcriterion') { $id = $this->get_next_id(array_keys($value['criteria'])); @@ -203,6 +204,16 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { $errors['err_maxscorenotnumeric'] = 1; $criterion['error_description'] = true; } + if (!strlen(trim($criterion['percentatge']))) { + $errors['err_nopercentatge'] = 1; + $criterion['error_description'] = true; + } else if (!is_numeric($criterion['percentatge']) || $criterion['percentatge'] < 0 || $criterion['percentatge'] > 100) { + $errors['err_percentatgenotnumeric'] = 1; + $criterion['error_description'] = true; + } + else { + $suma = $suma + $criterion['percentatge']; + } } if (array_key_exists('moveup', $criterion) || $lastaction == 'movedown') { unset($criterion['moveup']); @@ -229,7 +240,12 @@ class moodlequickform_guideeditor extends HTML_QuickForm_input { $lastid = $id; } } - + if ($suma != 100) + { + $errors['err_suma100'] = 1; + $criterion['error_description'] = true; + } + // Add sort order field to criteria. $csortorder = 1; foreach (array_keys($return['criteria']) as $id) { diff --git a/grade/grading/form/guide/js/guideeditor.js b/grade/grading/form/guide/js/guideeditor.js index 3aeb83b..c4ade11 100644 --- a/grade/grading/form/guide/js/guideeditor.js +++ b/grade/grading/form/guide/js/guideeditor.js @@ -52,7 +52,7 @@ M.gradingform_guideeditor.clickanywhere = function(e) { } // if clicked on description item and this item is not enabled - enable it var container = null - if ((container = el.ancestor('.criterionname')) || (container = el.ancestor('.criterionmaxscore'))) { + if (((container = el.ancestor('.criterionname')) || (container = el.ancestor('.criterionmaxscore')))|| (container = el.ancestor('.criterionpercentatge'))) { el = container.one('input[type=text]') } else if ((container = el.ancestor('.criteriondesc')) || (container = el.ancestor('.criteriondescmarkers'))) { el = container.one('textarea') @@ -128,12 +128,16 @@ M.gradingform_guideeditor.editmode = function(el, editmode) { if (ta.get('name').indexOf('[maxscore]') > 1) { ta.setStyle('width', '25px'); } else { + if (ta.get('name').indexOf('[percentatge]') > 1) { + ta.setStyle('width', '25px'); + } else { var width = parseFloat(ta.get('parentNode').getComputedStyle('width'))-10, height = parseFloat(ta.get('parentNode').getComputedStyle('height')) ta.setStyle('width', Math.max(width,50)+'px') ta.setStyle('height', Math.max(height,30)+'px') } } + } catch (err) { // this browser do not support 'computedStyle', leave the default size of the textbox } diff --git a/grade/grading/form/guide/lang/en/gradingform_guide.php b/grade/grading/form/guide/lang/en/gradingform_guide.php index 6bbfb40..2fbe92b 100644 --- a/grade/grading/form/guide/lang/en/gradingform_guide.php +++ b/grade/grading/form/guide/lang/en/gradingform_guide.php @@ -49,6 +49,9 @@ $string['description'] = 'Description'; $string['descriptionmarkers'] = 'Description for Markers'; $string['descriptionstudents'] = 'Description for Students'; $string['err_maxscorenotnumeric'] = 'Criterion max score must be numeric'; +$string['err_suma100'] = 'The sum of percentage should total 100'; +$string['err_nopercentatge'] = 'Criterion percentatge can not be empty'; +$string['err_percentatgenotnumeric']='Criterion percentatge must be numeric and lower than 100'; $string['err_nocomment'] = 'Comment can not be empty'; $string['err_nodescription'] = 'Student description can not be empty'; $string['err_nodescriptionmarkers'] = 'Marker description can not be empty'; @@ -66,6 +69,7 @@ $string['hidestudentdesc'] = 'Hide student criterion descriptions'; $string['maxscore'] = 'Maximum mark'; $string['name'] = 'Name'; $string['needregrademessage'] = 'The marking guide definition was changed after this student had been graded. The student can not see this marking guide until you check the marking guide and update the grade.'; +$string['percentatge'] = 'Percentage'; $string['pluginname'] = 'Marking guide'; $string['previewmarkingguide'] = 'Preview marking guide'; $string['regrademessage1'] = 'You are about to save changes to a marking guide that has already been used for grading. Please indicate if existing grades need to be reviewed. If you set this then the marking guide will be hidden from students until their item is regraded.'; diff --git a/grade/grading/form/guide/lib.php b/grade/grading/form/guide/lib.php index 15ef0d7..6545546 100644 --- a/grade/grading/form/guide/lib.php +++ b/grade/grading/form/guide/lib.php @@ -157,7 +157,7 @@ class gradingform_guide_controller extends gradingform_controller { } $currentcriteria = $currentdefinition->guide_criteria; $criteriafields = array('sortorder', 'description', 'descriptionformat', 'descriptionmarkers', - 'descriptionmarkersformat', 'shortname', 'maxscore'); + 'descriptionmarkersformat', 'shortname', 'maxscore', 'percentatge'); foreach ($newcriteria as $id => $criterion) { if (preg_match('/^NEWID\d+$/', $id)) { // Insert criterion into DB. @@ -313,8 +313,8 @@ class gradingform_guide_controller extends gradingform_controller { $criteria = $DB->get_recordset('gradingform_guide_criteria', array('definitionid' => $this->definition->id), 'sortorder'); foreach ($criteria as $criterion) { foreach (array('id', 'sortorder', 'description', 'descriptionformat', - 'maxscore', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname') as $fieldname) { - if ($fieldname == 'maxscore') { // Strip any trailing 0. + 'maxscore', 'descriptionmarkers', 'descriptionmarkersformat', 'shortname','percentatge') as $fieldname) { + if ($fieldname == 'maxscore'|| $fieldname == 'percentatge') { // Strip any trailing 0. $this->definition->guide_criteria[$criterion->id][$fieldname] = (float)$criterion->{$fieldname}; } else { $this->definition->guide_criteria[$criterion->id][$fieldname] = $criterion->{$fieldname}; @@ -634,7 +634,7 @@ class gradingform_guide_controller extends gradingform_controller { $returnvalue = array('minscore' => 0, 'maxscore' => 0); $maxscore = 0; foreach ($this->get_definition()->guide_criteria as $id => $criterion) { - $maxscore += $criterion['maxscore']; + $maxscore += $criterion['maxscore']*($criterion['percentatge']/100); } $returnvalue['maxscore'] = $maxscore; $returnvalue['minscore'] = 0; @@ -798,12 +798,26 @@ class gradingform_guide_instance extends gradingform_instance { $mingrade = $graderange[0]; $maxgrade = $graderange[count($graderange) - 1]; + $curscore = 0; + $i=0; + $j=0; foreach ($grade['criteria'] as $record) { - $curscore += $record['score']; + foreach ($this->get_controller()->get_definition()->guide_criteria as $id => $criterion) { + if($i==$j) + { + $curscore += $record['score']*($criterion['percentatge']/100); + } + $j=$j+1; + } + $j=0; + $i=$i+1; + } + return round(($curscore-$scores['minscore'])/($scores['maxscore']-$scores['minscore'])* - ($maxgrade-$mingrade), 0) + $mingrade; + ($maxgrade-$mingrade), 0) + $mingrade; + } /** @@ -841,6 +855,7 @@ class gradingform_guide_instance extends gradingform_instance { $a = new stdClass(); $a->criterianame = $criteria[$id]['shortname']; $a->maxscore = $criteria[$id]['maxscore']; + $a->percentatge = $criteria[$id]['percentatge']; $html .= html_writer::tag('div', get_string('err_scoreinvalid', 'gradingform_guide', $a), array('class' => 'gradingform_guide-error')); } diff --git a/grade/grading/form/guide/renderer.php b/grade/grading/form/guide/renderer.php index 360e1b9..b204eeb 100644 --- a/grade/grading/form/guide/renderer.php +++ b/grade/grading/form/guide/renderer.php @@ -66,9 +66,10 @@ class gradingform_guide_renderer extends plugin_renderer_base { 'class' => '{CRITERION-class}', 'descriptionmarkers' => '{CRITERION-descriptionmarkers}', 'shortname' => '{CRITERION-shortname}', - 'maxscore' => '{CRITERION-maxscore}'); + 'maxscore' => '{CRITERION-maxscore}', + 'percentatge' => '{CRITERION-percentatge}'); } else { - foreach (array('sortorder', 'description', 'class', 'shortname', 'descriptionmarkers', 'maxscore') as $key) { + foreach (array('sortorder', 'description', 'class', 'shortname', 'descriptionmarkers', 'maxscore','percentatge') as $key) { // Set missing array elements to empty strings to avoid warnings. if (!array_key_exists($key, $criterion)) { $criterion[$key] = ''; @@ -109,6 +110,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { 'value' => htmlspecialchars($criterion['maxscore']), 'id' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); $maxscore = html_writer::tag('div', $maxscore, array('class'=>'criterionmaxscore')); + + $percentatge = html_writer::empty_tag('input', array('type'=> 'text', + 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]', 'size' => '3', + 'value' => htmlspecialchars($criterion['percentatge']), + 'id' => '{NAME}[criteria][{CRITERION-id}][percentatge]')); + $percentatge = html_writer::tag('div', $percentatge, array('class'=>'criterionpercentatge')); } else { if ($mode == gradingform_guide_controller::DISPLAY_EDIT_FROZEN) { $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', @@ -121,14 +128,18 @@ class gradingform_guide_renderer extends plugin_renderer_base { 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]', 'value' => $criterion['descriptionmarkers'])); $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]', 'value' => $criterion['maxscore'])); + $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', + 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]', 'value' => $criterion['percentatge'])); } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL || $mode == gradingform_guide_controller::DISPLAY_VIEW) { $descriptionclass = 'descriptionreadonly'; } $shortname = html_writer::tag('div', $criterion['shortname'], array('class'=>'criterionshortname', 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]')); - $descmarkerclass = ''; - $descstudentclass = ''; + $descmarkerclass = 'a'; + $descstudentclass = 'b'; + $maxscoreclass = 'x'; + $percentatgeclass = 'y'; if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { if (!get_user_preferences('gradingform_guide-showmarkerdesc', true)) { $descmarkerclass = ' hide'; @@ -144,7 +155,11 @@ class gradingform_guide_renderer extends plugin_renderer_base { array('class'=>'criteriondescriptionmarkers'.$descmarkerclass, 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]')); $maxscore = html_writer::tag('div', $criterion['maxscore'], - array('class'=>'criteriondescriptionscore', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); + array('class'=>'criteriondescriptionscore'.$maxscoreclass, + 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); + $percentatge = html_writer::tag('div', $criterion['percentatge'], + array('class'=>'criteriondescriptionpercentatge'.$percentatgeclass, + 'name' => '{NAME}[criteria][{CRITERION-id}][percentatge]')); } if (isset($criterion['error_description'])) { @@ -165,6 +180,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { $title .= html_writer::tag('label', get_string('maxscore', 'gradingform_guide'), array('for'=>'{NAME}[criteria][{CRITERION-id}][maxscore]')); $title .= $maxscore; + //$title .= html_writer::tag('br'); + $title .= html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), + array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]')); + $title .= $percentatge; //contenido + //$title .= '%'; + //saltos de linea } else if ($mode == gradingform_guide_controller::DISPLAY_PREVIEW_GRADED || $mode == gradingform_guide_controller::DISPLAY_VIEW) { $title .= $description; @@ -184,6 +205,7 @@ class gradingform_guide_renderer extends plugin_renderer_base { } if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { $scoreclass = ''; + $percentatgeclass2 = ''; if (!empty($validationerrors[$criterion['id']]['score'])) { $scoreclass = 'error'; $currentscore = $validationerrors[$criterion['id']]['score']; // Show invalid score in form. @@ -199,8 +221,13 @@ class gradingform_guide_renderer extends plugin_renderer_base { 'id' => '{NAME}[criteria][{CRITERION-id}][score]', 'size' => '3', 'value' => htmlspecialchars($currentscore))); $score .= '/'.$maxscore; - $criteriontemplate .= html_writer::tag('td', $score, array('class' => 'score')); + $percentatge2 = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), + array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass2)); + $percentatge2 .= $percentatge; + $percentatge2 .= '%'; + $criteriontemplate .= html_writer::tag('td', $percentatge2, array('class' => 'percentatge2')); + } else if ($mode == gradingform_guide_controller::DISPLAY_EVAL_FROZEN) { $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark)); @@ -210,6 +237,12 @@ class gradingform_guide_renderer extends plugin_renderer_base { if (!empty($options['showmarkspercriterionstudents'])) { $criteriontemplate .= html_writer::tag('td', htmlspecialchars($currentscore). ' / '.$maxscore, array('class' => 'score')); + $percentatge2 = html_writer::tag('label', get_string('percentatge', 'gradingform_guide'), + array('for'=>'{NAME}[criteria][{CRITERION-id}][percentatge]', 'class' => $percentatgeclass)); + $percentatge2 .= $percentatge; + $percentatge2 .= '%'; + $criteriontemplate .= html_writer::tag('td', $percentatge2, array('class' => 'percentatge2')); + } } $criteriontemplate .= html_writer::end_tag('tr'); // Criterion. diff --git a/grade/grading/form/guide/styles.css b/grade/grading/form/guide/styles.css index 9a18aea..d07eb68 100644 --- a/grade/grading/form/guide/styles.css +++ b/grade/grading/form/guide/styles.css @@ -19,7 +19,8 @@ .gradingform_guide .criterion.even {background:#F0F0F0;} .gradingform_guide .criterion .description {width:100%;} -.gradingform_guide .criterion .description .criterionmaxscore input {width:20px;} +.gradingform_guide .criterion .description .criterionmaxscore input {width:20000px;} +.gradingform_guide .criterion .description .criterionpercentatge input {width:20000px;} .gradingform_guide .criterion .description .criterionname {font-weight:bold;} .gradingform_guide .criterion label {font-weight:bold; padding-right: 5px} @@ -64,4 +65,5 @@ .gradingform_guide table {width: 100%} .gradingform_guide .criteriondescriptionmarkers {width: 300px;} .gradingform_guide .markingguideremark {width: 100%;} -.gradingform_guide .criteriondescriptionscore {display: inline;} \ No newline at end of file +.gradingform_guide .criteriondescriptionscore {display: inline;} +.gradingform_guide .criteriondescriptionpercentatge {display: inline;} \ No newline at end of file diff --git a/moodle/nbproject/project.properties b/moodle/nbproject/project.properties new file mode 100644 index 0000000..d2735b5 --- /dev/null +++ b/moodle/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_53 +source.encoding=UTF-8 +src.dir=.. +tags.asp=false +tags.short=true +web.root=. diff --git a/moodle/nbproject/project.xml b/moodle/nbproject/project.xml new file mode 100644 index 0000000..2dc1068 --- /dev/null +++ b/moodle/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + moodle + + +