/**
* Smarty plugin: smarty_function_eF_template_printComments function. Prints inner table
*
*/
function smarty_function_eF_template_printComments($params, &$smarty)
{
    $max_title_size = 50;
    //The maximum length of the title, after which it is cropped with ...
    $list_fold_size = 3;
    //The folding occurs in this number of lines
    if (isset($params['limit'])) {
        $limit = min($params['limit'], sizeof($params['data']));
    } else {
        $limit = sizeof($params['data']);
    }
    $str .= '
        <table border = "0" width = "100%">';
    for ($i = 0; $i < $list_fold_size && $i < $limit; $i++) {
        if (mb_strlen($params['data'][$i]['content_name']) > $max_title_size) {
            $params['data'][$i]['content_name'] = mb_substr($params['data'][$i]['content_name'], 0, $max_title_size) . '...';
            //If the message title is large, cut it and append ...
        }
        $title2 = '#filter:timestamp_time-' . $params['data'][$i]['timestamp'] . '#';
        $str .= '
            <tr><td>
                    <span class = "counter">' . ($i + 1) . '.</span>';
        if ($_SESSION['s_type'] != "administrator") {
            // Students and professors are redirected to the same page - one type just views the other may also edit content
            $str .= '<a title = "' . htmlspecialchars($params['data'][$i]['data']) . '" href = "' . $_SESSION['s_type'] . '.php?ctg=content&view_unit=' . $params['data'][$i]['content_ID'];
            // Students and professors may have to change lesson session - using the new_lessons_ID parameter for this purpose
            if (isset($params['data'][$i]['show_lessons_id']) && $params['data'][$i]['show_lessons_id'] != 0 && isset($params['data'][$i]['show_lessons_name'])) {
                $str .= '&new_lessons_ID=' . $params['data'][$i]['show_lessons_id'] . '&sbctg=content"><b>' . $params['data'][$i]['show_lessons_name'] . '</b>: ' . $params['data'][$i]['content_name'] . '</a></td>';
            } else {
                $str .= '">' . $params['data'][$i]['content_name'] . '</a></td>';
            }
        } else {
            // Administrators have no links to projects
            if (isset($params['data'][$i]['show_lessons_id']) && $params['data'][$i]['show_lessons_id'] != 0 && isset($params['data'][$i]['show_lessons_name'])) {
                $str .= '<a title="' . $title_message . '" href = "administrator.php?ctg=lessons&edit_lesson=' . $params['data'][$i]['show_lessons_id'] . '"><b>' . $params['data'][$i]['show_lessons_name'] . "</b></a>: " . $params['data'][$i]['content_name'] . '</td>';
            } else {
                $str .= $params['data'][$i]['content_name'] . '</td>';
            }
        }
        $str .= '<td align = "right">
                    #filter:user_login-' . $params['data'][$i]['users_LOGIN'] . '#, 
                    <span title = "' . $title2 . '">' . eF_convertIntervalToTime(time() - $params['data'][$i]['timestamp'], true) . ' ' . _AGO . '</span>                    
                </td></tr>';
    }
    if ($i == 0) {
        $str .= '
            <tr><td class = "emptyCategory">' . _NONEWCOMMENTS . '</td></tr>
        </table>';
    } else {
        $str .= '
            </table>';
    }
    return $str;
}
Exemplo n.º 2
0
function getConnectedUsers()
{
    $usersOnline = array();
    //A user may have multiple active entries on the user_times table, one for system, one for unit etc. Pick the most recent
    $result = eF_getTableData("user_times,users,module_chat_users", "users_LOGIN, users.name, users.surname, users.user_type, timestamp_now, session_timestamp", "users.login=user_times.users_LOGIN and users.login=module_chat_users.username and session_expired=0", "timestamp_now desc");
    foreach ($result as $value) {
        if (!isset($parsedUsers[$value['users_LOGIN']])) {
            $value['login'] = $value['users_LOGIN'];
            $usersOnline[] = array('login' => $value['users_LOGIN'], 'formattedLogin' => formatLogin($value['login'], $value), 'user_type' => $value['user_type'], 'timestamp_now' => $value['timestamp_now'], 'time' => eF_convertIntervalToTime(time() - $value['session_timestamp']));
            $parsedUsers[$value['users_LOGIN']] = true;
        }
    }
    return $usersOnline;
}
 /**
  * Initialize project
  *
  * This function is used to initialize the designated project
  *
  * @param $project The project initialization data
  * @since 3.5.0
  * @access public
  */
 function __construct($project)
 {
     if (!is_array($project)) {
         if (!eF_checkParameter($project, 'id')) {
             throw new EfrontContentException(_INVALIDPROJECTID . ': ' . $project, EfrontContentException::INVALID_ID);
         }
         $project = eF_getTableData("projects", "*", "id={$project}");
         if (sizeof($project) == 0) {
             throw new EfrontContentException(_PROJECTNOTFOUND . ': ' . $project, EfrontContentException::PROJECT_NOT_EXISTS);
         }
         $this->project = $project[0];
     } else {
         $this->project = $project;
     }
     $this->timeRemaining = eF_convertIntervalToTime($this->project['deadline'] - time(), true);
 }
/**
* Smarty plugin: smarty_function_eF_template_printForumMessages function.
*
* This function prints a list with forum messages titles and the corresponding list
* It is used to both student and professor pages, at the front page, and wherever we need
* a list of forum messages.
* 
*/
function smarty_function_eF_template_printForumMessages($params, &$smarty)
{
    $max_title_size = 50;
    //The maximum length of the title, after which it is cropped with ...
    if (isset($params['limit'])) {
        //If limit is specified, then only up to limit messages are displayed
        $limit = min($params['limit'], sizeof($params['data']));
    } else {
        $limit = sizeof($params['data']);
    }
    $str = '        
        <table border = "0" width = "100%">';
    for ($i = 0; $i < $limit; $i++) {
        $params['data'][$i]['title'] ? $title_message = $params['data'][$i]['title'] : ($title_message = '<span class = "emptyCategory">' . _NOTITLE . '</span>');
        if (mb_strlen($params['data'][$i]['title']) > $max_title_size) {
            $params['data'][$i]['title'] = mb_substr($params['data'][$i]['title'], 0, $max_title_size) . '...';
            //If the message title is large, cut it and append ...
        }
        $str .= '
            <tr><td>
                    <span class = "counter">' . ($i + 1) . '.</span> 
                    <a title="' . $params['data'][$i]['title'] . '" href = ' . basename($_SERVER['PHP_SELF']) . '?ctg=forum&topic=' . $params['data'][$i]['topic_id'] . '&view_message=' . $params['data'][$i]['id'] . '>';
        if (isset($params['data'][$i]['show_lessons_name'])) {
            $str .= "<b>" . $params['data'][$i]['show_lessons_name'] . "</b>: ";
        }
        $str .= $title_message . '</a>
                </td><td align = "right">#filter:user_login-' . $params['data'][$i]['users_LOGIN'] . '#, ';
        $title2 = '#filter:timestamp_time-' . $params['data'][$i]['timestamp'] . '#';
        //$str .= '<img src="images/16x16/calendar.png" title="'.$title2.'" alt="'.$title2.'" style = "vertical-align:middle"/>';
        $str .= '<span title = "' . $title2 . '">' . eF_convertIntervalToTime(time() - $params['data'][$i]['timestamp'], true) . ' ' . _AGO . "</span>";
        $str .= '
                </td></tr>';
    }
    if ($i == 0) {
        $str .= '
            <tr><td class = "emptyCategory">' . _NONEWFORUMMESSAGES . '</td></tr>';
    }
    $str .= '</table>';
    return $str;
}
/**
* Smarty plugin: smarty_function_eF_template_printPersonalMessages function. Prints inner table
*
*/
function smarty_function_eF_template_printPersonalMessages($params, &$smarty)
{
    $max_title_size = 50;
    //The maximum length of the title, after which it is cropped with ...
    $list_fold_size = 3;
    //The folding occurs in this number of lines
    if (isset($params['limit'])) {
        $limit = min($params['limit'], sizeof($params['data']));
    } else {
        $limit = sizeof($params['data']);
    }
    $str = '        
        <table border = "0" width = "100%">';
    for ($i = 0; $i < $list_fold_size && $i < $limit; $i++) {
        $title_message = $params['data'][$i]['title'];
        if (mb_strlen($params['data'][$i]['title']) > $max_title_size) {
            $params['data'][$i]['title'] = mb_substr($params['data'][$i]['title'], 0, $max_title_size) . '...';
            //If the message title is large, cut it and append ...
        }
        $str .= '
            <tr><td>
                    <span class = "counter">' . ($i + 1) . '.</span> <a title="' . $title_message . '" href = "' . basename($_SERVER['PHP_SELF']) . '?ctg=messages&view=' . $params['data'][$i]['id'] . '">' . $params['data'][$i]['title'] . '</a></td>
                <td align = "right">#filter:user_login-' . $params['data'][$i]['sender'] . '#, ';
        $title2 = ' #filter:timestamp_time-' . $params['data'][$i]['timestamp'] . '#';
        $str .= '<span title = "' . $title2 . '">' . eF_convertIntervalToTime(time() - $params['data'][$i]['timestamp'], true) . ' ' . _AGO . "</span>";
        //$str .= '<img src="images/16x16/calendar.png" title="'.$title2.'" alt="'.$title2.'" style = "vertical-align:middle"/>
        $str .= '</td></tr>';
    }
    if ($i == 0) {
        $str .= '
            <tr><td class = "emptyCategory">' . _NONEWPERSONALMESSAGES . '</td></tr>
        </table>';
    } else {
        $str .= '
            </table>';
    }
    return $str;
}
    private function printCategoryLessons($iterator, $display_lessons, $options, $lessons)
    {
        $roles = EfrontLessonUser::getLessonsRoles();
        $roleNames = EfrontLessonUser::getLessonsRoles(true);
        $treeString = $lessonsString = '';
        $current = $iterator->current();
        foreach ($current->offsetGet('lessons') as $lessonId) {
            $treeLesson = $lessons[$lessonId];
            if (isset($treeLesson->lesson['user_type']) && $treeLesson->lesson['user_type']) {
                $roleInLesson = $treeLesson->lesson['user_type'];
                $roleBasicType = $roles[$roleInLesson];
                //Indicates that this is a catalog with user data
            } else {
                $roleBasicType = null;
            }
            if ($roleBasicType == 'student') {
                $this->hasLessonsAsStudent = true;
            }
            //if ($_COOKIE['display_all_courses'] == '1' || $roleBasicType != 'student' || (!$treeLesson -> lesson['completed'] && (is_null($treeLesson -> lesson['remaining']) || $treeLesson -> lesson['remaining'] > 0))) {
            $lessonsString .= '<tr class = "directionEntry">';
            if ($roleBasicType) {
                $lessonsString .= $this->printProgressBar($treeLesson, $roleBasicType);
            }
            $accessLimitString = '';
            if (isset($treeLesson->lesson['remaining']) && !is_null($treeLesson->lesson['remaining']) && $roles[$treeLesson->lesson['user_type']] == 'student') {
                $accessLimitString .= eF_convertIntervalToTime($treeLesson->lesson['remaining'], true) . ' ' . mb_strtolower(_REMAINING);
            }
            if (isset($treeLesson->lesson['access_limit']) && $treeLesson->lesson['access_limit'] && !is_null($treeLesson->lesson['access_counter']) && $roles[$treeLesson->lesson['user_type']] == 'student') {
                if ($treeLesson->lesson['access_counter'] >= $treeLesson->lesson['access_limit']) {
                    $accessLimitString = _ACCESSEXPIRED;
                    $treeLesson->lesson['active_in_lesson'] = false;
                } else {
                    !$accessLimitString or $accessLimitString .= ', ';
                    $accessLimitString .= str_replace('%x', $treeLesson->lesson['access_limit'] - $treeLesson->lesson['access_counter'], _ACCESSESREMAINING);
                }
            }
            if ($accessLimitString) {
                $accessLimitString = '<span class = "infoCell">(' . $accessLimitString . ')</span>';
            }
            $lessonsString .= '<td>';
            $lessonsString .= $this->printLessonBuyLink($treeLesson, $options);
            $lessonsString .= $this->printLessonLink($treeLesson, $options, $roleBasicType);
            $lessonsString .= (isset($treeLesson->lesson['different_role']) && $treeLesson->lesson['different_role'] ? '&nbsp;<span class = "courseRole">(' . $roleNames[$treeLesson->lesson['user_type']] . ')</span>' : '') . '								   
								   ' . $accessLimitString . '
										</td>
									</tr>';
            //}
        }
        if (isset($current['lessons']) && sizeof($current['lessons']) > 0 && $lessonsString) {
            $treeString .= '
						<tr id = "subtree' . $current['id'] . '" name = "default_visible" ' . ($iterator->getDepth() >= 1 ? '' : $display_lessons) . '>';
            $treeString .= ' <td></td>
							<td class = "lessonsList_nocolor">&nbsp;</td>
							<td colspan = "2">
								<table width = "100%">' . $lessonsString . '
								</table>
								</td></tr>';
        }
        return $treeString;
    }
