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


PHP EfrontUser::getRoles方法代码示例

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


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

示例1: array_unique

                 $branches = array_unique($branches);
                 $stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches) . ") AND filter_eb.assigned = 1)");
             }
         }
     }
 } else {
     if ($currentEmployee->isSupervisor()) {
         $isProfessor = false;
         if (isset($_GET['sel_course']) && $currentUser->hasCourse($_GET['sel_course'])) {
             $roles = EfrontUser::getRoles();
             if ($roles[$currentUser->getUserTypeInCourse($_GET['sel_course'])] == 'professor') {
                 $isProfessor = true;
             }
         } else {
             if (isset($infoLesson) && $currentUser->hasLesson($infoLesson)) {
                 $roles = EfrontUser::getRoles();
                 if ($roles[$currentUser->getUserTypeInLesson($infoLesson)] == 'professor') {
                     $isProfessor = true;
                 }
             }
         }
         if (!$isProfessor) {
             if (!$_GET['subbranches']) {
                 $supervisedBranches = $currentEmployee->getSupervisedBranches();
             } else {
                 $supervisedBranches = $currentEmployee->getSupervisedBranchesRecursive();
             }
             $branches = array();
             foreach ($supervisedBranches as $value) {
                 $branches[] = $value['branch_ID'];
             }
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:stats_filters.php

示例2: addUsers

 /**
  * Add users to course
  *
  * This function is used to register one or more users to the current course. A single login
  * or an array of logins may be specified
  * <br/>Example:
  * <code>
  * $course -> addUsers('joe', 'professor');         //Add the user with login 'joe' as a professor to this course
  * $users = array('joe', 'mary', 'mike');
  * $types = array('student', 'student', 'professor');
  * $course -> addUsers($users, $types);             //Add the users in the array $users with roles $types
  * </code>
  *
  * @param mixed $login The user login name
  * @param mixed $role The user role for this course, defaults to 'student'
  * @param boolean $confirmed If false, then the registration is set to 'pending' mode and the administration must confirm it
  * @since 3.5.0
  * @access public
  * @todo deprecated
  */
 public function addUsers($users, $userRoles = 'student', $confirmed = true)
 {
     if ($this->course['supervisor_LOGIN']) {
         $confirmed = false;
     }
     $roles = EfrontUser::getRoles();
     $users = EfrontUser::verifyUsersList($users);
     $userRoles = EfrontUser::verifyRolesList($userRoles, sizeof($users));
     foreach ($userRoles as $key => $value) {
         if (!EfrontUser::isStudentRole($value) && !EfrontUser::isProfessorRole($value)) {
             unset($userRoles[$key]);
             unset($users[$key]);
         }
     }
     if (empty($users)) {
         return false;
     }
     //For a single user, don't retrieve the full list of course users; that can be indefinitely big
     if (sizeof($users) == 1) {
         $result = eF_getTableData("users_to_courses uc, users u", "uc.users_LOGIN, uc.archive, uc.user_type, uc.to_timestamp, u.archive as user_archive, uc.completed", "u.login = '{$users[0]}' and u.login=uc.users_LOGIN and uc.courses_ID=" . $this->course['id']);
     } else {
         $result = eF_getTableData("users_to_courses uc, users u", "uc.users_LOGIN, uc.archive, uc.user_type, uc.to_timestamp, u.archive as user_archive, uc.completed", "u.login=uc.users_LOGIN and uc.courses_ID=" . $this->course['id']);
     }
     $courseUsers = array();
     $courseRoles = $this->getPossibleCourseRoles();
     $courseStudents = 0;
     foreach ($result as $value) {
         $courseUsers[$value['users_LOGIN']] = $value;
         if (!$value['user_archive'] && !$value['archive'] && EfrontUser::isStudentRole($value['user_type'])) {
             $courseStudents++;
         }
     }
     /*This query returns an array like:
     +------------+------------+-------------+-----------+----------------+---------+
     | courses_ID | lessons_ID | users_login | user_type | from_timestamp | archive |
     +------------+------------+-------------+-----------+----------------+---------+
     |          1 |          3 | professor   | professor |     1233140503 |       0 |
     |          1 |          3 | elpapath    | professor |     1233140503 |       0 |
     |          1 |         19 | periklis3   | student   |     1280488977 |       0 |
     |          1 |         20 | NULL        | NULL      |           NULL |    NULL |
     +------------+------------+-------------+-----------+----------------+---------+
     		So that it contains all the course's lessons and NULL for any lesson that does not have a user assigned
     		*/
     $result = eF_getTableData("lessons_to_courses lc left outer join users_to_lessons ul on lc.lessons_ID=ul.lessons_ID", "lc.lessons_ID, ul.users_LOGIN, ul.user_type, ul.from_timestamp, ul.archive, ul.to_timestamp, ul.completed", "courses_ID = " . $this->course['id']);
     $courseLessonsToUsers = array();
     foreach ($result as $value) {
         if (!is_null($value['users_LOGIN'])) {
             $courseLessonsToUsers[$value['lessons_ID']][$value['users_LOGIN']] = $value;
         } else {
             $courseLessonsToUsers[$value['lessons_ID']] = array();
         }
     }
     $courseLessons = array_unique(array_keys($courseLessonsToUsers));
     $result = eF_getTableData("projects", "id, lessons_ID", "auto_assign=1 and deadline >= " . time() . " and lessons_ID in (select lessons_ID from lessons_to_courses where courses_ID=" . $this->course['id'] . ")");
     $newProjectAssignments = $courseLessonsAutoAssignProjects = $assignedProjectsToUsers = array();
     foreach ($result as $value) {
         $courseLessonsAutoAssignProjects[$value['lessons_ID']][] = $value['id'];
     }
     $result = eF_getTableData("users_to_projects up, projects p", "up.users_LOGIN, up.projects_ID", "up.projects_ID=p.id and p.auto_assign=1 and p.deadline >= " . time() . " and p.lessons_ID in (select lessons_ID from lessons_to_courses where courses_ID=" . $this->course['id'] . ")");
     foreach ($result as $value) {
         $assignedProjectsToUsers[$value['users_LOGIN']][$value['projects_ID']] = $value['projects_ID'];
     }
     $newUsers = array();
     $existingUsers = array();
     foreach ($users as $key => $user) {
         $roleInCourse = $userRoles[$key];
         $roles[$roleInCourse] == 'student' ? $isStudentRoleInCourse = true : ($isStudentRoleInCourse = false);
         if ($this->course['max_users'] && $isStudentRoleInCourse && $this->course['max_users'] <= $courseStudents++) {
             throw new EfrontCourseException(str_replace(array("%x", "%y", "%z"), array($this->course['name'], $this->course['max_users'], $GLOBALS['configuration']['system_email']), _MAXSEATSDEPLEATED), EfrontCourseException::MAX_USERS_LIMIT);
         }
         if (!isset($courseUsers[$user])) {
             $newUsers[] = array('users_LOGIN' => $user, 'courses_ID' => $this->course['id'], 'active' => 1, 'archive' => 0, 'from_timestamp' => $confirmed ? time() : 0, 'user_type' => $roleInCourse, 'completed' => 0, 'score' => 0, 'issued_certificate' => '', 'comments' => '', 'to_timestamp' => 0);
         } elseif ($roleInCourse != $courseUsers[$user]['user_type'] || $courseUsers[$user]['archive']) {
             //update from_timestamp value when user reassigned to a course (only if it is not completed)
             if ($courseUsers[$user]['completed']) {
                 $fields = array('archive' => 0, 'user_type' => $roleInCourse);
             } else {
                 $fields = array('archive' => 0, 'user_type' => $roleInCourse, 'from_timestamp' => time());
             }
             //!$courseUsers[$user]['archive'] OR $fields['to_timestamp'] = 0;
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:course.class.php

示例3: createUser

 /**
  * Create new user
  *
  * This function is used to create a new user in the system
  * The user is created based on a a properties array, in which
  * the user login, name, surname and email must be present, otherwise
  * an EfrontUserException is thrown. Apart from these, all the other
  * user elements are optional, and defaults will be used if they are left
  * blank.
  * Once the database representation is created, the constructor tries to create the
  * user directories, G_UPLOADPATH.'login/' and message attachments subfolders. Finally
  * it assigns a default avatar to the user. The function instantiates the user based on
  * its type.
  * <br/>Example:
  * <code>
  * $properties = array('login' => 'jdoe', 'name' => 'john', 'surname' => 'doe', 'email' => 'jdoe@example.com');
  * $user = EfrontUser :: createUser($properties);
  * </code>
  *
  * @param array $userProperties The new user properties
  * @param array $users The list of existing users, with logins and active properties, in the form array($login => $active). It is handy to specify when creating massively users
  * @return array with new user settings if the new user was successfully created
  * @since 3.5.0
  * @access public
  */
 public static function createUser($userProperties, $users = array(), $addToDefaultGroup = true)
 {
     $result = eF_getTableData("users", "count(id) as total", "active=1");
     $activatedUsers = $result[0]['total'];
     if (!isset($userProperties['login']) || !eF_checkParameter($userProperties['login'], 'login')) {
         throw new EfrontUserException(_INVALIDLOGIN . ': ' . $userProperties['login'], EfrontUserException::INVALID_LOGIN);
     }
     $result = eF_getTableData("users", "login, archive", "login='{$userProperties['login']}'");
     //collation is by default utf8_general_ci, meaning that this search is case-insensitive
     if (sizeof($result) > 0) {
         if ($result[0]['archive']) {
             throw new EfrontUserException(_USERALREADYEXISTSARCHIVED . ': ' . $userProperties['login'], EfrontUserException::USER_EXISTS);
         } else {
             throw new EfrontUserException(_USERALREADYEXISTS . ': ' . $userProperties['login'], EfrontUserException::USER_EXISTS);
         }
     }
     /*		
     		$archived_keys = array_combine(array_keys($archived),array_keys($archived));  
     		if (isset($archived_keys[mb_strtolower($userProperties['login'])])) {
     		//if (in_array(mb_strtolower($userProperties['login']), array_keys($archived), true) !== false) {	
     			throw new EfrontUserException(_USERALREADYEXISTSARCHIVED.': '.$userProperties['login'], EfrontUserException :: USER_EXISTS);
     		}	
     		
     		$user_keys = array_combine(array_keys($users),array_keys($users));  
     		if (isset($user_keys[mb_strtolower($userProperties['login'])])) { 
     		//if (in_array(mb_strtolower($userProperties['login']), array_keys($users), true) !== false) {
     			throw new EfrontUserException(_USERALREADYEXISTS.': '.$userProperties['login'], EfrontUserException :: USER_EXISTS);
     		}
     */
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (G_VERSIONTYPE != 'standard') {
             #cpp#ifndef STANDARD
             //pr($activatedUsers);
             if (isset($GLOBALS['configuration']['version_users']) && $activatedUsers > $GLOBALS['configuration']['version_users'] && $GLOBALS['configuration']['version_users'] > 0) {
                 throw new EfrontUserException(_MAXIMUMUSERSNUMBERREACHED . ' (' . $GLOBALS['configuration']['version_users'] . '): ' . $userProperties['login'], EfrontUserException::MAXIMUM_REACHED);
             }
         }
         #cpp#endif
     }
     #cpp#endif
     if ($userProperties['email'] && !eF_checkParameter($userProperties['email'], 'email')) {
         throw new EfrontUserException(_INVALIDEMAIL . ': ' . $userProperties['email'], EfrontUserException::INVALID_PARAMETER);
     }
     if (!isset($userProperties['name'])) {
         throw new EfrontUserException(_INVALIDNAME . ': ' . $userProperties['name'], EfrontUserException::INVALID_PARAMETER);
     }
     if (!isset($userProperties['surname'])) {
         throw new EfrontUserException(_INVALIDSURNAME . ': ' . $userProperties['login'], EfrontUserException::INVALID_PARAMETER);
     }
     $roles = EfrontUser::getRoles();
     $rolesTypes = EfrontUser::getRoles(true);
     foreach (EfrontUser::getRoles(true) as $key => $value) {
         $rolesTypes[$key] = mb_strtolower($value);
     }
     //If a user type is not specified, by default make the new user student
     if (!isset($userProperties['user_type'])) {
         $userProperties['user_type'] = 'student';
     } else {
         if (in_array(mb_strtolower($userProperties['user_type']), $roles)) {
             $userProperties['user_type'] = mb_strtolower($userProperties['user_type']);
         } else {
             if ($k = array_search(mb_strtolower($userProperties['user_type']), $rolesTypes)) {
                 $userProperties['user_types_ID'] = $k;
                 $userProperties['user_type'] = $roles[$k];
             } else {
                 $userProperties['user_type'] = 'student';
             }
         }
     }
     if (!in_array($userProperties['user_type'], EFrontUser::$basicUserTypes)) {
         $userProperties['user_type'] = 'student';
         $userProperties['user_types_ID'] = 0;
     }
     //!isset($userProperties['user_type']) || !in_array($userProperties['user_type'], EfrontUser::getRoles())	  ? $userProperties['user_type']	  = 'student'									 : null;
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:user.class-backup.php

示例4: doChangeUserType

 private function doChangeUserType()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     $userTypes = EfrontUser::getRoles(true);
     $userTypesMapping = EfrontUser::getRoles();
     $changeUserTypeForm = new HTML_QuickForm("change_user_type_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_administrator_tools&tab=change_user_type", "", null, true);
     $changeUserTypeForm->addElement('select', 'from_type', _MODULE_ADMINISTRATOR_TOOLS_SELECTSOURCEUSERTYPE, $userTypes);
     $changeUserTypeForm->addElement('select', 'to_type', _MODULE_ADMINISTRATOR_TOOLS_SELECTTARGETUSERTYPE, $userTypes);
     $changeUserTypeForm->addElement('checkbox', 'change_courses', _MODULE_ADMINISTRATOR_TOOLS_CHANGETYPEINCOURSESASWELL);
     $changeUserTypeForm->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
     if ($changeUserTypeForm->isSubmitted() && $changeUserTypeForm->validate()) {
         try {
             $values = $changeUserTypeForm->exportValues();
             if ($userTypesMapping[$values['from_type']] == $userTypesMapping[$values['to_type']]) {
                 eF_updateTableData("users", array("user_types_ID" => $values['to_type']), "user_types_ID='" . $values['from_type'] . "' and user_type='" . $userTypesMapping[$values['from_type']] . "'");
                 if ($values['change_courses']) {
                     eF_updateTableData("users_to_lessons", array("user_type" => $values['to_type']), "user_type='" . $values['from_type'] . "'");
                     eF_updateTableData("users_to_courses", array("user_type" => $values['to_type']), "user_type='" . $values['from_type'] . "'");
                 }
                 $message = _OPERATIONCOMPLETEDSUCCESSFULLY;
                 $message_type = 'success';
             } else {
                 $message = _MODULE_ADMINISTRATOR_TOOLS_BASICTYPESMUSTMATCH;
                 $message_type = 'failure';
             }
             $this->setMessageVar($message, $message_type);
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $message_type = 'failure';
             $this->setMessageVar($message, $message_type);
         }
     }
     $smarty->assign("T_CHANGE_USER_TYPE_FORM", $changeUserTypeForm->toArray());
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:36,代码来源:module_administrator_tools.class.php

示例5: importDataMultiple

 protected function importDataMultiple($type, $data)
 {
     try {
         switch ($type) {
             case "users_to_groups":
                 foreach ($data as $value) {
                     $groups_ID = current($this->getGroupByName($value['groups.name']));
                     $groups[$groups_ID][] = $value['users_login'];
                 }
                 foreach ($groups as $id => $groupUsers) {
                     try {
                         $group = new EfrontGroup($id);
                         $this->log["success"][] = _NEWGROUPASSIGNMENT . " " . $group->group['name'];
                         $group->addUsers($groupUsers);
                     } catch (Exception $e) {
                         $this->log["failure"][] = _LINE . " " . ($key + 2) . ": " . $e->getMessage();
                         // ." ". str_replace("\n", "<BR>", $e->getTraceAsString());
                     }
                 }
                 break;
             case "users":
                 $existingUsers = eF_getTableDataFlat("users", "login, active, archive");
                 $roles = EfrontUser::getRoles();
                 foreach (EfrontUser::getRoles(true) as $key => $value) {
                     $rolesTypes[$key] = mb_strtolower($value);
                 }
                 $languages = EfrontSystem::getLanguages();
                 $addedUsers = array();
                 foreach ($data as $key => $value) {
                     try {
                         $newUser = EfrontUser::createUser($value, $existingUsers, false);
                         $existingUsers['login'][] = $newUser->user['login'];
                         $existingUsers['active'][] = $newUser->user['active'];
                         $existingUsers['archive'][] = $newUser->user['archive'];
                         $addedUsers[] = $newUser->user['login'];
                         $this->log["success"][] = _IMPORTEDUSER . " " . $newUser->user['login'];
                     } catch (Exception $e) {
                         if ($this->options['replace_existing']) {
                             if ($this->isAlreadyExistsException($e->getCode(), $type)) {
                                 if (!in_array($value['login'], $existingUsers['login'], true)) {
                                     //For case-insensitive matches
                                     foreach ($existingUsers['login'] as $login) {
                                         if (mb_strtolower($value['login']) == mb_strtolower($login)) {
                                             $value['login'] = $login;
                                         }
                                     }
                                 }
                                 if (!isset($value['user_type'])) {
                                     $value['user_type'] = 'student';
                                 } else {
                                     if (in_array(mb_strtolower($value['user_type']), $roles)) {
                                         $value['user_type'] = mb_strtolower($value['user_type']);
                                     } else {
                                         if ($k = array_search(mb_strtolower($value['user_type']), $rolesTypes)) {
                                             $value['user_types_ID'] = $k;
                                             $value['user_type'] = $roles[$k];
                                         } else {
                                             $value['user_type'] = 'student';
                                         }
                                     }
                                 }
                                 if (!in_array($value['user_type'], EFrontUser::$basicUserTypes)) {
                                     $value['user_type'] = 'student';
                                     $value['user_types_ID'] = 0;
                                 }
                                 if ($value['languages_NAME'] == "") {
                                     unset($value['languages_NAME']);
                                 } elseif (in_array($value['languages_NAME'], array_keys($languages)) === false) {
                                     $value['languages_NAME'] = $GLOBALS['configuration']['default_language'];
                                 }
                                 $this->updateExistingData($key + 2, $type, $value);
                             } else {
                                 $this->log["failure"][] = _LINE . " " . ($key + 2) . ": " . $e->getMessage();
                                 // ." ". str_replace("\n", "<BR>", $e->getTraceAsString());
                             }
                         } else {
                             $this->log["failure"][] = _LINE . " " . ($key + 2) . ": " . $e->getMessage();
                             // ." ". str_replace("\n", "<BR>", $e->getTraceAsString());
                         }
                     }
                 }
                 $defaultGroup = eF_getTableData("groups", "id", "is_default = 1 AND active = 1");
                 if (!empty($defaultGroup) && !empty($addedUsers)) {
                     $defaultGroup = new EfrontGroup($defaultGroup[0]['id']);
                     $defaultGroup->addUsers($addedUsers);
                 }
                 break;
             case "users_to_jobs":
                 $jobDescriptions = $userJobs = $userBranchesAssigned = $userBranchesUnassigned = array();
                 $result = eF_getTableData("module_hcd_job_description", "job_description_ID, branch_ID, description");
                 foreach ($result as $value) {
                     $jobDescriptions[$value['job_description_ID']] = $value;
                 }
                 $result = eF_getTableData("module_hcd_employee_has_job_description", "*");
                 foreach ($result as $value) {
                     $userJobs[$value['users_login']][$value['job_description_ID']] = $value['job_description_ID'];
                 }
                 $result = eF_getTableData("module_hcd_employee_works_at_branch", "*");
                 foreach ($result as $value) {
                     if ($value['assigned']) {
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:import_export.class.php

示例6: getModule

 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $currentUser = $this->getCurrentUser();
     $currentCourse = $this->getCurrentCourse();
     $currentLesson = $this->getCurrentLesson();
     $currentUnit = $this->getCurrentUnit();
     /*
     $str = "Current User: <br />";
     $str .= "id: " . $currentUser->user['id'] . "<br />";
     $str .= "login: " . $currentUser->user['login'] . "<br />";
     $str .= "password: " . $currentUser->user['password'] . "<br />";
     $str .= "email: " . $currentUser->user['email'] . "<br />";
     $str .= "languages_NAME: " . $currentUser->user['languages_NAME'] . "<br />";
     $str .= "timezone: " . $currentUser->user['timezone'] . "<br />";
     $str .= "name: " . $currentUser->user['name'] . "<br />";
     $str .= "surname: " . $currentUser->user['surname'] . "<br />";
     $str .= "active: " . $currentUser->user['active'] . "<br />";
     $str .= "comments: " . $currentUser->user['comments'] . "<br />";
     $str .= "user_type: " . $currentUser->user['user_type'] . "<br />";
     $str .= "timestamp: " . $currentUser->user['timestamp'] . "<br />";
     $str .= "active: " . $currentUser->user['active'] . "<br />";
     $str .= "user_types_ID: " . $currentUser->user['user_types_ID'] . "<br />";
     $str .= "type: " . $currentUser->user['user_type'] . "<br />";
     
     $str .= "<br />";
     */
     $username = $currentUser->user['login'];
     $userTypesID = $currentUser->user['user_types_ID'];
     // echo "<br> \$userTypesID is $userTypesID";
     $rolesPlain = EfrontUser::getRoles(true);
     $roleTypeName = $rolesPlain[$userTypesID];
     $vLabGranted = array('FIU' => true, 'Employee' => true, 'KaseyaScholar' => true, 'KCA' => true, 'KCT' => true, 'Professor' => true, 'KaseyaTester' => true, 'LabSuspend' => false, 'KaseyaPublic' => false, 'Instructors' => false, 'DemoFree' => false, 'KaseyaQuickStart' => false, 'Sales' => false, 'Trial' => false, 'Administrator' => false, 'Student' => false);
     $baseURL = $this->moduleBaseLink;
     // $baseURL = "http://localhost/moodle19/";
     // $baseURL = "http://ita-portal.cis.fiu.edu/";
     // $moodleURL = "http://localhost/moodle19/";
     $moodleURL = "http://ita-portal.cis.fiu.edu/";
     $hours = 3;
     $minutes = 0;
     // echo "\$vLabGranted[$roleTypeName] is $vLabGranted[$roleTypeName]";
     if ($vLabGranted[$roleTypeName]) {
         $vLabURL = $moodleURL . "mod/deva/view-embedded.php?id=10582&username={$username}&hours={$hours}&minutes={$minutes}";
     } else {
         $vLabURL = $baseURL . "KU-poweredby-ITS-NotAvailable.html";
     }
     /*
     $password = "test1234";
     $hashed_password = $currentUser->user['password'];
     $email = $currentUser->user['email'];
     $firstname = $currentUser->user['name'];
     $lastname = $currentUser->user['surname'];
     $timezone = $currentUser->user['timezone'];
     */
     /*
     $str .= "http://localhost/moodle19/mod/deva/embedded/auto-login.php?embedded=1&efront=1&username=$username";	
     $str1 = "http://localhost/moodle19/mod/deva/embedded/auto-login.php?embedded=1&efront=1&username=$username";	
     $payload = file_get_contents($str1);
     $str .= $payload;
     
     // src=\"http://localhost/moodle19/mod/deva/embedded/autologin.php?embedded=1&efront=1&username=$username&password=$password&hashed_password=$hashed_password&email=$email&firstname=$firstname&lastname=$lastname&timezone=$timezone\"
     */
     $str = "\n\t\t\t<div align=\"center\">\n\t\t\t\t<iframe \n\t\t\t\t\tsrc=\"{$vLabURL}\"\n\t\t\t\t\talign=\"middle\" \n    \t\t\t\theight=1000\n    \t\t\t\twidth=100%\n    \t\t\t\tmarginwidth=0\n    \t\t\t\tmarginheight=0 >\n\t\t\t\t</iframe>\n\t\t\t</div>";
     return $str;
     /*
     $username = "johndoc-f65";
     $password = "k4se-prt4l";
     $domain = "fiu";
     $hostName = "vc7.cis.fiu.edu";
     $hostPort = array(
     				"dc" 		=> 36646, 
     				"ws1" 		=> 36647, 
     				"ws2" 	=> 36648, 
     				"reception" 		=> 36649, 
     				"laptop_ceo" 	=> 36650);
     $frame = array(
     			"width" 		=> 1200,
     			"height" 		=> 480,
     			"align"			=> "middle",
     			"marginwidth"	=> 0,
     			"marginheight"	=> 0, 
     			"bpp" 			=> 16);
     
         	$smarty = $this -> getSmartyVar();
             $smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
             $smarty -> assign("T_MODULE_BASELINK" , $this -> moduleBaseLink);
             $smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
     
     $smarty -> assign("NetworkDiagramImage", "fiu-network-diagram.png");
     
     $smarty -> assign("frame", $frame);
     
     $smarty -> assign("T_DATA_SHEET", 
     			$this -> moduleBaseLink . 
     			"DataSheet.php");
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:module_vLab.class.php

示例7: EfrontBranch

if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (!$currentUser->coreAccess['forum'] || $currentUser->coreAccess['forum'] == 'change') {
    $_change_ = 1;
}
try {
    if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
        //this applies to supervisors only
        $currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
    }
    if (!EfrontUser::isOptionVisible('forum')) {
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
    }
    $loadScripts[] = 'includes/forum';
    $roles = EfrontUser::getRoles(true);
    $smarty->assign("T_USERROLES", $roles);
    $forums = f_forums::getAll("f_forums");
    foreach ($forums as $value) {
        $forums_to_lessons[$value['lessons_ID']] = $value['id'];
    }
    $lessons = EFrontLesson::getLessons(false, true);
    $res = eF_getTableData("lessons", "id,options");
    foreach ($res as $value) {
        $options = unserialize($value['options']);
        if (!empty($options) && !$options['forum']) {
            unset($forums[$forums_to_lessons[$value['id']]]);
        }
    }
    //pr($forums);
    if (!$_admin_) {
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:forum.php

示例8: unset

        unset($values['submit']);
        foreach ($values as $key => $value) {
            EfrontConfiguration::setValue($key, $value);
        }
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=main&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
    }
}
$smarty->assign("T_USER_MAIN_FORM", $userMainForm->toArray());
$userMultipleLoginsForm = new HTML_QuickForm("user_multiple_logins_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=multiple_logins", "", null, true);
$userMultipleLoginsForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$groups = array();
foreach (EfrontGroup::getGroups() as $value) {
    $groups[$value['id']] = $value['name'];
}
$userMultipleLoginsForm->addElement("select", "global", _ALLOWMULTIPLELOGINSGLOBALLY, array(0 => _NO, 1 => _YES));
$userMultipleLoginsForm->addElement("select", "user_types", _EXCEPTFORTHEROLES, EfrontUser::getRoles(true), "multiple");
if (sizeof($groups) > 0) {
    $userMultipleLoginsForm->addElement("select", "groups", _EXCEPTFORTHEGROUPS, $groups, "multiple");
}
$userMultipleLoginsForm->addElement("static", "", _HOLDDOWNCTRLFORMULTIPLESELECT);
$userMultipleLoginsForm->setDefaults(unserialize($GLOBALS['configuration']['multiple_logins']));
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $userMultipleLoginsForm->freeze();
} else {
    $userMultipleLoginsForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($userMultipleLoginsForm->isSubmitted() && $userMultipleLoginsForm->validate()) {
        $values = $userMultipleLoginsForm->exportValues();
        $multipleLogins = array('global' => $values['global'] ? 1 : 0, 'user_types' => $values['user_types'], 'groups' => $values['groups']);
        EfrontConfiguration::setValue('multiple_logins', serialize($multipleLogins));
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=multiple_logins&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
    }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:user.php

示例9: addToDefaultGroup

 public static function addToDefaultGroup($user, $userType)
 {
     // Get the default eFront group
     if (!$default_group) {
         $default_group = eF_getTableData("groups", "*", "is_default = 1 AND active = 1");
         if (sizeof($default_group)) {
             $default_group = $default_group[0];
         } else {
             $default_group = true;
             return;
         }
     }
     try {
         $roles = EfrontUser::getRoles();
         $group = new EfrontGroup($default_group);
         //Add user to group with group's default type or, if one is not set, the user's type
         $group->addUsers($user, $group->group['user_types_ID'] ? $group->group['user_types_ID'] : $userType);
     } catch (Exception $e) {
         /*otherwise no default group has been defined*/
     }
     return true;
 }
开发者ID:bqq1986,项目名称:efront,代码行数:22,代码来源:group.class.php

示例10: getModule

 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $currentLesson = $this->getCurrentLesson();
     $currentUser = $this->getCurrentUser();
     try {
         $currentContent = new EfrontContentTree($_SESSION['s_lessons_ID']);
         //Initialize content
     } catch (Exception $e) {
         $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
         $message = _ERRORLOADINGCONTENT . ": " . $_SESSION['s_lessons_ID'] . ": " . $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
     }
     //pr($currentUser);exit;
     $roles = EfrontUser::getRoles();
     //pr($roles);
     if ($roles[$currentUser->lessons[$_SESSION['s_lessons_ID']]] == "professor") {
         if (isset($_GET['view_list']) && eF_checkParameter($_GET['view_list'], 'id')) {
             $list = $currentContent->seekNode($_GET['view_list']);
             $questions = $list->getQuestions(true);
             $crosslists = array();
             $possibleCrosslistsIds = array();
             foreach ($questions as $key => $value) {
                 if ($value->question['type'] == 'empty_spaces') {
                     $crosslists[] = $value;
                     $possibleCrosslistsIds[] = $value->question['id'];
                 }
             }
             $questions = $crosslists;
             //pr($questions);
             foreach ($questions as $qid => $question) {
                 $questions[$qid]->question['text'] = str_replace('#', '_', strip_tags($question->question['text']));
                 //If we ommit this line, then the questions list is html formatted, images are displayed etc, which is *not* the intended behaviour
                 //$questions[$qid]->question['answer']           = unserialize($question->question['answer']);
             }
             $res = eF_getTableData("module_crossword_words", "crosslists,options", "content_ID=" . $_GET['view_list']);
             $resCrosslists = unserialize($res[0]['crosslists']);
             $smarty->assign("T_CROSSWORD_LIST_WORDS", $resCrosslists);
             $post_target = $this->moduleBaseUrl . '&view_list=' . $_GET['view_list'] . "&tab=options";
             //Create form elements
             $form = new HTML_QuickForm("list_options", "post", $post_target, "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             $form->addElement('advcheckbox', 'active', _CROSSWORD_ACTIVE, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement("text", "max_word", _LOW, 'size = "5"');
             $form->addRule('max_word', _INVALIDFIELDDATA . ":" . _LOW, 'checkParameter', 'id');
             $form->addElement('advcheckbox', 'reveal_answer', _CROSSWORD_SHOWANSWERFIRST, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('advcheckbox', 'save_pdf', _CROSSWORD_SAVEPDF, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('submit', 'submit_options', _SAVECHANGES, 'onclick ="return optionSubmit();" class = "flatButton"');
             //The submit content button
             $options = unserialize($res[0]['options']);
             $form->setDefaults(array('active' => $options['active'], 'reveal_answer' => $options['reveal_answer'], 'save_pdf' => $options['save_pdf'], 'max_word' => $options['max_word']));
             if ($form->isSubmitted() && $form->validate()) {
                 //If the form is submitted and validated
                 $values = $form->exportValues();
                 unset($values['submit_options']);
                 $options = serialize($values);
                 if (sizeof($res) != 0) {
                     $ok = eF_updateTableData("module_crossword_words", array('options' => $options), "content_ID=" . $_GET['view_list']);
                 } else {
                     $fields = array('content_ID' => $_GET['view_list'], 'options' => $options);
                     $ok = eF_insertTableData("module_crossword_words", $fields);
                 }
                 if ($ok !== false) {
                     $message = _CROSSWORD_SUCCESSFULLY;
                     $message_type = 'success';
                 } else {
                     $message = _CROSSWORD_PROBLEMOCCURED;
                     $message_type = 'failure';
                 }
                 eF_redirect("" . $this->moduleBaseUrl . "&view_list=" . $_GET['view_list'] . "&tab=options&message=" . urlencode($message) . "&message_type=" . $message_type);
             }
             $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
             //Create a smarty renderer
             $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
             //Set javascript error messages
             $form->setRequiredNote(_REQUIREDNOTE);
             $form->accept($renderer);
             //Assign this form to the renderer, so that corresponding template code is created
             $smarty->assign('T_CROSSWORD_OPTIONS', $renderer->toArray());
             //Assign the form to the template
             if (isset($_GET['postAjaxRequest'])) {
                 try {
                     $result = eF_getTableData("module_crossword_words", "crosslists", "content_ID=" . $_GET['view_list']);
                     //pr($result);exit;
                     $crosslistsArray = unserialize($result[0]['crosslists']);
                     if (isset($_GET['id']) && eF_checkParameter($_GET['id'], 'id')) {
                         if (!in_array($_GET['id'], array_values($crosslistsArray))) {
                             $crosslistsArray[] = $_GET['id'];
                             $crosslists = serialize($crosslistsArray);
                             if (sizeof($result) != 0) {
                                 $fields = array('crosslists' => $crosslists);
                                 eF_updateTableData("module_crossword_words", $fields, "content_ID=" . $_GET['view_list']);
                             } else {
                                 $fields = array('content_ID' => $_GET['view_list'], 'crosslists' => $crosslists);
                                 eF_insertTableData("module_crossword_words", $fields);
                             }
                         } elseif (in_array($_GET['id'], array_values($crosslistsArray))) {
                             unset($crosslistsArray[array_search($_GET['id'], $crosslistsArray)]);
                             if (!empty($crosslistsArray)) {
                                 $crosslists = serialize($crosslistsArray);
                                 $fields = array('crosslists' => $crosslists);
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_crossword.class.php

示例11: createSubstitutionsArrayForDateNotifications

 public static function createSubstitutionsArrayForDateNotifications($conditions)
 {
     $subs_array = array();
     if (isset($conditions['courses_ID'])) {
         $res = eF_getTableData('courses', 'name', 'id=' . $conditions['courses_ID']);
         $subs_array['courses_name'] = $res[0]['name'];
     } elseif (isset($conditions['lessons_ID'])) {
         $res = eF_getTableData('lessons', 'name', 'id=' . $conditions['lessons_ID']);
         $subs_array['lessons_name'] = $res[0]['name'];
     } elseif (isset($conditions['groups_ID'])) {
         $res = eF_getTableData('groups', 'name', 'id=' . $conditions['groups_ID']);
         $subs_array['groups_name'] = $res[0]['name'];
     } elseif (isset($conditions['user_type'])) {
         $roles = EfrontUser::getRoles(true);
         $subs_array['users_type'] = $roles[$conditions['user_type']];
     }
     return $subs_array;
 }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:18,代码来源:notification.class.php

示例12:

 			'KCT'				=> true,
 			'Professor'			=> true,
 			'KaseyaTester'		=> true,
 			'LabSuspend'		=> false, // should not happen 
 			'KaseyaPublic'		=> false,
 			'Instructors'		=> false,
 			'DemoFree'			=> false,
 			'KaseyaQuickStart'	=> false,
 			'Sales'				=> false,
 			'Trial'				=> false,
 			'Administrator'		=> false,
 			'Student'			=> false
 		);
 */
 // echo "<br> \$values['user_type'] is " . $values['user_type'];
 $rolesPlain = EfrontUser::getRoles(true);
 $roleTypeName = $rolesPlain[$values['user_type']];
 // echo "<br> \$roleTypeName is " . $roleTypeName;
 // echo "<br> \$vLabGranted[\$roleTypeName] is " . $vLabGranted[$roleTypeName];
 // exit;
 if (in_array($roleTypeName, $vLabEnabledState)) {
     // auto enroll
     $str = $vLab_moodleURL . "/mod/deva/embedded/auto-enroll.php?username={$vLab_username_urlEncoded}&courseid={$vLab_courseid_urlEncoded}";
     // echo $str . '<br>';
     $payload = file_get_contents($str);
     // echo $payload;
     // auto login
     $str = $vLab_moodleURL . "/mod/deva/embedded/auto-login.php?username={$vLab_username_urlEncoded}";
     // echo $str . '<br>';
     $payload = file_get_contents($str);
     // echo $payload;
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:profile.php

示例13: eF_redirect

/**
* Logs out a user.
*
* This page provides a list of logged in users, where the administrator may pick one to log out.
*/
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (!EfrontUser::isOptionVisible('online_users')) {
    eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
$loadScripts[] = 'includes/logout_user';
if (isset($_GET['ajax']) && isset($_GET['logout']) && $_GET['logout'] != $currentUser->user['login']) {
    try {
        $user = EfrontUserFactory::factory($_GET['logout']);
        $user->logout();
        echo json_encode(array('status' => 1));
        exit;
    } catch (Exception $e) {
        handleAjaxExceptions($e);
    }
}
$smarty->assign("T_ROLES", EfrontUser::getRoles(true));
if (isset($_GET['ajax']) && $_GET['ajax'] == 'usersTable') {
    $dataSource = EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60);
    foreach ($dataSource as $key => $value) {
        $dataSource[$key]['total_seconds'] = $value['time']['total_seconds'];
    }
    $tableName = 'usersTable';
    include "sorted_table.php";
}
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:logout_user.php

示例14: formatLogin

function formatLogin($login, $fields = array(), $duplicate = true)
{
    //The function is usually called by a filter, which passes a preg matches array, where index 1 holds the login
    !is_array($login) or $login = $login[1];
    if (!eF_checkParameter($login, 'login')) {
        return $login;
    }
    if (isset($GLOBALS['_usernames'][$login])) {
        return $GLOBALS['_usernames'][$login];
    }
    if ($usernames = EfrontCache::getInstance()->getCache('usernames')) {
        $GLOBALS['_usernames'] = $usernames;
        if (isset($GLOBALS['_usernames'][$login])) {
            return $GLOBALS['_usernames'][$login];
        }
    }
    $roles = EfrontUser::getRoles(true);
    $tags = array('#surname#', '#name#', '#login#', '#n#', '#type#');
    if (isset($fields['formatted_login'])) {
        $GLOBALS['_usernames'][$login] = $fields['formatted_login'];
    } else {
        if (!empty($fields)) {
            $replacements = array($fields['surname'], $fields['name'], $fields['login'], mb_substr($fields['name'], 0, 1), $roles[$fields['user_type']]);
            $format = str_replace($tags, $replacements, $GLOBALS['configuration']['username_format']);
            $GLOBALS['_usernames'][$login] = $format;
        } else {
            if (!isset($GLOBALS['usernames'][$login])) {
                $result = eF_getTableData("users", "login, name, surname, user_type", "login='{$login}'");
                if (sizeof($result) == 0) {
                    return $login;
                }
                $replacements = array($result[0]['surname'], $result[0]['name'], $result[0]['login'], mb_substr($result[0]['name'], 0, 1), $roles[$result[0]['user_type']]);
                $format = str_replace($tags, $replacements, $GLOBALS['configuration']['username_format']);
                $GLOBALS['_usernames'][$login] = $format;
            }
        }
    }
    EfrontCache::getInstance()->setCache('usernames', $GLOBALS['_usernames']);
    return $GLOBALS['_usernames'][$login];
}
开发者ID:kaseya-university,项目名称:efront,代码行数:40,代码来源:tools-backup.php

示例15: getModule

 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $currentLesson = $this->getCurrentLesson();
     $currentUser = $this->getCurrentUser();
     try {
         $currentContent = new EfrontContentTree($_SESSION['s_lessons_ID']);
         //Initialize content
     } catch (Exception $e) {
         $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
         $message = _ERRORLOADINGCONTENT . ": " . $_SESSION['s_lessons_ID'] . ": " . $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
     }
     //pr($currentUser);exit;
     $roles = EfrontUser::getRoles();
     //pr($roles);
     if ($roles[$currentUser->lessons[$_SESSION['s_lessons_ID']]] == "professor") {
         if (isset($_GET['view_deck']) && eF_checkParameter($_GET['view_deck'], 'id')) {
             $deck = $currentContent->seekNode($_GET['view_deck']);
             $questions = $deck->getQuestions(true);
             $cards = array();
             $possibleCardsIds = array();
             foreach ($questions as $key => $value) {
                 if ($value->question['type'] == 'empty_spaces') {
                     $cards[] = $value;
                     $possibleCardsIds[] = $value->question['id'];
                 }
             }
             $questions = $cards;
             //pr($questions);
             foreach ($questions as $qid => $question) {
                 $questions[$qid]->question['text'] = strip_tags($question->question['text']);
                 //If we ommit this line, then the questions list is html formatted, images are displayed etc, which is *not* the intended behaviour
                 //$questions[$qid]->question['answer']           = unserialize($question->question['answer']);
             }
             $res = eF_getTableData("module_flashcards_decks", "cards,options", "content_ID=" . $_GET['view_deck']);
             $resCards = unserialize($res[0]['cards']);
             $smarty->assign("T_FLASHCARDS_DECK_CARDS", $resCards);
             $post_target = $this->moduleBaseUrl . '&view_deck=' . $_GET['view_deck'] . "&tab=options";
             //Create form elements
             $form = new HTML_QuickForm("deck_options", "post", $post_target, "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             $form->addElement('advcheckbox', 'active', _FLASHCARDS_ACTIVE, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement("text", "low", _LOW, 'size = "5"');
             $form->addElement("text", "medium", _MEDIUM, 'size = "5"');
             $form->addElement("text", "hard", _HIGH, 'size = "5"');
             $form->addElement("text", "very_hard", _VERYHIGH, 'size = "5"');
             $form->addRule('low', _INVALIDFIELDDATA . ":" . _LOW, 'checkParameter', 'id');
             $form->addRule('medium', _INVALIDFIELDDATA . ":" . _MEDIUM, 'checkParameter', 'id');
             $form->addRule('hard', _INVALIDFIELDDATA . ":" . _HIGH, 'checkParameter', 'id');
             $form->addRule('very_hard', _INVALIDFIELDDATA . ":" . _VERYHIGH, 'checkParameter', 'id');
             $form->addElement('advcheckbox', 'answer_first', _FLASHCARDS_SHOWANSWERFIRST, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('advcheckbox', 'shuffle', _FLASHCARDS_SHUFFLECARDS, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('advcheckbox', 'display_mastery', _FLASHCARDS_DISPLAYMASTERY, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('advcheckbox', 'wrong', _FLASHCARDS_WRONGREDUCES, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('advcheckbox', 'show_count', _FLASHCARDS_SHOWSUCCESSCOUNT, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('advcheckbox', 'show_explanation', _FLASHCARDS_SHOWEXPLANATION, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('submit', 'submit_options', _SAVECHANGES, 'class = "flatButton"');
             //The submit content button
             $options = unserialize($res[0]['options']);
             $form->setDefaults(array('active' => $options['active'], 'answer_first' => $options['answer_first'], 'shuffle' => $options['shuffle'], 'display_mastery' => $options['display_mastery'], 'wrong' => $options['wrong'], 'show_count' => $options['show_count'], 'show_explanation' => $options['show_explanation'], 'low' => $options['low'] == "" ? 1 : $options['low'], 'medium' => $options['medium'] == "" ? 2 : $options['medium'], 'hard' => $options['hard'] == "" ? 4 : $options['hard'], 'very_hard' => $options['very_hard'] == "" ? 6 : $options['very_hard']));
             if ($form->isSubmitted() && $form->validate()) {
                 //If the form is submitted and validated
                 $values = $form->exportValues();
                 unset($values['submit_options']);
                 $options = serialize($values);
                 if (sizeof($res) != 0) {
                     $ok = eF_updateTableData("module_flashcards_decks", array('options' => $options), "content_ID=" . $_GET['view_deck']);
                 } else {
                     $fields = array('content_ID' => $_GET['view_deck'], 'options' => $options);
                     $ok = eF_insertTableData("module_flashcards_decks", $fields);
                 }
                 if ($ok !== false) {
                     $message = _FLASHCARDS_SUCCESSFULLY;
                     $message_type = 'success';
                 } else {
                     $message = _FLASHCARDS_PROBLEMOCCURED;
                     $message_type = 'failure';
                 }
                 eF_redirect("" . $this->moduleBaseUrl . "&view_deck=" . $_GET['view_deck'] . "&tab=options&message=" . $message . "&message_type=" . $message_type);
             }
             $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
             //Create a smarty renderer
             $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
             //Set javascript error messages
             $form->setRequiredNote(_REQUIREDNOTE);
             $form->accept($renderer);
             //Assign this form to the renderer, so that corresponding template code is created
             $smarty->assign('T_FLASHCARDS_OPTIONS', $renderer->toArray());
             //Assign the form to the template
             if (isset($_GET['postAjaxRequest'])) {
                 try {
                     $result = eF_getTableData("module_flashcards_decks", "cards", "content_ID=" . $_GET['view_deck']);
                     //pr($result);exit;
                     $cardsArray = unserialize($result[0]['cards']);
                     if (isset($_GET['id']) && eF_checkParameter($_GET['id'], 'id')) {
                         if (!in_array($_GET['id'], array_values($cardsArray))) {
                             $cardsArray[] = $_GET['id'];
                             $cards = serialize($cardsArray);
                             if (sizeof($result) != 0) {
                                 $fields = array('cards' => $cards);
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_flashcards.class.php


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