Assignment MDL-24948 fix depreceated calls to get group info
authorDan Marsden <Dan@digitalclay.co.nz>
Tue, 2 Nov 2010 01:38:56 +0000 (01:38 +0000)
committerDan Marsden <Dan@digitalclay.co.nz>
Tue, 2 Nov 2010 01:38:56 +0000 (01:38 +0000)
mod/assignment/type/online/assignment.class.php
mod/assignment/type/upload/assignment.class.php
mod/assignment/type/uploadsingle/assignment.class.php

index 7317f3e..8a22549 100644 (file)
@@ -398,18 +398,12 @@ class assignment_online extends assignment_base {
         //online assignment can use html
         $filextn=".html";
 
-        if (isset($this->cm->groupmode) && empty($this->course->groupmodeforce)) {
-            $groupmode = $this->cm->groupmode;
-        } else {
-            $groupmode = $this->course->groupmode;
-        }
-
+        $groupmode = groups_get_activity_groupmode($this->cm);
         $groupid = 0;   // All users
         $groupname = '';
         if ($groupmode) {
-            $group = get_current_group($this->course->id, true);
-            $groupid = $group->id;
-            $groupname = $group->name.'-';
+            $groupid = groups_get_activity_group($this->cm, true);
+            $groupname = groups_get_group_name($groupid).'-';
         }
         $filename = str_replace(' ', '_', clean_filename($this->course->shortname.'-'.$this->assignment->name.'-'.$groupname.$this->assignment->id.".zip")); //name of new zip file.
         foreach ($submissions as $submission) {
index 4731982..367af5e 100644 (file)
@@ -1097,18 +1097,12 @@ class assignment_upload extends assignment_base {
         $filesforzipping = array();
         $fs = get_file_storage();
 
-        if (isset($this->cm->groupmode) && empty($this->course->groupmodeforce)) {
-            $groupmode = $this->cm->groupmode;
-        } else {
-            $groupmode = $this->course->groupmode;
-        }
-        
+        $groupmode = groups_get_activity_groupmode($this->cm);
         $groupid = 0;   // All users
         $groupname = '';
         if ($groupmode) {
-            $group = get_current_group($this->course->id, true);
-            $groupid = $group->id;
-            $groupname = $group->name.'-';
+            $groupid = groups_get_activity_group($this->cm, true);
+            $groupname = groups_get_group_name($groupid).'-';
         }
         $filename = str_replace(' ', '_', clean_filename($this->course->shortname.'-'.$this->assignment->name.'-'.$groupname.$this->assignment->id.".zip")); //name of new zip file.
         foreach ($submissions as $submission) {
index bd75c08..d0278ac 100644 (file)
@@ -364,18 +364,12 @@ class assignment_uploadsingle extends assignment_base {
         $filesforzipping = array();
         $fs = get_file_storage();
 
-        if (isset($this->cm->groupmode) && empty($this->course->groupmodeforce)) {
-            $groupmode = $this->cm->groupmode;
-        } else {
-            $groupmode = $this->course->groupmode;
-        }
-        
+        $groupmode = groups_get_activity_groupmode($this->cm);
         $groupid = 0;   // All users
         $groupname = '';
         if ($groupmode) {
-            $group = get_current_group($this->course->id, true);
-            $groupid = $group->id;
-            $groupname = $group->name.'-';
+            $groupid = groups_get_activity_group($this->cm, true);
+            $groupname = groups_get_group_name($groupid).'-';
         }
         $filename = str_replace(' ', '_', clean_filename($this->course->shortname.'-'.$this->assignment->name.'-'.$groupname.$this->assignment->id.".zip")); //name of new zip file.
         foreach ($submissions as $submission) {