]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14617 removed some legacy group code
authorskodak <skodak>
Thu, 1 May 2008 22:30:28 +0000 (22:30 +0000)
committerskodak <skodak>
Thu, 1 May 2008 22:30:28 +0000 (22:30 +0000)
admin/uploaduser.php
lib/deprecatedlib.php
mod/feedback/analysis.php
mod/feedback/show_entries.php
mod/forum/subscribe.php
search/documents/chat_document.php
search/documents/data_document.php

index bafcf4ad856650b5171ec5ff73bfaa16bc41213d..6a4c411ade7b857b9d831b3f4c6e5a35582549c6 100755 (executable)
@@ -644,7 +644,7 @@ if ($formdata = $mform->is_cancelled()) {
                 //build group cache
                 if (is_null($ccache[$shortname]->groups)) {
                     $ccache[$shortname]->groups = array();
-                    if ($groups = get_groups($courseid)) {
+                    if ($groups = groups_get_all_groups($courseid)) {
                         foreach ($groups as $gid=>$group) {
                             $ccache[$shortname]->groups[$gid] = new object();
                             $ccache[$shortname]->groups[$gid]->id   = $gid;
index 9d5b78bf3c89278d27936a7579c0f915cd965d66..7be45bf4e2fe4b31773768f0f3c33beed09f2c60 100644 (file)
@@ -733,88 +733,6 @@ function detect_munged_arguments($string, $allowdots=1) {
 /** various deprecated groups function **/
 
 
-/**
- * Returns the table in which group members are stored, with a prefix 'gm'.
- * @return SQL string.
- */
-function groups_members_from_sql() {
-    global $CFG;
-    return " {$CFG->prefix}groups_members gm ";
-}
-
-/**
- * Returns a join testing user.id against member's user ID.
- * Relies on 'user' table being included as 'user u'.
- * Used in Quiz module reports.
- * @param group ID, optional to include a test for this in the SQL.
- * @return SQL string.
- */
-function groups_members_join_sql($groupid=false) {
-    $sql = ' JOIN '.groups_members_from_sql().' ON u.id = gm.userid ';
-    if ($groupid) {
-        $sql = "AND gm.groupid = '$groupid' ";
-    }
-    return $sql;
-    //return ' INNER JOIN '.$CFG->prefix.'role_assignments ra ON u.id=ra.userid'.
-    //       ' INNER JOIN '.$CFG->prefix.'context c ON ra.contextid=c.id AND c.contextlevel='.CONTEXT_GROUP.' AND c.instanceid='.$groupid;
-}
-
-/**
- * Returns SQL for a WHERE clause testing the group ID.
- * Optionally test the member's ID against another table's user ID column.
- * @param groupid
- * @param userid_sql Optional user ID column selector, example "mdl_user.id", or false.
- * @return SQL string.
- */
-function groups_members_where_sql($groupid, $userid_sql=false) {
-    $sql = " gm.groupid = '$groupid' ";
-    if ($userid_sql) {
-        $sql .= "AND $userid_sql = gm.userid ";
-    }
-    return $sql;
-}
-
-
-/**
- * Returns an array of group objects that the user is a member of
- * in the given course.  If userid isn't specified, then return a
- * list of all groups in the course.
- *
- * @uses $CFG
- * @param int $courseid The id of the course in question.
- * @param int $userid The id of the user in question as found in the 'user' table 'id' field.
- * @return object
- */
-function get_groups($courseid, $userid=0) {
-    return groups_get_all_groups($courseid, $userid);
-}
-
-/**
- * Returns the user's groups in a particular course
- * note: this function originally returned only one group
- *
- * @uses $CFG
- * @param int $courseid The course in question.
- * @param int $userid The id of the user as found in the 'user' table.
- * @param int $groupid The id of the group the user is in.
- * @return aray of groups
- */
-function user_group($courseid, $userid) {
-    return groups_get_all_groups($courseid, $userid);
-}
-
-
-/**
- * Determines if the user is a member of the given group.
- *
- * @param int $groupid The group to check for membership.
- * @param int $userid The user to check against the group.
- * @return boolean True if the user is a member, false otherwise.
- */
-function ismember($groupid, $userid = null) {
-    return groups_is_member($groupid, $userid);
-}
-
 /**
  * Get the IDs for the user's groups in the given course.
  *
@@ -832,21 +750,6 @@ function mygroupid($courseid) {
     }
 }
 
-/**
- * Add a user to a group, return true upon success or if user already a group
- * member
- *
- * @param int $groupid  The group id to add user to
- * @param int $userid   The user id to add to the group
- * @return bool
- */
-function add_user_to_group($groupid, $userid) {
-    global $CFG;
-    require_once($CFG->dirroot.'/group/lib.php');
-
-    return groups_add_member($groupid, $userid);
-}
-
 
 /**
  * Returns an array of user objects
@@ -895,23 +798,6 @@ function groupmode($course, $cm=null) {
 }
 
 
-/**
- * Sets the current group in the session variable
- * When $SESSION->currentgroup[$courseid] is set to 0 it means, show all groups.
- * Sets currentgroup[$courseid] in the session variable appropriately.
- * Does not do any permission checking.
- * @uses $SESSION
- * @param int $courseid The course being examined - relates to id field in
- * 'course' table.
- * @param int $groupid The group being examined.
- * @return int Current group id which was set by this function
- */
-function set_current_group($courseid, $groupid) {
-    global $SESSION;
-    return $SESSION->currentgroup[$courseid] = $groupid;
-}
-
-
 /**
  * Gets the current group - either from the session variable or from the database.
  *
index 7ce9cd9cd9ecaa1b0e925412ff8c6c081bd2ea1a..12fb2e244dbb4879f0b12ca3838f52f1bab389d0 100644 (file)
@@ -86,7 +86,7 @@
     if( $capabilities->viewreports ) {
 
         //available group modes (NOGROUPS, SEPARATEGROUPS or VISIBLEGROUPS)
-        $feedbackgroups = get_groups($course->id);
+        $feedbackgroups = groups_get_all_groups($course->id);
         //get the effective groupmode of this course and module
         $groupmode = groupmode($course, $cm);
         if(is_array($feedbackgroups) && $groupmode > 0){
index d81078ce5e08a90cc467548f26c1156dc669ba3b..d6ee4cd3962d4b8b69649320828d291b929d04f7 100644 (file)
             print_box_start('generalbox boxaligncenter boxwidthwide');
 
             //available group modes (NOGROUPS, SEPARATEGROUPS or VISIBLEGROUPS)
-            $feedbackgroups = get_groups($course->id);
+            $feedbackgroups = groups_get_all_groups($course->id);
             //if(is_array($feedbackgroups) && $groupmode != SEPARATEGROUPS){
             if(is_array($feedbackgroups) && $groupmode > 0){
                 require_once('choose_group_form.php');
index 01c26c5c242269075522cbbe937d5890c7b3c3c8..1a685c16b5d957f8e136dcd3fb8c1f6598826a14 100644 (file)
@@ -38,7 +38,7 @@
     if (groupmode($course, $cm)
                 and !forum_is_subscribed($user->id, $forum)
                 and !has_capability('moodle/site:accessallgroups', $context)) {
-        if (!mygroupid($course->id)) {
+        if (!groups_get_all_groups($course->id, $USER->id)) {
             error('Sorry, but you must be a group member to subscribe.');
         }
     }
index acc4ffb479b234468bec8f3c3aa6708eb4dd12f8..371c8584c97689e9a034d6db89feb263af121b46 100644 (file)
@@ -273,7 +273,7 @@ function chat_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
     // trap if user is not same group and groups are separated
     $current_group = get_current_group($course->id);
     $course = get_record('course', 'id', $chat->course);
-    if ((groupmode($course, $cm) == SEPARATEGROUPS) && !ismember($group_id) && !has_capability('moodle/site:accessallgroups', $context)){ 
+    if ((groupmode($course, $cm) == SEPARATEGROUPS) && !groups_is_member($group_id) && !has_capability('moodle/site:accessallgroups', $context)){ 
         if (!empty($CFG->search_access_debug)) echo "search reject : chat element is in separated group ";
         return false;
     }
index 4b301ffaa82c18b49666a67cec139b7d442bc564..655b5d5ae0fe8168aa1944ad15fb9a5d282e2101 100644 (file)
@@ -350,7 +350,7 @@ function data_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
     // trap if user is not same group and groups are separated
     $current_group = get_current_group($course->id);
     $course = get_record('course', 'id', $data->course);
-    if ((groupmode($course, $cm) == SEPARATEGROUPS) && !ismember($group_id) && !has_capability('moodle/site:accessallgroups', $context)){ 
+    if ((groupmode($course, $cm) == SEPARATEGROUPS) && !groups_is_member($group_id) && !has_capability('moodle/site:accessallgroups', $context)){ 
         if (!empty($CFG->search_access_debug)) echo "search reject : separated group owned resource ";
         return false;
     }