Exemplo n.º 7
0
            $randomPool = $_GET['random_pool'];
        }
        if (sizeof($currentTest->getQuestions()) < $randomPool) {
            $randomPool = sizeof($currentTest->getQuestions());
        }
        $currentTest->options['random_pool'] = $randomPool;
        //Set the user configurable option
        isset($_GET['user_configurable']) && $_GET['user_configurable'] ? $currentTest->options['user_configurable'] = 1 : ($currentTest->options['user_configurable'] = 0);
        isset($_GET['show_incomplete']) && $_GET['show_incomplete'] ? $currentTest->options['show_incomplete'] = 1 : ($currentTest->options['show_incomplete'] = 0);
        $currentTest->persist();
        //ArrayObject is required in order for json to work well with prototype
        $stats = new ArrayObject($currentTest->questionsInfo());
        $stats['difficulties'] = new ArrayObject($stats['difficulties']);
        $stats['types'] = new ArrayObject($stats['types']);
        $stats['percentage'] = new ArrayObject($stats['percentage']);
        $stats['duration'] = eF_convertIntervalToTime($stats['total_duration']);
        $stats['random_pool'] = $currentTest->options['random_pool'];
        //Set the test time to match questions time
        if ($_GET['update_test_time'] && $stats['total_duration'] > 0) {
            $currentTest->options['duration'] = $stats['total_duration'];
            $currentTest->persist();
        }
        $stats['test_duration'] = $currentTest->options['duration'];
        header("content-type:application/json");
        echo json_encode($stats);
    } catch (Exception $e) {
        header("HTTP/1.0 500 ");
        echo $e->getMessage() . ' (' . $e->getCode() . ')';
    }
    exit;
}
Exemplo n.º 8
0
     if ($value['lessons_ID']) {
         $lessons[$value['lessons_ID']] = array();
     }
 }
 $totalUserAccesses = $totalUserTime = 0;
 foreach ($users as $key => $user) {
     $users[$key]['time'] = eF_convertIntervalToTime($user['seconds']);
     $totalUserAccesses += $user['accesses'];
     $totalUserTime += $user['seconds'];
 }
 if (!isset($_GET['showusers'])) {
     $users = array_slice($users, 0, 20, true);
 }
 $smarty->assign("T_ACTIVE_USERS", $users);
 $smarty->assign("T_TOTAL_USER_ACCESSES", $totalUserAccesses);
 $smarty->assign("T_TOTAL_USER_TIME", eF_convertIntervalToTime($totalUserTime));
 if ($_GET['calculate_space']) {
     $smarty->assign("T_SPACE_USED", EfrontSystem::getSpaceUsage());
 }
 $smarty->assign("T_USER_TIMES", array('logins' => implode(",", array_keys($userTimes)), 'times' => implode(",", $userTimes)));
 //Needed only for chart
 /*
 //Commented out until we convert old log-based stats to time-based
 
     $directionsTree = new EfrontDirectionsTree();
     $directionsTreePaths = $directionsTree -> toPathString();
 
     $result       = eF_getTableDataFlat("lessons", "id, name, active, directions_ID");
     $lessonNames  = array_combine($result['id'], $result['name']);
     $lessonActive = array_combine($result['id'], $result['active']);
     $lessonCategory = array_combine($result['id'], $result['directions_ID']);
Exemplo n.º 9
0
     $traffic['users'] = $infoLesson->getUsersActiveTimeInLesson();
     foreach ($traffic['users'] as $key => $value) {
         $traffic['users'][$key] = EfrontTimes::formatTimeForReporting($value);
     }
 } else {
     $traffic['users'] = $infoLesson->getLessonTimesForUsers();
 }
 foreach ($traffic['users'] as $key => $user) {
     if (isset($statsFiltersUsers) && !in_array($key, array_keys($statsFiltersUsers))) {
         unset($traffic['users'][$key]);
     }
 }
 foreach ($traffic['users'] as $value) {
     $traffic['total_seconds'] += $value['total_seconds'];
 }
 $traffic['total_time'] = eF_convertIntervalToTime($traffic['total_seconds']);
 try {
     /*
                 	if (isset($_GET['ajax']) && $_GET['ajax'] == 'graph_access') {
                 		$graph = new EfrontGraph();
                 		$graph -> type = 'bar';
                 		$count = 0;
                 		foreach ($traffic['users'] as $key => $value) {
                 			$graph -> data[]    = array($count, $value['accesses']);
                 			$graph -> xLabels[] = array($count++, formatLogin($key));
                 		}
                 		//pr($graph);
                 		$graph -> xTitle = _USERS;
                 		$graph -> yTitle = _ACCESSES;
                 		$graph -> title  = _ACCESSESPERUSER;
     
Exemplo n.º 10
0
 public function getLessonModule()
 {
     $currentUser = $this->getCurrentUser();
     if ($currentUser->getRole($this->getCurrentLesson()) != "administrator") {
         // Get smarty variable
         $smarty = $this->getSmartyVar();
         $currentLesson = $this->getCurrentLesson();
         $fifteen_minutes_ago = time() - 15 * 60;
         if ($currentUser->getRole($this->getCurrentLesson()) == "student") {
             // User's role is that of a student
             $BBB = eF_getTableData("module_BBB_users_to_meeting JOIN module_BBB ON id = meeting_ID", "*", "lessons_ID = '" . $currentLesson->lesson['id'] . "' AND `timestamp` > {$fifteen_minutes_ago} AND users_LOGIN='******'login'] . "'", "timestamp DESC");
             //$BBB = eF_getTableData("module_BBB_users_to_meeting JOIN module_BBB ON id = meeting_ID", "*", "lessons_ID = '".$currentLesson -> lesson['id']."'  AND users_LOGIN='******'login']."'", "timestamp DESC");
             $smarty->assign("T_BBB_CURRENTLESSONTYPE", "student");
             $BBB_server = eF_getTableData("configuration", "value", "name = 'module_BBB_server'");
             foreach ($BBB as $key => $meeting) {
                 // The meeting has not started yet and is planned for some point in future
                 if ($meeting['timestamp'] > time()) {
                     $BBB[$key]['time_remaining'] = _BBB_IN . ' ' . eF_convertIntervalToTime($meeting['timestamp'] - time(), true);
                     $BBB[$key]['joiningUrl'] = $this->createBBBUrl($currentUser, $meeting, true);
                     $smarty->assign("T_BBB_CREATEMEETINGURL", $BBB[$key]['joiningUrl']);
                 }
                 // The meeting is planned for some point in the past
                 if ($meeting['timestamp'] <= time() && $meeting['timestamp'] > $fifteen_minutes_ago) {
                     $BBB[$key]['time_remaining'] = _BBB_NOW;
                     $BBB[$key]['joiningUrl'] = $this->createBBBUrl($currentUser, $meeting, true);
                     $smarty->assign("T_BBB_CREATEMEETINGURL", $BBB[$key]['joiningUrl']);
                 }
                 //pr($meeting);
             }
         } else {
             // User's role is that of a professor
             $BBB = eF_getTableData("module_BBB", "*", "lessons_ID = '" . $currentLesson->lesson['id'] . "' AND `timestamp` > {$fifteen_minutes_ago}", "timestamp DESC");
             //$BBB = eF_getTableData("module_BBB", "*", "lessons_ID = '".$currentLesson -> lesson['id']."'", "timestamp DESC");
             $smarty->assign("T_BBB_CURRENTLESSONTYPE", "professor");
             $now = time();
             foreach ($BBB as $key => $meeting) {
                 if ($meeting['timestamp'] > $now) {
                     $BBB[$key]['mayStart'] = 0;
                     $BBB[$key]['time_remaining'] = _BBB_IN . ' ' . eF_convertIntervalToTime($meeting['timestamp'] - time(), true);
                 } else {
                     $BBB[$key]['mayStart'] = 1;
                     $BBB[$key]['time_remaining'] = _BBB_NOW;
                     // always start_meeting = 1 url so that only one professor might start the meeting
                     $BBB_meeting_creation_URL = $this->createBBBUrl($currentUser, $meeting, FALSE);
                     $smarty->assign("T_BBB_CREATEMEETINGURL", $BBB_meeting_creation_URL);
                 }
             }
         }
         $smarty->assign("T_MODULE_BBB_INNERTABLE_OPTIONS", array(array('text' => _BBB_BBBLIST, 'image' => $this->moduleBaseLink . "images/go_into.png", 'href' => $this->moduleBaseUrl)));
         $smarty->assign("T_BBB_INNERTABLE", $BBB);
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 11
0
 /**
  * previous EfrontUser :: getLoginTime
  *
  * @param array $interval
  */
 private static function getDeprecatedUserTimesPerDay($interval)
 {
     /*
     		 $scormTimes = eF_getTableData("scorm_data sd, content c", "sd.total_time", "c.id=sd.content_ID and users_LOGIN = '******'login']."' and c.lessons_ID=".$this -> lesson['id']);
     		 $scormSeconds = 0;
     		 foreach ($scormTimes as $value) {
     			$scormSeconds += convertTimeToSeconds($value['total_time']);
     			}
     			$userTimes = EfrontStats :: getUsersTimeAll(false, false, array($this -> lesson['id'] => $this -> lesson['id']), array($user['login'] => $user['login']));
     			$userTimes = $userTimes[$this -> lesson['id']][$user['login']];
     if ($userTimes['total_seconds'] < $scormSeconds) {
     			$newTimes = convertSecondsToTime($scormSeconds);
     			$newTimes['total_seconds'] = $scormSeconds;
     			$newTimes['accesses']	   = $userTimes['accesses'];
     			$userTimes = $newTimes;
     			}
     $userTimes['time_string'] = '';
     			if ($userTimes['total_seconds']) {
     			!$userTimes['hours']   OR $userTimes['time_string'] .= $userTimes['hours']._HOURSSHORTHAND.' ';
     			!$userTimes['minutes'] OR $userTimes['time_string'] .= $userTimes['minutes']._MINUTESSHORTHAND.' ';
     			!$userTimes['seconds'] OR $userTimes['time_string'] .= $userTimes['seconds']._SECONDSSHORTHAND;
     			}
     */
     if ($interval && eF_checkParameter($interval['from'], 'timestamp') && eF_checkParameter($interval['to'], 'timestamp')) {
         $from = $interval['from'];
         $to = $interval['to'];
     } else {
         $from = "00000000";
         $to = time();
     }
     if ($login && eF_checkParameter($login, 'login')) {
         $result = eF_getTableData("logs", "users_LOGIN, id, timestamp, action", "users_LOGIN = '******' and timestamp between {$from} and {$to}", "id");
     } else {
         $result = eF_getTableData("logs", "users_LOGIN, id, timestamp, action", "timestamp between {$from} and {$to}", "id");
     }
     $userTimes = array();
     foreach ($result as $value) {
         $logs[$value['users_LOGIN']][] = $value;
     }
     foreach ($logs as $user => $result) {
         $totalTime = 0;
         $start = 0;
         $inlogin = 0;
         foreach ($result as $value) {
             if ($inlogin) {
                 if ($value['action'] != 'logout' && $value['action'] != 'login') {
                     if ($value['timestamp'] < $start + 1800) {
                         //if it is inactive more than half an hour, we don't consider it
                         $totalTime += $value['timestamp'] - $start;
                         $start = $value['timestamp'];
                     } else {
                         //$totalTime += 900;   // we could consider half of this period or enitre in the future
                         $start = $value['timestamp'];
                         // It is needed to refresh start time even if time period was more half an hour. It was missing
                     }
                 } else {
                     if ($value['action'] == 'logout') {
                         if ($value['timestamp'] < $start + 1800) {
                             //if it is inactive more than half an hour, we don't consider it
                             $totalTime += $value['timestamp'] - $start;
                         } else {
                             //$totalTime += 900; // we could consider half of this period or enitre in the future
                         }
                         $inlogin = 0;
                     } else {
                         if ($value['action'] == 'login') {
                             $inlogin = 1;
                             $start = $value['timestamp'];
                         }
                     }
                 }
             } else {
                 if ($value['action'] == 'login') {
                     $inlogin = 1;
                     $start = $value['timestamp'];
                 }
             }
         }
         $userTimes[$user] = eF_convertIntervalToTime($totalTime);
         $userTimes[$user]['total_seconds'] = $totalTime;
     }
     if ($login) {
         return $userTimes[$login];
     } else {
         return $userTimes;
     }
 }
