1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Online-Menu template cleanup

This commit is contained in:
Cameron
2013-04-29 19:36:30 -07:00
parent dfcca286df
commit 07990e7a7a
5 changed files with 76 additions and 41 deletions

View File

@@ -26,7 +26,7 @@ define("LAN_ONLINE_4", "Online");
define("LAN_ONLINE_5", "");
define("LAN_ONLINE_6", "Newest Member: ");
define("LAN_ONLINE_7", "viewing");
define("LAN_ONLINE_8", "most ever online: ");
define("LAN_ONLINE_8", "Most ever online: ");
define("LAN_ONLINE_9", "on ");
define("LAN_ONLINE_10", "Online Menu");

View File

@@ -35,13 +35,13 @@ $num = intval(varsettrue($menu_pref['online_ls_amount'],10));
$sql -> db_Select('user', 'user_id, user_name, user_currentvisit', 'ORDER BY user_currentvisit DESC LIMIT 0,'.$num, 'nowhere');
$lslist = $sql -> db_getList();
$text = $tp -> parseTemplate($TEMPLATE_LASTSEEN['START'], TRUE);
$text = $tp -> parseTemplate($LASTSEEN_TEMPLATE['start'], TRUE);
foreach($lslist as $row)
{
setScVar('online_shortcodes', 'currentUser', $row);
$text .= $tp -> parseTemplate($TEMPLATE_LASTSEEN['ITEM'],TRUE);
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['item'],TRUE);
}
$text .= $tp -> parseTemplate($TEMPLATE_LASTSEEN['END'], TRUE);
$text .= $tp -> parseTemplate($LASTSEEN_TEMPLATE['end'], TRUE);
$caption = varsettrue($menu_pref['online_ls_caption'],LAN_LASTSEEN_1);
$ns->tablerender($caption, $text, 'lastseen');

View File

