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


PHP GroupManager::subscribe_users方法代码示例

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


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

示例1: array

$selected_users = array();
if (!empty($group_member_list)) {
    foreach ($group_member_list as $index => $user) {
        $selected_users[] = $user['user_id'];
    }
}
$group_members_element = $form->addElement('advmultiselect', 'group_members', get_lang('GroupMembers'), $possible_users, 'style="width: 280px;"');
$form->addFormRule('check_group_members');
// submit button
$form->addButtonSave(get_lang('SaveSettings'));
if ($form->validate()) {
    $values = $form->exportValues();
    // Storing the users (we first remove all users and then add only those who were selected)
    GroupManager::unsubscribe_all_users($current_group['id']);
    if (isset($_POST['group_members']) && count($_POST['group_members']) > 0) {
        GroupManager::subscribe_users($values['group_members'], $current_group['id']);
    }
    // Returning to the group area (note: this is inconsistent with the rest of chamilo)
    $cat = GroupManager::get_category_from_group($current_group['id']);
    if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
        Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
        header('Location: group.php?' . api_get_cidreq(true, false));
    } else {
        Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
        header('Location: group.php?' . api_get_cidreq(true, false) . '&category=' . $cat['id']);
    }
    exit;
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
    case 'empty':
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:member_settings.php

示例2: importCourses

 /**
  * @param string $file
  * @param bool $moveFile
  * @param array $teacherBackup
  * @param array $groupBackup
  */
 private function importCourses($file, $moveFile = true, &$teacherBackup = array(), &$groupBackup = array())
 {
     $data = Import::csv_to_array($file);
     if (!empty($data)) {
         $this->logger->addInfo(count($data) . " records found.");
         foreach ($data as $row) {
             $row = $this->cleanCourseRow($row);
             $courseCode = CourseManager::get_course_id_from_original_id($row['extra_' . $this->extraFieldIdNameList['course']], $this->extraFieldIdNameList['course']);
             $courseInfo = api_get_course_info($courseCode);
             if (empty($courseInfo)) {
                 // Create
                 $params = array();
                 $params['title'] = $row['title'];
                 $params['exemplary_content'] = false;
                 $params['wanted_code'] = $row['course_code'];
                 $params['course_category'] = $row['course_category'];
                 $params['course_language'] = $row['language'];
                 $params['teachers'] = $row['teachers'];
                 $courseInfo = CourseManager::create_course($params);
                 if (!empty($courseInfo)) {
                     CourseManager::update_course_extra_field_value($courseInfo['code'], 'external_course_id', $row['extra_' . $this->extraFieldIdNameList['course']]);
                     $this->logger->addInfo("Courses - Course created " . $courseInfo['code']);
                 } else {
                     $this->logger->addError("Courses - Can't create course:" . $row['title']);
                 }
             } else {
                 // Update
                 $params = array('title' => $row['title'], 'category_code' => $row['course_category']);
                 $result = CourseManager::update_attributes($courseInfo['real_id'], $params);
                 $addTeacherToSession = isset($courseInfo['add_teachers_to_sessions_courses']) && !empty($courseInfo['add_teachers_to_sessions_courses']) ? true : false;
                 $teachers = $row['teachers'];
                 if (!is_array($teachers)) {
                     $teachers = array($teachers);
                 }
                 if ($addTeacherToSession) {
                     CourseManager::updateTeachers($courseInfo['id'], $row['teachers'], false, true, false, $teacherBackup);
                 } else {
                     CourseManager::updateTeachers($courseInfo['id'], $row['teachers'], false, false, false, $teacherBackup);
                 }
                 foreach ($teachers as $teacherId) {
                     if (isset($groupBackup['tutor'][$teacherId]) && isset($groupBackup['tutor'][$teacherId][$courseInfo['code']])) {
                         foreach ($groupBackup['tutor'][$teacherId][$courseInfo['code']] as $data) {
                             GroupManager::subscribe_tutors(array($teacherId), $data['group_id'], $data['c_id']);
                         }
                     }
                     if (isset($groupBackup['user'][$teacherId]) && isset($groupBackup['user'][$teacherId][$courseInfo['code']]) && !empty($groupBackup['user'][$teacherId][$courseInfo['code']])) {
                         foreach ($groupBackup['user'][$teacherId][$courseInfo['code']] as $data) {
                             GroupManager::subscribe_users(array($teacherId), $data['group_id'], $data['c_id']);
                         }
                     }
                 }
                 if ($result) {
                     $this->logger->addInfo("Courses - Course updated " . $courseInfo['code']);
                 } else {
                     $this->logger->addError("Courses - Course NOT updated " . $courseInfo['code']);
                 }
             }
         }
     }
     if ($moveFile) {
         $this->moveFile($file);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:69,代码来源:import_csv.php

示例3: get_lang

$nameTools = get_lang('GroupSpace');
$interbreadcrumb[] = array('url' => 'group.php?' . api_get_cidReq(), 'name' => get_lang('Groups'));
/*	Ensure all private groups // Juan Carlos Raña Trabado */
$forums_of_groups = get_forums_of_group($current_group['id']);
if (!GroupManager::userHasAccessToBrowse($user_id, $current_group, api_get_session_id())) {
    api_not_allowed(true);
}
Display::display_header($nameTools . ' ' . Security::remove_XSS($current_group['name']), 'Group');
/*	Introduction section (editable by course admin) */
Display::display_introduction_section(TOOL_GROUP);
/*	Actions and Action links */
/*
 * User wants to register in this group
 */
if (!empty($_GET['selfReg']) && GroupManager::is_self_registration_allowed($user_id, $current_group['id'])) {
    GroupManager::subscribe_users($user_id, $current_group['id']);
    Display::display_normal_message(get_lang('GroupNowMember'));
}
/*
 * User wants to unregister from this group
 */
if (!empty($_GET['selfUnReg']) && GroupManager::is_self_unregistration_allowed($user_id, $current_group['id'])) {
    GroupManager::unsubscribe_users($user_id, $current_group['id']);
    Display::display_normal_message(get_lang('StudentDeletesHimself'));
}
echo '<div class="actions">';
echo '<a href="group.php">' . Display::return_icon('back.png', get_lang('BackToGroupList'), '', ICON_SIZE_MEDIUM) . '</a>';
/*
 * Register to group
 */
$subscribe_group = '';
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:group_space.php

示例4: header

                Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
                header("Location: {$currentUrl}");
                exit;
            }
            break;
        case 'set_invisible':
            if (api_is_allowed_to_edit()) {
                GroupManager::setInvisible($my_get_id);
                Display::addFlash(Display::return_message(get_lang('ItemUpdated')));
                header("Location: {$currentUrl}");
                exit;
            }
            break;
        case 'self_reg':
            if (GroupManager::is_self_registration_allowed($userId, $my_group_id)) {
                GroupManager::subscribe_users($userId, $my_group_id);
                Display::addFlash(Display::return_message(get_lang('GroupNowMember')));
                header("Location: {$currentUrl}");
                exit;
            }
            break;
        case 'self_unreg':
            if (GroupManager::is_self_unregistration_allowed($userId, $my_group_id)) {
                GroupManager::unsubscribe_users($userId, $my_group_id);
                Display::addFlash(Display::return_message(get_lang('StudentDeletesHimself')));
                header("Location: {$currentUrl}");
                exit;
            }
            break;
    }
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:group.php

