Esempio n. 1
0
         }
         $actiontaken = true;
     }
     break;
     /**
      * Makes the user a member of a given group
      */
 /**
  * Makes the user a member of a given group
  */
 case 'addmember':
     if (has_capability('moodle/course:managegroups', $manager->get_context())) {
         $userid = required_param('user', PARAM_INT);
         $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
         $mform = new enrol_users_addmember_form(NULL, array('user' => $user, 'course' => $course, 'allgroups' => $manager->get_all_groups()));
         $mform->set_data($PAGE->url->params());
         $data = $mform->get_data();
         if ($mform->is_cancelled()) {
             redirect($PAGE->url);
         }
         if (!empty($data->groupids)) {
             foreach ($data->groupids as $groupid) {
                 $manager->add_user_to_group($user, $groupid);
             }
             redirect($PAGE->url);
         } else {
             $pagetitle = get_string('addgroup', 'group');
         }
         $actiontaken = true;
     }
     break;
Esempio n. 2
0
         }
         $actiontaken = true;
     }
     break;
     /**
      * Makes the user a member of a given group
      */
 /**
  * Makes the user a member of a given group
  */
 case 'addmember':
     if (has_capability('moodle/course:managegroups', $manager->get_context())) {
         $userid = required_param('user', PARAM_INT);
         $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
         $mform = new enrol_users_addmember_form(NULL, array('user' => $user, 'course' => $course, 'allgroups' => $manager->get_all_groups()));
         $mform->set_data($pageurl->params());
         $data = $mform->get_data();
         if ($mform->is_cancelled() || $data && $manager->add_user_to_group($user, $data->groupid)) {
             redirect($pageurl);
         } else {
             $pagetitle = get_string('addgroup', 'group');
         }
         $actiontaken = true;
     }
     break;
     /**
      * Edits the details of a users enrolment in the course
      */
 /**
  * Edits the details of a users enrolment in the course
  */