
but not all event has start and end time
echo "<div style='clear:both;'></div> ";
function timeDifference($start,$end,$return='days') {
//change times to Unix timestamp.
//$start = strtotime($start);
//$end = strtotime($end);
//subtract dates
//echo 'Start Timestamp: ' . $start . '<br/>End Timestamp: ' . $end . '<br/>';
$difference = max($end, $start) - min($end,$start);
$time = NULL;
//calculate time difference.
switch($return) {
case 'days':
$days = floor($difference/86400);
$difference = $difference % 86400;
$time['days'] = $days;
case 'hours':
$hours = floor($difference/3600);
$difference = $difference % 3600;
$time['hours'] = $hours;
case 'minutes':
$minutes = floor($difference/60);
$difference = $difference % 60;
$time['minutes'] = $minutes;
case 'seconds':
$seconds = $difference;
$time['seconds'] = $seconds;
}
$output = array();
if(is_array($time)) {
$showSec = true;
if(isset($time['hours']) && $time['hours'] > 0) {
$output[] = $time['hours'] . ' Hour';
$showSec = false;
}
if(isset($time['minutes']) && $time['minutes'] > 0) {
$output[] = $time['minutes'] . ' minutes';
$showSec = false;
}
if(isset($time['seconds']) && $showSec == true) {
return $time['seconds'] . ' Second';
}
return implode(', ',$output);
}
}
$now = time();
$hours = 24;
$count=0;
$time = ( intval( $hours ) > 0 ) ? time() - ( intval( $hours ) * 3600 ) : ( time() - 24*3600 );
global $xoopsDB;
$sql = "SELECT distinct uid, uname, user_avatar, last_login FROM ".$xoopsDB->prefix("users")." WHERE level > 0 AND uid NOT IN (1) AND uid NOT IN (76) AND last_login >= '" . $time . "' ORDER BY last_login DESC";
$result = $xoopsDB->query($sql);
while (list($uid, $uname,$user_avatar,$last_login) = $xoopsDB->fetchRow($result) ) {
//Put this variable in the echo statements where you would like them to show up.
$sinceLastLogin = ' ' . timeDifference($last_login,$now,'hours') . ' ago';
$count++;
if ($user_avatar == 'avatars/blank.gif')
{
echo "<div style='float: left; padding:2px;'><a href='".XOOPS_URL."/userinfo.php?uid=".$uid."'><img src='".XOOPS_URL."/uploads/avatars/blank.gif' title='$uname | $sinceLastLogin' border='0' alt='".$uname."' height='48' width='48'></a></div>";
}
else
{
echo "<div style='float: left; padding:2px;'><a href='".XOOPS_URL."/userinfo.php?uid=".$uid."'><img src='".XOOPS_URL."/uploads/".$user_avatar."' title='$uname | $sinceLastLogin' border='0' alt='".$uname."' height='48' width='48'></a></div>";
}
}
echo "<div style='clear:both;'></div> ";
eXtCal 2.37 RC 6 (2013/4/20)
by Zoullou, Mage, Mamba, JJ Delalandre (JJDai)
XOOPS Version XOOPS 2.5.5
PHP Version 5.3.1
mySQL Version 5.1.41
Server API apache2handler
OS WINNT
safe_mode Off
register_globals Off
magic_quotes_gpc Off
allow_url_fopen On
fsockopen On
post_max_size 128M
max_input_time 60
output_buffering
max_execution_time 60
memory_limit 128M
file_uploads On
upload_max_filesize 128M