Permalink
Browse files

Merge branch 'MDL-18301-23' of git://github.com/FMCorz/moodle into MO…

…ODLE_23_STABLE
  • Loading branch information...
2 parents d6cf442 + 2dd2bd7 commit 0dd189d59d7c1257e3275ae8157ffc8e58ae0e47 @danpoltawski danpoltawski committed Jul 9, 2012
Showing with 37 additions and 13 deletions.
  1. +1 −0 grade/edit/tree/item.php
  2. +11 −4 grade/edit/tree/item_form.php
  3. +1 −0 lang/en/grades.php
  4. +12 −0 lib/grade/grade_item.php
  5. +2 −0 lib/moodlelib.php
  6. +10 −9 mod/quiz/lib.php
View
1 grade/edit/tree/item.php
@@ -97,6 +97,7 @@
} else {
$item->aggregationcoef = format_float($item->aggregationcoef, 4);
}
+$item->cancontrolvisibility = $grade_item->can_control_visibility();
$mform = new edit_item_form(null, array('current'=>$item, 'gpr'=>$gpr));
View
15 grade/edit/tree/item_form.php
@@ -143,11 +143,18 @@ function definition() {
}
/// hiding
- // advcheckbox is not compatible with disabledIf!
- $mform->addElement('checkbox', 'hidden', get_string('hidden', 'grades'));
+ if ($item->cancontrolvisibility) {
+ // advcheckbox is not compatible with disabledIf!
+ $mform->addElement('checkbox', 'hidden', get_string('hidden', 'grades'));
+ $mform->addElement('date_time_selector', 'hiddenuntil', get_string('hiddenuntil', 'grades'), array('optional'=>true));
+ $mform->disabledIf('hidden', 'hiddenuntil[off]', 'notchecked');
+ } else {
+ $mform->addElement('static', 'hidden', get_string('hidden', 'grades'),
+ get_string('componentcontrolsvisibility', 'grades'));
+ // Unset hidden to avoid data override.
+ unset($item->hidden);
+ }
$mform->addHelpButton('hidden', 'hidden', 'grades');
- $mform->addElement('date_time_selector', 'hiddenuntil', get_string('hiddenuntil', 'grades'), array('optional'=>true));
- $mform->disabledIf('hidden', 'hiddenuntil[off]', 'notchecked');
/// locking
$mform->addElement('advcheckbox', 'locked', get_string('locked', 'grades'));
View
1 lang/en/grades.php
@@ -117,6 +117,7 @@
$string['categorytotalfull'] = '{$a->category} total';
$string['combo'] = 'Tabs and Dropdown menu';
$string['compact'] = 'Compact';
+$string['componentcontrolsvisibility'] = 'Whether this grade item is hidden is controlled by the activity settings.';
$string['contract'] = 'Contract category';
$string['controls'] = 'Controls';
$string['courseavg'] = 'Course average';
View
12 lib/grade/grade_item.php
@@ -2067,4 +2067,16 @@ public function get_coefstring() {
return false;
}
}
+
+ /**
+ * Returns whether the grade item can control the visibility of the grades
+ *
+ * @return bool
+ */
+ public function can_control_visibility() {
+ if (get_plugin_directory($this->itemtype, $this->itemmodule)) {
+ return !plugin_supports($this->itemtype, $this->itemmodule, FEATURE_CONTROLS_GRADE_VISIBILITY, false);
+ }
+ return true;
+ }
}
View
2 lib/moodlelib.php
@@ -385,6 +385,8 @@
define('FEATURE_GRADE_OUTCOMES', 'outcomes');
/** True if module supports advanced grading methods */
define('FEATURE_ADVANCED_GRADING', 'grade_advanced_grading');
+/** True if module controls the grade visibility over the gradebook */
+define('FEATURE_CONTROLS_GRADE_VISIBILITY', 'controlsgradevisbility');
/** True if module has code to track whether somebody viewed it */
define('FEATURE_COMPLETION_TRACKS_VIEWS', 'completion_tracks_views');
View
19 mod/quiz/lib.php
@@ -1550,15 +1550,16 @@ function quiz_attempt_summary_link_to_reports($quiz, $cm, $context, $returnzero
*/
function quiz_supports($feature) {
switch($feature) {
- case FEATURE_GROUPS: return true;
- case FEATURE_GROUPINGS: return true;
- case FEATURE_GROUPMEMBERSONLY: return true;
- case FEATURE_MOD_INTRO: return true;
- case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
- case FEATURE_GRADE_HAS_GRADE: return true;
- case FEATURE_GRADE_OUTCOMES: return false;
- case FEATURE_BACKUP_MOODLE2: return true;
- case FEATURE_SHOW_DESCRIPTION: return true;
+ case FEATURE_GROUPS: return true;
+ case FEATURE_GROUPINGS: return true;
+ case FEATURE_GROUPMEMBERSONLY: return true;
+ case FEATURE_MOD_INTRO: return true;
+ case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
+ case FEATURE_GRADE_HAS_GRADE: return true;
+ case FEATURE_GRADE_OUTCOMES: return false;
+ case FEATURE_BACKUP_MOODLE2: return true;
+ case FEATURE_SHOW_DESCRIPTION: return true;
+ case FEATURE_CONTROLS_GRADE_VISIBILITY: return true;
default: return null;
}

0 comments on commit 0dd189d

Please sign in to comment.