Beispiel #1
0
 public function find_users($search)
 {
     list($wherecondition, $params) = $this->search_sql($search, 'u');
     $roles = groups_get_members_by_role($this->groupid, $this->courseid, $this->required_fields_sql('u'), 'u.lastname, u.firstname', $wherecondition, $params);
     return $this->convert_array_format($roles, $search);
 }
Beispiel #2
0
echo '<p><input type="submit" name="act_updatemembers" id="updatemembers" value="' . get_string('showmembersforgroup', 'group') . '" /></p>' . "\n";
echo '<p><input type="submit" ' . $showeditgroupsettingsform_disabled . ' name="act_showgroupsettingsform" id="showeditgroupsettingsform" value="' . get_string('editgroupsettings', 'group') . '" /></p>' . "\n";
echo '<p><input type="submit" ' . $deletegroup_disabled . ' name="act_deletegroup" id="deletegroup" value="' . get_string('deleteselectedgroup', 'group') . '" /></p>' . "\n";
echo '<p><input type="submit" name="act_showcreateorphangroupform" id="showcreateorphangroupform" value="' . get_string('creategroup', 'group') . '" /></p>' . "\n";
echo '<p><input type="submit" name="act_showautocreategroupsform" id="showautocreategroupsform" value="' . get_string('autocreategroups', 'group') . '" /></p>' . "\n";
echo '<p><input type="submit" name="act_showimportgroups" id="showimportgroups" value="' . get_string('importgroups', 'core_group') . '" /></p>' . "\n";
echo '</td>' . "\n";
echo '<td>' . "\n";
echo '<p><label for="members"><span id="memberslabel">' . get_string('membersofselectedgroup', 'group') . ' </span><span id="thegroup">' . $selectedname . '</span></label></p>' . "\n";
//NOTE: the SELECT was, multiple="multiple" name="user[]" - not used and breaks onclick.
echo '<select name="user" id="members" size="15" class="select"' . "\n";
echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">' . "\n";
$member_names = array();
$atleastonemember = false;
if ($singlegroup) {
    if ($groupmemberroles = groups_get_members_by_role($groupids[0], $courseid, 'u.id,u.firstname,u.lastname')) {
        foreach ($groupmemberroles as $roleid => $roledata) {
            echo '<optgroup label="' . s($roledata->name) . '">';
            foreach ($roledata->users as $member) {
                echo '<option value="' . $member->id . '">' . fullname($member, true) . '</option>';
                $atleastonemember = true;
            }
            echo '</optgroup>';
        }
    }
}
if (!$atleastonemember) {
    // Print an empty option to avoid the XHTML error of having an empty select element
    echo '<option>&nbsp;</option>';
}
echo '</select>' . "\n";
Beispiel #3
0
    public function find_users($search) {
        list($wherecondition, $params) = $this->search_sql($search, 'u');

        list($sort, $sortparams) = users_order_by_sql('u', $search, $this->accesscontext);

        $roles = groups_get_members_by_role($this->groupid, $this->courseid,
                $this->required_fields_sql('u') . ', gm.component',
                $sort, $wherecondition, array_merge($params, $sortparams));

        return $this->convert_array_format($roles, $search);
    }
Beispiel #4
0
}
//UAIOPEN - tiene los permisos necesarios para ver todos los grupos
if (has_capability('moodle/site:accessallgroups', $context)) {
    echo '<p><input type="submit" name="act_showautocreategroupsform" id="showautocreategroupsform" value="' . get_string('autocreategroups', 'group') . '" /></p>' . "\n";
    echo '<p><input type="submit" name="act_showimportgroups" id="showimportgroups" value="' . get_string('importgroups', 'core_group') . '" /></p>' . "\n";
}
echo '</td>' . "\n";
echo '<td>' . "\n";
echo '<p><label for="members"><span id="memberslabel">' . get_string('membersofselectedgroup', 'group') . ' </span><span id="thegroup">' . $selectedname . '</span></label></p>' . "\n";
//NOTE: the SELECT was, multiple="multiple" name="user[]" - not used and breaks onclick.
echo '<select name="user" id="members" size="15" class="select"' . "\n";
echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">' . "\n";
$member_names = array();
$atleastonemember = false;
if ($singlegroup) {
    if ($groupmemberroles = groups_get_members_by_role($groupids[0], $courseid, 'u.id, ' . get_all_user_name_fields(true, 'u'))) {
        foreach ($groupmemberroles as $roleid => $roledata) {
            echo '<optgroup label="' . s($roledata->name) . '">';
            foreach ($roledata->users as $member) {
                echo '<option value="' . $member->id . '">' . fullname($member, true) . '</option>';
                $atleastonemember = true;
            }
            echo '</optgroup>';
        }
    }
}
if (!$atleastonemember) {
    // Print an empty option to avoid the XHTML error of having an empty select element
    echo '<option>&nbsp;</option>';
}
echo '</select>' . "\n";
     if ($course->groupmode) {
         $selectedgroup = get_current_group($course->id);
         $showgroups = true;
     } else {
         $selectedgroup = 0;
         $showgroups = false;
     }
 }
 // Get all the possible users
 if ($course->id != SITEID) {
     if ($selectedgroup) {
         // If using a group, only get users in that group.
         // MARSUPIAL ************ MODIFICAT -> Deprecated code in Moodle 2.x
         // 2012.12.14 @abertranb
         require_once $CFG->dirroot . '/group/lib.php';
         $users_to_show_role = groups_get_members_by_role($selectedgroup, $course->id, 'u.id,u.firstname,u.lastname,u.email', 'u.lastname ASC', 'u.id not in (SELECT DISTINCT euserid FROM ' . $CFG->prefix . 'rcommon_user_credentials WHERE isbn = \'' . $book->isbn . '\')');
         $users_to_show = array();
         if ($users_to_show_role && count($users_to_show_role) > 0) {
             foreach ($users_to_show_role as $role) {
                 foreach ($role->users as $u) {
                     $users_to_show[] = $u;
                 }
             }
         }
         // ************ MODIFICAT
         //$users_to_show = get_group_users($selectedgroup, 'u.lastname ASC', "SELECT DISTINCT euserid FROM {$CFG->prefix}rcommon_user_credentials WHERE isbn = '{$book->isbn}'", 'u.id, u.firstname, u.lastname, u.idnumber, u.email');
         // ************ FI
     } else {
         // MARSUPIAL ************ MODIFICAT -> Deprecated code in Moodle 2.x
         // 2012.12.14 @abertranb
         $context_course = context_course::instance($course->id);