本文整理汇总了PHP中EfrontUser类的典型用法代码示例。如果您正苦于以下问题:PHP EfrontUser类的具体用法?PHP EfrontUser怎么用?PHP EfrontUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EfrontUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_outputfilter_eF_template_loginToMessageLink
/**
* Replaces occurences of the form #filter:user_login-xxxxx# with a personal message link
*/
function smarty_outputfilter_eF_template_loginToMessageLink($compiled, &$smarty)
{
$access = false;
if (!$GLOBALS['currentUser']->coreAccess['personal_messages'] || $GLOBALS['currentUser']->coreAccess['personal_messages'] == 'change') {
$access = true;
}
if (!EfrontUser::isOptionVisible('messages_student') && $_SESSION['s_type'] == "student") {
$access = false;
}
if (!EfrontUser::isOptionVisible('messages')) {
$access = false;
}
if ($access) {
$new = preg_replace("/#filter:user_login-(.*)#/U", "<span style = \"white-space:nowrap;font-weight:bold\"><a href = \"" . basename($_SERVER['PHP_SELF']) . "?ctg=messages&add=1&recipient=\$1&popup=1\" onclick = \"eF_js_showDivPopup(event, '" . _NEWMESSAGE . "', 2)\" title=\"\\1\" target = \"POPUP_FRAME\">#filter:login-\$1#</a></span>", $compiled);
$new = preg_replace("/#filter:user_loginNoIcon-(.*)#/U", "<a href = \"" . basename($_SERVER['PHP_SELF']) . "?ctg=messages&add=1&recipient=\$1&popup=1\" onclick = \"eF_js_showDivPopup(event, '" . _NEWMESSAGE . "', 2)\" title=\"\\1\" target = \"POPUP_FRAME\">#filter:login-\\1#</a>", $new);
$compiled = $new;
} else {
$new = preg_replace("/#filter:user_login-(.*)#/U", "<span style = \"white-space:nowrap\"><a href = \"javascript:void(0)\" title=\"\\1\">#filter:login-\$1#</a></span>", $compiled);
$new = preg_replace("/#filter:user_loginNoIcon-(.*)#/U", "<a href = \"javascript:void(0)\" title=\"\\1\">\\1</a>", $new);
$compiled = $new;
}
// $compiled = preg_replace_callback("/#filter:user_login-(.*)#/U", 'formatLogin', $compiled);
// $compiled = preg_replace_callback("/#filter:user_loginNoIcon-(.*)#/U", 'formatLogin', $compiled);
return $compiled;
}
示例2: getFirstVisitableNode
public function getFirstVisitableNode($iterator = false)
{
if (!$iterator) {
if (EfrontUser::isOptionVisible('tests')) {
$iterator = new EfrontVisitableAndEmptyFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($this->tree), RecursiveIteratorIterator::SELF_FIRST)));
//Create a new iterator, so that the internal iterator pointer is not reset
} else {
$iterator = new EfrontVisitableAndEmptyFilterIterator(new EfrontNoTestsFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($this->tree), RecursiveIteratorIterator::SELF_FIRST))));
//Create a new iterator, so that the internal iterator pointer is not reset
}
}
$iterator->rewind();
//Initialize iterator
return $iterator->current();
}
示例3: getEvents
/**
* Get all events related with this lesson
*
* This function is used to acquire all events related for this lesson,
* according to a topical timeline
*
* <br/>Example:
* <code>
* $lesson -> getEvents(); // Get all events of this lessons from the most recent to the oldest
* </code>
*
* @param $topic_ID the id of the topic to which the return events for the timeline should belong
* @param $returnObjects whether to return event objects or not
* @param $avatarSize the normalization size for the avatar images
* @param $limit maximum number of events to return
* @return boolean true/false
* @since 3.6.0
* @access public
*/
public function getEvents($topic_ID = false, $returnObjects = false, $avatarSize = 0, $limit = false)
{
if (!EfrontUser::isOptionVisible('lessons_timeline')) {
return array();
}
if ($topic_ID) {
// only current lesson users
$users = $this->getUsers();
$users_logins = array_keys($users);
if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
//this applies to supervisors only
// don't mix with course events - with courses_ID = $this->lesson['id']
$related_events = eF_getTableData("events, module_hcd_employee_works_at_branch ewb", "events.*", "ewb.branch_ID= " . $_SESSION['s_current_branch'] . " and events.users_LOGIN=ewb.users_login and type = '" . EfrontEvent::NEW_POST_FOR_LESSON_TIMELINE_TOPIC . "' AND entity_ID = '" . $topic_ID . "' AND lessons_ID = '" . $this->lesson['id'] . "' AND events.users_LOGIN IN ('" . implode("','", $users_logins) . "') AND (type < 50 OR type >74)", "timestamp desc", "", $limit ? $limit * 5 : null);
} else {
// don't mix with course events - with courses_ID = $this->lesson['id']
$related_events = eF_getTableData("events, module_hcd_employee_works_at_branch ewb", "events.*", "ewb.branch_ID= " . $_SESSION['s_current_branch'] . " and events.users_LOGIN=ewb.users_login and type = '" . EfrontEvent::NEW_POST_FOR_LESSON_TIMELINE_TOPIC . "' AND entity_ID = '" . $topic_ID . "' AND lessons_ID = '" . $this->lesson['id'] . "' AND events.users_LOGIN IN ('" . implode("','", $users_logins) . "') AND (type < 50 OR type >74)", "timestamp desc", "", $limit ? $limit * 5 : null);
}
} else {
// only current lesson users
$users = $this->getUsers();
$users_logins = array_keys($users);
// if ($limit) {
// $related_events = eF_getTableData("events", "*", "lessons_ID = '". $this->lesson['id']."' AND users_LOGIN IN ('".implode("','", $users_logins)."')", "timestamp desc LIMIT " . $limit);
//
// } else {
if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
//this applies to supervisors only
$related_events = eF_getTableData("events, module_hcd_employee_works_at_branch ewb", "events.*", "ewb.branch_ID= " . $_SESSION['s_current_branch'] . " and events.users_LOGIN=ewb.users_login and lessons_ID = '" . $this->lesson['id'] . "' AND events.users_LOGIN IN ('" . implode("','", $users_logins) . "') AND (type < 50 OR type >74)\t", "timestamp desc", "", $limit ? $limit * 5 : null);
} else {
$related_events = eF_getTableData("events", "events.*", "lessons_ID = '" . $this->lesson['id'] . "' AND events.users_LOGIN IN ('" . implode("','", $users_logins) . "') AND (type < 50 OR type >74)\t", "timestamp desc", "", $limit ? $limit * 5 : null);
}
// }
}
if (!isset($avatarSize) || $avatarSize <= 0) {
$avatarSize = 25;
}
$prev_event = false;
$count = 0;
$filtered_related_events = array();
foreach ($related_events as $key => $event) {
$user = $users[$event['users_LOGIN']];
$filtered_related_events[$key] = $event;
try {
$file = new EfrontFile($user['avatar']);
$filtered_related_events[$key]['avatar'] = $user['avatar'];
list($filtered_related_events[$key]['avatar_width'], $filtered_related_events[$key]['avatar_height']) = eF_getNormalizedDims($file['path'], $avatarSize, $avatarSize);
} catch (EfrontfileException $e) {
$filtered_related_events[$key]['avatar'] = G_SYSTEMAVATARSPATH . "unknown_small.png";
$filtered_related_events[$key]['avatar_width'] = $avatarSize;
$filtered_related_events[$key]['avatar_height'] = $avatarSize;
}
// Logical combination of events
if ($prev_event) {
// since we have decreasing chronological order we now that $event['timestamp'] < $prev_event['timestamp']
if ($event['users_LOGIN'] == $prev_event['event']['users_LOGIN'] && $event['type'] == $prev_event['event']['type'] && $prev_event['event']['timestamp'] - $event['timestamp'] < EfrontEvent::SAME_USER_INTERVAL) {
unset($filtered_related_events[$prev_event['key']]);
$count--;
}
}
$prev_event = array("key" => $key, "event" => $event);
if ($limit && ++$count == $limit) {
break;
}
}
if ($returnObjects) {
$eventObjects = array();
foreach ($filtered_related_events as $event) {
$eventObjects[] = new EfrontEvent($event);
}
return $eventObjects;
} else {
return $filtered_related_events;
}
}
示例4: basename
<?php
//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
exit;
}
$load_editor = true;
if (!EfrontUser::isOptionVisible('news')) {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
//Create shorthands for user access rights, to avoid long variable names
!isset($currentUser->coreAccess['news']) || $currentUser->coreAccess['news'] == 'change' ? $_change_ = 1 : ($_change_ = 0);
if (isset($_GET['lessons_ID'])) {
if ($currentUser->user['user_type'] != 'administrator') {
$eligibleLessons = $currentUser->getEligibleLessons();
}
if (in_array($_GET['lessons_ID'], array_keys($eligibleLessons)) || $currentUser->user['user_type'] == 'administrator') {
$lessonId = $_GET['lessons_ID'];
} else {
$lessonId = array_keys($eligibleLessons);
}
} else {
$lessonId = $currentLesson->lesson['id'];
}
if ($_admin_) {
$news = news::getNews(0);
} else {
if ($_professor_ || $_student_) {
$news = news::getNews(0, true);
if ($_professor_) {
$lessonNews = news::getNews($lessonId, false);
示例5: urlencode
<?php
//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
exit;
}
if (!EfrontUser::isOptionVisible('backup')) {
eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
if (isset($currentUser->coreAccess['backup']) && $currentUser->coreAccess['backup'] == 'hidden') {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
$basedir = G_BACKUPPATH;
if (isset($_GET['restore'])) {
//ini_set("memory_limit", "-1");
try {
$restoreFile = new EfrontFile($_GET['restore']);
if (!EfrontSystem::restore($_GET['restore'], $_GET['force'] ? $_GET['force'] : false)) {
$message = _ERRORRESTORINGFILE;
$message_type = 'failure';
} else {
$message = _SUCCESFULLYRESTOREDSYSTEM;
$message_type = 'success';
}
} catch (Exception $e) {
handleNormalFlowExceptions($e);
if ($e->getCode() == EfrontSystemException::INCOMPATIBLE_VERSIONS) {
$message .= ' - <a href = "javascript:void(0)" onclick = "location=location+\'&force=1\'">Force restore</a>';
}
}
}
示例6: applyGlossary
/**
*
* @param $text
* @return unknown_type
*/
public static function applyGlossary($text, $lessonId)
{
if (EfrontUser::isOptionVisible('shared_glossary')) {
$glossary_words = eF_getTableData("glossary", "name,info,lessons_ID", "lessons_ID=" . $lessonId . " OR lessons_ID=0", "CHAR_LENGTH(name) desc");
//Get all the glossary words of this lesson
} else {
$glossary_words = eF_getTableData("glossary", "name,info,lessons_ID", "lessons_ID=" . $lessonId, "CHAR_LENGTH(name) desc");
//Get all the glossary words of this lesson
}
//if a term is defined both for current lesson and all lessons, current lesson definition must be displayed
$globalTerms = array();
foreach ($glossary_words as $key => $value) {
if ($value['lessons_ID'] == 0) {
$globalTerms[$key] = $value['name'];
}
}
foreach ($glossary_words as $key => $value) {
if ($value['lessons_ID'] && ($k = array_search($value['name'], $globalTerms))) {
unset($glossary_words[$k]);
}
}
$searchdata = array();
$searchdatanext = array();
$replacedata = array();
$returnValue = preg_match("/^\\p{L}.*\$/u", 'a');
foreach ($glossary_words as $key => $value) {
$first_letter = mb_substr($value['name'], 0, 1);
if ($first_letter != '<') {
$value['name'] = preg_quote($value['name'], "/");
if ($returnValue === false) {
$searchdata[] = "/(\\b)(" . $value['name'] . ")(\\b)/si";
} else {
$searchdata[] = "/(\\P{L})(" . $value['name'] . ")(\\P{L})/usi";
}
$searchdatanext[] = "/(yty656hgh" . $value['name'] . ")/usi";
//Added 'UTF-8' because of #1661 and ’
$replacedata[] = str_replace(array("\r\n", "\n"), '<br/>', rawurlencode(htmlentities(strip_tags($value['info']), ENT_QUOTES, "UTF-8")));
}
}
$text = self::highlightWords($text, $searchdata, $replacedata);
$text = preg_replace("/encode\\*\\(\\)\\!768atyj/", "", $text);
$text = preg_replace($searchdatanext, $replacedata, $text);
return $text;
}
示例7: array_unique
$branches = array_unique($branches);
$stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches) . ") AND filter_eb.assigned = 1)");
}
}
}
} else {
if ($currentEmployee->isSupervisor()) {
$isProfessor = false;
if (isset($_GET['sel_course']) && $currentUser->hasCourse($_GET['sel_course'])) {
$roles = EfrontUser::getRoles();
if ($roles[$currentUser->getUserTypeInCourse($_GET['sel_course'])] == 'professor') {
$isProfessor = true;
}
} else {
if (isset($infoLesson) && $currentUser->hasLesson($infoLesson)) {
$roles = EfrontUser::getRoles();
if ($roles[$currentUser->getUserTypeInLesson($infoLesson)] == 'professor') {
$isProfessor = true;
}
}
}
if (!$isProfessor) {
if (!$_GET['subbranches']) {
$supervisedBranches = $currentEmployee->getSupervisedBranches();
} else {
$supervisedBranches = $currentEmployee->getSupervisedBranchesRecursive();
}
$branches = array();
foreach ($supervisedBranches as $value) {
$branches[] = $value['branch_ID'];
}
示例8: array
$options['account'] = array('image' => '16x16/user.png', 'title' => _ACCOUNT, 'link' => basename($_SERVER['PHP_SELF']) . '?ctg=personal&user=' . $editedUser->user['login'] . "&op=profile", 'selected' => isset($_GET['op']) && in_array($_GET['op'], $accountOperations) ? true : false);
//administrators don't have a learning aspect
if ($editedUser->user['user_type'] != 'administrator') {
$options['learning'] = array('image' => '16x16/courses.png', 'title' => _LEARNING, 'link' => basename($_SERVER['PHP_SELF']) . '?ctg=personal&user=' . $editedUser->user['login'] . "&op=user_courses", 'selected' => isset($_GET['op']) && in_array($_GET['op'], $learningOperations) ? true : false);
}
if (G_VERSIONTYPE == 'enterprise') {
#cpp#ifdef ENTERPRISE
if ($currentUser->coreAccess['organization'] != 'hidden') {
$options['organization'] = array('image' => '16x16/enterprise.png', 'title' => _MYROLE, 'link' => basename($_SERVER['PHP_SELF']) . '?ctg=personal&user=' . $editedUser->user['login'] . "&op=placements", 'selected' => isset($_GET['op']) && in_array($_GET['op'], $enterpriseOperations) ? true : false);
}
if ($currentUser->user['login'] == $editedUser->user['login'] || $currentUser->user['user_type'] == 'administrator' || $currentEmployee->supervisesEmployee($editedUser->user['login'])) {
$options['files'] = array('image' => '16x16/folder.png', 'title' => _FILES, 'link' => basename($_SERVER['PHP_SELF']) . '?ctg=personal&user=' . $editedUser->user['login'] . "&op=files", 'selected' => isset($_GET['op']) && $_GET['op'] == 'files' ? true : false);
}
}
#cpp#endif
if (!isset($_GET['add_user']) && !$_GET['popup'] && (!isset($_SESSION['missing_fields']) || $currentUser->user['login'] != $editedUser->user['login'])) {
//When inside a popup, we don't want the menu
$smarty->assign("T_TABLE_OPTIONS", $options);
}
// Set facebook template variables
if ($GLOBALS['configuration']['social_modules_activated'] & FB_FUNC_CONNECT) {
if (isset($_SESSION['facebook_user']) && $_SESSION['facebook_user']) {
$smarty->assign("T_OPEN_FACEBOOK_SESSION", 1);
$smarty->assign("T_FACEBOOK_API_KEY", $GLOBALS['configuration']['facebook_api_key']);
$smarty->assign("T_FACEBOOK_SHOULD_UPDATE_STATUS", $_SESSION['facebook_can_update']);
}
$smarty->assign("T_FACEBOOK_ENABLED", 1);
}
if (EfrontUser::isOptionVisible('func_userstatus')) {
$smarty->assign("T_SHOW_USERSTATUS", 1);
}
示例9: EfrontFile
$avatarFile = new EfrontFile($infoUser->user['avatar']);
} catch (Exception $e) {
$avatarFile = new EfrontFile(G_SYSTEMAVATARSPATH . "unknown_small.png");
}
$info = array(array(_USERNAME, $userInfo['general']['fullname']), array(_USERTYPE, $userInfo['general']['user_types_ID'] ? $userInfo['general']['user_types_ID'] : $roles[$userInfo['general']['user_type']]), array(_ACTIVE, $userInfo['general']['active'] ? _YES : _NO), array(_JOINED, $userInfo['general']['joined_str']), array(_TOTALLOGINTIME, $userInfo['general']['total_login_time']['time_string']));
$pdf->printInformationSection(_GENERALUSERINFO, $info, $avatarFile);
$info = array(array(_FORUMPOSTS, sizeof($userInfo['communication']['forum_messages'])), array(_FORUMLASTMESSAGE, formatTimestamp($userInfo['communication']['last_message']['timestamp'])), array(_PERSONALMESSAGES, sizeof($userInfo['communication']['personal_messages'])), array(_MESSAGESFOLDERS, sizeof($userInfo['communication']['personal_folders'])), array(_FILES, sizeof($userInfo['communication']['files'])), array(_FOLDERS, sizeof($userInfo['communication']['folders'])), array(_TOTALSIZE, $userInfo['communication']['total_size'] . _KB), array(_COMMENTS, sizeof($userInfo['communication']['comments'])));
if (!EfrontUser::isOptionVisible('forum')) {
unset($info[_FORUMPOSTS]);
unset($info[_FORUMLASTMESSAGE]);
}
if (!EfrontUser::isOptionVisible('messages')) {
unset($info[_PERSONALMESSAGES]);
unset($info[_MESSAGESFOLDERS]);
}
if (!EfrontUser::isOptionVisible('comments')) {
unset($info[_COMMENTS]);
}
$pdf->printInformationSection(_USERCOMMUNICATIONINFO, $info);
$meanDuration = $timesReport->formatTimeForReporting($userInfo['usage']['mean_duration'] * 60);
$monthDuration = $timesReport->formatTimeForReporting($userInfo['usage']['month_mean_duration'] * 60);
$weekDuration = $timesReport->formatTimeForReporting($userInfo['usage']['week_mean_duration'] * 60);
$info = array(array(_LASTLOGIN, formatTimestamp($userInfo['usage']['last_login']['timestamp'])), array(_TOTALLOGINS, sizeof($userInfo['usage']['logins'])), array(_MONTHLOGINS, sizeof($userInfo['usage']['month_logins'])), array(_WEEKLOGINS, sizeof($userInfo['usage']['week_logins'])), array(_MEANDURATION, $meanDuration['time_string']), array(_MONTHMEANDURATION, $monthDuration['time_string']), array(_WEEKMEANDURATION, $weekDuration['time_string']), array(_LASTIPUSED, $userInfo['usage']['last_ip']));
$pdf->printInformationSection(_USERUSAGEINFO, $info);
$coursesAvgScore = $lessonsAvgScore = $projectsAvgScore = $testsAvgScore = 0;
$data = array();
$constraints = array('archive' => false);
if (!$show_inactive) {
$constraints['active'] = true;
}
$constraints['required_fields'] = array('has_instances', 'location', 'user_type', 'completed', 'score', 'has_course', 'num_lessons', 'to_timestamp');
示例10: printLessonLink
private function printLessonLink($treeLesson, $options, $roleBasicType)
{
$treeString = '';
if (!$roleBasicType || $treeLesson->lesson['active_in_lesson']) {
//active_in_lesson (equals from_timestamp in users_to_lessons) in user status means that the user's status in the lesson is not 'pending'
$classNames = array();
$lessonLink = $options['lessons_link'];
if ($roleBasicType == 'student' && ($treeLesson->lesson['from_timestamp'] && $treeLesson->lesson['from_timestamp'] > time() || $treeLesson->lesson['to_timestamp'] && $treeLesson->lesson['to_timestamp'] < time())) {
//here, from_timestamp and to_timestamp refer to the lesson periods
$lessonLink = false;
$classNames[] = 'inactiveLink';
}
if ($options['tooltip'] && (!isset($_SESSION['s_login']) || EfrontUser::isOptionVisible('tooltip'))) {
$treeString .= '<a href = "' . ($lessonLink ? str_replace("#user_type#", $roleBasicType, $lessonLink) . $treeLesson->lesson['id'] : 'javascript:void(0)') . '" class = "info ' . implode(" ", $classNames) . '" url = "ask_information.php?lessons_ID=' . $treeLesson->lesson['id'] . '">' . $treeLesson->lesson['name'] . '</a>';
} else {
$lessonLink ? $treeString .= '<a href = "' . str_replace("#user_type#", $roleBasicType, $lessonLink) . $treeLesson->lesson['id'] . '">' . $treeLesson->lesson['name'] . '</a>' : ($treeString .= '<a href = "javascript:void(0)' . '" class = "info ' . implode(" ", $classNames) . '">' . $treeLesson->lesson['name'] . '</a>');
}
} else {
$treeString .= '<a href = "javascript:void(0)" class = "inactiveLink" title = "' . _CONFIRMATIONPEDINGFROMADMIN . '">' . $treeLesson->lesson['name'] . '</a>';
}
return $treeString;
}
示例11: isset
//array_unique, so it doesn't send duplicate entries
if (preg_match("/compatible; MSIE 6/", $_SERVER['HTTP_USER_AGENT']) && !preg_match("/compatible; MSIE 7/", $_SERVER['HTTP_USER_AGENT'])) {
$smarty->assign("globalImageExtension", "gif");
} else {
$smarty->assign("globalImageExtension", "png");
}
if (!(isset($GLOBALS['currentTheme']->options['images_displaying']) && $GLOBALS['currentTheme']->options['images_displaying'] != 0)) {
$smarty->assign("T_SHOW_SIDEBAR_IMAGES", 1);
}
/**** FOR USER STATUS ****/
if (EfrontUser::isOptionVisible('func_userstatus')) {
if ($currentUser->coreAccess['dashboard'] != 'hidden') {
$smarty->assign("T_SHOW_USER_STATUS", 1);
}
}
$smarty->assign("T_SIDEBARWIDTH", $sideframe_width);
//$smarty -> assign("T_REALNAME", $realname);
$smarty->assign("T_SB_CTG", isset($_GET['sbctg']) ? $_GET['sbctg'] : false);
$smarty->assign("T_TYPE", $efront_type);
$smarty->assign("T_SIMPLE_COMPLETE_MODE", EfrontUser::isOptionVisible('simple_complete'));
$benchmark->set('script');
if (!isset($horizontal_inframe_version) || !$horizontal_inframe_version) {
$smarty->assign("T_NO_HORIZONTAL_MENU", 1);
$smarty->display('new_sidebar.tpl');
}
$benchmark->set('smarty');
$benchmark->stop();
$output = $benchmark->display();
if (G_DEBUG) {
//echo $output; //Don't display, it's annoying
}
示例12: addToDefaultGroup
public static function addToDefaultGroup($user, $userType)
{
// Get the default eFront group
if (!$default_group) {
$default_group = eF_getTableData("groups", "*", "is_default = 1 AND active = 1");
if (sizeof($default_group)) {
$default_group = $default_group[0];
} else {
$default_group = true;
return;
}
}
try {
$roles = EfrontUser::getRoles();
$group = new EfrontGroup($default_group);
//Add user to group with group's default type or, if one is not set, the user's type
$group->addUsers($user, $group->group['user_types_ID'] ? $group->group['user_types_ID'] : $userType);
} catch (Exception $e) {
/*otherwise no default group has been defined*/
}
return true;
}
示例13: getModule
/**
* The main functionality
*
* (non-PHPdoc)
* @see libraries/EfrontModule#getModule()
*/
public function getModule()
{
$currentUser = $this->getCurrentUser();
$currentCourse = $this->getCurrentCourse();
$currentLesson = $this->getCurrentLesson();
$currentUnit = $this->getCurrentUnit();
/*
$str = "Current User: <br />";
$str .= "id: " . $currentUser->user['id'] . "<br />";
$str .= "login: " . $currentUser->user['login'] . "<br />";
$str .= "password: " . $currentUser->user['password'] . "<br />";
$str .= "email: " . $currentUser->user['email'] . "<br />";
$str .= "languages_NAME: " . $currentUser->user['languages_NAME'] . "<br />";
$str .= "timezone: " . $currentUser->user['timezone'] . "<br />";
$str .= "name: " . $currentUser->user['name'] . "<br />";
$str .= "surname: " . $currentUser->user['surname'] . "<br />";
$str .= "active: " . $currentUser->user['active'] . "<br />";
$str .= "comments: " . $currentUser->user['comments'] . "<br />";
$str .= "user_type: " . $currentUser->user['user_type'] . "<br />";
$str .= "timestamp: " . $currentUser->user['timestamp'] . "<br />";
$str .= "active: " . $currentUser->user['active'] . "<br />";
$str .= "user_types_ID: " . $currentUser->user['user_types_ID'] . "<br />";
$str .= "type: " . $currentUser->user['user_type'] . "<br />";
$str .= "<br />";
*/
$username = $currentUser->user['login'];
$userTypesID = $currentUser->user['user_types_ID'];
// echo "<br> \$userTypesID is $userTypesID";
$rolesPlain = EfrontUser::getRoles(true);
$roleTypeName = $rolesPlain[$userTypesID];
$vLabGranted = array('FIU' => true, 'Employee' => true, 'KaseyaScholar' => true, 'KCA' => true, 'KCT' => true, 'Professor' => true, 'KaseyaTester' => true, 'LabSuspend' => false, 'KaseyaPublic' => false, 'Instructors' => false, 'DemoFree' => false, 'KaseyaQuickStart' => false, 'Sales' => false, 'Trial' => false, 'Administrator' => false, 'Student' => false);
$baseURL = $this->moduleBaseLink;
// $baseURL = "http://localhost/moodle19/";
// $baseURL = "http://ita-portal.cis.fiu.edu/";
// $moodleURL = "http://localhost/moodle19/";
$moodleURL = "http://ita-portal.cis.fiu.edu/";
$hours = 3;
$minutes = 0;
// echo "\$vLabGranted[$roleTypeName] is $vLabGranted[$roleTypeName]";
if ($vLabGranted[$roleTypeName]) {
$vLabURL = $moodleURL . "mod/deva/view-embedded.php?id=10582&username={$username}&hours={$hours}&minutes={$minutes}";
} else {
$vLabURL = $baseURL . "KU-poweredby-ITS-NotAvailable.html";
}
/*
$password = "test1234";
$hashed_password = $currentUser->user['password'];
$email = $currentUser->user['email'];
$firstname = $currentUser->user['name'];
$lastname = $currentUser->user['surname'];
$timezone = $currentUser->user['timezone'];
*/
/*
$str .= "http://localhost/moodle19/mod/deva/embedded/auto-login.php?embedded=1&efront=1&username=$username";
$str1 = "http://localhost/moodle19/mod/deva/embedded/auto-login.php?embedded=1&efront=1&username=$username";
$payload = file_get_contents($str1);
$str .= $payload;
// src=\"http://localhost/moodle19/mod/deva/embedded/autologin.php?embedded=1&efront=1&username=$username&password=$password&hashed_password=$hashed_password&email=$email&firstname=$firstname&lastname=$lastname&timezone=$timezone\"
*/
$str = "\n\t\t\t<div align=\"center\">\n\t\t\t\t<iframe \n\t\t\t\t\tsrc=\"{$vLabURL}\"\n\t\t\t\t\talign=\"middle\" \n \t\t\t\theight=1000\n \t\t\t\twidth=100%\n \t\t\t\tmarginwidth=0\n \t\t\t\tmarginheight=0 >\n\t\t\t\t</iframe>\n\t\t\t</div>";
return $str;
/*
$username = "johndoc-f65";
$password = "k4se-prt4l";
$domain = "fiu";
$hostName = "vc7.cis.fiu.edu";
$hostPort = array(
"dc" => 36646,
"ws1" => 36647,
"ws2" => 36648,
"reception" => 36649,
"laptop_ceo" => 36650);
$frame = array(
"width" => 1200,
"height" => 480,
"align" => "middle",
"marginwidth" => 0,
"marginheight" => 0,
"bpp" => 16);
$smarty = $this -> getSmartyVar();
$smarty -> assign("T_MODULE_BASEDIR" , $this -> moduleBaseDir);
$smarty -> assign("T_MODULE_BASELINK" , $this -> moduleBaseLink);
$smarty -> assign("T_MODULE_BASEURL" , $this -> moduleBaseUrl);
$smarty -> assign("NetworkDiagramImage", "fiu-network-diagram.png");
$smarty -> assign("frame", $frame);
$smarty -> assign("T_DATA_SHEET",
$this -> moduleBaseLink .
"DataSheet.php");
//.........这里部分代码省略.........
示例14: key
}
if (isset($selectedAvatar)) {
$selectedAvatar = $avatarsFileSystemTree->seekNode(G_SYSTEMAVATARSPATH . $selectedAvatar);
$newList = FileSystemTree::importFiles($selectedAvatar['path']);
//Import the file to the database, so we can access it with view_file
$editedUser->user['avatar'] = key($newList);
}
}
EfrontEvent::triggerEvent(array("type" => EfrontEvent::AVATAR_CHANGE, "users_LOGIN" => $editedUser->user['login'], "users_name" => $editedUser->user['name'], "users_surname" => $editedUser->user['surname'], "lessons_ID" => 0, "lessons_name" => "", "entity_ID" => $editedUser->user['avatar']));
}
$editedUser->persist();
if (G_VERSIONTYPE == 'enterprise') {
#cpp#ifdef ENTERPRISE
if (isset($_GET['add_user'])) {
$editedEmployee = EfrontHcdUser::createUser(array('users_login' => $editedUser->user['login']));
if ($currentEmployee->isSupervisor() && !EfrontUser::isOptionVisible('show_unassigned_users_to_supervisors')) {
//if supervisors can't see unassigned users, then attach this new user to the supervisor's firts branch and job
$branch = new EfrontBranch(current($currentEmployee->getSupervisedBranchesRecursive()));
$nospecific = false;
foreach ($branch->getJobDescriptions() as $value) {
if ($value['description'] == _NOSPECIFICJOB) {
$nospecific = $value['job_description_ID'];
}
}
if (!$nospecific) {
$nospecific = EfrontJob::createJob(array('description' => _NOSPECIFICJOB, 'branch_ID' => $branch->branch['branch_ID']));
}
$editedEmployee->addJob($editedUser, $nospecific, $branch->branch['branch_ID'], 0);
}
}
}
示例15: current
$jsonValues['entity_id'] = current($entity);
if ($newTime && is_numeric($newTime)) {
$result = eF_executeNew("insert into users_to_content (users_LOGIN, content_ID, lessons_ID) values('" . $_SESSION['s_login'] . "', " . key($entity) . ", " . $_SESSION['s_lessons_ID'] . ") on duplicate key update total_time={$newTime}");
$jsonValues['time_in_unit'] = EfrontTimes::formatTimeForReporting($newTime);
} else {
$jsonValues['old_time_in_unit'] = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInUnit($_SESSION['s_login'], key($entity)));
$jsonValues['old_time_in_lesson'] = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInLesson($_SESSION['s_login'], $_SESSION['s_lessons_ID']));
}
}
if (empty($_SESSION['last_periodic_check']) || time() - $_SESSION['last_periodic_check'] >= ceil($GLOBALS['configuration']['updater_period'] / 1000)) {
$result = eF_executeNew("update user_times set time=time+(" . time() . "-timestamp_now),timestamp_now=" . time() . "\r\n\t\t\t\t\t\twhere session_expired = 0 and session_custom_identifier = '" . $_SESSION['s_custom_identifier'] . "' and users_LOGIN = '" . $_SESSION['s_login'] . "'\r\n\t\t\t\t\t\tand entity = '" . current($entity) . "' and entity_id = '" . key($entity) . "'");
$_SESSION['last_periodic_check'] = time();
if ($currentTheme->options['sidebar_interface'] == 0) {
if (empty($_SESSION['last_periodic_check_users']) || time() - $_SESSION['last_periodic_check_users'] >= 300) {
$_SESSION['last_periodic_check_users'] = $_SESSION['last_periodic_check'];
$online = EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60);
$_SESSION['online_users'] = $online;
if ($currentTheme->options['sidebar_interface'] == 0) {
$jsonValues['online'] = $online;
}
} else {
if ($currentTheme->options['sidebar_interface'] == 0) {
$jsonValues['online'] = $_SESSION['online_users'];
}
}
}
//$messages = eF_getTableData("f_personal_messages pm, f_folders ff", "count(*)", "pm.users_LOGIN='".$_SESSION['s_login']."' and viewed='no' and f_folders_ID=ff.id and ff.name='Incoming'");
//$jsonValues['messages'] = $messages[0]['count(*)'];
$jsonValues['status'] = 1;
echo json_encode($jsonValues);
} else {