@@ -42,10 +42,16 @@ if(!defined('e_TRACKING_DISABLED'))
{
if (MEMBERS_ONLINE)
{
global $listuserson;
// global $listuserson;
$listuserson = e107::getOnline()->userList();
$ret='';
foreach($listuserson as $uinfo => $pinfo)
foreach($listuserson as $uinfo => $row)
{
$pinfo = $row['user_location'];
$online_location_page = str_replace('.php', '', substr(strrchr($pinfo, '/'), 1));
if ($pinfo == 'log.php' || $pinfo == 'error.php')
{
@@ -73,20 +79,30 @@ if(!defined('e_TRACKING_DISABLED'))
$online_location_page = 'comment';
}
list($oid, $oname) = explode('.', $uinfo, 2);
setScVar('online_shortcodes', 'currentMember', array('oid' => $oid, 'oname' => $oname, 'page' => $online_location_page, 'pinfo' => $pinfo));
$ret .= $tp->parseTemplate($TEMPLATE_ONLINE['ONLINE_MEMBERS_LIST_EXTENDED'], TRUE);
$data = array(
'oid' => $row['user_id'],
'oname' =>$row['user_name'],
'page' => $online_location_page,
'pinfo' => $pinfo,
'oimage' => $row['user_image']
);
setScVar('online_shortcodes', 'currentMember', $data);
$ret .= $tp->parseTemplate($ONLINE_TEMPLATE['online_members_list_extended'], TRUE);
}
setScVar('online_shortcodes', 'onlineMembersList', $ret);
}
}
$text = $tp->parseTemplate($TEMPLATE_ONLINE['ENABLED'], TRUE);
$text = $tp->parseTemplate($ONLINE_TEMPLATE['enabled'], TRUE);
}
else
{
if (ADMIN)
{
$text = $tp->parseTemplate($TEMPLATE_ONLINE['DISABLED'], TRUE);
$text = $tp->parseTemplate($ONLINE_TEMPLATE['disabled'], TRUE);
}
else
{
@@ -95,7 +111,16 @@ else
}
$img = (is_readable(THEME.'images/online_menu.png') ? "<img src='".THEME_ABS."images/online_menu.png' alt='' />" : '');
$caption = $img.' '.varsettrue($menu_pref['online_caption'],LAN_ONLINE_10);
if (getperms('1'))
{
$path = e_PLUGIN_ABS."online/config.php";
$caption .= "<a class='pull-right' href='".$path."' title='Configure'><i class='icon-cog'></i></a>";
}
$ns->tablerender($caption, $text, 'online_extended');
?>

View File

@@ -17,35 +17,32 @@
global $sc_style;
//##### LASTSEEN MENU ---------------------------------------------------------
$sc_style['LASTSEEN_DATE']['pre'] = "<br /> [ ";
$sc_style['LASTSEEN_DATE']['post'] = " ]";
$TEMPLATE_LASTSEEN['START'] = "<ul style='margin-left:15px; margin-top:0px; padding-left:0px;'>";
$TEMPLATE_LASTSEEN['ITEM'] = "<li style='list-style-type: square;'>{LASTSEEN_USERLINK} {LASTSEEN_DATE}</li>";
$TEMPLATE_LASTSEEN['END'] = "</ul>";
$LASTSEEN_TEMPLATE['start'] = "<ul class='lastseen-menu'>";
$LASTSEEN_TEMPLATE['item'] = "<li>{LASTSEEN_USERLINK} <small class='muted'>{LASTSEEN_DATE}</small></li>";
$LASTSEEN_TEMPLATE['end'] = "</ul>";
//##### ONLINE MENU -----------------------------------------------------------
$sc_style['ONLINE_GUESTS']['pre'] = LAN_ONLINE_1;
$sc_style['ONLINE_GUESTS']['post'] = "<br />";
$sc_style['ONLINE_GUESTS']['pre'] = "<li>".LAN_ONLINE_1;
$sc_style['ONLINE_GUESTS']['post'] = "</li>";
$sc_style['ONLINE_MEMBERS']['pre'] = LAN_ONLINE_2;
$sc_style['ONLINE_MEMBERS']['post'] = "";
$sc_style['ONLINE_MEMBERS']['pre'] = "<li>".LAN_ONLINE_2;
$sc_style['ONLINE_MEMBERS']['post'] = "</li>";
$sc_style['ONLINE_MEMBERS_LIST']['pre'] = ", ";
$sc_style['ONLINE_MEMBERS_LIST']['post'] = "";
$sc_style['ONLINE_MEMBERS_LIST']['pre'] = "<ul>";
$sc_style['ONLINE_MEMBERS_LIST']['post'] = "</ul>";
$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['pre'] = "<br />";
$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['post'] = "<br />";
$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['pre'] = "<ul class='unstyled'>";
$sc_style['ONLINE_MEMBERS_LIST_EXTENDED']['post'] = "</ul>";
$sc_style['ONLINE_ONPAGE']['pre'] = LAN_ONLINE_3;
$sc_style['ONLINE_ONPAGE']['post'] = "<br />";
$sc_style['ONLINE_ONPAGE']['pre'] = "<li>".LAN_ONLINE_3;
$sc_style['ONLINE_ONPAGE']['post'] = "</li>";
$sc_style['ONLINE_MEMBER_TOTAL']['pre'] = LAN_ONLINE_2;
$sc_style['ONLINE_MEMBER_TOTAL']['post'] = "<br />";
$sc_style['ONLINE_MEMBER_TOTAL']['pre'] = "<li>".LAN_ONLINE_2;
$sc_style['ONLINE_MEMBER_TOTAL']['post'] = "</li>";
$sc_style['ONLINE_MEMBER_NEWEST']['pre'] = LAN_ONLINE_6;
$sc_style['ONLINE_MEMBER_NEWEST']['post'] = "<br />";
$sc_style['ONLINE_MEMBER_NEWEST']['pre'] = "<li>".LAN_ONLINE_6;
$sc_style['ONLINE_MEMBER_NEWEST']['post'] = "</li>";
$sc_style['ONLINE_MOST']['pre'] = LAN_ONLINE_8;
$sc_style['ONLINE_MOST']['post'] = "<br />";
@@ -53,29 +50,36 @@ $sc_style['ONLINE_MOST']['post'] = "<br />";
$sc_style['ONLINE_MOST_MEMBERS']['pre'] = LAN_ONLINE_2;
$sc_style['ONLINE_MOST_MEMBERS']['post'] = "";
$sc_style['ONLINE_MOST_GUESTS']['pre'] = LAN_ONLINE_1;
$sc_style['ONLINE_MOST_GUESTS']['post'] = "";
$sc_style['ONLINE_MOST_GUESTS']['pre'] = "".LAN_ONLINE_1;
$sc_style['ONLINE_MOST_GUESTS']['post'] = ", ";
$sc_style['ONLINE_MOST_DATESTAMP']['pre'] = LAN_ONLINE_9;
$sc_style['ONLINE_MOST_DATESTAMP']['pre'] = "".LAN_ONLINE_9;
$sc_style['ONLINE_MOST_DATESTAMP']['post'] = "";
$TEMPLATE_ONLINE['ENABLED'] = "
$ONLINE_TEMPLATE['enabled'] = "
<ul class='online-menu'>
{ONLINE_GUESTS}
{ONLINE_MEMBERS}{ONLINE_MEMBERS_LIST}<br />
{ONLINE_MEMBERS}
{ONLINE_MEMBERS_LIST_EXTENDED}
{ONLINE_ONPAGE}
<br />
{ONLINE_MEMBER_TOTAL}
{ONLINE_MEMBER_NEWEST}
<br />
<li>
{ONLINE_MOST}
({ONLINE_MOST_MEMBERS}, {ONLINE_MOST_GUESTS}) {ONLINE_MOST_DATESTAMP}
<small class='muted'>
{ONLINE_MOST_GUESTS}
{ONLINE_MOST_MEMBERS}
{ONLINE_MOST_DATESTAMP}
</small>
</li>
</ul>
";
//##### ONLINE TRACKING DISABLED ----------------------------------------------
$TEMPLATE_ONLINE['DISABLED'] = "{ONLINE_TRACKING_DISABLED}";
$ONLINE_TEMPLATE['disabled'] = "{ONLINE_TRACKING_DISABLED}";
//##### ONLINE MEMBER LIST EXTENDED -------------------------------------------
$TEMPLATE_ONLINE['ONLINE_MEMBERS_LIST_EXTENDED'] = "{ONLINE_MEMBER_IMAGE} {ONLINE_MEMBER_USER} ".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}<br />";
$ONLINE_TEMPLATE['online_members_list_extended'] = "{SETIMAGE: w=40}<li>{ONLINE_MEMBER_IMAGE=avatar} {ONLINE_MEMBER_USER} ".LAN_ONLINE_7." {ONLINE_MEMBER_PAGE}</li>";
?>

View File

@@ -41,6 +41,7 @@ class online_shortcodes
function sc_lastseen_date()
{
$seen_ago = $this->gen->computeLapse($this->currentUser['user_currentvisit'], false, false, true, 'short');
return $seen_ago;
return ($seen_ago ? $seen_ago : '1 '.LANDT_09).' '.LANDT_AGO;
}
@@ -136,8 +137,13 @@ class online_shortcodes
}
function sc_online_member_image()
function sc_online_member_image($parm='')
{
if($parm == 'avatar')
{
return e107::getParser()->parseTemplate("{USER_AVATAR=".$this->currentMember['oimage']."}",true);
}
return "<img src='".e_IMAGE_ABS."admin_images/users_16.png' alt='' style='vertical-align:middle' />";
}