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


PHP SessionManager::installCourse方法代码示例

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


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

示例1: foreach

         $user_counter++;
     }
 }
 // Adding courses to a session.
 foreach ($node_session->Course as $node_course) {
     $course_code = Database::escape_string(trim(api_utf8_decode($node_course->CourseCode)));
     // Verify that the course pointed by the course code node exists.
     if (CourseManager::course_exists($course_code)) {
         // If the course exists we continue.
         $course_info = CourseManager::get_course_information($course_code);
         $courseId = $course_info['c_id'];
         $session_course_relation = SessionManager::relation_session_course_exist($session_id, $courseId);
         if (!$session_course_relation) {
             $sql_course = "INSERT INTO {$tbl_session_course} SET\n                                            c_id = {$courseId},\n                                            session_id = {$session_id}";
             $rs_course = Database::query($sql_course);
             SessionManager::installCourse($id_session, $courseId);
         }
         $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                                                user_id='{$coach_id}',\n                                                c_id = '{$courseId}',\n                                                session_id = '{$session_id}',\n                                                status = 2 ";
                 $rs_coachs = Database::query($sql);
             } else {
                 $error_message .= get_lang('UserDoesNotExist') . ' : ' . $user . '<br />';
             }
         }
         // Adding users.
         $course_counter++;
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:session_import.php

示例2: foreach

     $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 ";
                     $rs_coachs = Database::query($sql);
                 } else {
                     $error_message .= get_lang('UserDoesNotExist') . ' : ' . $user . '<br />';
                 }
             }
             // adding users
             $course_counter++;
             $users_in_course_counter = 0;
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:session_import.php

示例3: importCSV


//.........这里部分代码省略.........
                     if (empty($userList)) {
                         foreach ($usersListInDatabase as $userInfo) {
                             self::unsubscribe_user_from_session($session_id, $userInfo['user_id']);
                         }
                     } else {
                         foreach ($usersListInDatabase as $userInfo) {
                             if (!in_array($userInfo['user_id'], $userList)) {
                                 self::unsubscribe_user_from_session($session_id, $userInfo['user_id']);
                             }
                         }
                     }
                 }
             }
             $courses = explode('|', $enreg['Courses']);
             // See BT#6449
             $onlyAddFirstCoachOrTeacher = false;
             if ($sessionWithCoursesModifier) {
                 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::get_teacher_list_from_course_code($course_code);
                                 if (!empty($alreadyAddedTeachers)) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:67,代码来源:sessionmanager.lib.php


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