Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Commit

Permalink
Merge branch 'wip-MDL-43800-master' of git://github.com/marinaglancy/…
Browse files Browse the repository at this point in the history
…moodle
  • Loading branch information
stronk7 committed Jan 27, 2014
2 parents 5e7f4b1 + 3ba6353 commit 9be395e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions course/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ function definition_after_data() {
$options[$grouping->id] = format_string($grouping->name);
}
}
core_collator::asort($options);
$gr_el =& $mform->getElement('defaultgroupingid');
$gr_el->load($options);
}
Expand Down
3 changes: 2 additions & 1 deletion course/editsection_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ public function definition_after_data() {
// Grouping conditions - only if grouping is enabled at site level
if (!empty($CFG->enablegroupmembersonly)) {
$options = array();
$options[0] = get_string('none');
if ($groupings = $DB->get_records('groupings', array('courseid' => $course->id))) {
foreach ($groupings as $grouping) {
$options[$grouping->id] = format_string(
$grouping->name, true, array('context' => $context));
}
}
core_collator::asort($options);
$options = array(0 => get_string('none')) + $options;
$mform->addElement('select', 'groupingid', get_string('groupingsection', 'group'), $options);
$mform->addHelpButton('groupingid', 'groupingsection', 'group');
}
Expand Down
3 changes: 2 additions & 1 deletion course/moodleform_mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,13 @@ function standard_coursemodule_elements(){
if ($this->_features->groupings or $this->_features->groupmembersonly) {
//groupings selector - used for normal grouping mode or also when restricting access with groupmembersonly
$options = array();
$options[0] = get_string('none');
if ($groupings = $DB->get_records('groupings', array('courseid'=>$COURSE->id))) {
foreach ($groupings as $grouping) {
$options[$grouping->id] = format_string($grouping->name);
}
}
core_collator::asort($options);
$options = array(0 => get_string('none')) + $options;
$mform->addElement('select', 'groupingid', get_string('grouping', 'group'), $options);
$mform->addHelpButton('groupingid', 'grouping', 'group');
}
Expand Down
6 changes: 5 additions & 1 deletion group/groupings.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@
$data = array();
if ($groupings = $DB->get_records('groupings', array('courseid'=>$course->id), 'name')) {
$canchangeidnumber = has_capability('moodle/course:changeidnumber', $context);
foreach ($groupings as $gid => $grouping) {
$groupings[$gid]->formattedname = format_string($grouping->name, true, array('context' => $context));
}
core_collator::asort_objects_by_property($groupings, 'formattedname');
foreach($groupings as $grouping) {
$line = array();
$line[0] = format_string($grouping->name);
$line[0] = $grouping->formattedname;

if ($groups = groups_get_all_groups($courseid, 0, $grouping->id)) {
$groupnames = array();
Expand Down
10 changes: 7 additions & 3 deletions group/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@
$strnogroups = get_string('nogroups', 'group');
$strdescription = get_string('description');

// Get all groupings
// Get all groupings and sort them by formatted name.
$groupings = $DB->get_records('groupings', array('courseid'=>$courseid), 'name');
foreach ($groupings as $gid => $grouping) {
$groupings[$gid]->formattedname = format_string($grouping->name, true, array('context' => $context));
}
core_collator::asort_objects_by_property($groupings, 'formattedname');
$members = array();
foreach ($groupings as $grouping) {
$members[$grouping->id] = array();
Expand Down Expand Up @@ -136,7 +140,7 @@
$options = array();
$options[0] = get_string('all');
foreach ($groupings as $grouping) {
$options[$grouping->id] = strip_tags(format_string($grouping->name));
$options[$grouping->id] = strip_tags($grouping->formattedname);
}
$popupurl = new moodle_url($rooturl.'&group='.$groupid);
$select = new single_select($popupurl, 'grouping', $options, $groupingid, array());
Expand Down Expand Up @@ -199,7 +203,7 @@
if ($gpgid < 0) {
echo $OUTPUT->heading($strnotingrouping, 3);
} else {
echo $OUTPUT->heading(format_string($groupings[$gpgid]->name), 3);
echo $OUTPUT->heading($groupings[$gpgid]->formattedname, 3);
$description = file_rewrite_pluginfile_urls($groupings[$gpgid]->description, 'pluginfile.php', $context->id, 'grouping', 'description', $gpgid);
$options = new stdClass;
$options->noclean = true;
Expand Down

0 comments on commit 9be395e

Please sign in to comment.