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


PHP EfrontUser::verifyRolesList方法代码示例

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


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

示例1: setRoles

 /**
  * Set user roles in course
  *
  * This function sets the role for the specified user in the course
  * <br/>Example:
  * <code>
  * $course -> addUsers('jdoe', 'student');              //Added the user 'jdoe' in the lesson, having the role 'student'
  * $course -> setRoles('jdoe', 'professor');                //Updated jdoe's role to be 'professor'
  * </code>
  * Multiple values can be set if arguments are arrays
  *
  * @param mixed $users The user login name
  * @param mixed $roles The user role for this course
  * @since 3.5.0
  * @access public
  */
 public function setRoles($users, $roles)
 {
     $users = EfrontUser::verifyUsersList($users);
     $roles = EfrontUser::verifyRolesList($roles, sizeof($users));
     $courseLessons = $this->getCourseLessons();
     foreach ($users as $key => $value) {
         $fields = array('user_type' => $roles[$key]);
         $where = "users_LOGIN='" . $value . "' and courses_ID=" . $this->course['id'];
         self::persistCourseUsers($fields, $where, $this->course['id'], $value);
         foreach ($courseLessons as $lessonId => $lesson) {
             $lesson->setRoles($value, $roles[$key]);
         }
     }
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:30,代码来源:course.class.php

示例2: addCourses

 /**
  * Assign courses to user.
  *
  * This function can be used to assign a course to the current user. If $userTypes
  * is specified, then the user is assigned to the course using the specified type.
  * By default, the user asic type is used.
  * <br/>Example:
  * <code>
  * $user = EfrontUserFactory :: factory('jdoe');
  * $user -> addCourses(23);						 //Add a signle course with id 23
  * $user -> addCourses(23, 'professor');			//Add a signle course with id 23 and set the user type to 'professor'
  * $user -> addCourses(array(23,24,25));			//Add multiple courses using an array
  * $user -> addCourses(array(23,24,25), array('professor', 'student', 'professor'));			//Add multiple courses using an array for course ids and another for corresponding user types
  * </code>
  *
  * @param mixed $courseIds Either a single course id, or an array if ids
  * @param mixed $userTypes The corresponding user types for the specified courses
  * @param boolean $activeate Courses will be set as active or not
  * @return mixed The array of course ids or false if the course already exists.
  * @since 3.5.0
  * @access public
  * @todo auto_projects
  */
 public function addCourses($courses, $roles = 'student', $confirmed = true)
 {
     $courses = $this->verifyCoursesList($courses);
     $roles = EfrontUser::verifyRolesList($roles, sizeof($courses));
     if (sizeof($courses) > 0) {
         $courses = eF_getTableData("courses", "*", "id in (" . implode(",", $courses) . ")");
         foreach ($courses as $key => $course) {
             $course = new EfrontCourse($course);
             $course->addUsers($this->user['login'], $roles[$key], $confirmed);
         }
         $this->courses = false;
         //Reset courses information
     }
     return $this->getUserCourses();
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:38,代码来源:user.class-backup.php

示例3: setRoles

 /**
  * Set user roles in lesson
  *
  * This function sets the role for the specified user
  * <br/>Example:
  * <code>
  * $lesson -> addUsers('jdoe', 'student');              //Added the user 'jdoe' in the lesson, having the role 'student'
  * $lesson -> setRoles('jdoe', 'professor');                //Updated jdoe's role to be 'professor'
  * </code>
  * Multiple values can be set if arguments are arrays
  *
  * @param mixed $login The user login name
  * @param mixed $role The user role for this lesson
  * @return boolean true if everything is ok
  * @since 3.5.0
  * @access public
  */
 public function setRoles($users, $roles)
 {
     $users = EfrontUser::verifyUsersList($users);
     $roles = EfrontUser::verifyRolesList($roles, sizeof($users));
     foreach ($users as $key => $value) {
         eF_updateTableData("users_to_lessons", array('archive' => 0, 'user_type' => $roles[$key]), "users_LOGIN='" . $value . "' and lessons_ID=" . $this->lesson['id']);
         //$cacheKey = "user_lesson_status:lesson:".$this -> lesson['id']."user:".$value;
         //EfrontCache::getInstance()->deleteCache($cacheKey);
     }
 }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:27,代码来源:lesson.class.php


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