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


PHP EfrontLesson::confirm方法代码示例

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


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

示例1: confirmLessons

 /**
  * Confirm user's lessons
  *
  * This function can be used to set the "active" flag of a user's lesson to "true", so that
  * he can access the corresponding lessons.
  * <br/>Example:
  * <code>
  * $user = EfrontUserFactory :: factory('jdoe');
  * $user -> confirmLessons(23);						 //Confirms the lesson with id 23
  * $user -> addLessons(array(23,24,25));			//Confirms multiple lessons using an array
  * </code>
  *
  * @param mixed $lessonIds Either a single lesson id, or an array if ids
  * @return array The array of lesson ids
  * @since 3.6.0
  * @access public
  */
 public function confirmLessons($lessonIds)
 {
     if (sizeof($this->lessons) == 0) {
         $this->getLessons();
     }
     if (!is_array($lessonIds)) {
         $lessonIds = array($lessonIds);
     }
     $lessons = eF_getTableData("lessons", "*", "id in (" . implode(",", $lessonIds) . ")");
     foreach ($lessons as $key => $lesson) {
         $lesson = new EfrontLesson($lesson);
         $lesson->confirm($this->user['login']);
     }
     $this->lessons = false;
     //Reset lessons information
     return $this->getLessons();
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:34,代码来源:user.class-backup.php

示例2: array

                         }
                     }
                 }
             }
         }
         exit;
     }
 }
 if (isset($_GET['ajax']) && $_GET['ajax'] == 'toggle_user' && $_GET['type'] == 'lesson' && $_change_lessons_) {
     $response = array('status' => 1);
     $editLesson = new EfrontLesson($_GET['id']);
     if ($editLesson->isUserActiveInLesson($editedUser)) {
         $editLesson->unConfirm($editedUser);
         $response['access'] = 0;
     } else {
         $editLesson->confirm($editedUser);
         $response['access'] = 1;
     }
     echo json_encode($response);
     exit;
 } else {
     if (isset($_GET['ajax']) && in_array($_GET['ajax'], array('lessonsTable'))) {
         $roles = EfrontLessonUser::getLessonsRoles(true);
         $smarty->assign("T_ROLES_ARRAY", $roles);
         $directionsTree = new EfrontDirectionsTree();
         $smarty->assign("T_DIRECTION_PATHS", $directionsTree->toPathString());
         $rolesBasic = EfrontLessonUser::getLessonsRoles();
         $smarty->assign("T_BASIC_ROLES_ARRAY", $rolesBasic);
         $smarty->assign("T_EDITED_USER_TYPE", $editedUser->user['user_types_ID'] ? $editedUser->user['user_types_ID'] : $editedUser->user['user_type']);
         if (isset($_GET['ajax']) && $_GET['ajax'] == 'lessonsTable') {
             $smarty->assign("T_DATASOURCE_COLUMNS", array('name', 'directions_ID', 'completed', 'active_in_lesson', 'user_type', 'score', 'has_lesson'));
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:user_lessons.php

示例3: importData

 protected function importData($line, $type, $data)
 {
     //pr($line);exit;
     try {
         switch ($type) {
             case "users":
                 $newUser = EfrontUser::createUser($data);
                 $this->log["success"][] = _LINE . " {$line}: " . _IMPORTEDUSER . " " . $newUser->login;
                 break;
             case "users_to_courses":
                 //Check if a user exists and whether it has the same case
                 $userFound = false;
                 if (!in_array($data['users_login'], $this->allUserLogins)) {
                     //For case-insensitive matches
                     foreach ($this->allUserLogins as $login) {
                         if (mb_strtolower($data['users_login']) == mb_strtolower($login)) {
                             $data['users_login'] = $login;
                             $userFound = true;
                         }
                     }
                 } else {
                     $userFound = true;
                 }
                 if ($userFound) {
                     $courses_name = trim($data['course_name']);
                     $courses_ID = $this->getCourseByName($courses_name);
                     unset($data['course_name']);
                     if ($courses_ID) {
                         foreach ($courses_ID as $course_ID) {
                             $data['courses_ID'] = $course_ID;
                             $course = new EfrontCourse($course_ID);
                             if (is_null($this->course_users[$course_ID])) {
                                 $result = eF_getTableDataFlat("users_to_courses", "users_LOGIN", "courses_ID={$course_ID} AND archive=0");
                                 $this->course_users[$course_ID] = array_combine($result['users_LOGIN'], $result['users_LOGIN']);
                             }
                             if (isset($this->course_users[$course_ID][$data['users_login']])) {
                                 throw new Exception("User is already assigned to the course", self::USER_TO_COURSE_EXISTS);
                             }
                             //$course -> addUsers($data['users_login'], (isset($data['user_type']) && $data['user_type']?$data['user_type']:"student"));
                             $course->addUsers($data['users_login'], isset($data['user_type']) ? $data['user_type'] : "student");
                             $where = "users_login = '" . $data['users_login'] . "' AND courses_ID = " . $data['courses_ID'];
                             $data['completed'] ? $data['completed'] = 1 : ($data['completed'] = 0);
                             EfrontCourse::persistCourseUsers($data, $where, $data['courses_ID'], $data['users_login']);
                             if ($data['active']) {
                                 $course->confirm($data['users_login']);
                             } else {
                                 $course->unconfirm($data['users_login']);
                             }
                             $this->course_users[$course_ID][$data['users_login']] = $data['users_login'];
                             $this->log["success"][] = _LINE . " {$line}: " . _NEWCOURSEASSIGNMENT . " " . $courses_name . " - " . $data['users_login'];
                         }
                     } else {
                         if ($courses_name != "") {
                             $course = EfrontCourse::createCourse(array("name" => $courses_name));
                             $this->log["success"][] = _LINE . " {$line}: " . _NEWCOURSE . " " . $courses_name;
                             $course->addUsers($data['users_login'], isset($data['user_type']) ? $data['user_type'] : "student");
                             $courses_ID = $course->course['id'];
                             $this->courseNamesToIds[$courses_name] = array($courses_ID);
                             $where = "users_login = '" . $data['users_login'] . "' AND courses_ID = " . $courses_ID;
                             EfrontCourse::persistCourseUsers($data, $where, $courses_ID, $data['users_login']);
                             if ($data['active']) {
                                 $course->confirm($data['users_login']);
                             } else {
                                 $course->unconfirm($data['users_login']);
                             }
                             $this->log["success"][] = _LINE . " {$line}: " . _NEWCOURSEASSIGNMENT . " " . $courses_name . " - " . $data['users_login'];
                         } else {
                             $this->log["failure"][] = _LINE . " {$line}: " . _COULDNOTFINDCOURSE . " " . $courses_name;
                         }
                     }
                 } else {
                     $this->log["failure"][] = _LINE . " {$line}: " . _USERDOESNOTEXIST . ": " . $data['users_login'];
                 }
                 break;
             case "users_to_lessons":
                 //Check if a user exists and whether it has the same case
                 $userFound = false;
                 if (!in_array($data['users_login'], $this->allUserLogins)) {
                     //For case-insensitive matches
                     foreach ($this->allUserLogins as $login) {
                         if (mb_strtolower($data['users_login']) == mb_strtolower($login)) {
                             $data['users_login'] = $login;
                             $userFound = true;
                         }
                     }
                 } else {
                     $userFound = true;
                 }
                 if ($userFound) {
                     $lessons_name = trim($data['lesson_name']);
                     $lessons_ID = $this->getLessonByName($lessons_name);
                     unset($data['lesson_name']);
                     if ($lessons_ID) {
                         foreach ($lessons_ID as $lesson_ID) {
                             $data['lessons_ID'] = $lesson_ID;
                             $lesson = new EfrontLesson($lesson_ID);
                             if (is_null($this->lesson_users[$lesson_ID])) {
                                 $result = eF_getTableDataFlat("users_to_lessons", "users_LOGIN", "lessons_ID={$lesson_ID} AND archive=0");
                                 $this->lesson_users[$lesson_ID] = array_combine($result['users_LOGIN'], $result['users_LOGIN']);
                             }
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:import_export.class.php


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