From: <dj...@us...> - 2012-01-20 18:21:12
|
Revision: 8765 http://xoops.svn.sourceforge.net/xoops/?rev=8765&view=rev Author: djculex Date: 2012-01-20 18:21:05 +0000 (Fri, 20 Jan 2012) Log Message: ----------- adjusted styling etc in index.php Modified Paths: -------------- XoopsModules/smallworld/trunk/smallworld/admin/index.php Modified: XoopsModules/smallworld/trunk/smallworld/admin/index.php =================================================================== --- XoopsModules/smallworld/trunk/smallworld/admin/index.php 2012-01-20 17:25:31 UTC (rev 8764) +++ XoopsModules/smallworld/trunk/smallworld/admin/index.php 2012-01-20 18:21:05 UTC (rev 8765) @@ -24,7 +24,11 @@ include_once dirname(__FILE__) . '/admin_header.php'; xoops_cp_header(); +global $xoTheme; +$xoTheme->addStylesheet(XOOPS_URL . '/modules/smallworld/css/SmallworldAdmin.css'); +$xoTheme->addScript(XOOPS_URL . '/modules/smallworld/js/adminsmallworld.js'); + $indexAdmin = new ModuleAdmin(); @@ -49,71 +53,105 @@ $sumallusers = $admin->TotalUsers (); // Find list of most active users (total) $maAllround = $admin->mostactiveusers_allround(); - $ma = "<table class='smallworldadmin'><tr>"; - $ma .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; - $i = 1; - while ($i < count($maAllround)-1) { - $ma .= vsprintf('<tr><td>%s</td>',array($maAllround['counter'][$i])); - $ma .= vsprintf('<td>%s</td>',array($maAllround['img'][$i])); - $ma .= vsprintf('<td>%s</td>',array($maAllround['cnt'][$i])); - $ma .= vsprintf('<td>%s</td></tr>',array($maAllround['from'][$i])); - $i++; - } - $ma .= "</tr></table>"; +$ma_cnt = 0; + if (count($maAllround) != 0) { + $ma_cnt = 1; + $ma = "<table class='smallworldadmin'><tr>"; + $ma .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; + $i = 1; + while ($i < count($maAllround)-1) { + $ma .= vsprintf('<tr><td>%s</td>',array($maAllround['counter'][$i])); + $ma .= vsprintf('<td>%s</td>',array($maAllround['img'][$i])); + $ma .= vsprintf('<td>%s</td>',array($maAllround['cnt'][$i])); + $ma .= vsprintf('<td>%s</td></tr>',array($maAllround['from'][$i])); + $i++; + } + $ma .= "</tr></table>"; + } else { + $maAllround = 0; + } // Find list of most active users (24 hours) $maToday = $admin->mostactiveusers_today(); - $mat = "<table class='smallworldadmin'><tr>"; - $mat .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; - $i = 1; - while ($i < count($maToday)-1) { - $mat .= vsprintf('<tr><td>%s</td>',array($maToday['counter'][$i])); - $mat .= vsprintf('<td>%s</td>',array($maToday['img'][$i])); - $mat .= vsprintf('<td>%s</td>',array($maToday['cnt'][$i])); - $mat .= vsprintf('<td>%s</td></tr>',array($maToday['from'][$i])); - $i++; - } - $mat .= "</tr></table>"; +$mat_cnt = 0; + if (count($maToday) != 0) { + $mat_cnt = 1; + $mat = "<table class='smallworldadmin'><tr>"; + $mat .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; + $i = 1; + while ($i < count($maToday)-1) { + $mat .= vsprintf('<tr><td>%s</td>',array($maToday['counter'][$i])); + $mat .= vsprintf('<td>%s</td>',array($maToday['img'][$i])); + $mat .= vsprintf('<td>%s</td>',array($maToday['cnt'][$i])); + $mat .= vsprintf('<td>%s</td></tr>',array($maToday['from'][$i])); + $i++; + } + $mat .= "</tr></table>"; + } else { + $mat = 0; + } // FInd list of best rated users overall $topusers = $admin->topratedusers('up'); - $top = "<table class='smallworldadmin'><tr>"; - $top .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; - $i = 1; - while ($i < count($topusers)-1) { - $top .= vsprintf('<tr><td>%s</td>',array($topusers['counter'][$i])); - $top .= vsprintf('<td>%s</td>',array($topusers['img'][$i])); - $top .= vsprintf('<td>%s</td>',array($topusers['cnt'][$i])); - $top .= vsprintf('<td>%s</td></tr>',array($topusers['user'][$i])); - $i++; - } - $top .= "</tr></table>"; +$top_cnt = 0; + if (count($topusers) != 0) { + $top_cnt = 1; + $top = "<table class='smallworldadmin'><tr>"; + $top .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; + $i = 1; + while ($i < count($topusers)-1) { + $top .= vsprintf('<tr><td>%s</td>',array($topusers['counter'][$i])); + $top .= vsprintf('<td>%s</td>',array($topusers['img'][$i])); + $top .= vsprintf('<td>%s</td>',array($topusers['cnt'][$i])); + $top .= vsprintf('<td>%s</td></tr>',array($topusers['user'][$i])); + $i++; + } + $top .= "</tr></table>"; + } else { + $top = 0; + } // FInd list of worst rated users overall $lowusers = $admin->topratedusers('down'); - $low = "<table class='smallworldadmin'><tr>"; - $low .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; - $i = 1; - while ($i < count($lowusers)-1) { - $low .= vsprintf('<tr><td>%s</td>',array($lowusers['counter'][$i])); - $low .= vsprintf('<td>%s</td>',array($lowusers['img'][$i])); - $low .= vsprintf('<td>%s</td>',array($lowusers['cnt'][$i])); - $low .= vsprintf('<td>%s</td></tr>',array($lowusers['user'][$i])); - $i++; - } - $low .= "</tr></table>"; +$low_cnt = 0; + if (count($lowusers) != 0) { + $low_cnt = 1; + $low = "<table class='smallworldadmin'><tr>"; + $low .= "<td><b>"._AM_SMALLWORLD_STATS_POS."</b></td><td><b>"._AM_SMALLWORLD_STATS_IMG."</b></td><td><b>"._AM_SMALLWORLD_STATS_AMOUNT."</b></td><td><b>"._AM_SMALLWORLD_STATS_NAME."</b></td></tr>"; + $i = 1; + while ($i <= count(array($lowusers))) { + $low .= vsprintf('<tr><td>%s</td>',array($lowusers['counter'][$i])); + $low .= vsprintf('<td>%s</td>',array($lowusers['img'][$i])); + $low .= vsprintf('<td>%s</td>',array($lowusers['cnt'][$i])); + $low .= vsprintf('<td>%s</td></tr>',array($lowusers['user'][$i])); + $i++; + } + $low .= "</tr></table>"; + } else { + $low = 0; + } $indexAdmin->addInfoBox(_AM_SMALLWORLD_USERSTATS); -$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<span style='smallworldadmin_tab_container'><p class='smallworldadmin'>"._AM_SMALLWORLD_DATEOFFIRSTMESSAGE." : %s</p>",$dateoffirstmessage,'Green','default'); +$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_DATEOFFIRSTMESSAGE." : %s</p>",$dateoffirstmessage,'Green','default'); $indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_TOTALUSERS." : %s</p>",$sumallusers, 'Red','default'); -$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_AVERAGEMSGPERDAY." : %s</p>", $avgperday, 'Red','default'); -$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_TOPCHATTERS_TODAY." : %s</p>", $mat, 'Red','default'); -$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_TOPCHATTERS." : %s</p>", $ma, 'Red','default'); -$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_TOPRATEDUSERS." : %s</p>", $top, 'Red','default'); -$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_BOTTOMRATEDUSERS." : %s</p></span>", $low, 'Red','default'); +if ($avgperday > 0) { + $indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_AVERAGEMSGPERDAY." : %s</p>", $avgperday, 'Red','default'); +} +if ($mat_cnt != 0 ) { + $indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_TOPCHATTERS_TODAY." : %s</p>", $mat, 'Red','default'); +} +if ($ma_cnt != 0 ) { + $indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_TOPCHATTERS." : %s</p>", $ma, 'Red','default'); +} +if ($top_cnt != 0 ) { + $indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_TOPRATEDUSERS." : %s</p>", $top, 'Red','default'); +} +if ($low_cnt != 0 ) { +$indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<p class='smallworldadmin'>"._AM_SMALLWORLD_BOTTOMRATEDUSERS." : %s</p>", $low, 'Red','default'); +} echo $indexAdmin->addNavigation('index.php'); echo $indexAdmin->renderIndex(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |