예제 #1
0
                 $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'];
             }
예제 #2
0
 /**
  * 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 = '******' 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;
             $confirmed or $fields['from_timestamp'] = 0;
             $where = "users_LOGIN='******' and courses_ID=" . $this->course['id'];
             self::persistCourseUsers($fields, $where, $this->course['id'], $user);
             $existingUsers[] = $courseUsers[$user];
         }
         foreach ($courseLessons as $id) {
             if (!isset($courseLessonsToUsers[$id][$user])) {
                 $usersToAddToCourseLesson[$id][$user] = array('login' => $user, 'role' => $roleInCourse, 'confirmed' => $confirmed);
                 $newLessonUsers[] = array('users_LOGIN' => $user, 'lessons_ID' => $id, 'active' => 1, 'archive' => 0, 'from_timestamp' => $confirmed ? time() : 0, 'user_type' => $roleInCourse, 'positions' => '', 'done_content' => '', 'current_unit' => 0, 'completed' => 0, 'score' => 0, 'comments' => '', 'to_timestamp' => 0);
                 if (EfrontUser::isStudentRole($roleInCourse)) {
                     foreach ($courseLessonsAutoAssignProjects[$id] as $projectId) {
                         if (!isset($assignedProjectsToUsers[$user][$projectId])) {
                             $newProjectAssignments[] = array('users_LOGIN' => $user, 'projects_ID' => $projectId);
                         }
                     }
                 }
             } elseif ($roleInCourse != $courseLessonsToUsers[$id][$user]['user_type'] || $courseLessonsToUsers[$id][$user]['archive']) {
                 //update also lesson from_timestamp value when user reassigned to a course (only if it is not completed)
                 if ($courseLessonsToUsers[$id][$user]['completed']) {
                     $fields = array('archive' => 0, 'user_type' => $roleInCourse);
                 } else {
                     $fields = array('archive' => 0, 'user_type' => $roleInCourse, 'from_timestamp' => time());
                 }
                 $fields['access_counter'] = 0;
                 //!$courseLessonsToUsers[$id][$user]['archive'] OR $fields['to_timestamp'] = 0;
                 $confirmed or $fields['from_timestamp'] = 0;
                 eF_updateTableData("users_to_lessons", $fields, "users_LOGIN='******' and lessons_ID=" . $id);
                 if (EfrontUser::isStudentRole($roleInCourse)) {
                     foreach ($courseLessonsAutoAssignProjects[$id] as $projectId) {
                         if (!isset($assignedProjectsToUsers[$user][$projectId])) {
                             $newProjectAssignments[] = array('users_LOGIN' => $user, 'projects_ID' => $projectId);
                         }
                     }
                 }
             }
         }
     }
     if (!empty($newUsers)) {
         eF_insertTableDataMultiple("users_to_courses", $newUsers);
     }
     if (!empty($newLessonUsers)) {
         eF_insertTableDataMultiple("users_to_lessons", $newLessonUsers);
     }
     if (!empty($newProjectAssignments)) {
         eF_insertTableDataMultiple("users_to_projects", $newProjectAssignments);
     }
     !isset($newUsers) ? $newUsers = array() : null;
     !isset($existingUsers) ? $existingUsers = array() : null;
     $eventArray = array_merge($newUsers, $existingUsers);
     if (!defined(_DISABLE_EVENTS) || _DISABLE_EVENTS !== true) {
         foreach ($eventArray as $value) {
             $event = array("type" => EfrontUser::isStudentRole($value['user_type']) ? EfrontEvent::COURSE_ACQUISITION_AS_STUDENT : EfrontEvent::COURSE_ACQUISITION_AS_PROFESSOR, "users_LOGIN" => $value['users_LOGIN'], "lessons_ID" => $this->course['id'], "lessons_name" => $this->course['name']);
             EfrontEvent::triggerEvent($event);
             if (EfrontUser::isStudentRole($value['user_type'])) {
                 $event = array("type" => -1 * EfrontEvent::COURSE_COMPLETION, "users_LOGIN" => $value['users_LOGIN'], "lessons_ID" => $this->course['id'], "lessons_name" => $this->course['name'], "replace" => true, "create_negative" => false);
                 EfrontEvent::triggerEvent($event);
             }
         }
     }
     $modules = eF_loadAllModules();
     foreach ($modules as $module) {
         $module->onAddUsersToCourse($this->course['id'], $eventArray, $newLessonUsers);
     }
     $this->users = false;
     //Reset users cache
 }
 /**
  * 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' => '*****@*****.**');
  * $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='******'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;
     isset($userProperties['password']) && $userProperties['password'] != '' ? $passwordNonTransformed = $userProperties['password'] : ($passwordNonTransformed = $userProperties['login']);
     if ($userProperties['password'] != 'ldap') {
         !isset($userProperties['password']) || $userProperties['password'] == '' ? $userProperties['password'] = EfrontUser::createPassword($userProperties['login']) : ($userProperties['password'] = self::createPassword($userProperties['password']));
         if ($GLOBALS['configuration']['force_change_password']) {
             $userProperties['need_pwd_change'] = 1;
         }
     }
     !isset($userProperties['email']) ? $userProperties['email'] = '' : null;
     // 0 means not pending, 1 means pending
     !isset($userProperties['languages_NAME']) ? $userProperties['languages_NAME'] = $GLOBALS['configuration']['default_language'] : null;
     //If language is not specified, use default language
     !isset($userProperties['active']) || $userProperties['active'] == "" ? $userProperties['active'] = 0 : null;
     // 0 means inactive, 1 means active
     !isset($userProperties['pending']) ? $userProperties['pending'] = 0 : null;
     // 0 means not pending, 1 means pending
     !isset($userProperties['timestamp']) || $userProperties['timestamp'] == "" ? $userProperties['timestamp'] = time() : null;
     !isset($userProperties['user_types_ID']) ? $userProperties['user_types_ID'] = 0 : null;
     $languages = EfrontSystem::getLanguages();
     if (in_array($userProperties['languages_NAME'], array_keys($languages)) === false) {
         $userProperties['languages_NAME'] = $GLOBALS['configuration']['default_language'];
     }
     if ($userProperties['archive']) {
         $userProperties['archive'] = time();
         $userProperties['active'] = 0;
     }
     !isset($userProperties['timezone']) || $userProperties['timezone'] == '' ? $userProperties['timezone'] = $GLOBALS['configuration']['time_zone'] : null;
     $userProfile = eF_getTableData("user_profile", "name,options", "active=1 AND type='select'");
     foreach ($userProfile as $field) {
         if (isset($userProperties[$field['name']])) {
             $options = unserialize($field['options']);
             $userProperties[$field['name']] = array_search($userProperties[$field['name']], $options);
         }
     }
     eF_insertTableData("users", $userProperties);
     // Assign to the new user all skillgap tests that should be automatically assigned to every new student
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (G_VERSIONTYPE != 'standard') {
             #cpp#ifndef STANDARD
             if ($userProperties['user_type'] == 'student') {
                 $tests = EfrontTest::getAutoAssignedTests();
                 foreach ($tests as $test) {
                     eF_insertTableData("users_to_skillgap_tests", array("users_LOGIN" => $userProperties['login'], "tests_ID" => $test));
                 }
             }
         }
         #cpp#endif
     }
     #cpp#endif
     $newUser = EfrontUserFactory::factory($userProperties['login']);
     //$newUser -> user['password'] = $passwordNonTransformed;	//commented out because it was not needed any more, and created problems. Will be removed in next pass
     global $currentUser;
     // this is for running eF_loadAllModules ..needs to go somewhere else
     if (!$currentUser) {
         $currentUser = $newUser;
     }
     EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_JOIN, "users_LOGIN" => $newUser->user['login'], "users_name" => $newUser->user['name'], "users_surname" => $newUser->user['surname'], "entity_name" => $passwordNonTransformed));
     EfrontEvent::triggerEvent(array("type" => -1 * EfrontEvent::SYSTEM_VISITED, "users_LOGIN" => $newUser->user['login'], "users_name" => $newUser->user['name'], "users_surname" => $newUser->user['surname']));
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (G_VERSIONTYPE != 'standard') {
             #cpp#ifndef STANDARD
             if ($addToDefaultGroup) {
                 EfrontGroup::addToDefaultGroup($newUser, $newUser->user['user_types_ID'] ? $newUser->user['user_types_ID'] : $newUser->user['user_type']);
             }
         }
         #cpp#endif
     }
     #cpp#endif
     ///MODULES1 - Module user add events
     // Get all modules (NOT only the ones that have to do with the user type)
     if (!self::$cached_modules) {
         self::$cached_modules = eF_loadAllModules();
     }
     // Trigger all necessary events. If the function has not been re-defined in the derived module class, nothing will happen
     foreach (self::$cached_modules as $module) {
         $module->onNewUser($userProperties['login']);
     }
     EfrontCache::getInstance()->deleteCache('usernames');
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (G_VERSIONTYPE != 'standard') {
             #cpp#ifndef STANDARD
             $threshold = self::NOTIFY_THRESHOLD * $GLOBALS['configuration']['version_users'];
             if (isset($GLOBALS['configuration']['version_users']) && $GLOBALS['configuration']['version_users'] > 0 && $activatedUsers < $threshold && $activatedUsers + 1 > $threshold) {
                 $admin = EfrontSystem::getAdministrator();
                 eF_mail($GLOBALS['configuration']['system_email'], $admin->user['email'], _YOUAREREACHINGYOURSUBSCRIPTIONLIMIT, str_replace(array('%w', '%x', '%y', '%z'), array($admin->user['name'], self::NOTIFY_THRESHOLD * 100, $GLOBALS['configuration']['site_name'], G_SERVERNAME), _YOUAREREACHINGYOURSUBSCRIPTIONLIMITBODY));
             }
         }
         #cpp#endif
     }
     #cpp#endif
     return $newUser;
 }
 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());
 }
예제 #5
0
 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']) {
                         $userBranchesAssigned[$value['users_login']][$value['branch_ID']] = $value;
                     } else {
                         $userBranchesUnassigned[$value['users_login']][$value['branch_ID']] = $value;
                     }
                 }
                 $allBranches = eF_getTableData("module_hcd_branch", "branch_ID, father_branch_ID", "");
                 $addedJobs = $addedBranches = array();
                 foreach ($data as $key => $value) {
                     try {
                         if (!$value['description']) {
                             throw new EfrontJobException(_MISSING_JOB_DESCRIPTION, EfrontJobException::MISSING_JOB_DESCRIPTION);
                         }
                         $branchId = $this->getBranchByName($value['branch_name']);
                         //Executes only once
                         if ($branchId[0]) {
                             if (sizeof($branchId) == 1) {
                                 $branchId = $branchId[0];
                             } else {
                                 throw new EfrontBranchException(_BRANCHNAMEAMBIGUOUS . ': ' . $value['branch_name'], EfrontBranchException::BRANCH_AMBIGUOUS);
                             }
                         } else {
                             throw new EfrontBranchException(_BRANCHDOESNOTEXIST . ': ' . $value['branch_name'], EfrontBranchException::BRANCH_NOT_EXISTS);
                         }
                         $jobId = false;
                         foreach ($jobDescriptions as $job) {
                             if ($job['description'] == $value['description'] && $job['branch_ID'] == $branchId) {
                                 $jobId = $job['job_description_ID'];
                             }
                         }
                         if (!$jobId) {
                             $jobId = eF_insertTableData("module_hcd_job_description", array('description' => $value['description'], 'branch_ID' => $branchId));
                             $jobDescriptions[$jobId] = array('job_description_ID' => $jobId, 'description' => $value['description'], 'branch_ID' => $branchId);
                         }
                         $user = EfrontUserFactory::factory($value["users_login"]);
                         $value['users_login'] = $user->user['login'];
                         if (isset($userJobs[$value['users_login']]) && $this->options['replace_assignments']) {
                             $unset = false;
                             foreach ($userJobs[$value['users_login']] as $key => $v) {
                                 if (!isset($addedJobs[$v][$value['users_login']])) {
                                     $user->aspects['hcd']->removeJob($v);
                                     unset($userJobs[$value['users_login']][$v]);
                                     $unset = true;
                                 }
                             }
                             if ($unset) {
                                 unset($userBranchesAssigned[$value['users_login']]);
                             }
                         }
                         if (isset($userJobs[$value['users_login']][$jobId]) && $this->options['replace_existing']) {
                             eF_deleteTableData("module_hcd_employee_has_job_description", "users_login='******'users_login'] . "' AND job_description_ID ='" . $jobId . "'");
                             unset($userJobs[$value['users_login']][$jobId]);
                         }
                         // Check if this job description is already assigned
                         if (!isset($userJobs[$value['users_login']][$jobId])) {
                             if (!isset($userBranchesAssigned[$value['users_login']][$branchId])) {
                                 // Write to the database the new branch assignment: employee to branch (if such an assignment is not already true)
                                 if (isset($userBranchesUnassigned[$value['users_login']][$branchId])) {
                                     eF_updateTableData("module_hcd_employee_works_at_branch", array("assigned" => 1), "users_login='******'users_login'] . "' and branch_ID={$branchId}");
                                     unset($userBranchesUnassigned[$value['users_login']][$branchId]);
                                 } else {
                                     $fields = array('users_login' => $value['users_login'], 'supervisor' => $value['supervisor'], 'assigned' => '1', 'branch_ID' => $branchId);
                                     eF_insertTableData("module_hcd_employee_works_at_branch", $fields);
                                     if ($value['supervisor']) {
                                         //Iterate through sub branches
                                         foreach (eF_subBranches($branchId, $allBranches) as $subBranchId) {
                                             //If this subranch is not associated with the user, associate it
                                             if (!isset($userBranchesAssigned[$value['users_login']][$subBranchId]) && !isset($userBranchesUnassigned[$value['users_login']][$subBranchId])) {
                                                 $fields = array('users_login' => $value['users_login'], 'supervisor' => 1, 'assigned' => '0', 'branch_ID' => $subBranchId);
                                                 eF_insertTableData("module_hcd_employee_works_at_branch", $fields);
                                                 $userBranchesUnassigned[$value['users_login']][$branchId] = array('branch_ID' => $branchId, 'supervisor' => $value['supervisor'], 'assigned' => 0);
                                             } elseif (isset($userBranchesAssigned[$value['users_login']][$subBranchId]) && $userBranchesAssigned[$value['users_login']][$subBranchId]['supervisor'] == 0) {
                                                 eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 1), "users_login='******'users_login'] . "' and branch_ID={$subBranchId}");
                                                 $userBranchesAssigned[$value['users_login']][$subBranchId]['supervisor'] = 1;
                                             } elseif (isset($userBranchesUnassigned[$value['users_login']][$subBranchId]) && $userBranchesUnassigned[$value['users_login']][$subBranchId]['supervisor'] == 0) {
                                                 eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 1), "users_login='******'users_login'] . "' and branch_ID={$subBranchId}");
                                                 $userBranchesUnassigned[$value['users_login']][$subBranchId]['supervisor'] = 1;
                                             }
                                         }
                                     }
                                 }
                                 $userBranchesAssigned[$value['users_login']][$branchId] = array('branch_ID' => $branchId, 'supervisor' => $value['supervisor'], 'assigned' => 1);
                                 $addedBranches[$branchId][$value['users_login']] = $value['users_login'];
                             } elseif (!$userBranchesAssigned[$value['users_login']][$branchId]['supervisor'] && $value['supervisor']) {
                                 eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 1), "users_login='******'users_login'] . "' and branch_ID={$branchId}");
                                 //Iterate through sub branches
                                 foreach (eF_subBranches($branchId, $allBranches) as $subBranchId) {
                                     //If this subranch is not associated with the user, associate it
                                     if (!isset($userBranchesAssigned[$value['users_login']][$subBranchId]) && !isset($userBranchesUnassigned[$value['users_login']][$subBranchId])) {
                                         $fields = array('users_login' => $value['users_login'], 'supervisor' => 1, 'assigned' => '0', 'branch_ID' => $subBranchId);
                                         eF_insertTableData("module_hcd_employee_works_at_branch", $fields);
                                         $userBranchesUnassigned[$value['users_login']][$branchId] = array('branch_ID' => $branchId, 'supervisor' => $value['supervisor'], 'assigned' => 0);
                                     } elseif (isset($userBranchesAssigned[$value['users_login']][$subBranchId]) && $userBranchesAssigned[$value['users_login']][$subBranchId]['supervisor'] == 0) {
                                         eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 1), "users_login='******'users_login'] . "' and branch_ID={$subBranchId}");
                                         $userBranchesAssigned[$value['users_login']][$subBranchId]['supervisor'] = 1;
                                     } elseif (isset($userBranchesUnassigned[$value['users_login']][$subBranchId]) && $userBranchesUnassigned[$value['users_login']][$subBranchId]['supervisor'] == 0) {
                                         eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 1), "users_login='******'users_login'] . "' and branch_ID={$subBranchId}");
                                         $userBranchesUnassigned[$value['users_login']][$subBranchId]['supervisor'] = 1;
                                     }
                                 }
                             } elseif ($userBranchesAssigned[$value['users_login']][$branchId]['supervisor'] && !$value['supervisor']) {
                                 eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 0), "users_login='******'users_login'] . "' and branch_ID={$branchId}");
                             }
                             // Write to database the new job assignment: employee to job description
                             $fields = array('users_login' => $value['users_login'], 'job_description_ID' => $jobId);
                             eF_insertTableData("module_hcd_employee_has_job_description", $fields);
                             $userJobs[$value['users_login']][$jobId] = $jobId;
                             $addedJobs[$jobId][$value['users_login']] = $value['users_login'];
                             /*
                             									if ($event_info) {
                             										EfrontEvent::triggerEvent(array("type" => EfrontEvent::HCD_NEW_JOB_ASSIGNMENT, "users_LOGIN" => $this -> login, "lessons_ID" => $branchID, "lessons_name" => $bname[0]['name'], "entity_ID" => $jobID, "entity_name" => $job_description, "timestamp" => $event_info['timestamp'], "explicitly_selected" => $event_info['manager']));
                             									} else {
                             										EfrontEvent::triggerEvent(array("type" => EfrontEvent::HCD_NEW_JOB_ASSIGNMENT, "users_LOGIN" => $this -> login, "lessons_ID" => $branchID, "lessons_name" => $bname[0]['name'], "entity_ID" => $jobID, "entity_name" => $job_description));
                             									}
                             */
                         } else {
                             throw new EfrontUserException(_JOBALREADYASSIGNED . ": " . $value['users_login'], EfrontUserException::WRONG_INPUT_TYPE);
                         }
                         $this->log["success"][] = _LINE . " " . ($key + 2) . " : " . _NEWJOBASSIGNMENT . " " . $value["users_login"] . " - (" . $value['branch_name'] . " - " . $value['description'] . ") ";
                     } catch (Exception $e) {
                         $this->log["failure"][] = _LINE . " " . ($key + 2) . " : " . $e->getMessage() . ' (' . $e->getCode() . ')';
                     }
                 }
                 $courseAssignmentsToUsers = $lessonAssignmentsToUsers = array();
                 $result = eF_getTableData("module_hcd_course_to_job_description", "*");
                 foreach ($result as $value) {
                     foreach ($addedJobs[$value['job_description_ID']] as $user) {
                         $courseAssignmentsToUsers[$value['courses_ID']][] = $user;
                     }
                 }
                 $result = eF_getTableData("module_hcd_lesson_to_job_description", "*");
                 foreach ($result as $value) {
                     foreach ($addedJobs[$value['job_description_ID']] as $user) {
                         $lessonAssignmentsToUsers[$value['lessons_ID']][] = $user;
                     }
                 }
                 if ($GLOBALS['configuration']['mode_propagate_courses_to_branch_users']) {
                     $result = eF_getTableData("module_hcd_course_to_branch", "*");
                     foreach ($result as $value) {
                         foreach ($addedBranches[$value['branches_ID']] as $user) {
                             $courseAssignmentsToUsers[$value['courses_ID']][] = $user;
                         }
                     }
                 }
                 foreach ($courseAssignmentsToUsers as $courseId => $users) {
                     $course = new EfrontCourse($courseId);
                     $course->addUsers($users);
                 }
                 foreach ($lessonAssignmentsToUsers as $lessonId => $users) {
                     $course = new EfrontLesson($lessonId);
                     $course->addUsers($users);
                 }
                 break;
         }
     } catch (Exception $e) {
         $this->log["failure"][] = $e->getMessage() . ' (' . $e->getCode() . ')';
         // ." ". str_replace("\n", "<BR>", $e->getTraceAsString());
     }
 }
 /**
  * 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: "******"<br />";
     $str .= "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 = "******";
     $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 = "******";
     $password = "******";
     $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");
     $smarty -> assign("T_CONNECTION_INFO", 
     			$this -> moduleBaseLink . 
     			"ConnectionInfo.php");
     $smarty -> assign("T_DC", 
     			$this -> moduleBaseLink . 
     			"webRDP.php?" . 
     			"hostName=" . $hostName . "&" . 
     			"hostPort=" . $hostPort["dc"] . "&" . 
     			"username="******"&" . 
     			"password="******"&" . 
     			"domain=" . $domain . "&" . 
     			"frameWidth=" . $frame["width"] . "&" . 
     			"frameHeight=" . $frame["height"] . "&" . 
     			"frameBpp=" . $frame["bpp"]);
     $smarty -> assign("T_WS1", 
     			$this -> moduleBaseLink . 
     			"webRDP.php?" . 
     			"hostName=" . $hostName . "&" . 
     			"hostPort=" . $hostPort["ws1"] . "&" . 
     			"username="******"&" . 
     			"password="******"&" . 
     			"domain=" . $domain . "&" . 
     			"frameWidth=" . $frame["width"] . "&" . 
     			"frameHeight=" . $frame["height"] . "&" . 
     			"frameBpp=" . $frame["bpp"]);
     $smarty -> assign("T_WS2", 
     			$this -> moduleBaseLink . 
     			"webRDP.php?" . 
     			"hostName=" . $hostName . "&" . 
     			"hostPort=" . $hostPort["ws2"] . "&" . 
     			"username="******"&" . 
     			"password="******"&" . 
     			"domain=" . $domain . "&" . 
     			"frameWidth=" . $frame["width"] . "&" . 
     			"frameHeight=" . $frame["height"] . "&" . 
     			"frameBpp=" . $frame["bpp"]);
     $smarty -> assign("T_RECEPTION", 
     			$this -> moduleBaseLink . 
     			"webRDP.php?" . 
     			"hostName=" . $hostName . "&" . 
     			"hostPort=" . $hostPort["reception"] . "&" . 
     			"username="******"&" . 
     			"password="******"&" . 
     			"domain=" . $domain . "&" . 
     			"frameWidth=" . $frame["width"] . "&" . 
     			"frameHeight=" . $frame["height"] . "&" . 
     			"frameBpp=" . $frame["bpp"]);
     $smarty -> assign("T_LAPTOP_CEO", 
     			$this -> moduleBaseLink . 
     			"webRDP.php?" . 
     			"hostName=" . $hostName . "&" . 
     			"hostPort=" . $hostPort["laptop_ceo"] . "&" . 
     			"username="******"&" . 
     			"password="******"&" . 
     			"domain=" . $domain . "&" . 
     			"frameWidth=" . $frame["width"] . "&" . 
     			"frameHeight=" . $frame["height"] . "&" . 
     			"frameBpp=" . $frame["bpp"]);
     		
             return true;
     */
 }
