Merge branch 'wip-MDL-30478-master' of git://github.com/abgreeve/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 24 Apr 2012 23:11:38 +0000 (01:11 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 24 Apr 2012 23:11:38 +0000 (01:11 +0200)
1  2 
mod/wiki/create.php

@@@ -62,9 -62,29 +62,29 @@@ if (!$cm = get_coursemodule_from_instan
      print_error('invalidcoursemoduleid', 'wiki');
  }
  
+ $groups = new stdClass();
+ if (groups_get_activity_groupmode($cm)) {
+     $modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
+     $canaccessgroups = has_capability('moodle/site:accessallgroups', $modulecontext);
+     if ($canaccessgroups) {
+         $groups->availablegroups = groups_get_all_groups($cm->course);
+         $allpart = new stdClass();
+         $allpart->id = '0';
+         $allpart->name = get_string('allparticipants');
+         array_unshift($groups->availablegroups, $allpart);
+     } else {
+         $groups->availablegroups = groups_get_all_groups($cm->course, $USER->id);
+     }
+     if (!empty($group)) {
+         $groups->currentgroup = $group;
+     } else {
+         $groups->currentgroup = groups_get_activity_group($cm);
+     }
+ }
  $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
  
 -require_login($course->id, true, $cm);
 +require_login($course, true, $cm);
  
  $wikipage = new page_wiki_create($wiki, $subwiki, $cm);