Fixed bug with auto filtering users on the Taking page based on active group (thanks...
authorArtem Andreev <andreev.artem@gmail.com>
Sat, 2 Mar 2013 07:50:38 +0000 (11:50 +0400)
committerArtem Andreev <andreev.artem@gmail.com>
Sat, 2 Mar 2013 07:53:28 +0000 (11:53 +0400)
renderables.php
take.php

index 16fe825..a5482ca 100644 (file)
@@ -257,10 +257,12 @@ class attforblock_take_data implements renderable {
     private $att;
 
     public function  __construct(attforblock $att) {
-        if ($att->pageparams->grouptype)
+        if ($att->pageparams->grouptype) {
             $this->users = $att->get_users($att->pageparams->grouptype);
-        else
+        }
+        else {
             $this->users = $att->get_users($att->pageparams->group);
+        }
 
         $this->pageparams = $att->pageparams;
         $this->perm = $att->perm;
index 4f74e14..b7415d4 100644 (file)
--- a/take.php
+++ b/take.php
@@ -22,7 +22,6 @@ $pageparams = new att_take_page_params();
 $id                     = required_param('id', PARAM_INT);
 $pageparams->sessionid  = required_param('sessionid', PARAM_INT);
 $pageparams->grouptype  = required_param('grouptype', PARAM_INT);
-$pageparams->group     = optional_param('group', null, PARAM_INT);
 $pageparams->sort              = optional_param('sort', null, PARAM_INT);
 $pageparams->copyfrom   = optional_param('copyfrom', null, PARAM_INT);
 $pageparams->viewmode   = optional_param('viewmode', null, PARAM_INT);
@@ -34,6 +33,8 @@ $att            = $DB->get_record('attforblock', array('id' => $cm->instance), '
 
 require_login($course, true, $cm);
 
+$pageparams->group = groups_get_activity_group($cm, true);
+
 $pageparams->init($course->id);
 $att = new attforblock($att, $cm, $course, $PAGE->context, $pageparams);