当前位置: 首页>>代码示例>>PHP>>正文


PHP course_enrolment_manager::add_user_to_group方法代码示例

本文整理汇总了PHP中course_enrolment_manager::add_user_to_group方法的典型用法代码示例。如果您正苦于以下问题:PHP course_enrolment_manager::add_user_to_group方法的具体用法?PHP course_enrolment_manager::add_user_to_group怎么用?PHP course_enrolment_manager::add_user_to_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在course_enrolment_manager的用法示例。


在下文中一共展示了course_enrolment_manager::add_user_to_group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

     /**
      * 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;
 }
 // If we took an action display we need to display something special.
 if ($actiontaken) {
     if (empty($pageheading)) {
         $pageheading = $pagetitle;
     }
     $PAGE->set_title($pagetitle);
开发者ID:Keneth1212,项目名称:moodle,代码行数:31,代码来源:users.php

示例2: array

         }
         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() || $data && $manager->add_user_to_group($user, $data->groupid)) {
                 redirect($PAGE->url);
             } else {
                 $pagetitle = get_string('addgroup', 'group');
             }
             $actiontaken = true;
         }
         break;
 }
 // If we took an action display we need to display something special.
 if ($actiontaken) {
     if (empty($pageheading)) {
         $pageheading = $pagetitle;
     }
     $PAGE->set_title($pagetitle);
     $PAGE->set_heading($pageheading);
开发者ID:vinoth4891,项目名称:clinique,代码行数:31,代码来源:users.php


注:本文中的course_enrolment_manager::add_user_to_group方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。