示例5: importCSV


//.........这里部分代码省略.........
                 if (count($courses) >= 2) {
                     // Only first teacher in course session;
                     $onlyAddFirstCoachOrTeacher = true;
                     // Remove all teachers from course.
                     $removeAllTeachersFromCourse = false;
                 }
             }
             foreach ($courses as $course) {
                 $courseArray = bracketsToArray($course);
                 $course_code = $courseArray[0];
                 if (CourseManager::course_exists($course_code)) {
                     $courseInfo = api_get_course_info($course_code);
                     $courseId = $courseInfo['real_id'];
                     // Adding the course to a session.
                     $sql = "INSERT IGNORE INTO {$tbl_session_course}\n                                SET c_id = '{$courseId}', session_id='{$session_id}'";
                     Database::query($sql);
                     SessionManager::installCourse($session_id, $courseInfo['real_id']);
                     if ($debug) {
                         $logger->addInfo("Sessions - Adding course '{$course_code}' to session #{$session_id}");
                     }
                     $course_counter++;
                     $course_coaches = isset($courseArray[1]) ? $courseArray[1] : null;
                     $course_users = isset($courseArray[2]) ? $courseArray[2] : null;
                     $course_users = explode(',', $course_users);
                     $course_coaches = explode(',', $course_coaches);
                     // Checking if the flag is set TeachersWillBeAddedAsCoachInAllCourseSessions (course_edit.php)
                     $addTeachersToSession = true;
                     if (array_key_exists('add_teachers_to_sessions_courses', $courseInfo)) {
                         $addTeachersToSession = $courseInfo['add_teachers_to_sessions_courses'];
                     }
                     // If any user provided for a course, use the users array.
                     if (empty($course_users)) {
                         if (!empty($userList)) {
                             SessionManager::subscribe_users_to_session_course($userList, $session_id, $course_code);
                             if ($debug) {
                                 $msg = "Sessions - Adding student list " . implode(', #', $userList) . " to course: '{$course_code}' and session #{$session_id}";
                                 $logger->addInfo($msg);
                             }
                         }
                     }
                     // Adding coaches to session course user.
                     if (!empty($course_coaches)) {
                         $savedCoaches = array();
                         // only edit if add_teachers_to_sessions_courses is set.
                         if ($addTeachersToSession) {
                             if ($addOriginalCourseTeachersAsCourseSessionCoaches) {
                                 // Adding course teachers as course session teachers.
                                 $alreadyAddedTeachers = CourseManager::getTeacherListFromCourse($course_code);
                                 if (!empty($alreadyAddedTeachers)) {
                                     $teachersToAdd = array();
                                     foreach ($alreadyAddedTeachers as $user) {
                                         $teachersToAdd[] = $user['username'];
                                     }
                                     $course_coaches = array_merge($course_coaches, $teachersToAdd);
                                 }
                             }
                             foreach ($course_coaches as $course_coach) {
                                 $coach_id = UserManager::get_user_id_from_username($course_coach);
                                 if ($coach_id !== false) {
                                     // Just insert new coaches
                                     SessionManager::updateCoaches($session_id, $courseId, array($coach_id), false);
                                     if ($debug) {
                                         $logger->addInfo("Sessions - Adding course coach: user #{$coach_id} ({$course_coach}) to course: '{$course_code}' and session #{$session_id}");
                                     }
                                     $savedCoaches[] = $coach_id;
                                 } else {
开发者ID:daffef,项目名称:chamilo-lms,代码行数:67,代码来源:sessionmanager.lib.php

示例6: isset

// Tool introduction
Display::display_introduction_section(TOOL_GROUP);
/*
 * Self-registration and un-registration
 */
$my_group_id = isset($_GET['group_id']) ? intval($_GET['group_id']) : null;
$my_msg = isset($_GET['msg']) ? Security::remove_XSS($_GET['msg']) : null;
$my_group = isset($_REQUEST['group']) ? Security::remove_XSS($_REQUEST['group']) : null;
$my_get_id1 = isset($_GET['id1']) ? Security::remove_XSS($_GET['id1']) : null;
$my_get_id2 = isset($_GET['id2']) ? Security::remove_XSS($_GET['id2']) : null;
$my_get_id = isset($_GET['id']) ? Security::remove_XSS($_GET['id']) : null;
if (isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'self_reg':
            if (GroupManager::is_self_registration_allowed($_SESSION['_user']['user_id'], $my_group_id)) {
                GroupManager::subscribe_users($_SESSION['_user']['user_id'], $my_group_id);
                Display::display_confirmation_message(get_lang('GroupNowMember'));
            }
            break;
        case 'self_unreg':
            if (GroupManager::is_self_unregistration_allowed($_SESSION['_user']['user_id'], $my_group_id)) {
                GroupManager::unsubscribe_users($_SESSION['_user']['user_id'], $my_group_id);
                Display::display_confirmation_message(get_lang('StudentDeletesHimself'));
            }
            break;
        case 'show_msg':
            Display::display_confirmation_message($my_msg);
            break;
        case 'warning_message':
            Display::display_warning_message($my_msg);
            break;
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:group.php


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