예제 #7
0
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_) {
예제 #8
0
        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");
    }
예제 #9
0
 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;
 }
예제 #10
0
 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);
                                 eF_updateTableData("module_crossword_words", $fields, "content_ID=" . $_GET['view_list']);
                             } else {
                                 eF_deleteTableData("module_crossword_words", "content_ID=" . $_GET['view_list']);
                             }
                         }
                     } else {
                         if (isset($_GET['addAll'])) {
                             $crosslists = serialize($possibleCrosslistsIds);
                             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);
                             }
                         } else {
                             if (isset($_GET['removeAll'])) {
                                 $fields = array('crosslists' => "");
                                 eF_updateTableData("module_crossword_words", $fields, "content_ID=" . $_GET['view_list']);
                             }
                         }
                     }
                 } catch (Exception $e) {
                     header("HTTP/1.0 500 ");
                     echo $e->getMessage() . ' (' . $e->getCode() . ')';
                 }
                 exit;
             }
             $smarty->assign("T_CROSSWORD_CROSSLISTS", $crosslists);
             $smarty->assign("T_CROSSWORD_CROSSLISTS_SIZE", sizeof($crosslists));
         } else {
             $listsArray = array();
             $iterator = new EfrontContentFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator($currentContent->tree, RecursiveIteratorIterator::SELF_FIRST)));
             foreach ($iterator as $key => $value) {
                 $questions = $value->getQuestions(true);
                 $crosslists = array();
                 foreach ($questions as $key2 => $value2) {
                     if ($value2->question['type'] == 'empty_spaces') {
                         $crosslists[] = $value2;
                     }
                 }
                 if (sizeof($crosslists) > 0) {
                     $listsArray[$value['id']] = array('id' => $value['id'], 'name' => $value['name'], 'questions' => sizeof($crosslists));
                 }
             }
             if (!empty($listsArray)) {
                 $str = implode(",", array_keys($listsArray));
                 $lists = eF_getTableDataFlat("module_crossword_words", "*", "content_ID IN (" . $str . ")");
                 $listsTemp = array_combine(array_values($lists['content_ID']), array_values($lists['options']));
                 $listsTemp2 = array_combine(array_values($lists['content_ID']), array_values($lists['crosslists']));
                 foreach ($listsArray as $key => $value) {
                     $listsArray[$value['id']]['options'] = unserialize($listsTemp[$key]);
                     $crosslistsTemp = unserialize($listsTemp2[$key]);
                     $listsArray[$value['id']]['num_crosslists'] = empty($crosslistsTemp) ? 0 : sizeof($crosslistsTemp);
                 }
             }
             $smarty->assign("T_CROSSWORD_WORDS", $listsArray);
         }
     } elseif ($roles[$currentUser->lessons[$_SESSION['s_lessons_ID']]] == "student") {
         if (isset($_GET['restart_list']) && eF_checkParameter($_GET['restart_list'], 'id')) {
             eF_deleteTableData("module_crossword_users", "users_LOGIN='******'s_login'] . "' AND content_ID=" . $_GET['restart_list']);
         }
         if (isset($_GET['restart_lists'])) {
             eF_deleteTableData("module_crossword_users", "users_LOGIN='******'s_login'] . "'");
         }
         if ($_GET['answer'] == "true") {
             $resUserCard = eF_getTableData("module_crossword_users", "*", "crosslists_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             if (sizeof($resUserCard) == 0) {
                 $fields = array('users_LOGIN' => $_SESSION['s_login'], 'content_ID' => $_GET['view_list'], 'crosslists_ID' => $_GET['view_card'], 'success' => '1');
                 eF_insertTableData("module_crossword_users", $fields);
             } else {
                 $success = $resUserCard[0]['success'] + 1;
                 eF_updateTableData("module_crossword_users", array('success' => $success), "crosslists_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             }
         } elseif ($_GET['answer'] == "false") {
             $resUserCard = eF_getTableData("module_crossword_users", "*", "crosslists_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             $currentListTemp = eF_getTableData("module_crossword_words", "options", "content_ID=" . $_GET['view_list']);
             $listTemp = unserialize($currentListTemp[0]['options']);
             if ($listTemp['wrong'] == 1 && sizeof($resUserCard) != 0 && $resUserCard[0]['success'] != 0) {
                 $success = $resUserCard[0]['success'] - 1;
                 eF_updateTableData("module_crossword_users", array('success' => $success), "crosslists_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             }
         }
         $listsArray = array();
         $iterator = new EfrontContentFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator($currentContent->tree, RecursiveIteratorIterator::SELF_FIRST)));
         foreach ($iterator as $key => $value) {
             $listsArray[$value['id']] = array('id' => $value['id'], 'name' => $value['name']);
         }
         if (empty($listsArray)) {
             $smarty->assign("T_CROSSWORD_WORDSNAMES", $listsArray);
             return true;
         }
         $str = implode(",", array_keys($listsArray));
         $lists = eF_getTableData("module_crossword_words", "*", "content_ID IN (" . $str . ")");
         $mastery = eF_getTableDataFlat("module_crossword_users", "*", "content_ID IN (" . $str . ")");
         $masteryArray = array_combine(array_values($mastery['crosslists_ID']), array_values($mastery['success']));
         $questionsDiff = eF_getTableDataFlat("questions", "*", "content_ID IN (" . $str . ")");
         $questionsDiffArray = array_combine(array_values($questionsDiff['id']), array_values($questionsDiff['difficulty']));
         $validLists = array();
         foreach ($lists as $key => $value) {
             $opt = unserialize($value['options']);
             $crosslists = unserialize($value['crosslists']);
             if ($opt['active'] == 1 && !empty($crosslists)) {
                 $value['number_crosslists'] = empty($crosslists) ? 0 : sizeof($crosslists);
                 $validLists[$value['content_ID']] = $value;
                 $validLists[$value['content_ID']]['options'] = $opt;
                 $finishedCrosslists = 0;
                 foreach ($crosslists as $index => $item) {
                     if ($masteryArray[$item] == $opt[$questionsDiffArray[$item]]) {
                         $finishedCrosslists++;
                     }
                 }
                 $conid = $validLists[$value['content_ID']]['content_ID'];
                 $validLists[$value['content_ID']]['non_finished'] = $value['number_crosslists'] - $finishedCrosslists;
                 $validLists[$value['content_ID']]['mastery'] = (double) $finishedCrosslists / sizeof($crosslists) * 100;
                 $respoints = eF_getTableDataFlat("module_crossword_users", "*", "content_ID = '{$conid}' and users_LOGIN='******'s_login'] . "'");
                 $validLists[$value['content_ID']]['points'] = round($respoints['points'][0] / $respoints['totallength'][0] * 100);
                 $validLists[$value['content_ID']]['crosstime'] = $respoints['wordtime'][0];
             }
         }
         //print_r($validLists);
         $smarty->assign("T_CROSSWORD_WORDS", $validLists);
         $smarty->assign("T_CROSSWORD_WORDSNAMES", $listsArray);
         if (isset($_GET['view_list']) && !isset($_GET['pdf'])) {
             $resunit = eF_getTableData("content", "name", "id=" . $_GET['view_list']);
             $smarty->assign("T_CROSSWORD_UNITNAME", $resunit[0]['name']);
             $_SESSION['contentid'] = $_GET['view_list'];
             if (isset($_POST) && !empty($_POST['crosstime'])) {
                 $userlist = eF_getTableData("module_crossword_users", "*", "users_LOGIN='******'s_login'] . "' and content_ID=" . $_GET['view_list'] . "");
                 if (count($userlist) == 0) {
                     $fields = array('users_LOGIN' => $_SESSION['s_login'], 'content_ID' => $_GET['view_list'], 'points' => $_POST['points'], 'totallength' => $_SESSION['WORDLEN'], 'wordtime' => $_POST['crosstime']);
                     eF_insertTableData("module_crossword_users", $fields);
                 } else {
                     $fields = array('points' => $_POST['points'], 'totallength' => $_SESSION['WORDLEN'], 'wordtime' => $_POST['crosstime']);
                     eF_updateTableData("module_crossword_users", $fields, "content_ID=" . $_GET['view_list'] . " and users_LOGIN='******'s_login'] . "'");
                 }
                 $message_type = 'success';
                 $message = _CROSSWORD_GAME_SUCCESSFULLY;
                 eF_redirect($this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type=" . $message_type);
             }
             $contentid = $_GET['view_list'];
             $res = eF_getTableData("module_crossword_words", "crosslists,options", "content_ID=" . $_GET['view_list']);
             $reswords = unserialize($res[0]['crosslists']);
             $maxwords = unserialize($res[0]['options']);
             $maxwords1 = $maxwords['max_word'];
             $smarty->assign("T_CROSSWORD_REVEALANSWER", $maxwords['reveal_answer']);
             $smarty->assign("T_CROSSWORD_MAXWORD", $maxwords1 + 1);
             $_SESSION['CROSSWORD_MAXWORD'] = $maxwords1;
             require_once 'init.php';
             $rowquesans = "";
             foreach ($reswords as $rowques) {
                 $rowquesans .= $rowques . ",";
             }
             $quesids = mb_substr($rowquesans, 0, -1);
             $quesans = eF_getTableData("questions", "text,answer", "id IN({$quesids}) order by rand() limit {$maxwords1}");
             $value = array();
             foreach ($quesans as $row) {
                 $answer = unserialize($row['answer']);
                 $answer1 = explode("|", $answer['0']);
                 $value[] = array('ANSWER' => $answer1['0'], 'QUESTION' => $row['text']);
             }
             if (!empty($value)) {
                 //pr($value);exit;
                 $success = $pc->generateFromWords($value);
                 if (!$success) {
                     $message_type = 'failure';
                     $message = _CROSSWORD_UNABLEGENERATECROSSWORD;
                     eF_redirect($this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type=" . $message_type);
                 } else {
                     $words = $pc->getWords();
                     $wordlen = "";
                     foreach ($words as $rowwords) {
                         $wordlen = $wordlen + $rowwords['wordlength'];
                     }
                     $_SESSION['WORDLEN'] = $wordlen;
                     $smarty->assign("T_CROSSWORD_LENGTH", $_SESSION['WORDLEN']);
                     //vd($words);
                     //because of #1599
                     foreach ($words as $key => $word) {
                         $words[$key]['question'] = str_replace(array("\r\n", "\n"), '<br/>', $word['question']);
                     }
                     //vd($words);
                     $smarty->assign("T_CROSSWORD_ANSWERS", $words);
                 }
             }
             $post_target = $this->moduleBaseUrl . "&view_list=" . $_GET['view_list'] . "";
             $form = new HTML_QuickForm("crossword_game", "post", $post_target, "", null, true);
             $form->addElement('submit', 'submit_crossword', 'SUBMIT', 'class = "flatButton"');
             //The submit content button
             $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_SUBMIT', $renderer->toArray());
             //Assign the form to the template
             $message = "";
             //$message_type = 'success';
             // eF_redirect("".$this -> moduleBaseUrl."&popup=1&finish=1&message=".$message."&message_type=".$message_type);
         } else {
             if (isset($_GET['view_list']) && isset($_GET['pdf']) && $_GET['pdf'] == 'cross') {
                 $resunit = eF_getTableData("content", "name,lessons_ID", "id=" . $_GET['view_list']);
                 $reslesson = eF_getTableData("lessons", "name", "id=" . $resunit[0]['lessons_ID']);
                 $res = eF_getTableData("module_crossword_words", "crosslists,options", "content_ID=" . $_GET['view_list']);
                 $reswords = unserialize($res[0]['crosslists']);
                 $maxwords = unserialize($res[0]['options']);
                 $maxwords1 = $maxwords['max_word'];
                 $_SESSION['CROSSWORD_MAXWORD'] = $maxwords1;
                 require_once 'init.php';
                 $rowquesans = "";
                 foreach ($reswords as $rowques) {
                     $rowquesans .= $rowques . ",";
                 }
                 $quesids = mb_substr($rowquesans, 0, -1);
                 $quesans = eF_getTableData("questions", "text,answer", "id IN({$quesids}) order by rand() limit {$maxwords1}");
                 $value = array();
                 foreach ($quesans as $row) {
                     $answer = unserialize($row['answer']);
                     $answer1 = explode("|", $answer['0']);
                     $value[] = array('ANSWER' => $answer1['0'], 'QUESTION' => $row['text']);
                 }
                 $success = $pc->generateFromWords($value);
                 if (!$success) {
                     $message_type = 'failure';
                     $message = _CROSSWORD_UNABLEGENERATECROSSWORD;
                     eF_redirect($this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type=" . $message_type);
                 } else {
                     $currentlesson = $reslesson[0]['name'];
                     $words = $pc->getWords();
                     $answor = array();
                     $html1 = array();
                     $html2 = array();
                     $html1[] = $currentlesson;
                     $html1[] .= $resunit[0]['name'];
                     $html1[] .= _CROSSWORD_ACROSS;
                     $html2[] = _CROSSWORD_DOWN;
                     $k = 1;
                     //pr($words);
                     foreach ($words as $row) {
                         if ($row['axis'] == 1) {
                             $html1[] .= $k . '. ' . $row['question'];
                         } else {
                             $html2[] .= $k . '. ' . $row['question'];
                         }
                         $k++;
                     }
                     //pr($html1);
                     //pr($html2);
                     //exit;
                     $answor[] = array_merge($html1, $html2);
                     //pr($answor); exit;
                     $dd = $pc->getHTML($answor);
                     exit;
                 }
             }
         }
     }
     return true;
 }
 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;
 }
예제 #12
0
 			'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;
예제 #13
0
/**
* 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";
}
예제 #14
0
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='******'");
                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];
}
예제 #15
0
 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);
                                 eF_updateTableData("module_flashcards_decks", $fields, "content_ID=" . $_GET['view_deck']);
                             } else {
                                 $fields = array('content_ID' => $_GET['view_deck'], 'cards' => $cards);
                                 eF_insertTableData("module_flashcards_decks", $fields);
                             }
                         } elseif (in_array($_GET['id'], array_values($cardsArray))) {
                             unset($cardsArray[array_search($_GET['id'], $cardsArray)]);
                             if (!empty($cardsArray)) {
                                 $cards = serialize($cardsArray);
                                 $fields = array('cards' => $cards);
                                 eF_updateTableData("module_flashcards_decks", $fields, "content_ID=" . $_GET['view_deck']);
                             } else {
                                 eF_deleteTableData("module_flashcards_decks", "content_ID=" . $_GET['view_deck']);
                             }
                         }
                     } else {
                         if (isset($_GET['addAll'])) {
                             $cards = serialize($possibleCardsIds);
                             if (sizeof($result) != 0) {
                                 $fields = array('cards' => $cards);
                                 eF_updateTableData("module_flashcards_decks", $fields, "content_ID=" . $_GET['view_deck']);
                             } else {
                                 $fields = array('content_ID' => $_GET['view_deck'], 'cards' => $cards);
                                 eF_insertTableData("module_flashcards_decks", $fields);
                             }
                         } else {
                             if (isset($_GET['removeAll'])) {
                                 $fields = array('cards' => "");
                                 eF_updateTableData("module_flashcards_decks", $fields, "content_ID=" . $_GET['view_deck']);
                             }
                         }
                     }
                 } catch (Exception $e) {
                     header("HTTP/1.0 500 ");
                     echo $e->getMessage() . ' (' . $e->getCode() . ')';
                 }
                 exit;
             }
             $smarty->assign("T_FLASHCARDS_CARDS", $cards);
             $smarty->assign("T_FLASHCARDS_CARDS_SIZE", sizeof($cards));
         } else {
             $decksArray = array();
             $iterator = new EfrontContentFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator($currentContent->tree, RecursiveIteratorIterator::SELF_FIRST)));
             foreach ($iterator as $key => $value) {
                 $questions = $value->getQuestions(true);
                 $cards = array();
                 foreach ($questions as $key2 => $value2) {
                     if ($value2->question['type'] == 'empty_spaces') {
                         $cards[] = $value2;
                     }
                 }
                 if (sizeof($cards) > 0) {
                     $decksArray[$value['id']] = array('id' => $value['id'], 'name' => $value['name'], 'questions' => sizeof($cards));
                 }
             }
             if (!empty($decksArray)) {
                 $str = implode(",", array_keys($decksArray));
                 $decks = eF_getTableDataFlat("module_flashcards_decks", "*", "content_ID IN (" . $str . ")");
                 $decksTemp = array_combine(array_values($decks['content_ID']), array_values($decks['options']));
                 $decksTemp2 = array_combine(array_values($decks['content_ID']), array_values($decks['cards']));
                 foreach ($decksArray as $key => $value) {
                     $decksArray[$value['id']]['options'] = unserialize($decksTemp[$key]);
                     $cardsTemp = unserialize($decksTemp2[$key]);
                     $decksArray[$value['id']]['num_cards'] = empty($cardsTemp) ? 0 : sizeof($cardsTemp);
                 }
             }
             //pr($decksArray);
             $smarty->assign("T_FLASHCARDS_DECKS", $decksArray);
         }
     } elseif ($roles[$currentUser->lessons[$_SESSION['s_lessons_ID']]] == "student") {
         if (isset($_GET['restart_deck']) && eF_checkParameter($_GET['restart_deck'], 'id')) {
             eF_deleteTableData("module_flashcards_users_to_cards", "users_LOGIN='******'s_login'] . "' AND content_ID=" . $_GET['restart_deck']);
         }
         if (isset($_GET['restart_decks'])) {
             eF_deleteTableData("module_flashcards_users_to_cards", "users_LOGIN='******'s_login'] . "'");
         }
         if ($_GET['answer'] == "true") {
             $resUserCard = eF_getTableData("module_flashcards_users_to_cards", "*", "cards_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             if (sizeof($resUserCard) == 0) {
                 $fields = array('users_LOGIN' => $_SESSION['s_login'], 'content_ID' => $_GET['view_deck'], 'cards_ID' => $_GET['view_card'], 'success' => '1');
                 eF_insertTableData("module_flashcards_users_to_cards", $fields);
             } else {
                 $success = $resUserCard[0]['success'] + 1;
                 eF_updateTableData("module_flashcards_users_to_cards", array('success' => $success), "cards_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             }
         } elseif ($_GET['answer'] == "false") {
             $resUserCard = eF_getTableData("module_flashcards_users_to_cards", "*", "cards_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             $currentDeckTemp = eF_getTableData("module_flashcards_decks", "options", "content_ID=" . $_GET['view_deck']);
             $deckTemp = unserialize($currentDeckTemp[0]['options']);
             if ($deckTemp['wrong'] == 1 && sizeof($resUserCard) != 0 && $resUserCard[0]['success'] != 0) {
                 $success = $resUserCard[0]['success'] - 1;
                 eF_updateTableData("module_flashcards_users_to_cards", array('success' => $success), "cards_ID=" . $_GET['view_card'] . " and users_LOGIN='******'s_login'] . "'");
             }
         }
         $decksArray = array();
         $iterator = new EfrontContentFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator($currentContent->tree, RecursiveIteratorIterator::SELF_FIRST)));
         foreach ($iterator as $key => $value) {
             $decksArray[$value['id']] = array('id' => $value['id'], 'name' => $value['name']);
         }
         if (empty($decksArray)) {
             $smarty->assign("T_FLASHCARDS_DECKSNAMES", $decksArray);
             return true;
         }
         $str = implode(",", array_keys($decksArray));
         $decks = eF_getTableData("module_flashcards_decks", "*", "content_ID IN (" . $str . ")");
         $mastery = eF_getTableDataFlat("module_flashcards_users_to_cards", "*", "content_ID IN (" . $str . ") and users_LOGIN='******'s_login'] . "'");
         $masteryArray = array_combine(array_values($mastery['cards_ID']), array_values($mastery['success']));
         $questionsDiff = eF_getTableDataFlat("questions", "*", "content_ID IN (" . $str . ")");
         $questionsDiffArray = array_combine(array_values($questionsDiff['id']), array_values($questionsDiff['difficulty']));
         $validDecks = array();
         foreach ($decks as $key => $value) {
             $opt = unserialize($value['options']);
             $cards = unserialize($value['cards']);
             if ($opt['active'] == 1 && !empty($cards)) {
                 $value['number_cards'] = empty($cards) ? 0 : sizeof($cards);
                 $validDecks[$value['content_ID']] = $value;
                 $validDecks[$value['content_ID']]['cards'] = $cards;
                 $validDecks[$value['content_ID']]['options'] = $opt;
                 $finishedCards = 0;
                 foreach ($cards as $index => $item) {
                     if ($masteryArray[$item] == $opt[$questionsDiffArray[$item]]) {
                         $finishedCards++;
                     }
                 }
                 $validDecks[$value['content_ID']]['non_finished'] = $value['number_cards'] - $finishedCards;
                 $validDecks[$value['content_ID']]['mastery'] = (double) $finishedCards / sizeof($cards) * 100;
             }
         }
         //pr($masteryArray);
         //pr($validDecks);
         //pr($decksArray);
         $smarty->assign("T_FLASHCARDS_DECKS", $validDecks);
         $smarty->assign("T_FLASHCARDS_DECKSNAMES", $decksArray);
         if (isset($_GET['view_deck'])) {
             $currentDeck = $validDecks[$_GET['view_deck']];
             $resUserSuccess = eF_getTableDataFlat("module_flashcards_users_to_cards", "*", "content_ID=" . $_GET['view_deck'] . " and users_LOGIN='******'s_login'] . "'");
             $successArray = array_combine(array_values($resUserSuccess['cards_ID']), array_values($resUserSuccess['success']));
             //pr($successArray);
             foreach ($currentDeck['cards'] as $key => $value) {
                 $questionTemp = new EmptySpacesQuestion($value);
                 $limit = $currentDeck['options'][$questionTemp->question['difficulty']];
                 if ($successArray[$value] == $limit && $value != $_GET['view_card']) {
                     unset($currentDeck['cards'][$key]);
                 }
             }
             $currentDeck['cards'] = array_values($currentDeck['cards']);
             if ($currentDeck['options']['shuffle'] == 1) {
                 shuffle($currentDeck['cards']);
             }
             if (!empty($currentDeck['cards'])) {
                 if (isset($_GET['view_card'])) {
                     while (current($currentDeck['cards']) != $_GET['view_card'] & next($currentDeck['cards']) !== false) {
                     }
                     if (current($currentDeck['cards']) === false) {
                         reset($currentDeck['cards']);
                     }
                     $_GET['view_card'] = current($currentDeck['cards']);
                 } else {
                     $_GET['view_card'] = $currentDeck['cards'][0];
                 }
                 //echo $_GET['view_card'];
                 $question = new EmptySpacesQuestion($_GET['view_card']);
                 $limit = $currentDeck['options'][$question->question['difficulty']];
                 if ($successArray[$_GET['view_card']] == $limit) {
                     $message = _FLASHCARDS_SUCCESSFULLYCOMPLETEDDECK;
                     $message_type = 'success';
                     eF_redirect($this->moduleBaseUrl . "&reset_popup=1&message=" . urlencode($message) . "&message_type=" . $message_type, true, 'parent');
                 } else {
                     //$form = new HTML_QuickForm("questionForm", "post", "", "", null, true);
                     $form = new HTML_QuickForm();
                     $question->toHTMLQuickForm($form);
                     foreach ($question->answer as $key => $value) {
                         $form->setDefaults(array("question[" . $question->question['id'] . "][{$key}]" => "________"));
                     }
                     $form->freeze();
                     $smarty->assign("T_FLASHCARDS_CURRENTCARD_PREVIEW", $question->toHTML($form));
                     //$smarty -> assign("T_FLASHCARDS_CURRENTCARD_PREVIEW_ANSWERED", $question -> toHTMLSolved(new HTML_QuickForm(), true, false, false));
                     $smarty->assign("T_FLASHCARDS_CURRENTCARD_PREVIEW_ANSWERED", implode("<br/>", $question->answer));
                 }
             } else {
                 $message = _FLASHCARDS_SUCCESSFULLYCOMPLETEDDECK;
                 //$message_type = 'success';
                 eF_redirect("" . $this->moduleBaseUrl . "&popup=1&finish=1&message=" . $message . "&message_type=" . $message_type);
             }
             //pr($question);
             //pr($currentDeck);
             $smarty->assign("T_FLASHCARDS_CURRENTDECK", $currentDeck);
             $smarty->assign("T_FLASHCARDS_CURRENTCARD", $question);
             //pr($currentDeck);
             $smarty->assign("T_FLASHCARDS_SUCCESSARRAY", $successArray);
             $smarty->assign("T_FLASHCARDS_LESSONNAME", $currentLesson->lesson['name']);
         }
     }
     return true;
 }
 /**
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getLessonCenterLinkInfo()
  */
 public function getLessonCenterLinkInfo()
 {
     $roles = EfrontUser::getRoles();
     if ($roles[$_SESSION['s_lesson_user_type']] == 'professor') {
         return array('title' => $this->getName(), 'image' => $this->moduleBaseLink . 'folders.png', 'link' => $this->moduleBaseUrl);
     }
 }