/**
* 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
0
 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
0
파일: social.php 프로젝트: bqq1986/efront
             }
         }
         $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
         $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
         $form->setRequiredNote(_REQUIREDNOTE);
         $form->accept($renderer);
         $smarty->assign('T_COMMENTS_FORM', $renderer->toArray());
         $smarty->assign("T_HEADER_LOAD_SCRIPTS", array());
         $smarty->assign("T_HEADER_EDITOR", $load_editor);
         $smarty->assign("T_MESSAGE", $message);
         $smarty->assign("T_MESSAGE_TYPE", $message_type);
     }
     /********************* PEOPLE PAGE ******************/
 } else {
     if ($_GET['op'] == "people") {
         if (EfrontUser::isOptionVisible('func_people') === false) {
             eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=personal&user="******"&op=dashboard&message=" . urlencode(_UNPRIVILEGEDATTEMPT) . "&message_type=failure");
         }
         if (isset($_GET['ajax'])) {
             isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = 10);
             if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) {
                 $sort = $_GET['sort'];
                 isset($_GET['order']) && $_GET['order'] == 'desc' ? $order = 'desc' : ($order = 'asc');
             } else {
                 $sort = 'timestamp';
                 $order = 'asc';
             }
             if ($_GET['display'] == 2) {
                 $all_related_users = $currentLesson->getUsers();
                 $all_related_users = array_keys($all_related_users);
                 foreach ($all_related_users as $key => $user) {
 /**
  * Get the user profile's comments list
  *
  * <br/>Example:
  * <code>
  * $commentsList	= $user -> getProfileComments();						 //Returns an array with pairs [groups id] => [employee specification for this group]
  * </code>
  *
  * @return array A sorted according to timestamp array of [comment id] => [timestamp, authors_LOGIN, authors_name, authors_surname, data] pairs, or an array of comments
  * @since 3.6.0
  * @access public
  */
 public function getProfileComments()
 {
     if (EfrontUser::isOptionVisible('func_comments')) {
         $result = eF_getTableData("profile_comments JOIN users ON authors_LOGIN = users.login", "profile_comments.id, profile_comments.timestamp, authors_LOGIN, users.name, users.surname, users.avatar, data", "users_LOGIN = '******'login'] . "'", "timestamp DESC");
         $comments = array();
         foreach ($result as $comment) {
             $comments[$comment['id']] = $comment;
         }
         return $comments;
     } else {
         return array();
     }
 }
예제 #5
0
파일: index.php 프로젝트: bqq1986/efront
    $mainScripts = getMainScripts();
    $smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts));
    //Operation/file specific scripts
    $loadScripts = array_diff($loadScripts, $mainScripts);
    //Clear out duplicates
    $smarty->assign("T_HEADER_LOAD_SCRIPTS", implode(",", array_unique($loadScripts)));
    //array_unique, so it doesn't send duplicate entries
    if (in_array('news', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
        $smarty->assign("T_NEWS", news::getNews(0, true));
    }
    if (G_VERSIONTYPE == 'enterprise') {
        #cpp#ifdef ENTERPRISE
        require_once "../libraries/module_hcd_tools.php";
    }
    #cpp#endif
    if (EfrontUser::isOptionVisible('online_users') && in_array('online', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
        $smarty->assign("T_ONLINE_USERS_LIST", EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60));
    }
    $smarty->assign("T_CURRENT_USER", $currentUser);
    $smarty->load_filter('output', 'eF_template_setEditorOffset');
    $smarty->display('index.tpl');
} else {
    $smarty->load_filter('output', 'eF_template_setEditorOffset');
    $smarty->display('index.tpl');
}
$benchmark->set('smarty');
$benchmark->stop();
$output = $benchmark->display();
if (G_DEBUG) {
    echo $output;
}
예제 #6
0
파일: personal.php 프로젝트: bqq1986/efront
$options['account'] = array('image' => '16x16/user.png', 'title' => _ACCOUNT, 'link' => basename($_SERVER['PHP_SELF']) . '?ctg=personal&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='******'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='******'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='******'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);
}
예제 #7
0
 /**
  * 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;
     }
 }
     $pdfId = explode("=", $matches[0]);
     if (isset($pdfId[1])) {
         $options[] = array('text' => _VIEWPDFINIOS, 'image' => "others/ios.png", 'href' => "javascript:void(0)", 'onclick' => "window.open('view_file.php?file=" . $pdfId[1] . "')");
     } else {
         preg_match("#content/lessons/.*\\.pdf#", $currentUnit['data'], $matches);
         $options[] = array('text' => _VIEWPDFINIOS, 'image' => "others/ios.png", 'href' => "javascript:void(0)", 'onclick' => "window.open('view_file.php?file=" . $matches[0] . "')");
         //pr($matches);
     }
 }
 if ($_student_ && $currentLesson->options['content_report'] && $ruleCheck) {
     $options[] = array('text' => _CONTENTREPORT, 'image' => "16x16/warning.png", 'href' => "content_report.php?" . http_build_query($_GET), 'onclick' => "eF_js_showDivPopup(event, '" . _CONTENTREPORT . "', 1)", "target" => "POPUP_FRAME");
 }
 if ($currentLesson->options['bookmarking'] && EfrontUser::isOptionVisible('bookmarks') && $ruleCheck) {
     $options[] = array('text' => _ADDTHISPAGETOYOURBOOKMARKS, 'image' => "16x16/bookmark_add.png", 'onclick' => "addBookmark(this)");
 }
 if (EfrontUser::isOptionVisible('comments') && $ruleCheck) {
     $options[] = array('text' => _ADDCOMMENT, 'image' => "16x16/comment_add.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=comments&view_unit=" . $_GET['view_unit'] . "&add=1&popup=1", 'onclick' => "eF_js_showDivPopup(event, '" . _ADDCOMMENT . "', 1)", "target" => "POPUP_FRAME");
 }
 //$options[] = array('text' => "open window", 'image' => "16x16/add.png", 'href' => basename($_SERVER['PHP_SELF'])."?ctg=content&view_unit=".$_GET['view_unit']."&bare=1&popup=1", 'onclick' => "window.open('about:blank', 'testme', 'width=800, height=600')", "target" => "testme");
 if (G_VERSIONTYPE != 'community') {
     #cpp#ifndef COMMUNITY
     if (G_VERSIONTYPE != 'standard') {
         #cpp#ifndef STANDARD
         $scorm2004 = in_array($currentUnit['scorm_version'], EfrontContentTreeSCORM::$scorm2004Versions);
         if ($scorm2004) {
             //This means that the content will not start automatically, so a handle must appear to prompt for user selection
             if ($scormState['start'] == 'disabled') {
                 $smarty->assign("T_NO_START", true);
                 unset($treeOptions['selectedNode']);
                 //$treeOptions['expand'] = true;
                 $treeOptions['show_hide'] = false;
예제 #9
0
<?php

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']]]);
        }
    }
예제 #10
0
파일: news.php 프로젝트: bqq1986/efront
<?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);
예제 #11
0
파일: projects.php 프로젝트: bqq1986/efront
$_student_ = $_professor_ = $_admin_ = 0;
if ($_SESSION['s_lesson_user_type'] == 'student') {
    $_student_ = 1;
} else {
    if ($_SESSION['s_lesson_user_type'] == 'professor') {
        $_professor_ = 1;
    }
}
//Create shorthands for user access rights, to avoid long variable names
$_change_ = $_hidden_ = 0;
if (!isset($currentUser->coreAccess['content']) || $currentUser->coreAccess['content'] == 'change') {
    $_change_ = 1;
} elseif (isset($currentUser->coreAccess['content']) && $currentUser->coreAccess['content'] == 'hidden') {
    $_hidden_ = 1;
}
if (!EfrontUser::isOptionVisible('projects')) {
    eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
if (!$currentLesson) {
    eF_redirect("" . basename($_SERVER['PHP_SELF']));
}
if ($_hidden_) {
    eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
try {
    $_professor_ ? $projects = $currentLesson->getProjects(true) : ($projects = $currentLesson->getProjects(true, $currentUser->user['login']));
} catch (Exception $e) {
    $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
    $message = _SOMEPROBLEMOCCURED . ': ' . $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
    $message_type = 'failure';
}
예제 #12
0
     if ($GLOBALS['configuration']['time_reports']) {
         $tag = _ACTIVETIMEINLESSON;
         $val = $user['active_time_in_lesson']['time_string'];
     } else {
         $tag = _TIMEINLESSON;
         $val = $user['time_in_lesson']['time_string'];
     }
     $data[] = array(_USER => formatLogin($user['login']), $tag => $val, _REGISTRATIONDATE => formatTimestamp($user['timestamp']), _CONTENT => formatScore($user['overall_progress']['percentage']) . "%", _TESTS => formatScore($user['test_status']['mean_score']) . "%", _PROJECTS => formatScore($user['project_status']['mean_score']) . "%", _COMPLETED => $user['completed'] ? _YES . ', ' . _ON . ' ' . formatTimestamp($user['timestamp_completed']) : _NO, _SCORE => formatScore($user['score']) . "%", _LASTLOGIN => formatTimestamp($user['last_login'], true));
 }
 $pdf->printDataSection(_USERSINFO, $data, $formatting);
 $data = array();
 foreach ($professors as $user) {
     $data[] = array(_USER => formatLogin($user['login']), _REGISTRATIONDATE => formatTimestamp($user['timestamp']));
 }
 $pdf->printDataSection(_PROFESSORSINFO, $data, $formatting);
 if (EfrontUser::isOptionVisible('tests')) {
     $formatting = array(_USER => array('width' => '25%', 'fill' => false), _SCORE => array('width' => '15%', 'fill' => false));
     foreach ($testsInfo as $id => $info) {
         $data = array();
         foreach ($info['done'] as $results) {
             $avgScore[] = $results['active_score'] ? $results['active_score'] : $results['score'];
             $data[] = array(_USER => formatLogin($results['users_LOGIN']), _SCORE => formatScore(round($results['active_score'] ? $results['active_score'] : $results['score'], 2)) . "%");
         }
         if (!empty($data)) {
             $data[] = array(_USER => _AVERAGESCORE, _SCORE => formatScore(round(array_sum($avgScore) / sizeof($avgScore), 2)) . "%");
         }
         $pdf->printDataSection(_TESTSINFORMATION . ': ' . $info['general']['name'], $data, $formatting);
     }
     if (sizeof($lessonQuestions) > 0) {
         $formatting = array(_QUESTION => array('width' => '50%', 'fill' => false), _QUESTIONTYPE => array('width' => '20%', 'fill' => false), _DIFFICULTY => array('width' => '10%', 'fill' => false, 'align' => 'C'), _TIMESDONE => array('width' => '10%', 'fill' => false, 'align' => 'C'), _AVERAGESCORE => array('width' => '10%', 'fill' => false, 'align' => 'C'));
         $data = array();
 $value = str_replace("\n", "<br />", $value);
 switch ($key) {
     case 'language':
         $GLOBALS['configuration']['onelanguage'] or $tooltipInfo[] = '<div class = "infoEntry"><span>' . _LANGUAGE . "</span><span>: {$languages[$value]}</span></div>";
         break;
     case 'professors':
         $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PROFESSORS . "</span><span>: {$value}</span></div>";
         break;
     case 'content':
         $tooltipInfo[] = '<div class = "infoEntry"><span>' . _CONTENTUNITS . "</span><span>: {$value}</span></div>";
         break;
     case 'tests':
         EfrontUser::isOptionVisible('tests') ? $tooltipInfo[] = '<div class = "infoEntry"><span>' . _TESTS . "</span><span>: {$value}</span></div>" : null;
         break;
     case 'projects':
         EfrontUser::isOptionVisible('projects') ? $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PROJECTS . "</span><span>: {$value}</span></div>" : null;
         break;
     case 'course_dependency':
         $tooltipInfo[] = '<div class = "infoEntry"><span>' . _DEPENDSON . "</span><span>: {$value}</span></div>";
         break;
     case 'from_timestamp':
         $tooltipInfo[] = '<div class = "infoEntry"><span>' . _AVAILABLEFROM . "</span><span>: " . formatTimestamp($value, 'time_nosec') . "</span></div>";
         break;
     case 'to_timestamp':
         $tooltipInfo[] = '<div class = "infoEntry"><span>' . _AVAILABLEUNTIL . "</span><span>: " . formatTimestamp($value, 'time_nosec') . "</span></div>";
         break;
     case 'general_description':
         $tooltipInfo[] = '<div class = "infoEntry"><span>' . _DESCRIPTION . "</span><span>: {$value}</span></div>";
         break;
     case 'assessment':
         $tooltipInfo[] = '<div class = "infoEntry"><span>' . _ASSESSMENT . "</span><span>: {$value}</span></div>";
예제 #14
0
파일: rules.php 프로젝트: bqq1986/efront
 $form = new HTML_QuickForm("complete_lesson_form", "post", basename($_SERVER['PHP_SELF']) . '?ctg=rules&tab=conditions&' . $post_target, "", null, true);
 $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
 //Register this rule for checking user input with our function, eF_checkParameter
 $form->registerRule('in_array', 'callback', 'in_array');
 $testsIterator = new EfrontTestsFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->tree), RecursiveIteratorIterator::SELF_FIRST), array('active' => 1)));
 $testUnits = $currentContent->toHTMLSelectOptions($testsIterator);
 $contentIterator = new EfrontContentFeedbackFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->tree), RecursiveIteratorIterator::SELF_FIRST), array('active' => 1)));
 //Get active units that are anything but tests (false negates both rules)
 $noTestUnits = $currentContent->toHTMLSelectOptions($contentIterator);
 if (!empty($noTestUnits)) {
     $form->addElement('select', 'specific_unit', null, $noTestUnits, 'class = "inputSelect"');
     $form->addRule('specific_unit', _INVALIDID, 'numeric', null, 'client');
 } else {
     unset($condition_types['specific_unit']);
 }
 if (!empty($testUnits) && EfrontUser::isOptionVisible('tests')) {
     $form->addElement('select', 'specific_test', null, $testUnits, 'class = "inputSelect"');
     $form->addRule('specific_test', _INVALIDID, 'numeric', null, 'client');
 } else {
     unset($condition_types['specific_test']);
 }
 $form->addElement('select', 'condition_types', null, $condition_types, 'class = "inputSelect" onchange = "selectCondition(this)"');
 $form->addRule('condition_types', _INVALIDCONDITION, 'in_array', array_keys($condition_types));
 $form->addElement('text', 'percentage_units', null, 'style = "width:2.5em"');
 $form->setDefaults(array('percentage_units' => 50));
 $form->addRule('percentage_units', _THEFIELD . ' ' . _ISMANDATORY, 'required', null, 'client');
 $form->addRule('percentage_units', _INVALIDPERCENTAGE, 'numeric');
 $form->addElement('text', 'time_in_lesson', _MINUTES, 'style = "width:5em"');
 $form->addRule('time_in_lesson', _INVALIDDATA, 'numeric', null, 'client');
 $form->addElement('select', 'relation', null, array('and' => _AND, 'or' => _OR));
 $form->addElement('submit', 'submit_complete_lesson_condition', _SUBMIT, 'class = "flatButton"');
예제 #15
0
파일: progress.php 프로젝트: bqq1986/efront
<?php

if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (!EfrontUser::isOptionVisible('progress')) {
    eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
    exit;
}
$loadScripts[] = 'includes/progress';
$loadScripts[] = 'includes/datepicker/datepicker';
if ($_student_) {
    $currentUser->coreAccess['progress'] = 'view';
    $_GET['edit_user'] = $currentUser->user['login'];
    $smarty->assign("T_STUDENT_ROLE", true);
}
if (isset($_GET['edit_user']) && eF_checkParameter($_GET['edit_user'], 'login')) {
    $editedUser = EfrontUserFactory::factory($_GET['edit_user']);
    $load_editor = true;
    //$lessonUser  = EfrontUserFactory :: factory($_GET['edit_user']);
    //Check conditions
    $currentContent = new EfrontContentTree($currentLesson);
    $seenContent = EfrontStats::getStudentsSeenContent($currentLesson->lesson['id'], $editedUser->user['login']);
    $conditions = $currentLesson->getConditions();
    foreach ($iterator = new EfrontVisitableFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->tree), RecursiveIteratorIterator::SELF_FIRST))) as $key => $value) {
        $visitableContentIds[$key] = $key;
        //Get the not-test unit ids for this content
    }
    foreach ($iterator = new EfrontTestsFilterIterator(new EfrontVisitableFilterIterator(new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->tree), RecursiveIteratorIterator::SELF_FIRST)))) as $key => $value) {
        $testsIds[$key] = $key;
        //Get the not-test unit ids for this content
예제 #16
0
<?php

/**
 * eFront email digests
 *
 * This page is used for the functionalities eFront email digests functionalities
 * @package eFront
 * @version 3.6.0
 */
//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (!EfrontUser::isOptionVisible('notifications')) {
    eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
!isset($currentUser->coreAccess['notifications']) || $currentUser->coreAccess['notifications'] == 'change' ? $_change_ = 1 : ($_change_ = 0);
$smarty->assign("_change_", $_change_);
$loadScripts[] = "includes/digests";
if (isset($_GET['add_default']) && $_GET['add_default'] == 1) {
    EfrontNotification::addDefaultNotifications();
}
if (isset($_GET['activate_notification'])) {
    if (isset($_GET['event']) && $_GET['event']) {
        EfrontNotification::activateEventNotification($_GET['activate_notification']);
    } else {
        $notification = new EfrontNotification($_GET['activate_notification']);
        $notification->activate();
    }
    exit;
} else {
예제 #17
0
<?php

//pr($currentUser -> coreAccess);
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
if (!EfrontUser::isOptionVisible('themes')) {
    eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
!isset($currentUser->coreAccess['themes']) || $currentUser->coreAccess['themes'] == 'change' ? $_change_ = 1 : ($_change_ = 0);
$smarty->assign("_change_", $_change_);
$loadScripts[] = 'scriptaculous/dragdrop';
$loadScripts[] = 'includes/themes';
$loadScripts[] = 'includes/entity';
$themeSettingsTools = array(array('text' => _APPEARANCE, 'image' => "16x16/layout.png", 'href' => basename($_SERVER['PHP_SELF']) . '?ctg=system_config&op=appearance'));
$smarty->assign("T_APPEARANCE_LINK", $themeSettingsTools);
try {
    try {
        $currentSetTheme = new themes($GLOBALS['configuration']['theme']);
    } catch (Exception $e) {
        //EfrontConfiguration :: setValue('theme', 1);
        $currentSetTheme = new themes('default');
    }
    !isset($currentUser->coreAccess['themes']) || $currentUser->coreAccess['themes'] == 'change' ? $_change_ = 1 : ($_change_ = 0);
    $smarty->assign("_change_", $_change_);
    $themes = themes::getAll("themes");
    $allBrowsers = themes::$browsers;
    $usedBrowsers = array();
    foreach ($themes as $value) {
        $themeNames[] = $value->themes['name'];
    }
예제 #18
0
         echo rawurlencode($e->getMessage()) . ' (' . $e->getCode() . ')';
     }
     exit;
 } elseif (isset($_GET['flag']) && in_array($_GET['flag'], $legalValues) && eF_checkParameter($_GET['flag'], 'id')) {
     try {
         $message = $messages[$_GET['flag']];
         $message['priority'] ? $priority = 0 : ($priority = 1);
         eF_updateTableData("f_personal_messages", array("priority" => $priority), "id=" . $_GET['flag']);
         echo $priority;
     } catch (Exception $e) {
         header("HTTP/1.0 500 ");
         echo rawurlencode($e->getMessage()) . ' (' . $e->getCode() . ')';
     }
     exit;
 } elseif (isset($_GET['add'])) {
     if (!$_change_ || !EfrontUser::isOptionVisible('messages_student') && $_SESSION['s_type'] == "student") {
         $message = _UNAUTHORIZEDACCESS;
         eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=messages&message=" . urlencode($message) . "&message_type=failure");
         exit;
     }
     $load_editor = true;
     $grant_full_access = false;
     if (G_VERSIONTYPE == 'enterprise') {
         #cpp#ifdef ENTERPRISE
         $currentEmployee = $currentUser->aspects['hcd'];
         if ($currentEmployee->isSupervisor()) {
             $grant_full_access = true;
         }
     }
     #cpp#endif
     if ($currentUser->getType() == "administrator") {
 private function getLessonSettings()
 {
     $currentUser = $this->getCurrentUser();
     $lessonSettings['theory'] = array('text' => _THEORY, 'image' => "32x32/theory.png", 'onClick' => 'activate(this, \'theory\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     $lessonSettings['examples'] = array('text' => _EXAMPLES, 'image' => "32x32/examples.png", 'onClick' => 'activate(this, \'examples\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     if (EfrontUser::isOptionVisible('projects')) {
         $lessonSettings['projects'] = array('text' => _PROJECTS, 'image' => "32x32/projects.png", 'onClick' => 'activate(this, \'projects\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     if (EfrontUser::isOptionVisible('tests')) {
         $lessonSettings['tests'] = array('text' => _TESTS, 'image' => "32x32/tests.png", 'onClick' => 'activate(this, \'tests\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (EfrontUser::isOptionVisible('surveys')) {
             $lessonSettings['survey'] = array('text' => _SURVEY, 'image' => "32x32/surveys.png", 'onClick' => 'activate(this, \'survey\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
         }
     }
     #cpp#endif
     if (EfrontUser::isOptionVisible('feedback')) {
         $lessonSettings['feedback'] = array('text' => _FEEDBACK, 'image' => "32x32/feedback.png", 'onClick' => 'activate(this, \'feedback\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     $lessonSettings['rules'] = array('text' => _ACCESSRULES, 'image' => "32x32/rules.png", 'onClick' => 'activate(this, \'rules\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     if (EfrontUser::isOptionVisible('forum')) {
         $lessonSettings['forum'] = array('text' => _FORUM, 'image' => "32x32/forum.png", 'onClick' => 'activate(this, \'forum\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     if (EfrontUser::isOptionVisible('comments')) {
         $lessonSettings['comments'] = array('text' => _COMMENTS, 'image' => "32x32/note.png", 'onClick' => 'activate(this, \'comments\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     if (EfrontUser::isOptionVisible('news')) {
         $lessonSettings['news'] = array('text' => _ANNOUNCEMENTS, 'image' => "32x32/announcements.png", 'onClick' => 'activate(this, \'news\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (EfrontUser::isOptionVisible('lessons_timeline')) {
             $lessonSettings['lessons_timeline'] = array('text' => _LESSONSTIMELINE, 'image' => "32x32/user_timeline.png", 'onClick' => 'activate(this, \'lessons_timeline\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
         }
     }
     #cpp#endif
     $lessonSettings['scorm'] = array('text' => _SCORM, 'image' => "32x32/scorm.png", 'onClick' => 'activate(this, \'scorm\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     $lessonSettings['ims'] = array('text' => _IMS, 'image' => "32x32/autocomplete.png", 'onClick' => 'activate(this, \'ims\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     $lessonSettings['digital_library'] = array('text' => _SHAREDFILES, 'image' => "32x32/file_explorer.png", 'onClick' => 'activate(this, \'digital_library\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     if (EfrontUser::isOptionVisible('calendar')) {
         $lessonSettings['calendar'] = array('text' => _CALENDAR, 'image' => "32x32/calendar.png", 'onClick' => 'activate(this, \'calendar\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     if (EfrontUser::isOptionVisible('glossary')) {
         $lessonSettings['glossary'] = array('text' => _GLOSSARY, 'image' => "32x32/glossary.png", 'onClick' => 'activate(this, \'glossary\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     }
     $lessonSettings['auto_complete'] = array('text' => _AUTOCOMPLETE, 'image' => "32x32/autocomplete.png", 'onClick' => 'activate(this, \'auto_complete\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['content_tree'] = array('text' => _CONTENTTREEFIRSTPAGE, 'image' => "32x32/content_tree.png", 'onClick' => 'activate(this, \'content_tree\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['lesson_info'] = array('text' => _LESSONINFORMATION, 'image' => "32x32/information.png", 'onClick' => 'activate(this, \'lesson_info\')', 'title' => _CLICKTOTOGGLE, 'group' => 2, 'class' => 'inactiveImage');
     if (EfrontUser::isOptionVisible('bookmarks')) {
         $lessonSettings['bookmarking'] = array('text' => _BOOKMARKS, 'image' => "32x32/bookmark.png", 'onClick' => 'activate(this, \'bookmarking\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     }
     $lessonSettings['reports'] = array('text' => _STATISTICS, 'image' => "32x32/reports.png", 'onClick' => 'activate(this, \'reports\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['content_report'] = array('text' => _CONTENTREPORT, 'image' => "32x32/warning.png", 'onClick' => 'activate(this, \'content_report\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['print_content'] = array('text' => _PRINTCONTENT, 'image' => "32x32/printer.png", 'onClick' => 'activate(this, \'print_content\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['start_resume'] = array('text' => _STARTRESUME, 'image' => "32x32/continue.png", 'onClick' => 'activate(this, \'start_resume\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['show_percentage'] = array('text' => _COMPLETIONPERCENTAGEBLOCK, 'image' => "32x32/percent.png", 'onClick' => 'activate(this, \'show_percentage\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['show_content_tools'] = array('text' => _UNITOPTIONSBLOCK, 'image' => "32x32/options.png", 'onClick' => 'activate(this, \'show_content_tools\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['show_right_bar'] = array('text' => _RIGHTBAR, 'image' => "32x32/hide_right.png", 'onClick' => 'activate(this, \'show_right_bar\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['show_left_bar'] = array('text' => _LEFTBAR, 'image' => "32x32/hide_left.png", 'onClick' => 'activate(this, \'show_left_bar\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['show_student_cpanel'] = array('text' => _STUDENTCPANEL, 'image' => "32x32/options.png", 'onClick' => 'activate(this, \'show_student_cpanel\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     $lessonSettings['show_dashboard'] = array('text' => _DASHBOARD, 'image' => "32x32/generic.png", 'onClick' => 'activate(this, \'show_dashboard\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     if ($GLOBALS['currentTheme']->options['sidebar_interface'] == 1 || $GLOBALS['currentTheme']->options['sidebar_interface'] == 2) {
         $lessonSettings['show_horizontal_bar'] = array('text' => _SHOWHORIZONTALBAR, 'image' => "32x32/export.png", 'onClick' => 'activate(this, \'show_horizontal_bar\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
     }
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (G_VERSIONTYPE != 'standard') {
             #cpp#ifndef STANDARD
             $lessonSettings['timers'] = array('text' => _TIMERS, 'image' => "32x32/clock.png", 'onClick' => 'activate(this, \'timers\')', 'title' => _CLICKTOTOGGLE, 'group' => 1, 'class' => 'inactiveImage');
         }
         #cpp#endif
     }
     #cpp#endif
     foreach (eF_loadAllModules(true) as $module) {
         if ($module->isLessonModule()) {
             // The $setLanguage variable is defined in globals.php
             if (!in_array("administrator", $module->getPermittedRoles())) {
                 $mod_lang_file = $module->getLanguageFile($setLanguage);
                 if (is_file($mod_lang_file)) {
                     require_once $mod_lang_file;
                 }
             }
             // The $setLanguage variable is defined in globals.php
             if (!in_array("administrator", $module->getPermittedRoles())) {
                 $mod_lang_file = $module->getLanguageFile($setLanguage);
                 if (is_file($mod_lang_file)) {
                     require_once $mod_lang_file;
                 }
             }
             $lessonSettings[$module->className] = array('text' => $module->getName(), 'image' => "32x32/addons.png", 'onClick' => 'activate(this, \'' . $module->className . '\')', 'title' => _CLICKTOTOGGLE, 'group' => 3, 'class' => 'inactiveImage');
         }
     }
     $lessonSettings[$key]['onClick'] = 'activate(this, \'' . $key . '\')';
     $lessonSettings[$key]['style'] = 'color:inherit';
     return $lessonSettings;
 }
예제 #20
0
<?php

//This file cannot be called directly, only included.
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
    exit;
}
$loadScripts[] = 'scriptaculous/controls';
$loadScripts[] = 'includes/lessons';
if (!EfrontUser::isOptionVisible('professor_courses') || $_SESSION['s_type'] != 'professor' || $currentUser->coreAccess['professor_courses'] == 'hidden') {
    eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
}
if (isset($_GET['delete_lesson']) && eF_checkParameter($_GET['delete_lesson'], 'id')) {
    //The administrator asked to delete a lesson
    if (isset($currentUser->coreAccess['lessons']) && $currentUser->coreAccess['lessons'] != 'change') {
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure");
        exit;
    }
    try {
        $lesson = new EfrontLesson($_GET['delete_lesson']);
        if ($lesson->lesson['creator_LOGIN'] != $_SESSION['s_login']) {
            throw new Exception(_UNAUTHORIZEDACCESS);
        }
        $lesson->delete();
    } catch (Exception $e) {
        $message = _SOMEPROBLEMEMERGED . ': ' . $e->getMessage() . ' (' . $e->getCode() . ')';
        header("HTTP/1.0 500 ");
        echo rawurlencode($e->getMessage()) . ' (' . $e->getCode() . ')';
    }
    exit;
} elseif (isset($_GET['archive_lesson']) && eF_checkParameter($_GET['archive_lesson'], 'login')) {
    //The administrator asked to delete a lesson
예제 #21
0
파일: backup.php 프로젝트: bqq1986/efront
<?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>';
        }
    }
}
예제 #22
0
     $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');
예제 #23
0
        $my_timeline_options = array(array('text' => _GOTOCOMPLETESYSTEMTIMELINE, 'image' => "16x16/go_into.png", 'href' => $_SESSION['s_type'] . ".php?ctg=social&op=timeline"));
        $smarty->assign("T_MY_TIMELINE_OPTIONS", $my_timeline_options);
        $smarty->assign("T_EVENTS", $events);
    }
    /********************* SHOW PROFILE POPUP ******************/
} else {
    if ($_GET['op'] == "show_profile") {
        if (isset($_GET['user'])) {
            $shownUser = EfrontUserFactory::factory($_GET['user']);
            try {
                $avatarfile = new EfrontFile($shownUser->user['avatar']);
            } catch (EfrontFileException $ex) {
                $shownUser->user['avatar'] = G_SYSTEMAVATARSPATH . "unknown_small.png";
            }
            $smarty->assign("T_PROFILE_TO_SHOW", $shownUser->user);
            if (EfrontUser::isOptionVisible('func_comments')) {
                $smarty->assign("T_COMMENTS_ENABLED", 1);
            }
            $comments = $shownUser->getProfileComments();
            if (sizeof($comments) > 0) {
                foreach ($comments as $id => $comment) {
                    try {
                        $file = new EfrontFile($comment['avatar']);
                        list($comments[$id]['avatar_width'], $comments[$id]['avatar_height']) = eF_getNormalizedDims($file['path'], 25, 25);
                    } catch (EfrontFileException $e) {
                        $comments[$id]['avatar'] = G_SYSTEMAVATARSPATH . "unknown_small.png";
                        $comments[$id]['avatar_width'] = 25;
                        $comments[$id]['avatar_height'] = 25;
                    }
                    $comments[$id]['time_ago'] = eF_convertIntervalToTime(time() - $comment['timestamp'], true) . ' ' . _AGO;
                }
예제 #24
0
    //$categoryPath = str_replace("&rarr", "&raquo", $categoryPath);
    $smarty->assign("T_CURRENT_CATEGORY_PATH", $categoryPath);
    if ($currentLesson->lesson['course_only'] == 1 && $_SESSION['s_courses_ID']) {
        $currentCourse = new EfrontCourse($_SESSION['s_courses_ID']);
        $smarty->assign("T_CURRENT_COURSE_NAME", htmlspecialchars($currentCourse->course['name'], ENT_QUOTES));
        $smarty->assign("T_CURRENT_COURSE_ID", $currentCourse->course['id']);
    }
}
if (G_VERSIONTYPE != 'community') {
    #cpp#ifndef COMMUNITY
    if ($GLOBALS['configuration']['facebook_api_key'] && $GLOBALS['configuration']['facebook_secret']) {
        $smarty->assign("T_FACEBOOK_USER", EfrontFacebook::userConnected());
    }
}
#cpp#endif
if ((!isset($currentUser->coreAccess['personal_messages']) || $currentUser->coreAccess['personal_messages'] != 'hidden') && EfrontUser::isOptionVisible('messages')) {
    $messages = eF_getTableData("f_personal_messages pm, f_folders ff", "count(*)", "pm.users_LOGIN='******'s_login'] . "' and viewed='no' and f_folders_ID=ff.id and ff.name='Incoming'");
    $smarty->assign("T_NUM_MESSAGES", $messages[0]['count(*)']);
}
//$smarty -> assign("T_SIMPLE_COMPLETE_MODE", EfrontUser::isOptionVisible('simple_complete'));
$smarty->load_filter('output', 'eF_template_formatTimestamp');
$smarty->load_filter('output', 'eF_template_formatLogins');
$smarty->load_filter('output', 'eF_template_setInnerLinks');
$smarty->load_filter('output', 'eF_template_setEditorOffset');
$benchmark->set('script');
$smarty->display('student.tpl');
$benchmark->set('smarty');
$benchmark->stop();
$output = $benchmark->display();
if (G_DEBUG) {
    echo $output;
예제 #25
0
    /**
     * Print a link with tooltip
     *
     * This function is used to print a course link with a popup tooltip
     * containing information on this lesson. The link must be provided
     * and optionally the information.
     * <br/>Example:
     * <code>
     * echo $course -> toHTMLTooltipLink('javascript:void(0)');
     * </code>
     *
     * @param string $link The link to print
     * @param array $courseInformation The information to display (According to the EfrontCourse :: getInformation() format)
     * @since 3.5.0
     * @access public
     * @todo refactor
     */
    public function toHTMLTooltipLink($link, $courseInformation = false)
    {
        if (EfrontUser::isOptionVisible('tooltip')) {
            if (!$courseInformation) {
                $courseInformation = $this->getInformation();
            }
            if (!$link) {
                $link = 'javascript:void(0)';
            }
            if (isset($courseInformation['professors'])) {
                foreach ($courseInformation['professors'] as $value) {
                    $professorsString[] = $value['name'] . ' ' . $value['surname'];
                }
                $courseInformation['professors'] = implode(", ", $professorsString);
            }
            $tooltipInfo = array();
            foreach ($courseInformation as $key => $value) {
                if ($value) {
                    switch ($key) {
                        case 'professors':
                            $tooltipInfo[] = '<strong>' . _PROFESSORS . "</strong>: {$value}<br/>";
                            break;
                        case 'lessons_number':
                            $tooltipInfo[] = '<strong>' . _LESSONS . "</strong>: {$value}<br/>";
                            break;
                        case 'instances':
                            $tooltipInfo[] = '<strong>' . _COURSEINSTANCES . "</strong>: {$value}<br/>";
                            break;
                        case 'general_description':
                            $tooltipInfo[] = '<strong>' . _DESCRIPTION . "</strong>: {$value}<br/>";
                            break;
                        case 'assessment':
                            $tooltipInfo[] = '<strong>' . _ASSESSMENT . "</strong>: {$value}<br/>";
                            break;
                        case 'objectives':
                            $tooltipInfo[] = '<strong>' . _OBJECTIVES . "</strong>: {$value}<br/>";
                            break;
                        case 'lesson_topics':
                            $tooltipInfo[] = '<strong>' . _COURSETOPICS . "</strong>: {$value}<br/>";
                            break;
                        case 'resources':
                            $tooltipInfo[] = '<strong>' . _RESOURCES . "</strong>: {$value}<br/>";
                            break;
                        case 'other_info':
                            $tooltipInfo[] = '<strong>' . _OTHERINFO . "</strong>: {$value}<br/>";
                            break;
                        default:
                            break;
                    }
                }
            }
            $classes = array();
            if (sizeof($tooltipInfo) > 0) {
                $classes[] = 'info';
                $tooltipString = '
					<a href = "' . $link . '" class = "' . implode(" ", $classes) . '" style = "vertical-align:middle;">
						' . $this->course['name'] . '
						<span class = "tooltipSpan">' . implode("", $tooltipInfo) . '</span></a>';
            } else {
                $tooltipString = '
					<a href = "' . $link . '" class = "' . implode(" ", $classes) . '" style = "vertical-align:middle;">
						' . $this->course['name'] . '</a>';
            }
        } else {
            $tooltipString = '
					<a href = "' . $link . '" class = "' . implode(" ", $classes) . '" style = "vertical-align:middle;">
						' . $this->course['name'] . '</a>';
        }
        return $tooltipString;
    }
         }
         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);
         }
     }
 }
예제 #27
0
 /**
  *
  * @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 &rsquo;
             $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;
 }
 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;
 }
예제 #29
0
            }
        }
        #cpp#endif
        if ((!isset($currentUser->coreAccess['personal_messages']) || $currentUser->coreAccess['personal_messages'] != 'hidden') && EfrontUser::isOptionVisible('messages')) {
            $myCoursesOptions[] = array('text' => _MESSAGES, 'image' => "32x32/mail.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=messages");
        }
        if (EfrontUser::isOptionVisible('statistics')) {
            $myCoursesOptions[] = array('text' => _STATISTICS, 'image' => "32x32/reports.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=statistics");
        }
        if (EfrontUser::isOptionVisible('forum')) {
            $myCoursesOptions[] = array('text' => _FORUM, 'image' => "32x32/forum.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=forum");
        }
        if (EfrontUser::isOptionVisible('calendar')) {
            $myCoursesOptions[] = array('text' => _CALENDAR, 'image' => "32x32/calendar.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=calendar");
        }
        if (EfrontUser::isOptionVisible('professor_courses') && ($_SESSION['s_type'] == 'professor' || $currentUser->user['user_type'] == 'professor')) {
            if ($currentUser->coreAccess['professor_courses'] != 'hidden') {
                $myCoursesOptions[] = array('text' => _COURSES, 'image' => "32x32/courses.png", 'href' => "professor.php?ctg=courses");
                $myCoursesOptions[] = array('text' => _LESSONS, 'image' => "32x32/lessons.png", 'href' => "professor.php?ctg=professor_lessons");
            }
        }
        foreach ($loadedModules as $module) {
            if ($linkInfo = $module->getToolsLinkInfo()) {
                $myCoursesOptions[] = array('text' => $linkInfo['title'], 'image' => eF_getRelativeModuleImagePath($linkInfo['image']), 'href' => $linkInfo['link']);
            }
        }
        $smarty->assign("T_LAYOUT_CLASS", $currentTheme->options['toolbar_position'] == "left" ? "hideRight" : "hideLeft");
        //Whether to show the sidemenu on the left or on the right
        $smarty->assign("T_COURSES_LIST_OPTIONS", $myCoursesOptions);
    }
} catch (Exception $e) {
예제 #30
0
//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
}