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


PHP eF_convertIntervalToTime函数代码示例

本文整理汇总了PHP中eF_convertIntervalToTime函数的典型用法代码示例。如果您正苦于以下问题:PHP eF_convertIntervalToTime函数的具体用法?PHP eF_convertIntervalToTime怎么用?PHP eF_convertIntervalToTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: smarty_function_eF_template_printComments

/**
* 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;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:58,代码来源:function.eF_template_printComments.php

示例2: getConnectedUsers

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;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:14,代码来源:new-items.php

示例3: __construct

 /**
  * 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);
 }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:25,代码来源:project.class.php

示例4: smarty_function_eF_template_printForumMessages

/**
* 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;
}
开发者ID:bqq1986,项目名称:efront,代码行数:48,代码来源:function.eF_template_printForumMessages.php

示例5: smarty_function_eF_template_printPersonalMessages

/**
* 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;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:42,代码来源:function.eF_template_printPersonalMessages.php

示例6: printCategoryLessons

    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;
    }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:60,代码来源:direction.class.php

示例7: sizeof

            $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;
}
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:add_test.php

示例8: array

     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']);
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:system_stats.php

示例9: foreach

     $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;
     
开发者ID:kaseya-university,项目名称:efront,代码行数:30,代码来源:lessons_stats.php

示例10: getLessonModule

 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='" . $currentUser->user['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='".$currentUser -> user['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;
     }
 }
开发者ID:bqq1986,项目名称:efront,代码行数:55,代码来源:module_bbb.class.php

示例11: getDeprecatedUserTimesPerDay

 /**
  * 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 = '".$user['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 = '{$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;
     }
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:92,代码来源:times.class.php

示例12: eF_convertIntervalToTime

    //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':
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:add_question.php

示例13: getNews

 /**
  * 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;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:73,代码来源:news.class.php

示例14: smarty_function_eF_template_printProjects

/**
 * 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;
}
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:79,代码来源:function.eF_template_printProjects.php

示例15: createMessage


//.........这里部分代码省略.........
                 $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=" . $this->notification['entity_ID'] . "&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'];
 }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:notification.class.php


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