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


PHP CourseManager::get_courses_info_from_visual_code方法代码示例

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


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

示例1: updateUsers

/**
 * Update users from the imported data
 * @param   array   $users List of users
 * @return  void
 * @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in
 */
function updateUsers($users)
{
    global $insertedIn_course;
    // Not all scripts declare the $inserted_in_course array (although they should).
    if (!isset($inserted_in_course)) {
        $inserted_in_course = array();
    }
    require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php';
    $usergroup = new UserGroup();
    $send_mail = $_POST['sendMail'] ? true : false;
    if (is_array($users)) {
        foreach ($users as $user) {
            $user = complete_missing_data($user);
            $user['Status'] = api_status_key($user['Status']);
            $userName = $user['UserName'];
            $userInfo = api_get_user_info_from_username($userName);
            $user_id = $userInfo['user_id'];
            if ($user_id == 0) {
                return false;
            }
            $firstName = isset($user['FirstName']) ? $user['FirstName'] : $userInfo['firstname'];
            $lastName = isset($user['LastName']) ? $user['LastName'] : $userInfo['lastname'];
            $userName = isset($user['NewUserName']) ? $user['NewUserName'] : $userInfo['username'];
            $password = isset($user['Password']) ? $user['Password'] : $userInfo['password'];
            $authSource = isset($user['AuthSource']) ? $user['AuthSource'] : $userInfo['auth_source'];
            $email = isset($user['Email']) ? $user['Email'] : $userInfo['email'];
            $status = isset($user['Status']) ? $user['Status'] : $userInfo['status'];
            $officialCode = isset($user['OfficialCode']) ? $user['OfficialCode'] : $userInfo['official_code'];
            $phone = isset($user['PhoneNumber']) ? $user['PhoneNumber'] : $userInfo['phone'];
            $pictureUrl = isset($user['PictureUri']) ? $user['PictureUri'] : $userInfo['picture_url'];
            $expirationDate = isset($user['ExpiryDate']) ? $user['ExpiryDate'] : $userInfo['expiration_date'];
            $active = isset($user['Active']) ? $user['Active'] : $userInfo['active'];
            $creatorId = $userInfo['creator_id'];
            $hrDeptId = $userInfo['hr_dept_id'];
            $language = isset($user['Language']) ? $user['Language'] : $userInfo['language'];
            $sendEmail = isset($user['SendEmail']) ? $user['SendEmail'] : $userInfo['language'];
            $userUpdated = UserManager::update_user($user_id, $firstName, $lastName, $userName, $password, $authSource, $email, $status, $officialCode, $phone, $pictureUrl, $expirationDate, $active, $creatorId, $hrDeptId, null, $language, '', '', '');
            if (!is_array($user['Courses']) && !empty($user['Courses'])) {
                $user['Courses'] = array($user['Courses']);
            }
            if (is_array($user['Courses'])) {
                foreach ($user['Courses'] as $course) {
                    if (CourseManager::course_exists($course)) {
                        CourseManager::subscribe_user($user_id, $course, $user['Status']);
                        $course_info = CourseManager::get_course_information($course);
                        $inserted_in_course[$course] = $course_info['title'];
                    }
                    if (CourseManager::course_exists($course, true)) {
                        // Also subscribe to virtual courses through check on visual code.
                        $list = CourseManager::get_courses_info_from_visual_code($course);
                        foreach ($list as $vcourse) {
                            if ($vcourse['code'] == $course) {
                                // Ignore, this has already been inserted.
                            } else {
                                CourseManager::subscribe_user($user_id, $vcourse['code'], $user['Status']);
                                $inserted_in_course[$vcourse['code']] = $vcourse['title'];
                            }
                        }
                    }
                }
            }
            if (!empty($user['ClassId'])) {
                $classId = explode('|', trim($user['ClassId']));
                foreach ($classId as $id) {
                    $usergroup->subscribe_users_to_usergroup($id, array($user_id), false);
                }
            }
            // Saving extra fields.
            global $extra_fields;
            // We are sure that the extra field exists.
            foreach ($extra_fields as $extras) {
                if (isset($user[$extras[1]])) {
                    $key = $extras[1];
                    $value = $user[$extras[1]];
                    UserManager::update_extra_field_value($user_id, $key, $value);
                }
            }
        }
    }
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:86,代码来源:user_update_import.php

示例2: get_lang

             // Adding to session_rel_user_rel_course table.
             $sql = "INSERT IGNORE INTO {$tbl_session_course_user} SET\n                                                id_user='{$user_id}',\n                                                course_code='{$course_code}',\n                                                id_session = '{$session_id}'";
             $rs_users = Database::query($sql);
             $users_in_course_counter++;
         } else {
             $error_message .= get_lang('UserDoesNotExist') . ' : ' . $username . '<br />';
         }
     }
     $update_session_course = "UPDATE {$tbl_session_course} SET nbr_users='{$users_in_course_counter}' WHERE course_code='{$course_code}'";
     Database::query($update_session_course);
     $inserted_in_course[$course_code] = $course_info['title'];
 }
 if (CourseManager::course_exists($course_code, true)) {
     // If the course exists we continue.
     // Also subscribe to virtual courses through check on visual code.
     $list = CourseManager::get_courses_info_from_visual_code($course_code);
     foreach ($list as $vcourse) {
         if ($vcourse['code'] == $course_code) {
             // Ignore, this has already been inserted.
         } else {
             $sql_course = "INSERT INTO {$tbl_session_course} SET\n                                                course_code = '" . $vcourse['code'] . "',\n                                                id_session='{$session_id}'";
             $rs_course = Database::query($sql_course);
             $course_info = api_get_course_info($course['code']);
             SessionManager::installCourse($id_session, $course_info['real_id']);
             $course_coaches = explode(",", $node_course->Coach);
             // adding coachs to session course user
             foreach ($course_coaches as $course_coach) {
                 $coach_id = UserManager::purify_username(api_utf8_decode($course_coach), $purification_option_for_usernames);
                 $coach_id = UserManager::get_user_id_from_username($course_coach);
                 if ($coach_id !== false) {
                     $sql = "INSERT IGNORE INTO {$tbl_session_course_user} SET\n                                                        id_user='{$coach_id}',\n                                                        course_code='{$vcourse['code']}',\n                                                        id_session = '{$session_id}',\n                                                        status = 2 ";
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:session_import.php

示例3: save_data

/**
 * Save the imported data
 * @param   array   $users List of users
 * @return  void
 * @uses global variable $inserted_in_course, which returns the list of courses the user was inserted in
 */
function save_data($users)
{
    global $inserted_in_course;
    // Not all scripts declare the $inserted_in_course array (although they should).
    if (!isset($inserted_in_course)) {
        $inserted_in_course = array();
    }
    $usergroup = new UserGroup();
    $send_mail = $_POST['sendMail'] ? true : false;
    if (is_array($users)) {
        foreach ($users as $user) {
            $user = complete_missing_data($user);
            $user['Status'] = api_status_key($user['Status']);
            $user_id = UserManager::create_user($user['FirstName'], $user['LastName'], $user['Status'], $user['Email'], $user['UserName'], $user['Password'], $user['OfficialCode'], $user['language'], $user['PhoneNumber'], '', $user['AuthSource'], $user['ExpiryDate'], 1, 0, null, null, $send_mail);
            if (!is_array($user['Courses']) && !empty($user['Courses'])) {
                $user['Courses'] = array($user['Courses']);
            }
            if (is_array($user['Courses'])) {
                foreach ($user['Courses'] as $course) {
                    if (CourseManager::course_exists($course)) {
                        CourseManager::subscribe_user($user_id, $course, $user['Status']);
                        $course_info = CourseManager::get_course_information($course);
                        $inserted_in_course[$course] = $course_info['title'];
                    }
                    if (CourseManager::course_exists($course, true)) {
                        // Also subscribe to virtual courses through check on visual code.
                        $list = CourseManager::get_courses_info_from_visual_code($course);
                        foreach ($list as $vcourse) {
                            if ($vcourse['code'] == $course) {
                                // Ignore, this has already been inserted.
                            } else {
                                CourseManager::subscribe_user($user_id, $vcourse['code'], $user['Status']);
                                $inserted_in_course[$vcourse['code']] = $vcourse['title'];
                            }
                        }
                    }
                }
            }
            if (!empty($user['ClassId'])) {
                $classId = explode('|', trim($user['ClassId']));
                foreach ($classId as $id) {
                    $usergroup->subscribe_users_to_usergroup($id, array($user_id), false);
                }
            }
            // Saving extra fields.
            global $extra_fields;
            // We are sure that the extra field exists.
            foreach ($extra_fields as $extras) {
                if (isset($user[$extras[1]])) {
                    $key = $extras[1];
                    $value = $user[$extras[1]];
                    UserManager::update_extra_field_value($user_id, $key, $value);
                }
            }
        }
    }
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:63,代码来源:user_import.php


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