Permalink
Browse files

Merge pull request #25 from marinaglancy/wip-nov14-rubric

  • Loading branch information...
mudrd8mz committed Nov 14, 2011
2 parents 6f07a6a + 3c2b3cb commit 053d290c0dda4d5597f3cdafaa5d97df61ebe045
@@ -570,26 +570,29 @@ protected function get_method_name() {
*
* @param moodle_page $page
* @param int $itemid
- * @param array $grading_info result of function grade_get_grades if plugin want to use some of their info
+ * @param array $gradinginfo result of function grade_get_grades if plugin want to use some of their info
* @param string $defaultcontent default string to be returned if no active grading is found or for some reason can not be shown to a user
* @param boolean $cangrade whether current user has capability to grade in this context
* @return string
*/
- public function render_grade($page, $itemid, $grading_info, $defaultcontent, $cangrade) {
+ public function render_grade($page, $itemid, $gradinginfo, $defaultcontent, $cangrade) {
return $defaultcontent;
}
/**
* Sets the range of grades used in this area. This is usually either range like 0-100
* or the scale where keys start from 1. Typical use:
* $controller->set_grade_range(make_grades_menu($gradingtype));
+ *
+ * @param array $graderange
*/
public final function set_grade_range(array $graderange) {
$this->graderange = $graderange;
}
/**
* Returns the range of grades used in this area
+ *
* @return array
*/
public final function get_grade_range() {
@@ -90,7 +90,7 @@ public function definition() {
* @return array of "element_name"=>"error_description" if there are errors,
* or an empty array if everything is OK (true allowed for backwards compatibility too).
*/
- function validation($data, $files) {
+ public function validation($data, $files) {
$err = parent::validation($data, $files);
$err = array();
$form = $this->_form;
@@ -116,7 +116,7 @@ function validation($data, $files) {
*
* @return object submitted data; NULL if not valid or not submitted or cancelled
*/
- function get_data() {
+ public function get_data() {
$data = parent::get_data();
if (!empty($data->saverubric)) {
$data->status = gradingform_controller::DEFINITION_STATUS_READY;
@@ -133,7 +133,7 @@ function get_data() {
*
* @param gradingform_rubric_controller $controller
*/
- function need_confirm_regrading($controller) {
+ public function need_confirm_regrading($controller) {
$data = $this->get_data();
if (isset($data->rubric['regrade'])) {
// we have already displayed the confirmation on the previous step
@@ -180,7 +180,7 @@ function need_confirm_regrading($controller) {
* @param string $elementname
* @return HTML_QuickForm_element
*/
- function &findButton($elementname) {
+ protected function &findButton($elementname) {
$form = $this->_form;
$buttonar =& $form->getElement('buttonar');
$elements =& $buttonar->getElements();
@@ -7,7 +7,7 @@ M.gradingform_rubric.init = function(Y, options) {
Y.on('click', M.gradingform_rubric.levelclick, '#rubric-'+options.name+' .level', null, Y, options.name);
Y.all('#rubric-'+options.name+' .radio').setStyle('display', 'none')
Y.all('#rubric-'+options.name+' .level').each(function (node) {
- if (node.one('input[type=radio][checked]')) {
+ if (node.one('input[type=radio]').get('checked')) {
node.addClass('checked');
}
});
@@ -63,17 +63,17 @@ M.gradingform_rubriceditor.editmode = function(el, editmode, focustb) {
var ta = el.one('textarea')
if (!editmode && ta.getStyle('display') == 'none') return;
if (editmode && ta.getStyle('display') == 'block') return;
- var pseudotablink = '<a href="#" class="pseudotablink"> </a>',
+ var pseudotablink = '<a href="#" class="pseudotablink">&nbsp;</a>',
taplain = ta.get('parentNode').one('.plainvalue'),
tbplain = null,
tb = el.one('input[type=text]')
// add 'plainvalue' next to textarea for description/definition and next to input text field for score (if applicable)
if (!taplain) {
- ta.get('parentNode').append('<div class="plainvalue"><span></span>'+pseudotablink+'</div>')
+ ta.get('parentNode').append('<div class="plainvalue"><span class="textvalue">&nbsp;</span>'+pseudotablink+'</div>')
taplain = ta.get('parentNode').one('.plainvalue')
taplain.one('.pseudotablink').on('focus', M.gradingform_rubriceditor.clickanywhere)
if (tb) {
- tb.get('parentNode').append('<div class="plainvalue"><span></span>'+pseudotablink+'</div>')
+ tb.get('parentNode').append('<div class="plainvalue"><span class="textvalue">&nbsp;</span>'+pseudotablink+'</div>')
tbplain = tb.get('parentNode').one('.plainvalue')
tbplain.one('.pseudotablink').on('focus', M.gradingform_rubriceditor.clickanywhere)
}
@@ -88,8 +88,8 @@ M.gradingform_rubriceditor.editmode = function(el, editmode, focustb) {
value = (el.hasClass('level')) ? M.str.gradingform_rubric.levelempty : M.str.gradingform_rubric.criterionempty
taplain.addClass('empty')
}
- taplain.one('span').set('innerHTML', value)
- if (tb) tbplain.one('span').set('innerHTML', tb.get('value'))
+ taplain.one('.textvalue').set('innerHTML', value)
+ if (tb) tbplain.one('.textvalue').set('innerHTML', tb.get('value'))
} else {
// if we need to show the input fields, set the width/height for textarea so it fills the cell
var width = parseFloat(ta.get('parentNode').getComputedStyle('width')),
@@ -33,13 +33,20 @@
*/
class gradingform_rubric_controller extends gradingform_controller {
// Modes of displaying the rubric (used in gradingform_rubric_renderer)
- const DISPLAY_EDIT_FULL = 1; // For editing (moderator or teacher creates a rubric)
- const DISPLAY_EDIT_FROZEN = 2; // Preview the rubric design with hidden fields
- const DISPLAY_PREVIEW = 3; // Preview the rubric design
- const DISPLAY_EVAL = 4; // For evaluation, enabled (teacher grades a student)
- const DISPLAY_EVAL_FROZEN = 5; // For evaluation, with hidden fields
- const DISPLAY_REVIEW = 6; // Teacher reviews filled rubric
- const DISPLAY_VIEW = 7; // Dispaly filled rubric (i.e. students see their grades)
+ /** Rubric display mode: For editing (moderator or teacher creates a rubric) */
+ const DISPLAY_EDIT_FULL = 1;
+ /** Rubric display mode: Preview the rubric design with hidden fields */
+ const DISPLAY_EDIT_FROZEN = 2;
+ /** Rubric display mode: Preview the rubric design */
+ const DISPLAY_PREVIEW = 3;
+ /** Rubric display mode: For evaluation, enabled (teacher grades a student) */
+ const DISPLAY_EVAL = 4;
+ /** Rubric display mode: For evaluation, with hidden fields */
+ const DISPLAY_EVAL_FROZEN = 5;
+ /** Rubric display mode: Teacher reviews filled rubric */
+ const DISPLAY_REVIEW = 6;
+ /** Rubric display mode: Dispaly filled rubric (i.e. students see their grades) */
+ const DISPLAY_VIEW = 7;
/**
* Extends the module settings navigation with the rubric grading settings
@@ -247,6 +254,9 @@ public function update_or_check_rubric(stdClass $newdefinition, $usermodified =
return array_pop($changelevels);
}
+ /**
+ * Marks all instances filled with this rubric with the status INSTANCE_STATUS_NEEDUPDATE
+ */
public function mark_for_regrade() {
global $DB;
if ($this->has_active_instances()) {
@@ -312,6 +322,11 @@ protected function load_definition() {
}
}
+ /**
+ * Returns the default options for the rubric display
+ *
+ * @return array
+ */
public static function get_default_options() {
$options = array(
'sortlevelsasc' => 1,
@@ -326,6 +341,11 @@ public static function get_default_options() {
return $options;
}
+ /**
+ * Gets the options of this rubric definition, fills the missing options with default values
+ *
+ * @return array
+ */
public function get_options() {
$options = self::get_default_options();
if (!empty($this->definition->options)) {
@@ -398,6 +418,9 @@ public function get_definition_copy(gradingform_controller $target) {
}
/**
+ * Options for displaying the rubric description field in the form
+ *
+ * @param object $context
* @return array options for the form description field
*/
public static function description_form_field_options($context) {
@@ -437,7 +460,7 @@ public function get_formatted_description() {
* Returns the rubric plugin renderer
*
* @param moodle_page $page the target page
- * @return renderer_base
+ * @return gradingform_rubric_renderer
*/
public function get_renderer(moodle_page $page) {
return $page->get_renderer('gradingform_'. $this->get_method_name());
@@ -519,12 +542,12 @@ public function get_or_create_instance($instanceid, $raterid, $itemid) {
*
* @param moodle_page $page
* @param int $itemid
- * @param array $grading_info result of function grade_get_grades
+ * @param array $gradinginfo result of function grade_get_grades
* @param string $defaultcontent default string to be returned if no active grading is found
* @param boolean $cangrade whether current user has capability to grade in this context
* @return string
*/
- public function render_grade($page, $itemid, $grading_info, $defaultcontent, $cangrade) {
+ public function render_grade($page, $itemid, $gradinginfo, $defaultcontent, $cangrade) {
return $this->get_renderer($page)->display_instances($this->get_active_instances($itemid), $defaultcontent, $cangrade);
}
@@ -610,6 +633,8 @@ public function copy($raterid, $itemid) {
/**
* Validates that rubric is fully completed and contains valid grade on each criterion
+ *
+ * @param array $elementvalue value of element as came in form submit
* @return boolean true if the form data is validated and contains no errors
*/
public function validate_grading_element($elementvalue) {
Oops, something went wrong.

0 comments on commit 053d290

Please sign in to comment.