Exemplo n.º 12
0
    //If a difficulty is specified, then set it to be selected
} else {
    $form->setDefaults(array('difficulty' => 'medium'));
    //else, set the default selected difficulty to be 'medium'
}
if (strpos($postTarget, '&from_test') === false) {
    //This means that we got here by clicking on the "add new question" icon of a specific test. We don't want the "submit_question_another" button, since it will break the referer, and won't return back to the test
    //@todo: change the detection method, not to use referer, but rather a simple GET parameter
    $form->addElement('submit', 'submit_question_another', _SAVEQUESTIONANDCREATENEW, 'class = "flatButton"');
}
if (isset($currentQuestion)) {
    //If we are changing an existing question
    //pr($currentQuestion);
    $form->setDefaults(array('content_ID' => $currentQuestion->question['content_ID'], 'question_type' => $currentQuestion->question['type'], 'difficulty' => $currentQuestion->question['difficulty'], 'question_text' => $currentQuestion->question['text'], 'explanation' => $currentQuestion->question['explanation']));
    if ($currentQuestion->question['estimate']) {
        $interval = eF_convertIntervalToTime($currentQuestion->question['estimate']);
        $form->setDefaults(array('estimate_min' => $interval['minutes'], 'estimate_sec' => $interval['seconds']));
    }
    /*
    if ($currentQuestion -> question['type'] == "raw_text" && strpos($currentQuestion -> question['answer'],"<a href") !== false) {
    $smarty -> assign("T_HTML_ANSWER",$currentQuestion -> question['answer']);
    }
    */
    $form->freeze('question_type');
    //The question type cannot be changed
    $smarty->assign("T_HAS_EXPLANATION", $currentQuestion->question['explanation']);
    //If the question has an explanation, use this smarty tag to set explanation field to be visible by default.
}
switch ($_GET['question_type']) {
    //Depending on the question type, the user might have added new form fields. We need to recreate the form, in order to be able to handle them both in case of succes or failure.
    case 'multiple_one':
Exemplo n.º 13
0
 /**
  * Get announcements
  *
  * This function gets the lesson announcements (news). It returns an array holding the announcement title, id
  * and timestamp.
  * <br/>Example:
  * <code>
  * $news = news ::: getNews();
  * print_r($news);
  * //Returns:
  *Array
  *(
  *    [0] => Array
  *        (
  *            [title] => announcement 1
  *            [id] => 3
  *            [timestamp] => 1125751731
  *            [users_LOGIN] => admin
  *        )
  *
  *    [1] => Array
  *        (
  *            [title] => Important announcem...
  *            [id] => 5
  *            [timestamp] => 1125751012
  *            [users_LOGIN] => peris
  *        )
  *)
  * </code>
  *
  * @param mixed $lessonId The lesson id or an array of ids
  * @param boolean $check_expire Whether to return only announcements that are valid for the current date
  * @return array The news array
  * @since 3.6.0
  * @static
  * @access public
  */
 public static function getNews($lessonId, $checkExpire = false)
 {
     if ($checkExpire) {
         $expireString = " and (n.expire=0 OR n.expire is null OR n.expire >=" . time() . ") AND n.timestamp<=" . time();
         //$expireString = " AND n.timestamp<=".time();   // check why it was here hot talking into account expire. makriria 15/3/2010
     }
     if (is_array($lessonId) && !empty($lessonId)) {
         foreach ($lessonId as $key => $value) {
             if (!eF_checkParameter($value, 'id')) {
                 unset($lessonId[$key]);
             }
         }
         if (!empty($lessonId)) {
             $result = eF_getTableData("news n, users u", "n.*, u.surname, u.name", "n.users_LOGIN = u.login" . $expireString . " and n.lessons_ID in (" . implode(",", $lessonId) . ")", "n.timestamp desc, n.id desc");
             $news = array();
             foreach ($result as $value) {
                 $interval = time() - $value['timestamp'];
                 $value['time_since'] = eF_convertIntervalToTime(abs($interval), true) . ' ' . ($interval > 0 ? _AGO : _REMAININGPLURAL);
                 $news[$value['id']] = $value;
             }
         }
         return $news;
     }
     //We don't have an "else" statement here, because in case the check in the above if removed all elements of lessonId (they were not ids), this part of code will be executed and the function won't fail
     if (!eF_checkParameter($lessonId, 'id')) {
         $lessonId = 0;
     }
     $result = eF_getTableData("news n, users u", "n.*, u.surname, u.name", "n.users_LOGIN = u.login" . $expireString . " and n.lessons_ID={$lessonId}", "n.timestamp desc, n.id desc");
     $news = array();
     foreach ($result as $value) {
         $interval = time() - $value['timestamp'];
         $value['time_since'] = eF_convertIntervalToTime(abs($interval), true) . ' ' . ($interval > 0 ? _AGO : _REMAININGPLURAL);
         $news[$value['id']] = $value;
     }
     return $news;
 }
/**
 * Smarty plugin: smarty_function_eF_template_printProjects function. Prints projects data
 *
 */
function smarty_function_eF_template_printProjects($params, &$smarty)
{
    $max_title_size = 50;
    //The maximum length of the title, after which it is cropped with ...
    $list_fold_size = 5;
    //The folding occurs in this number of lines
    if (isset($params['limit'])) {
        $limit = min($params['limit'], sizeof($params['data']));
    } else {
        $limit = sizeof($params['data']);
    }
    $params['data'] = array_values($params['data']);
    $str = '
        <table class = "cpanelTable">';
    for ($i = 0; $i < $list_fold_size && $i < $limit; $i++) {
        $title_message = $params['data'][$i]['title'];
        if (mb_strlen($params['data'][$i]['title']) > $max_title_size) {
            $params['data'][$i]['title'] = mb_substr($params['data'][$i]['title'], 0, $max_title_size) . '...';
            //If the project title is large, cut it and append ...
        }
        if (!empty($params['data'][$i]['last_comment']) && $params['data'][$i]['last_comment'] != $_SESSION['s_login']) {
            $last_comment = " [" . _NEWCOMMENT . "]";
        } else {
            $last_comment = "";
        }
        $str .= '
	            <tr><td>
	                    <span class = "counter">' . ($i + 1) . '. </span>';
        if ($_SESSION['s_type'] == "student") {
            // Students may view a project
            $str .= '<a title="' . $title_message . '" href = "student.php?ctg=projects&view_project=' . $params['data'][$i]['id'];
            // Students and professors may have to change lesson session - using the new_lessons_ID parameter for this purpose
            if (isset($params['data'][$i]['show_lessons_id']) && $params['data'][$i]['show_lessons_id'] != 0 && isset($params['data'][$i]['show_lessons_name'])) {
                $str .= '&new_lessons_ID=' . $params['data'][$i]['show_lessons_id'] . '&sbctg=exercises"><b>' . $params['data'][$i]['show_lessons_name'] . '</b>: ' . $params['data'][$i]['title'] . $last_comment . '</a></td>';
            } else {
                $str .= '">' . $params['data'][$i]['title'] . $last_comment . '</a></td>';
            }
            $str .= '<td class = "cpanelTime">';
            $title2 = _DEADLINE . ': #filter:timestamp_time-' . $params['data'][$i]['deadline'] . '#';
            if ($params['data'][$i]['deadline'] > time()) {
                $str .= '<span title = "' . $title2 . '">' . _EXPIRESIN . ' ' . eF_convertIntervalToTime($params['data'][$i]['deadline'] - time(), true) . "</span>";
            } else {
                $str .= '<span title = "' . $title2 . '">' . _EXPIREDBEFORE . ' ' . eF_convertIntervalToTime(time() - $params['data'][$i]['deadline'], true) . "</span>";
            }
            $str .= '</td></tr>';
        } else {
            if (isset($params['data'][$i]['upload_timestamp'])) {
                //from lesson control panel
                $str .= '<a title="' . $title_message . '" href = "professor.php?ctg=projects&project_results=' . $params['data'][$i]['id'] . '">#filter:login-' . $params['data'][$i]['users_LOGIN'] . '# (' . $params['data'][$i]['title'] . ')' . $last_comment . '</a></td>
	                <td class = "cpanelTime">';
                $str .= '<span> ' . eF_convertIntervalToTime(time() - $params['data'][$i]['upload_timestamp'], true) . "&nbsp;" . _AGO . "</span>";
                $str .= '</td></tr>';
            } else {
                //from social page
                $str .= '<a title="' . $title_message . '" href = "professor.php?ctg=projects&lessons_ID=' . $params['data'][$i]['lessons_ID'] . '&project_results=' . $params['data'][$i]['id'] . '">' . $params['data'][$i]['title'] . $last_comment . '</a></td>
						<td class = "cpanelTime">';
                if ($params['data'][$i]['deadline'] > time()) {
                    $str .= '<span title = "' . $title2 . '">' . _EXPIRESIN . ' ' . eF_convertIntervalToTime($params['data'][$i]['deadline'] - time(), true) . "</span>";
                } else {
                    $str .= '<span title = "' . $title2 . '">' . _EXPIREDBEFORE . ' ' . eF_convertIntervalToTime(time() - $params['data'][$i]['deadline'], true) . "</span>";
                }
                $str .= '</td></tr>';
            }
        }
    }
    if ($i == 0) {
        $str .= '
            <tr><td class = "emptyCategory">' . _NOPROJECTS . '</td></tr>
        </table>';
    } else {
        $str .= '
            </table>';
    }
    return $str;
}
 /**
  * Get notification message
  *
  * This function creates the message string for this notification
  * according to its type and its information
  *
  * <br/>Example:
  * <code>
  * $notification = new EfrontNotification(5);       //create object for notification with id 5
  * $notification -> createMessage();
  * echo $notification -> notification['message'];
  * </code>
  *
  * @param array with all modules to optimize module message printing
  * @returns the message value also set to the $this -> notification['message'] field
  * @since 3.6.0
  * @access public
  */
 public function createMessage($modulesArray = false)
 {
     global $currentUser;
     if ($this->notification['type'] >= EfrontNotification::MODULE_BASE_TYPE_CODE) {
         $className = $this->notification['entity_ID'];
         if (isset($modulesArray[$className])) {
             $data = array();
             if ($this->notification['entity_name'] != '') {
                 $data = unserialize($this->notification['entity_name']);
             }
             foreach ($this->notification as $field => $value) {
                 $data[$field] = $value;
             }
             $this->notification['message'] = $modulesArray[$className]->getNotificationMessage((int) $this->notification['type'] - EfrontNotification::MODULE_BASE_TYPE_CODE, $data);
         }
         if (!$this->notification['message']) {
             $this->notification['message'] = _UNREGISTEREDEVENT . " " . _FORTHEMODULE . " '" . $className . "'";
         }
     } else {
         $this->notification['message'] = _NAMEARTICLE . " <b><a  href = \"" . $currentUser->getType() . ".php?ctg=social&op=show_profile&user="******"&popup=1\" onclick = \"eF_js_showDivPopup(event, '" . _USERPROFILE . "', 1)\"  target = \"POPUP_FRAME\"> " . $this->notification['users_name'] . " " . $this->notification['users_surname'] . "</a></b> ";
         if ($this->notification['type'] == EfrontNotification::LESSON_ACQUISITION_AS_STUDENT) {
             $this->notification['message'] .= _WASASSIGNEDTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
         } else {
             if ($this->notification['type'] == EfrontNotification::LESSON_ACQUISITION_AS_PROFESSOR) {
                 $this->notification['message'] .= _WILLBETEACHINGLESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
             } else {
                 if ($this->notification['type'] == EfrontNotification::LESSON_COMPLETION) {
                     $this->notification['message'] .= _HASCOMPLETEDLESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                 } else {
                     if ($this->notification['type'] == EfrontNotification::LESSON_PROGRESS_RESET) {
                         $this->notification['message'] .= _WASBEINGRESETLESSONPROGRESS . " <b>" . $this->notification['lessons_name'] . "</b>";
                     } else {
                         if ($this->notification['type'] == EfrontNotification::LESSON_REMOVAL) {
                             $this->notification['message'] .= _NOLONGERATTENDSLESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                         } else {
                             if ($this->notification['type'] == EfrontNotification::NEW_COMMENT_WRITING) {
                                 $this->notification['message'] .= _WROTEACOMMENTFORUNIT . " <b>" . $this->notification['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                             } else {
                                 if ($this->notification['type'] == EfrontNotification::TEST_COMPLETION) {
                                     $this->notification['message'] .= _COMPLETEDTEST . " <b>" . $this->notification['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                 } else {
                                     if ($this->notification['type'] == EfrontNotification::TEST_FAILURE) {
                                         $this->notification['message'] .= _FAILEDTEST . " <b>" . $this->notification['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                     } else {
                                         if ($this->notification['type'] == EfrontNotification::TEST_MARKED) {
                                             $this->notification['message'] .= _MARKEDTEST . " <b>" . $this->notification['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                         } else {
                                             if ($this->notification['type'] == EfrontNotification::TEST_CREATION) {
                                                 $this->notification['message'] .= _CREATEDTHETEST . " <b>" . $this->notification['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                             } else {
                                                 if ($this->notification['type'] == EfrontNotification::NEW_FORUM) {
                                                     $this->notification['message'] .= _CREATEDTHENEWFORUM . " <b>" . $this->notification['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                                 } else {
                                                     if ($this->notification['type'] == EfrontNotification::NEW_TOPIC) {
                                                         $this->notification['message'] .= _CREATEDTHENEWTOPIC . " <b>" . $this->notification['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                                     } else {
                                                         if ($this->notification['type'] == EfrontNotification::NEW_POLL) {
                                                             $this->notification['message'] .= _CREATEDTHENEWPOLL . " <b>" . $this->notification['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                                         } else {
                                                             if ($this->notification['type'] == EfrontNotification::NEW_FORUM_MESSAGE_POST) {
                                                                 $this->notification['message'] .= _POSTEDTHENEWMESSAGE . " <b>" . $this->notification['entity_name'] . "</b> " . _INTHEFORUMOFTHELESSON . " <b>" . $this->notification['lessons_name'] . "</b>";
                                                             } else {
                                                                 if ($this->notification['type'] == EfrontNotification::STATUS_CHANGE) {
                                                                     $this->notification['message'] .= _CHANGEDHISHERPROFILE;
                                                                 } else {
                                                                     if ($this->notification['type'] == EfrontNotification::AVATAR_CHANGE) {
                                                                         $this->notification['message'] .= _CHANGEDHISHERAVATARPICTURE;
                                                                     } else {
                                                                         if ($this->notification['type'] == EfrontNotification::PROFILE_CHANGE) {
                                                                             $this->notification['message'] .= _CHANGEDHISHERPROFILE;
                                                                         } else {
                                                                             if ($this->notification['type'] == EfrontNotification::NEW_PROFILE_COMMENT_FOR_OTHER) {
                                                                                 $this->notification['message'] .= _COMMENTEDONTHEPROFILEOF;
                                                                                 // Here check whether this is your own profile or not
                                                                                 if ($this->notification['entity_ID'] != $currentUser->user['login']) {
                                                                                     $this->notification['message'] .= " <b><a  href = \"" . $currentUser->getType() . ".php?ctg=social&op=show_profile&user="******"&popup=1\" onclick = \"eF_js_showDivPopup(event, '" . _USERPROFILE . "', 1)\"  target = \"POPUP_FRAME\"> " . $this->notification['entity_name'] . "</a></b> ";
                                                                                 } else {
                                                                                     $this->notification['message'] .= " <b>" . $this->notification['entity_name'] . "</b>";
                                                                                 }
                                                                             } else {
                                                                                 if ($this->notification['type'] == EfrontNotification::NEW_PROFILE_COMMENT_FOR_SELF) {
                                                                                     $this->notification['message'] .= _COMMENTEDONHISHEROWNPROFILE;
                                                                                 } else {
                                                                                     if ($this->notification['type'] == EfrontNotification::DELETE_PROFILE_COMMENT_FOR_SELF) {
                                                                                         $this->notification['message'] .= _DELETEDACOMMENTFROMHISHEROWNPROFILE;
                                                                                     } else {
                                                                                         if ($this->notification['type'] == EfrontNotification::NEW_POST_FOR_LESSON_TIMELINE_TOPIC) {
                                                                                             $topic_post = unserialize($this->notification['entity_name']);
                                                                                             $this->notification['message'] .= _POSTEDFORLESSONTOPIC . " <b>" . $topic_post['topic_title'] . "</b> " . _THEPOST . ": " . $topic_post['data'];
                                                                                             if ($this->notification['users_LOGIN'] == $GLOBALS['currentUser']->user['login']) {
                                                                                                 $this->notification['editlink'] = "<a href='" . $_SESSION['s_type'] . ".php?ctg=social&op=timeline&lessons_ID=" . $this->notification['lessons_ID'] . "&post_topic=" . $this->notification['entity_ID'] . "&action=change&popup=1&id=" . $topic_post['post_id'] . "' onclick = 'eF_js_showDivPopup(event, \"" . _EDITMESSAGEFORLESSONTIMELINETOPIC . "\", 1)'  target = 'POPUP_FRAME'><img src='images/16x16/edit.png' border='0' alt = '" . _EDITMESSAGEFORLESSONTIMELINETOPIC . "' title='" . _EDITMESSAGEFORLESSONTIMELINETOPIC . "' /></a>";
                                                                                                 $this->notification['deletelink'] = "<a href='" . $_SESSION['s_type'] . ".php?ctg=social&op=timeline&lessons_ID=" . $this->notification['lessons_ID'] . "&post_topic=" . $this->notification['entity_ID'] . "&action=delete&id=" . $topic_post['post_id'] . "'><img src='images/16x16/error_delete.png' border='0' alt = '" . _DELETEMESSAGEFORLESSONTIMELINETOPIC . "' title='" . _DELETEMESSAGEFORLESSONTIMELINETOPIC . "' /></a>";
                                                                                             }
                                                                                         } else {
                                                                                             if ($this->notification['type'] == EfrontNotification::DELETE_POST_FROM_LESSON_TIMELINE) {
                                                                                                 $this->notification['message'] .= _DELETEDAPOSTFORLESSONTOPIC . " " . $this->notification['entity_name'];
                                                                                             } else {
                                                                                                 $this->notification['message'] = _UNREGISTEREDEVENT;
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->notification['time'] = eF_convertIntervalToTime(time() - $this->notification['timestamp'], true) . ' ' . _AGO;
     return $this->notification['message'];
 }
Exemplo n.º 16
0
 }
 foreach ($questions as $key => $question) {
     $names = array();
     if ($question['content_ID'] && isset($currentContent)) {
         if (!isset($names[$question['content_ID']])) {
             foreach ($iterator = new EfrontAttributeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($currentContent->getNodeAncestors($question['content_ID']))), array('name')) as $k => $v) {
                 $names[$question['content_ID']][] = $v;
             }
         }
         $questions[$key]['parent_unit'] = implode("&nbsp;&raquo;&nbsp;", array_reverse($names[$question['content_ID']]));
     } else {
         $questions[$key]['parent_unit'] = "";
     }
     $questions[$key]['text'] = strip_tags($question['text']);
     //Strip tags from the question text, so they do not display in the list
     $questions[$key]['estimate_interval'] = eF_convertIntervalToTime($questions[$key]['estimate']);
     $questions[$key]['lesson_name'] = $lessons[$question['lessons_ID']]['name'];
     if ($_GET['ctg'] == 'feedback' && $question['type'] == 'true_false') {
         unset($questions[$key]);
     }
 }
 //remove questions from inactive and archived lessons
 if ($skillgap_tests) {
     $questionsTemp = array();
     //remove inactive and archived lessons
     $result = eF_getTableDataFlat("lessons", "id", "active=0 OR archive!=''");
     if (!empty($result['id'])) {
         foreach ($questions as $key => $value) {
             if (in_array($value['lessons_ID'], $result['id']) === false) {
                 $questionsTemp[] = $questions[$key];
             }
Exemplo n.º 17
0
    /**
     * Create question counter
     *
     * This function is used to print a small count-down counter for the question's remaining time
     * <br/>Example:
     * <code>
     * $counterString = $question -> getCounter();
     * </code>
     *
     * @return string The count-down counter code
     * @since 3.5.4
     * @access public
     */
    public function getCounter()
    {
        if ($this->question['estimate']) {
            $timeInterval = $this->question['estimate_interval'];
            $duration = $this->question['estimate'];
            if (isset($this->time)) {
                $timeInterval = eF_convertIntervalToTime($this->time);
                //The time spent in this question
                $duration = $this->time;
            }
            $counterStr = '
                <script language = "JavaScript" type = "text/javascript">
                	questionHours[' . $this->question['id'] . ']    = "' . $timeInterval['hours'] . '";
                    questionMinutes[' . $this->question['id'] . ']  = "' . $timeInterval['minutes'] . '";
                    questionSeconds[' . $this->question['id'] . ']  = "' . $timeInterval['seconds'] . '";
                    questionDuration[' . $this->question['id'] . '] = "' . $duration . '";

                    questionMin[' . $this->question['id'] . ']     = new String(3);
                    questionSec[' . $this->question['id'] . ']     = new String(3);
                    //eF_js_printQuestionTimer(' . $this->question['id'] . ');
				</script>';
            return $counterStr;
        } else {
            return false;
        }
    }
Exemplo n.º 18
0
 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     $currentUser = $this->getCurrentUser();
     if ($currentUser->user['user_type'] != 'administrator') {
         $currentEmployee = $this->getCurrentUser()->aspects['hcd'];
         if (!$currentEmployee || !$currentEmployee->isSupervisor()) {
             throw new Exception("You cannot access this module");
         }
     }
     $form = new HTML_QuickForm("user_activity_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_idle_users&tab=user_activity", "", null, true);
     $form->addElement('date', 'idle_from_timestamp', _MODULE_IDLE_USERS_SHOWINACTIVEUSERSSINCE, array('minYear' => 2005, 'maxYear' => date("Y")));
     $form->addElement("static", "", '<a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . date("m") . ',' . (date("d") - 7) . ')">' . _LASTWEEK . '</a> - <a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . (date("m") - 1) . ',' . date("d") . ')">' . _LASTMONTH . '</a> - <a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . (date("m") - 3) . ',' . date("d") . ')">' . _MODULE_IDLE_USERS_LAST3MONTHS . '</a>');
     $form->addElement("submit", "submit", _SUBMIT, 'class = "flatButton"');
     if (!isset($_SESSION['timestamp_from'])) {
         $_SESSION['timestamp_from'] = time() - 86400 * 30;
     }
     $form->setDefaults(array("idle_from_timestamp" => $_SESSION['timestamp_from']));
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->exportValues();
         $_SESSION['timestamp_from'] = mktime(0, 0, 0, $values['idle_from_timestamp']['M'], $values['idle_from_timestamp']['d'], $values['idle_from_timestamp']['Y']);
     }
     $smarty->assign("T_IDLE_USER_FORM", $form->toArray());
     try {
         if ($currentEmployee) {
             if ($_SESSION['s_current_branch'] && in_array($_SESSION['s_current_branch'], $currentEmployee->supervisesBranches)) {
                 $currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
                 $subbranches = $currentBranch->getSubbranches();
                 foreach ($subbranches as $subbranch) {
                     $branches[$subbranch['branch_ID']] = $subbranch['branch_ID'];
                 }
                 $branches[$_SESSION['s_current_branch']] = $_SESSION['s_current_branch'];
                 $result = eF_getTableData("users u JOIN module_hcd_employee_works_at_branch ewb on ewb.users_login=u.login", "u.login,u.name,u.surname,u.active,u.last_login as last_action", "ewb.branch_ID in (" . implode(',', $branches) . ") and u.last_login is null or u.last_login <= " . $_SESSION['timestamp_from']);
                 //$result = eF_getTableData("(select login,name,surname,active,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 group by login) r join module_hcd_employee_works_at_branch ewb on ewb.users_login=r.login", "*", "ewb.branch_ID in (".implode(',', $branches) .") and (r.last_action is null or r.last_action <= ".$_SESSION['timestamp_from'].")");
             } else {
                 $result = eF_getTableData("users u JOIN module_hcd_employee_works_at_branch ewb on ewb.users_login=u.login", "u.login,u.name,u.surname,u.active,u.last_login as last_action", "ewb.branch_ID in (" . implode(',', $currentEmployee->supervisesBranches) . ") and u.last_login is null or u.last_login <= " . $_SESSION['timestamp_from']);
                 //$result = eF_getTableData("(select login,name,surname,active,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 group by login) r join module_hcd_employee_works_at_branch ewb on ewb.users_login=r.login", "*", "ewb.branch_ID in (".implode(',', $currentEmployee->supervisesBranches).") and (r.last_action is null or r.last_action <= ".$_SESSION['timestamp_from'].")");
             }
         } else {
             $result = eF_getTableData("users", "login,name,surname,active,last_login as last_action", "last_login is null or last_login <= " . $_SESSION['timestamp_from']);
         }
         $users = array();
         foreach ($result as $value) {
             if ($value['last_action']) {
                 $value['last_action_since'] = eF_convertIntervalToTime(time() - $value['last_action'], true);
             } else {
                 $value['last_action_since'] = null;
             }
             $users[$value['login']] = $value;
         }
         foreach ($users as $key => $value) {
             if (isset($_COOKIE['toggle_active'])) {
                 if ($_COOKIE['toggle_active'] == 1 && !$value['active'] || $_COOKIE['toggle_active'] == -1 && $value['active']) {
                     unset($users[$key]);
                 }
             }
         }
         if (isset($_GET['excel'])) {
             $export_users[] = array(_USER, _MODULE_IDLE_USERS_LASTACTION, _STATUS);
             foreach ($users as $key => $value) {
                 $value['last_action'] ? $last_action = formatTimestamp($value['last_action']) : ($last_action = _NEVER);
                 $value['active'] ? $status = _ACTIVE : ($status = _INACTIVE);
                 $export_users[] = array(formatLogin($value['login']), $last_action, $status);
             }
             EfrontSystem::exportToCsv($export_users, true);
             exit;
         }
         if ($_GET['ajax'] == 'idleUsersTable') {
             list($tableSize, $users) = filterSortPage($users);
             $smarty->assign("T_SORTED_TABLE", $_GET['ajax']);
             $smarty->assign("T_TABLE_SIZE", $tableSize);
             $smarty->assign("T_DATA_SOURCE", $users);
         }
         if (isset($_GET['ajax']) && isset($_GET['archive_user'])) {
             if (isset($users[$_GET['archive_user']])) {
                 $user = EfrontUserFactory::factory($_GET['archive_user']);
                 $user->archive();
             }
             exit;
         } else {
             if (isset($_GET['ajax']) && isset($_GET['archive_all_users'])) {
                 //eF_updateTableData("users", array("archive" => 1, "active" => 0), "login in (select login from (select login,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 and u.login != '".$_SESSION['s_login']."' group by login) r where r.last_action <= ".$_SESSION['timestamp_from']." or r.last_action is null)");
                 foreach ($users as $value) {
                     eF_updateTableData("users", array("archive" => 1, "active" => 0), "login='******'login'] . "'");
                 }
                 exit;
             } else {
                 if (isset($_GET['ajax']) && isset($_GET['toggle_user'])) {
                     if (isset($users[$_GET['toggle_user']])) {
                         $user = EfrontUserFactory::factory($_GET['toggle_user']);
                         if ($user->user['active']) {
                             $user->deactivate();
                         } else {
                             $user->activate();
                         }
                         echo json_encode(array('status' => 1, 'active' => $user->user['active']));
                     }
                     exit;
                 } else {
                     if (isset($_GET['ajax']) && isset($_GET['deactivate_all_users'])) {
                         //eF_updateTableData("users", array("active" => 0), "login in (select login from (select login,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 and u.login != '".$_SESSION['s_login']."' group by login) r where r.last_action <= ".$_SESSION['timestamp_from']." or r.last_action is null)");
                         foreach ($users as $value) {
                             eF_updateTableData("users", array("active" => 0), "login='******'login'] . "'");
                         }
                         exit;
                     }
                 }
             }
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
     return true;
 }
Exemplo n.º 19
0
     $current_course->course['remaining'] = 0;
 } else {
     if ($current_course->options['duration'] && $check_completed_course[0]['active_in_course']) {
         if ($check_completed_course[0]['active_in_course'] < $current_course->course['start_date']) {
             $check_completed_course[0]['active_in_course'] = $current_course->course['start_date'];
         }
         $current_course->course['remaining'] = $check_completed_course[0]['active_in_course'] + $current_course->options['duration'] * 3600 * 24 - time();
         if ($current_course->course['end_date'] && $current_course->course['end_date'] < $check_completed_course[0]['active_in_course'] + $current_course->options['duration'] * 3600 * 24) {
             $current_course->course['remaining'] = $current_course->course['end_date'] - time();
         }
     } else {
         $current_course->course['remaining'] = null;
     }
 }
 if (!empty($current_course->course['remaining'])) {
     $smarty->assign("T_COURSE_USER_REMAINING_STRING", '<span style = "font-style:italic">&nbsp;(' . eF_convertIntervalToTime($current_course->course['remaining'], true) . ' ' . mb_strtolower(_REMAINING) . ')</span>');
 }
 //Added code to check course completion in case course must have been completed but it is not (remove lesson from course after all other lessons were completed)
 if ($userProgress['completed'] && $current_course->options['auto_complete'] && !$check_completed_course[0]['completed']) {
     $constraints = array('archive' => false, 'active' => true, 'return_objects' => false);
     $courseLessons = $current_course->getCourseLessons($constraints);
     if (!empty($courseLessons)) {
         $userLessons = array();
         $result = eF_getTableData("users_to_lessons", "lessons_ID,completed,score", "users_LOGIN='******'s_login'] . "' and lessons_ID IN (" . implode(',', array_keys($courseLessons)) . ")");
         foreach ($result as $value) {
             if ($userLessons[$value['lessons_ID']] = $value) {
             }
         }
         $completed = $score = array();
         foreach ($courseLessons as $lessonId => $value) {
             $userLessons[$lessonId]['completed'] ? $completed[] = 1 : ($completed[] = 0);
Exemplo n.º 20
0
 foreach ($related_users_events as $events) {
     $login = $events['users_LOGIN'];
     // The first value will be the one to set - the most recent - the rest will be disregarded
     if (!isset($my_related_users[$login]['timestamp'])) {
         $my_related_users[$login]['timestamp'] = $events['timestamp'];
     }
 }
 $my_related_users = eF_multiSort($my_related_users, $_GET['sort'], $order);
 if (isset($_GET['filter'])) {
     $my_related_users = eF_filterData($my_related_users, $_GET['filter']);
 }
 //	   $this -> event['time'] =
 $filtered_users_array = array();
 foreach ($my_related_users as $login => $user) {
     if ($user['timestamp']) {
         $my_related_users[$login]['time_ago'] = eF_convertIntervalToTime(time() - $user['timestamp'], true) . ' ' . _AGO;
         $filtered_users_array[] = $login;
     } else {
         // For the most recently changed display, remove the ones that have not changed their display
         if ($sort == 'timestamp' && $_GET['display'] != "2") {
             unset($my_related_users[$login]);
         } else {
             $filtered_users_array[] = $login;
         }
     }
 }
 $common_lessons_result = eF_getTableData("users_to_lessons as ul1, users_to_lessons as ul2", "ul2.users_LOGIN, count(ul1.users_LOGIN) as common_lessons", "ul1.archive=0 and ul2.archive=0 and ul1.users_LOGIN = '******'login'] . "' AND ul2.users_LOGIN IN ('" . implode("','", $filtered_users_array) . "') AND ul1.lessons_ID = ul2.lessons_ID", "", "ul2.users_LOGIN");
 foreach ($common_lessons_result as $common_lessons) {
     $my_related_users[$common_lessons['users_LOGIN']]['common_lessons'] = $common_lessons['common_lessons'];
 }
 $count = sizeof($my_related_users);
Exemplo n.º 21
0
 /**
  * Get statistic information about scorm tests
  *
  * This returns statistic info for a scorm test
  * <br/>Example:
  * <code>
  * $tests = array(2, 4);
  * $info = EfrontStats :: getScomTestInfo($tests);                   //Get information for tests 2,4
  * </code>
  * @param mixed $tests Either an array of tests id or false (request information for all existing tests)
  * @return array the tests' statistic info
  * @since 3.5.0
  * @access public
  * @static
  */
 public static function getScormTestInfo($tests = false, $categories = false, $show_all = false)
 {
     $tests_info = array();
     if ($tests === false) {
         $tests = eF_getTableDataFlat("content", "id", "ctg_type='scorm_test'");
         $tests = $tests['id'];
     } else {
         if (!is_array($tests)) {
             $tests = array($tests);
         }
     }
     $lessonNames = eF_getTableDataFlat("lessons", "id,name");
     sizeof($lessonNames) > 0 ? $lessonNames = array_combine($lessonNames['id'], $lessonNames['name']) : ($lessonNames = array());
     $result = eF_getTableData("users", "name, surname, login");
     $users = array();
     foreach ($result as $user) {
         $users[$user['login']] = $user;
     }
     foreach ($tests as $id) {
         $testInfo = array();
         $unit = new EfrontUnit($id);
         $result = eF_getTableData("scorm_data", "*", "content_ID={$id} and (users_LOGIN is null or users_LOGIN='')");
         $testInfo['general']['content_ID'] = $id;
         $testInfo['general']['id'] = $id;
         $testInfo['general']['name'] = $unit->offsetGet('name');
         $testInfo['general']['scorm'] = 1;
         $testInfo['general']['lesson_name'] = $lessonNames[$unit->offsetGet('lessons_ID')];
         if ($result[0]['maxtimeallowed']) {
             $time_parts = explode(":", $result[0]['maxtimeallowed']);
             $testInfo['general']['duration'] = $time_parts[0] * 3600 + $time_parts[1] * 60 + $time_parts[2];
             $testInfo['general']['duration_str'] = eF_convertIntervalToTime($testInfo['general']['duration']);
         } else {
             $testInfo['general']['duration'] = '';
             $testInfo['general']['duration_str'] = eF_convertIntervalToTime($testInfo['general']['duration']);
         }
         // Create results score categories
         if ($categories) {
             $testInfo['score_categories'] = array();
             $step = 100 / $categories;
             for ($i = 0; $i < $categories; $i++) {
                 $testInfo['score_categories'][$i] = array("from" => $i * $step, "to" => ($i + 1) * $step, "count" => 0);
                 if ($i == $categories - 1) {
                     $testInfo['score_categories'][$i]["to"] = 100;
                 }
             }
         }
         $testInfo['done'] = array();
         $done_info = eF_getTableData("scorm_data d, users u", "d.users_LOGIN, u.name, u.surname, d.score, d.timestamp, d.lesson_status, d.masteryscore, d.minscore, d.maxscore", "d.lesson_status != 'incomplete' and d.users_LOGIN = u.LOGIN and d.content_ID = {$id}");
         foreach ($done_info as $done) {
             $done_test = array();
             $done_test['users_LOGIN'] = $done['users_LOGIN'];
             $done_test['name'] = $done['name'];
             $done_test['surname'] = $done['surname'];
             $done_test['timestamp'] = $done['timestamp'];
             $done_test['status'] = $done['lesson_status'];
             $done_test['mastery_score'] = $done['masteryscore'];
             if (is_numeric($done['minscore']) && is_numeric($done['maxscore'])) {
                 $done_test['score'] = 100 * $done['score'] / ($done['minscore'] + $done['maxscore']);
             } else {
                 $done_test['score'] = $done['score'];
             }
             //$done_test['score']         = $done['score'];
             $testInfo['done'][] = $done_test;
             if ($categories) {
                 $stat_cat = $done_test['score'] / $step;
                 $testInfo['score_categories'][$stat_cat >= $categories ? $categories - 1 : $stat_cat]["count"]++;
             }
         }
         if ($categories) {
             $doneTestsCount = sizeof($testInfo['done']);
             $sum_count = $doneTestsCount;
             // counts how many users have score equal or above each score_category
             if ($sum_count > 0) {
                 foreach ($testInfo['score_categories'] as $key => $score) {
                     $testInfo['score_categories'][$key]['percent'] = round(100 * ($testInfo['score_categories'][$key]['count'] / $doneTestsCount), 2);
                     $testInfo['score_categories'][$key]['sum_count'] = $sum_count;
                     $testInfo['score_categories'][$key]['sum_count_percent'] = round(100 * ($sum_count / $doneTestsCount), 2);
                     $sum_count -= $testInfo['score_categories'][$key]['count'];
                 }
             }
         }
         $tests_info[$id] = $testInfo;
     }
     return $tests_info;
 }
Exemplo n.º 22
0
    /**
     * Convert course to HTML list
     *
     * This function converts the course to an HTML list
     * with the lessons it contains.
     * <br/>Example:
     * <code>
     * $course -> toHTML();
     * </code>
     *
     * @param array $userInfo User information to customize data for
     * @param $options Specific display options
     * @return string The HTML code of the course list
     * @since 3.5.0
     * @access public
     * @todo convert to smarty template
     */
    public function toHTML($lessons = false, $options = array(), $checkLessons = array(), $meets_depends_on_criteria = true)
    {
        !isset($options['courses_link']) ? $options['courses_link'] = false : null;
        !isset($options['lessons_link']) ? $options['lessons_link'] = false : null;
        /*	if (isset($options['collapse']) && $options['collapse'] == 2) {
        			$display 			= '';
        			$display_lessons 	= 'style = "display:none"';
        			$imageString = 'down';
        		} elseif (isset($options['collapse']) && $options['collapse'] == 1) {
        			$display 			= 'style = "display:none"';
        			$display_lessons 	= 'style = "display:none"';
        			$classString = ' class = "visible" ';
        			$imageString = 'up';
        		} else {
        			$display 			= '';
        			$display_lessons 	= '';
        			$classString = ' class = "visible" ';
        			$imageString = 'up';
        		}
        	*/
        $display = '';
        $display_lessons = '';
        $classString = ' class = "visible" ';
        $imageString = 'up';
        $roles = EfrontLessonUser::getLessonsRoles();
        $roleNames = EfrontLessonUser::getLessonsRoles(true);
        if ($this->course['user_type']) {
            $roleBasicType = $roles[$this->course['user_type']];
            //The basic type of the user's role in the course
        } else {
            $roleBasicType = null;
        }
        $courseLessons = $this->getCourseLessons();
        if ($lessons) {
            foreach ($courseLessons as $key => $value) {
                $courseLessons[$key]->lesson = array_merge($lessons[$key]->lesson, $courseLessons[$key]->lesson);
            }
        }
        if ($roleBasicType == 'student') {
            // fixed to apply checkRules to sub-student user types
            if (empty($checkLessons)) {
                $checkLessons = $courseLessons;
            } else {
                foreach ($courseLessons as $key => $value) {
                    if (isset($checkLessons[$key])) {
                        $checkLessons[$key]->lesson['start_date'] = $value->lesson['start_date'];
                        $checkLessons[$key]->lesson['end_date'] = $value->lesson['end_date'];
                        $checkLessons[$key]->lesson['start_period'] = $value->lesson['start_period'];
                        $checkLessons[$key]->lesson['end_period'] = $value->lesson['end_period'];
                        $temp[$key] = $checkLessons[$key];
                        //bring them in the correct order
                    }
                }
                $checkLessons = $temp;
            }
            $eligible = $this->checkRules($this->course['users_LOGIN'], $checkLessons);
        } else {
            if (sizeof($courseLessons) > 0) {
                $eligible = array_combine(array_keys($courseLessons), array_fill(0, sizeof($courseLessons), 1));
                //All lessons set to true
            } else {
                $eligible = array();
            }
        }
        //$eligible = array_combine(array_keys($this -> getLessons()), array_fill(0, sizeof($this -> getLessons()), 1));    //All lessons set to true
        foreach ($eligible as $lessonId => $value) {
            $eligible[$lessonId] = $courseLessons[$lessonId];
            $eligible[$lessonId]->eligible = $value;
        }
        $courseString = '
                        <table class = "coursesTable" >
                            <tr class = "lessonsList"  >

                            	<td>
                                    <img id = "course_img' . $this->course['id'] . '" src = "images/32x32/courses.png">';
        if (!isset($this->course['from_timestamp']) || $this->course['from_timestamp']) {
            if ($options['courses_link'] && $options['courses_link'] === true) {
                $coursesLink = basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=course_info';
            } else {
                if ($options['courses_link']) {
                    $coursesLink = str_replace("#user_type#", $roleBasicType, $options['courses_link']) . $this->course['id'];
                } elseif ($options['tooltip']) {
                    $coursesLink = 'javascript:void(0)';
                } else {
                    $coursesLink = '';
                }
            }
            if (EfrontUser::isOptionVisible('tooltip')) {
                if ($options['tooltip']) {
                    $courseString .= '
										<a href = "' . $coursesLink . '" class = "info" url = "ask_information.php?courses_ID=' . $this->course['id'] . '" >
											<span class = "listName">' . $this->course['name'] . '</span>
										</a>';
                } else {
                    $options['courses_link'] ? $courseString .= '<a href = "' . $coursesLink . '">' . $this->course['name'] . '</a>' : ($courseString .= $this->course['name']);
                }
            } else {
                $courseString .= $this->course['name'];
            }
        } else {
            $courseString .= '<a href = "javascript:void(0)" class = "inactiveLink" title = "' . _CONFIRMATIONPEDINGFROMADMIN . '">' . $this->course['name'] . '</a>';
        }
        if ($this->course['different_role']) {
            $courseString .= '<span class = "courseRole">&nbsp;(' . $roleNames[$this->course['user_type']] . ')</span>';
        }
        if ($this->course['module_restriction_message']) {
            $courseString .= '<span style = "vertical-align:middle">&nbsp;(' . $this->course['module_restriction_message'] . ')</span>';
            if ($roleBasicType == 'student') {
                foreach ($eligible as $lessonId => $value) {
                    $eligible[$lessonId]->eligible = false;
                }
            }
        } else {
            if ($this->course['start_date'] > time()) {
                $courseString .= '<span style = "vertical-align:middle">&nbsp;(' . _COURSESTARTSAT . ' ' . formatTimestamp($this->course['start_date'], 'time_nosec') . ')</span>';
                if ($roleBasicType == 'student') {
                    foreach ($eligible as $lessonId => $value) {
                        $eligible[$lessonId]->eligible = false;
                    }
                }
            } elseif (!is_null($this->course['remaining']) && $roleBasicType == 'student') {
                if ($this->course['remaining'] > 0) {
                    $courseString .= '<span style = "vertical-align:middle">&nbsp;(' . eF_convertIntervalToTime($this->course['remaining'], true) . ' ' . mb_strtolower(_REMAINING) . ')</span>';
                } else {
                    $courseString .= '<span style = "vertical-align:middle">&nbsp;(' . _ACCESSEXPIRED . ')</span>';
                    foreach ($eligible as $lessonId => $value) {
                        $eligible[$lessonId]->eligible = false;
                    }
                }
            }
        }
        if (!$meets_depends_on_criteria && $this->course['depends_on'] && $roleBasicType == 'student') {
            foreach ($eligible as $lessonId => $value) {
                $eligible[$lessonId]->eligible = false;
            }
        }
        $courseOptions = array();
        if ($roleBasicType == 'professor') {
            if (!isset($GLOBALS['currentUser']->coreAccess['course_settings']) || $GLOBALS['currentUser']->coreAccess['course_settings'] != 'hidden') {
                $autocompleteImage = '16x16/certificate.png';
                if (G_VERSIONTYPE == 'community') {
                    #cpp#ifdef COMMUNITY
                    $autocompleteImage = '16x16/autocomplete.png';
                }
                #cpp#endif
                $courseOptions['information'] = '<img src = "images/16x16/information.png" title = "' . _COURSEINFORMATION . '" alt = "' . _COURSEINFORMATION . '" class = "ajaxHandle" onclick = "location = \'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=course_info\'" />&nbsp;';
                $courseOptions['completion'] = '<img src = "images/' . $autocompleteImage . '" title = "' . _COMPLETION . '" alt = "' . _COMPLETION . '" class = "ajaxHandle" onclick = "location = \'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=course_certificates\'" />&nbsp;';
                $courseOptions['rules'] = '<img src = "images/16x16/rules.png" title = "' . _COURSERULES . '" alt = "' . _COURSERULES . '" class = "ajaxHandle" onclick = "location=\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=course_rules\'" />&nbsp;';
                $courseOptions['order'] = '<img src = "images/16x16/order.png" title = "' . _COURSEORDER . '" alt = "' . _COURSEORDER . '" class = "ajaxHandle" onclick = "location=\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=course_order\'" />&nbsp;';
                $courseOptions['schedule'] = '<img src = "images/16x16/calendar.png" title = "' . _COURSESCHEDULE . '" alt = "' . _COURSESCHEDULE . '" class = "ajaxHandle" onclick = "location=\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=course_scheduling\'" />&nbsp;';
                if (!isset($GLOBALS['currentUser']->coreAccess['course_settings']) || $GLOBALS['currentUser']->coreAccess['course_settings'] == 'change') {
                    $courseOptions['export'] = '<img src = "images/16x16/export.png" title = "' . _EXPORTCOURSE . '" alt = "' . _EXPORTCOURSE . '" class = "ajaxHandle" onclick = "location=\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=export_course\'" />&nbsp;';
                    $courseOptions['import'] = '<img src = "images/16x16/import.png" title = "' . _IMPORTCOURSE . '" alt = "' . _IMPORTCOURSE . '" class = "ajaxHandle" onclick = "location=\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=import_course\'" />&nbsp;';
                }
                foreach ($GLOBALS['currentUser']->getModules() as $module) {
                    if ($moduleTabPage = $module->getTabPageSmartyTpl('course_settings')) {
                        $courseOptions[$moduleTabPage['tab_page']] = '<img src = "' . $moduleTabPage['image'] . '" title = "' . $moduleTabPage['title'] . '" alt = "' . $moduleTabPage['title'] . '" class = "ajaxHandle" onclick = "location=\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&op=' . $moduleTabPage['tab_page'] . '\'"/>&nbsp;';
                    }
                }
                $courseString .= '<span style = "margin-left:30px">(' . _COURSEACTIONS . ': ' . implode('', $courseOptions) . ')</span>';
            }
        } else {
            if ($this->course['completed']) {
                $courseOptions['completed'] = '<img src = "images/16x16/success.png" title = "' . _COURSECOMPLETED . ': ' . formatTimestamp($this->course['to_timestamp'], 'time') . '" alt = "' . _COURSECOMPLETED . ': ' . formatTimestamp($this->course['to_timestamp'], 'time') . '">&nbsp;';
            }
            if ($this->course['issued_certificate']) {
                $dateTable = unserialize($this->course['issued_certificate']);
                $certificateExportMethod = $this->options['certificate_export_method'];
                if (G_VERSIONTYPE != 'community') {
                    #cpp#ifndef COMMUNITY
                    if ($this->course['certificate_expiration'] != "" && $this->course['certificate_expiration'] != 0) {
                        //$dateFormat = eF_dateFormat();
                        if (eF_checkParameter($dateTable['date'], 'timestamp')) {
                            //new way that issued date saves
                            //$expirationTimestamp = $this -> course['certificate_expiration'] + $dateTable['date'];
                            $expirationArray = convertTimeToDays($this->course['certificate_expiration']);
                            $expirationTimestamp = getCertificateExpirationTimestamp($dateTable['date'], $expirationArray);
                        } else {
                            //old way..works only for english
                            $expirationTimestamp = $this->course['certificate_expiration'] + strtotime($dateTable['date']);
                        }
                        $dateExpire = formatTimestamp($expirationTimestamp);
                        $tooltipCourseString = "<strong>" . _CERTIFICATEISSUEDON . ":</strong>&nbsp;" . formatTimestamp($dateTable['date']) . "<br /><strong>" . ($expirationTimestamp > time() ? _CERTIFICATEEXPIRESON : _CERTIFICATEEXPIREDON) . ":</strong>&nbsp;" . $dateExpire . "<br /><strong>" . _RESETCOURSEAFTEREXPIRATION . ":</strong>&nbsp;" . ($this->course['reset'] == 1 ? _YES : _NO);
                        if ($expirationTimestamp > time()) {
                            $courseOptions['certificate'] = '<img class = "ajaxHandle info" src = "images/16x16/certificate.png" title = "' . _COURSECERTIFICATE . '" alt = "' . _COURSECERTIFICATE . '" onclick = "window.open(\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&export=' . $certificateExportMethod . '&user='******'users_LOGIN'] . '\')" onmouseover = "new Tip(this, $(\'certificate_details_\'+' . $this->course['id'] . '));"><span id = "certificate_details_' . $this->course['id'] . '" style = "display:none">' . $tooltipCourseString . '</span>&nbsp;';
                        } else {
                            $courseOptions['certificate'] = '<img class = "ajaxHandle info" src = "images/16x16/certificate.png" title = "' . _COURSECERTIFICATE . '" alt = "' . _COURSECERTIFICATE . '" onmouseover = "new Tip(this, $(\'certificate_details_\'+' . $this->course['id'] . '));" /><span id = "certificate_details_' . $this->course['id'] . '" style = "display:none">' . $tooltipCourseString . '</span>&nbsp;';
                        }
                        //$courseString .= "<a class = 'info' href = 'javascript:void(0)'>"._DETAILS."<span class = 'tooltipSpan'>".$tooltipCourseString."</span></a>";
                    } else {
                        $courseOptions['certificate'] = '<img class = "ajaxHandle info" src = "images/16x16/certificate.png" title = "' . _COURSECERTIFICATE . '" alt = "' . _COURSECERTIFICATE . '" onclick = "window.open(\'' . basename($_SERVER['PHP_SELF']) . '?ctg=lessons&course=' . $this->course['id'] . '&export=' . $certificateExportMethod . '&user='******'users_LOGIN'] . '\')"/>&nbsp;';
                    }
                }
                #cpp#endif
            }
            $courseString .= '<span style = "margin-left:30px">' . implode('', $courseOptions) . '</span>';
        }
        $courseString .= '
                                </td><td>';
        if (isset($options['buy_link']) && $options['buy_link'] && sizeof($this->getInstances()) == 0 && !$this->course['has_course'] && !$this->course['reached_max_users'] && $_SESSION['s_type'] != 'administrator') {
            $this->course['price'] ? $priceString = formatPrice($this->course['price'], array($this->options['recurring'], $this->options['recurring_duration']), true) : ($priceString = false);
            $courseString .= '
                    					<span class = "buyLesson">
                                        	<span onclick = "addToCart(this, \'' . $this->course['id'] . '\', \'course\')">' . $priceString . '</span>
                    						<img class = "ajaxHandle" src = "images/16x16/shopping_basket_add.png" alt = "' . _BUY . '" title = "' . _BUY . '" onclick = "addToCart(this, \'' . $this->course['id'] . '\', \'course\')">
                                        </span>';
        }
        $courseString .= '
                                </td></tr>';
        if (sizeof($eligible) > 0) {
            //changed from subtree_course to subcoursetree because of #1332
            $courseString .= '
                            <tr id = "subcoursetree' . $this->course['id'] . '" name = "default_visible" ' . $display_lessons . '>
                                <td colspan = "2">
                                	<table>';
            foreach ($eligible as $lessonId => $lesson) {
                //Changed because of #4492 where lesson was completed but course was not and $lesson was unset in material in process
                $roleBasicType = $roles[$lesson->lesson['user_type']] ? $roles[$lesson->lesson['user_type']] : $roles[$this->course['user_type']];
                $courseString .= '<tr class = "directionEntry">';
                if (isset($lesson->lesson['active_in_lesson']) && !$lesson->lesson['active_in_lesson']) {
                    $courseString .= '<td style = "padding-bottom:2px"></td><td><a href = "javascript:void(0)" class = "inactiveLink" title = "' . _CONFIRMATIONPEDINGFROMADMIN . '">' . $lesson->lesson['name'] . '</a></td>';
                } else {
                    if (!$lesson->eligible) {
                        if ($lesson->lesson['completed']) {
                            if ($lesson->options['show_percentage'] != 0) {
                                $courseString .= '
							<td class = "lessonProgress">
                                <span class = "progressNumber completedLessonProgress" style = "width:50px;">&nbsp;</span>
                                <span class = "progressBar completedLessonProgress" style = "width:50px;text-align:center"><img src = "images/16x16/success.png" alt = "' . _LESSONCOMPLETE . '" title = "' . _LESSONCOMPLETE . '" /></span>
                                &nbsp;&nbsp;
                            </td>';
                            } else {
                                $courseString .= '
							<td class = "lessonProgress">
                            </td>';
                            }
                        } else {
                            if ($lesson->options['show_percentage'] != 0) {
                                $courseString .= '
							<td class = "lessonProgress">
                                <span class = "progressNumber incompletedLessonProgress" style = "width:50px;">' . $lesson->lesson['overall_progress']['percentage'] . '%</span>
                                <span class = "progressBar incompletedLessonProgress" style = "width:' . $lesson->lesson['overall_progress']['percentage'] / 2 . 'px;">&nbsp;</span>
                                &nbsp;&nbsp;
                            </td>';
                            } else {
                                $courseString .= '
							<td class = "lessonProgress">
                            </td>';
                            }
                        }
                        if (EfrontUser::isOptionVisible('tooltip')) {
                            $courseString .= '
							<td>
                            	<a href = "javascript:void(0)" title = "" class = "inactiveLink info" url = "ask_information.php?lessons_ID=' . $lesson->lesson['id'] . '&from_course=' . $this->course['id'] . '">
                            		' . $lesson->lesson['name'] . '
                            	</a>
                            <td>';
                        } else {
                            $courseString .= '
							<td>
                            	<a href = "javascript:void(0)" title = "" class = "inactiveLink">
                            		' . $lesson->lesson['name'] . '
                            	</a>
                            <td>';
                        }
                    } else {
                        if ($lesson->lesson['user_type'] && $roles[$lesson->lesson['user_type']] == 'student' && $lesson->lesson['completed']) {
                            //Show the progress bar
                            if ($lesson->options['show_percentage'] != 0) {
                                $courseString .= '
							<td class = "lessonProgress">
                                <span class = "progressNumber completedLessonProgress" style = "width:50px;">&nbsp;</span>
                                <span class = "progressBar completedLessonProgress" style = "width:50px;text-align:center"><img src = "images/16x16/success.png" alt = "' . _LESSONCOMPLETE . '" title = "' . _LESSONCOMPLETE . '" style = "vertical-align:middle" /></span>
                                &nbsp;&nbsp;
                            </td>';
                            } else {
                                $courseString .= '
							<td class = "lessonProgress">
                            </td>';
                            }
                        } elseif ($lesson->lesson['user_type'] && $roles[$lesson->lesson['user_type']] == 'student') {
                            if ($lesson->options['show_percentage'] != 0) {
                                $courseString .= '
							<td class = "lessonProgress">
                                <span class = "progressNumber incompletedLessonProgress" style = "width:50px;">' . $lesson->lesson['overall_progress']['percentage'] . '%</span>
                                <span class = "progressBar incompletedLessonProgress" style = "width:' . $lesson->lesson['overall_progress']['percentage'] / 2 . 'px;">&nbsp;</span>
                                &nbsp;&nbsp;
                            </td>';
                            } else {
                                $courseString .= '
							<td class = "lessonProgress">
                            </td>';
                            }
                        } else {
                            $courseString .= '
							<td></td>';
                        }
                        if (EfrontUser::isOptionVisible('tooltip')) {
                            $courseString .= '
                    		<td>
                    			' . ($options['lessons_link'] ? '<a href = "' . str_replace("#user_type#", $roleBasicType, $options['lessons_link']) . $lesson->lesson['id'] . '&from_course=' . $this->course['id'] . '" class = "info" url = "ask_information.php?lessons_ID=' . $lesson->lesson['id'] . '&from_course=' . $this->course['id'] . '">' . $lesson->lesson['name'] . '</a>' : $lesson->lesson['name']) . '
                                </td>';
                        } else {
                            $courseString .= '
                    		<td>
                    			' . ($options['lessons_link'] ? '<a href = "' . str_replace("#user_type#", $roleBasicType, $options['lessons_link']) . $lesson->lesson['id'] . '&from_course=' . $this->course['id'] . '" >' . $lesson->lesson['name'] . '</a>' : $lesson->lesson['name']) . '
                                </td>';
                        }
                    }
                }
                $courseString .= '';
            }
            $courseString .= '
								</tr>
                            </table>
                        </td></tr>';
        }
        $courseString .= '
                        </table>';
        return $courseString;
    }
Exemplo n.º 23
0
 /**
  * Get event message
  *
  * This function creates the message string for this event
  * according to its type and its information
  *
  * <br/>Example:
  * <code>
  * $event = new EfrontEvent(5);       //create object for event with id 5
  * $event -> createMessage();
  * echo $event -> event['message'];
  * </code>
  *
  * @param array with all modules to optimize module message printing
  * @returns the message value also set to the $this -> event['message'] field
  * @since 3.6.0
  * @access public
  */
 public function createMessage($modulesArray = false)
 {
     global $currentUser;
     // Module related code
     if ($this->event['type'] >= EfrontEvent::MODULE_BASE_TYPE_CODE) {
         $className = $this->event['entity_ID'];
         if (isset($modulesArray[$className])) {
             $data = array();
             if ($this->event['entity_name'] != '') {
                 $data = unserialize($this->event['entity_name']);
             }
             foreach ($this->event as $field => $value) {
                 $data[$field] = $value;
             }
             $this->event['message'] = $modulesArray[$className]->getEventMessage((int) $this->event['type'] - EfrontEvent::MODULE_BASE_TYPE_CODE, $data);
         }
         if (!$this->event['message']) {
             $this->event['message'] = _UNREGISTEREDEVENT . " " . _FORTHEMODULE . " '" . $className . "'";
         }
     } else {
         // Basic system event codes
         // All excluded events are not of the form: The user did sth. For example: Project X expired
         if ($this->event['type'] != EfrontEvent::PROJECT_EXPIRY && $this->event['type'] != EfrontEvent::LESSON_PROGRAMMED_EXPIRY && $this->event['type'] != EfrontEvent::LESSON_PROGRAMMED_START) {
             //changed to $_SESSION['s_type'] to work for different roles between lessons
             formatLogin($this->event['users_LOGIN']) ? $formattedLogin = formatLogin($this->event['users_LOGIN']) : ($formattedLogin = $this->event['users_name'] . ' ' . $this->event['users_surname'] . ' (' . $this->event['users_LOGIN'] . ')');
             $this->event['message'] = _NAMEARTICLE . " <b><a  href = \"" . $_SESSION['s_type'] . ".php?ctg=social&op=show_profile&user="******"&popup=1\" onclick = \"eF_js_showDivPopup(event, '" . _USERPROFILE . "', 1)\"  target = \"POPUP_FRAME\"> " . $formattedLogin . "</a></b> ";
         }
         if ($this->event['type'] == EfrontEvent::SYSTEM_JOIN) {
             $this->event['message'] .= _HASJOINEDTHESYSTEM;
         } else {
             if ($this->event['type'] == EfrontEvent::SYSTEM_VISITED) {
                 $this->event['message'] .= _VISITEDTHESYSTEM;
             } else {
                 if ($this->event['type'] == EfrontEvent::SYSTEM_FORGOTTEN_PASSWORD) {
                     $this->event['message'] .= _HASFORGOTTENHISPASSWORD;
                 } else {
                     if ($this->event['type'] == EfrontEvent::SYSTEM_REMOVAL) {
                         $this->event['message'] .= _HASBEENREMOVEDFROMTHESYSTEM;
                     } else {
                         if ($this->event['type'] == EfrontEvent::LESSON_ACQUISITION_AS_STUDENT) {
                             $this->event['message'] .= _WASASSIGNEDTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                         } else {
                             if ($this->event['type'] == EfrontEvent::LESSON_ACQUISITION_AS_PROFESSOR) {
                                 $this->event['message'] .= _WILLBETEACHINGLESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                             } else {
                                 if ($this->event['type'] == EfrontEvent::LESSON_VISITED) {
                                     $this->event['message'] .= _VISITEDLESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                 } else {
                                     if ($this->event['type'] == EfrontEvent::LESSON_REMOVAL) {
                                         $this->event['message'] .= _NOLONGERATTENDSLESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                     } else {
                                         if ($this->event['type'] == EfrontEvent::LESSON_COMPLETION) {
                                             $this->event['message'] .= _HASCOMPLETEDLESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                         } else {
                                             if ($this->event['type'] == EfrontEvent::LESSON_PROGRESS_RESET) {
                                                 $this->event['message'] .= _WASBEINGRESETLESSONPROGRESS . " <b>" . $this->event['lessons_name'] . "</b>";
                                             } else {
                                                 if ($this->event['type'] == EfrontEvent::PROJECT_SUBMISSION) {
                                                     $this->event['message'] .= _SUBMITTEDPROJECT . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                 } else {
                                                     if ($this->event['type'] == EfrontEvent::PROJECT_CREATION) {
                                                         $this->event['message'] .= _HASCREATEDPROJECT . " <b>" . $this->event['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                     } else {
                                                         if ($this->event['type'] == EfrontEvent::LESSON_PROGRAMMED_START) {
                                                             $this->event['message'] .= _SCHEDULEDSTARTOFLESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                         } else {
                                                             if ($this->event['type'] == EfrontEvent::LESSON_PROGRAMMED_EXPIRY) {
                                                                 $this->event['message'] .= _SCHEDULEDEXPIRYOFLESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                             } else {
                                                                 if ($this->event['type'] == EfrontEvent::PROJECT_EXPIRY) {
                                                                     $this->event['message'] .= _THEPROJECT . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b> " . _HASEXPIRED;
                                                                 } else {
                                                                     if ($this->event['type'] == EfrontEvent::PROJECT_ASSIGNMENT) {
                                                                         $this->event['message'] .= _THEPROJECT . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b> " . _WASASSIGNEDTO . " " . $this->event['users_LOGIN'];
                                                                     } else {
                                                                         if ($this->event['type'] == EfrontEvent::NEW_LESSON_ANNOUNCEMENT) {
                                                                             $this->event['message'] .= _HASPUBLISHEDTHEANNOUNCEMENT . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b> ";
                                                                         } else {
                                                                             if ($this->event['type'] == EfrontEvent::SYSTEM_NEW_PASSWORD_REQUEST) {
                                                                                 $this->event['message'] .= _HASASKEDFORANEWPASSWORD;
                                                                             } else {
                                                                                 if ($this->event['type'] == EfrontEvent::SYSTEM_REGISTER) {
                                                                                     $this->event['message'] .= _WASREGISTEREDINTOTHESYSTEM;
                                                                                 } else {
                                                                                     if ($this->event['type'] == EfrontEvent::SYSTEM_ON_EMAIL_ACTIVATION) {
                                                                                         $this->event['message'] .= _ACTIVATEDHISACCOUNTWITHEACTIVATIONMAIL;
                                                                                     } else {
                                                                                         if ($this->event['type'] == EfrontEvent::SYSTEM_ON_ADMIN_ACTIVATION) {
                                                                                             $this->event['message'] .= _ACTIVATEDACCOUNTFROMSUPERVISOR;
                                                                                         } else {
                                                                                             if ($this->event['type'] == EfrontEvent::SYSTEM_USER_DEACTIVATE) {
                                                                                                 $this->event['message'] .= _WASDEACTIVATEDFROMTHESYSTEM;
                                                                                                 // For courses we have lessons_name -> courses_name
                                                                                             } else {
                                                                                                 if ($this->event['type'] == EfrontEvent::COURSE_ACQUISITION_AS_STUDENT) {
                                                                                                     $this->event['message'] .= _WASASSIGNEDTHECOURSE . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                 } else {
                                                                                                     if ($this->event['type'] == EfrontEvent::COURSE_ACQUISITION_AS_PROFESSOR) {
                                                                                                         $this->event['message'] .= _WILLBETEACHINGCOURSE . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                     } else {
                                                                                                         if ($this->event['type'] == EfrontEvent::COURSE_COMPLETION) {
                                                                                                             $this->event['message'] .= _HASCOMPLETEDCOURSE . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                         } else {
                                                                                                             if ($this->event['type'] == EfrontEvent::COURSE_REMOVAL) {
                                                                                                                 $this->event['message'] .= _NOLONGERATTENDSCOURSE . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                             } else {
                                                                                                                 if ($this->event['type'] == EfrontEvent::COURSE_PROGRAMMED_START) {
                                                                                                                     $this->event['message'] .= _SCHEDULEDSTARTOFCOURSE . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                 } else {
                                                                                                                     if ($this->event['type'] == EfrontEvent::COURSE_PROGRAMMED_EXPIRY) {
                                                                                                                         $this->event['message'] .= _SCHEDULEDEXPIRYOFCOURSE . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                     } else {
                                                                                                                         if ($this->event['type'] == EfrontEvent::COURSE_PROGRESS_RESET) {
                                                                                                                             $this->event['message'] .= _WASBEINGRESETCOURSEPROGRESS . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                         } else {
                                                                                                                             if ($this->event['type'] == EfrontEvent::TEST_CREATION) {
                                                                                                                                 $this->event['message'] .= _CREATEDTHETEST . " <b>" . $this->event['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                             } else {
                                                                                                                                 if ($this->event['type'] == EfrontEvent::CONTENT_MODIFICATION) {
                                                                                                                                     $this->event['message'] .= _HASMODIFIEDUNIT . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                 } else {
                                                                                                                                     if ($this->event['type'] == EfrontEvent::CONTENT_CREATION) {
                                                                                                                                         $this->event['message'] .= _HASCREATEDUNIT . " <b>" . $this->event['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                     } else {
                                                                                                                                         if ($this->event['type'] == EfrontEvent::CONTENT_COMPLETION) {
                                                                                                                                             $this->event['message'] .= _HASCOMPLETEDUNIT . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                         } else {
                                                                                                                                             if ($this->event['type'] == EfrontEvent::NEW_SYSTEM_ANNOUNCEMENT) {
                                                                                                                                                 $this->event['message'] .= _HASPUBLISHEDTHEANNOUNCEMENT . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                             } else {
                                                                                                                                                 if ($this->event['type'] == EfrontEvent::NEW_SURVEY) {
                                                                                                                                                     $this->event['message'] .= _HASPUBLISHEDSURVEY . " <b>" . str_replace("</p>", "", str_replace("<p>", "", $this->event['entity_name'])) . "</b> " . _FORTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                 } else {
                                                                                                                                                     if ($this->event['type'] == EfrontEvent::NEW_COMMENT_WRITING) {
                                                                                                                                                         $this->event['message'] .= _WROTEACOMMENTFORUNIT . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                     } else {
                                                                                                                                                         if ($this->event['type'] == EfrontEvent::TEST_START) {
                                                                                                                                                             $this->event['message'] .= _STARTEDTEST . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                         } else {
                                                                                                                                                             if ($this->event['type'] == EfrontEvent::TEST_COMPLETION) {
                                                                                                                                                                 $this->event['message'] .= _COMPLETEDTEST . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                             } else {
                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::TEST_FAILURE) {
                                                                                                                                                                     $this->event['message'] .= _FAILEDTEST . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                 } else {
                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::TEST_MARKED) {
                                                                                                                                                                         $this->event['message'] .= _MARKEDTEST . " <b>" . $this->event['entity_name'] . "</b> " . _OFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                     } else {
                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::NEW_FORUM) {
                                                                                                                                                                             $this->event['message'] .= _CREATEDTHENEWFORUM . " <b>" . $this->event['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                         } else {
                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::NEW_TOPIC) {
                                                                                                                                                                                 $this->event['message'] .= _CREATEDTHENEWTOPIC . " <b>" . $this->event['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                             } else {
                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::NEW_POLL) {
                                                                                                                                                                                     $this->event['message'] .= _CREATEDTHENEWPOLL . " <b>" . $this->event['entity_name'] . "</b> " . _FORTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                 } else {
                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::NEW_FORUM_MESSAGE_POST) {
                                                                                                                                                                                         $this->event['message'] .= _POSTEDTHENEWMESSAGE . " <b>" . $this->event['entity_name'] . "</b> " . _INTHEFORUMOFTHELESSON . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                     } else {
                                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::STATUS_CHANGE) {
                                                                                                                                                                                             $this->event['message'] .= _CHANGEDHISHERPROFILE;
                                                                                                                                                                                         } else {
                                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::AVATAR_CHANGE) {
                                                                                                                                                                                                 $this->event['message'] .= _CHANGEDHISHERAVATARPICTURE;
                                                                                                                                                                                             } else {
                                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::PROFILE_CHANGE) {
                                                                                                                                                                                                     $this->event['message'] .= _CHANGEDHISHERPROFILE;
                                                                                                                                                                                                 } else {
                                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::NEW_PROFILE_COMMENT_FOR_OTHER) {
                                                                                                                                                                                                         $this->event['message'] .= _COMMENTEDONTHEPROFILEOF;
                                                                                                                                                                                                         // Here check whether this is your own profile or not
                                                                                                                                                                                                         if ($this->event['entity_ID'] != $currentUser->user['login']) {
                                                                                                                                                                                                             $this->event['message'] .= " <b><a  href = \"" . $currentUser->getType() . ".php?ctg=social&op=show_profile&user="******"&popup=1\" onclick = \"eF_js_showDivPopup(event, '" . _USERPROFILE . "', 1)\"  target = \"POPUP_FRAME\"> " . $this->event['entity_name'] . "</a></b> ";
                                                                                                                                                                                                         } else {
                                                                                                                                                                                                             $this->event['message'] .= " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                         }
                                                                                                                                                                                                     } else {
                                                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::NEW_PROFILE_COMMENT_FOR_SELF) {
                                                                                                                                                                                                             $this->event['message'] .= _COMMENTEDONHISHEROWNPROFILE;
                                                                                                                                                                                                         } else {
                                                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::DELETE_PROFILE_COMMENT_FOR_SELF) {
                                                                                                                                                                                                                 $this->event['message'] .= _DELETEDACOMMENTFROMHISHEROWNPROFILE;
                                                                                                                                                                                                             } else {
                                                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::NEW_POST_FOR_LESSON_TIMELINE_TOPIC) {
                                                                                                                                                                                                                     $topic_post = unserialize($this->event['entity_name']);
                                                                                                                                                                                                                     $this->event['message'] .= _POSTEDFORLESSONTOPIC . " <b>" . $topic_post['topic_title'] . "</b> " . _THEPOST . ": " . $topic_post['data'];
                                                                                                                                                                                                                     if ($this->event['users_LOGIN'] == $GLOBALS['currentUser']->user['login']) {
                                                                                                                                                                                                                         $this->event['editlink'] = "<a href='" . $_SESSION['s_type'] . ".php?ctg=social&op=timeline&lessons_ID=" . $this->event['lessons_ID'] . "&post_topic=" . $this->event['entity_ID'] . "&action=change&popup=1&id=" . $topic_post['post_id'] . "' onclick = 'eF_js_showDivPopup(event, \"" . _EDITMESSAGEFORLESSONTIMELINETOPIC . "\", 1)'  target = 'POPUP_FRAME'><img src='images/16x16/edit.png' border='0' alt = '" . _EDITMESSAGEFORLESSONTIMELINETOPIC . "' title='" . _EDITMESSAGEFORLESSONTIMELINETOPIC . "' /></a>";
                                                                                                                                                                                                                         $this->event['deletelink'] = "<a href='" . $_SESSION['s_type'] . ".php?ctg=social&op=timeline&lessons_ID=" . $this->event['lessons_ID'] . "&post_topic=" . $this->event['entity_ID'] . "&action=delete&id=" . $topic_post['post_id'] . "'><img src='images/16x16/error_delete.png' border='0' alt = '" . _DELETEMESSAGEFORLESSONTIMELINETOPIC . "' title='" . _DELETEMESSAGEFORLESSONTIMELINETOPIC . "' /></a>";
                                                                                                                                                                                                                     }
                                                                                                                                                                                                                 } else {
                                                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::DELETE_POST_FROM_LESSON_TIMELINE) {
                                                                                                                                                                                                                         $this->event['message'] .= _DELETEDAPOSTFORLESSONTOPIC . " " . $this->event['entity_name'];
                                                                                                                                                                                                                     } else {
                                                                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::HCD_NEW_BRANCH) {
                                                                                                                                                                                                                             $this->event['message'] .= _CREATEDTHEBRANCH . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                                                         } else {
                                                                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::HCD_REMOVE_BRANCH) {
                                                                                                                                                                                                                                 $this->event['message'] .= _DELETEDTHEBRANCH . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                                                             } else {
                                                                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::HCD_NEW_JOB_ASSIGNMENT) {
                                                                                                                                                                                                                                     $this->event['message'] .= _WASASSIGNEDTHEJOB . " <b>" . $this->event['entity_name'] . "</b>" . _ATBRANCH . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                                                                 } else {
                                                                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::HCD_REMOVE_JOB_ASSIGNMENT) {
                                                                                                                                                                                                                                         $this->event['message'] .= _WASREMOVEDFROMJOB . " <b>" . $this->event['entity_name'] . "</b>" . _ATBRANCH . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                                                                     } else {
                                                                                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::HCD_FIRED) {
                                                                                                                                                                                                                                             $this->event['message'] .= _WASFIRED;
                                                                                                                                                                                                                                         } else {
                                                                                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::NEW_ASSIGNMENT_TO_GROUP) {
                                                                                                                                                                                                                                                 $this->event['message'] .= _WASASSIGNEDTOGROUP . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                             } else {
                                                                                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::REMOVAL_FROM_GROUP) {
                                                                                                                                                                                                                                                     $this->event['message'] .= _WASREMOVEDFROMGROUP . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                 } else {
                                                                                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::NEW_PAYPAL_PAYMENT) {
                                                                                                                                                                                                                                                         $this->event['message'] .= _PAYEDWITHPAYPAL . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                     } else {
                                                                                                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::NEW_BALANCE_PAYMENT) {
                                                                                                                                                                                                                                                             $this->event['message'] .= _PAYEDWITHBALANCE . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                         } else {
                                                                                                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::NEW_MANUAL_PAYMENT) {
                                                                                                                                                                                                                                                                 $this->event['message'] .= _PAYEDMANUALLY . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                             } else {
                                                                                                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::COUPON_USAGE) {
                                                                                                                                                                                                                                                                     $this->event['message'] .= _USEDCOUPON . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                                 } else {
                                                                                                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::HCD_NEW_SKILL) {
                                                                                                                                                                                                                                                                         $this->event['message'] .= _WASASSIGNEDSKILL . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                                     } else {
                                                                                                                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::HCD_REMOVE_SKILL) {
                                                                                                                                                                                                                                                                             $this->event['message'] .= _DOESNOTHAVEANYMORESKILL . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                                         } else {
                                                                                                                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::HCD_SKILL_EDIT) {
                                                                                                                                                                                                                                                                                 $this->event['message'] .= _HADHISSKILLEDITEDTO . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                                             } else {
                                                                                                                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::HCD_HIRED) {
                                                                                                                                                                                                                                                                                     $this->event['message'] .= _WASHIRED;
                                                                                                                                                                                                                                                                                 } else {
                                                                                                                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::HCD_LEFT) {
                                                                                                                                                                                                                                                                                         $this->event['message'] .= _HASLEFTHECOMPANY;
                                                                                                                                                                                                                                                                                     } else {
                                                                                                                                                                                                                                                                                         if ($this->event['type'] == EfrontEvent::HCD_WAGE_CHANGE) {
                                                                                                                                                                                                                                                                                             $this->event['message'] .= _HASHADHISWAGECHANGETO . " <b>" . $this->event['entity_name'] . "</b>";
                                                                                                                                                                                                                                                                                         } else {
                                                                                                                                                                                                                                                                                             if ($this->event['type'] == EfrontEvent::COURSE_CERTIFICATE_ISSUE) {
                                                                                                                                                                                                                                                                                                 $this->event['message'] .= _HASCERTIFICATED . " <b>" . $this->event['lessons_name'] . "</b> " . _WITHGRADE . " <b>" . $this->event['entity_name'] . "</b> " . _WITHKEY . " <b> " . $this->event['entity_ID'] . "</b>";
                                                                                                                                                                                                                                                                                             } else {
                                                                                                                                                                                                                                                                                                 if ($this->event['type'] == EfrontEvent::COURSE_CERTIFICATE_REVOKE) {
                                                                                                                                                                                                                                                                                                     $this->event['message'] .= _HASLOSTCERTIFICATE . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                                                                                                                                 } else {
                                                                                                                                                                                                                                                                                                     if ($this->event['type'] == EfrontEvent::COURSE_CERTIFICATE_EXPIRY) {
                                                                                                                                                                                                                                                                                                         $this->event['message'] .= _CERTIFICATEEXPIRY . " <b>" . $this->event['lessons_name'] . "</b>";
                                                                                                                                                                                                                                                                                                     } else {
                                                                                                                                                                                                                                                                                                         return false;
                                                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                                                                             }
                                                                                                                                                                                                                                                                                         }
                                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                                                             }
                                                                                                                                                                                                                                                                         }
                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                                             }
                                                                                                                                                                                                                                                         }
                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                             }
                                                                                                                                                                                                                                         }
                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                             }
                                                                                                                                                                                                                         }
                                                                                                                                                                                                                     }
                                                                                                                                                                                                                 }
                                                                                                                                                                                                             }
                                                                                                                                                                                                         }
                                                                                                                                                                                                     }
                                                                                                                                                                                                 }
                                                                                                                                                                                             }
                                                                                                                                                                                         }
                                                                                                                                                                                     }
                                                                                                                                                                                 }
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->event['time'] = eF_convertIntervalToTime(time() - $this->event['timestamp'], true) . ' ' . _AGO;
     return $this->event['message'];
 }