/*
+---------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
//$ec_dir = e_PLUGIN."calendar_menu/";
$lan_file = $ec_dir."languages/".e_LANGUAGE.".php";
include(file_exists($lan_file) ? $lan_file : e_PLUGIN."calendar_menu/languages/English.php");
$datearray = getdate();
$current_day = $datearray['mday'];
$current_month = $datearray['mon'];
$current_year = $datearray['year'];
// get first and last days of month in unix format---------------------------------------------------
$monthstart= mktime(0,0,0,$current_month,1,$current_year);
$firstdayarray = getdate($monthstart);
$monthend = mktime(0,0,0,$current_month+1,0,$current_year);
$lastdayarray = getdate($monthend);
// ----------------------------------------------------------------------------------------------------------
// get events from current month----------------------------------------------------------------------
$sql -> db_Select("event", "*", "(event_start>='$monthstart' AND event_start<= '$monthend') OR (event_rec_y='$current_month')");
$events = $sql -> db_Rows();
while($row = $sql -> db_Fetch()){
extract($row);
$evf = getdate($event_start);
$tmp = $evf['mday'];
$event_true[$tmp] = $event_category;
}
// -----------------------------------------------------------------------------------------------------------
// set up arrays for calender display ------------------------------------------------------------------
$week = Array(EC_LAN_25,EC_LAN_19,EC_LAN_20,EC_LAN_21,EC_LAN_22,EC_LAN_23,EC_LAN_24);
$months = Array(EC_LAN_0,EC_LAN_1,EC_LAN_2,EC_LAN_3,EC_LAN_4,EC_LAN_5,EC_LAN_6,EC_LAN_7,EC_LAN_8,EC_LAN_9,EC_LAN_10,EC_LAN_11);
$calendar_title = $months[$datearray[mon]-1]." ".$current_year;
// -----------------------------------------------------------------------------------------------------------
$text = "";
if($events){
$text .= EC_LAN_26 . ": ".$events;
}else{
$text .= EC_LAN_27;
}
$start = $monthstart;
$text .= "
";
foreach($week as $day){
$text .= "| ".$day." | ";
}
$text .= " ";
$thismonth = $datearray['mon'];
$thisday = $datearray['mday'];
for($c=0; $c<$firstdayarray['wday']; $c++){
$text .= "
| ";
}
$loop = $firstdayarray['wday'];
for($c=1; $c<=31; $c++){
$dayarray = getdate($start+($c*84460));
if($dayarray['mon'] == $thismonth){
if($thisday == $c){
$text .= "";
}else{
$text .=" | ";
}
if($event_true[($c)]){
$sql -> db_Select("event_cat", "*", "event_cat_id='".$event_true[($c)]."' ");
$icon = $sql -> db_Fetch();
extract($icon);
$img = " ";
}else{
$img = " ";
}
$linkut = mktime(0 ,0 ,0 ,$dayarray['mon'], $c, $datearray['year']);
$text .="$img $c";
if($thisday == $c){
}
$text .= " | \n";
$loop++;
if($loop == 7){
$loop = 0;
$text .= " ";
}
}
}
for($a=($loop+1); $a<=7; $a++){
$text .="| | ";
}
$text .= "
";
$ns -> tablerender($calendar_title, $text);
?>
|
$caption = 'COMCENT System v2.0';
$text = ' ';
if ($_GET['cmd']){ // Just for future capabilities
} else {
if (!$_SESSION['uobject']){
// This person has not logged in yet.
$text .= NOTLOGGEDINMSG.'
';
}
// The first thing we want to show is how the universe is doing
// Now to grab all battles
$tbattles = $GLOBALS['services']->sql_autofetch('select count(game_info.game_id) as total_battles from game_info');
// Now get pilot/squad totals
$adata = $GLOBALS['services']->sql_autofetch('select count(nick_id) as nicks,
count(distinct onweb.squad_id) as squads
from onweb
left join squads on squads.squad_id = onweb.squad_id
where score > 0 or time_played > 0');
// Now to dump it into table structure
$text .= $_SESSION['out']->tableStart(4,"Universe's Statistics");
$text .= $_SESSION['out']->tableHeaders(Array('Battles','Pilots','Squads','% in Control [ VIEW MAP ]'));
$text .= $_SESSION['out']->tableRow(Array(
$tbattles['total_battles'],
$adata['nicks'],
$adata['squads'],
buildControlBarGraph()));
$text .= $_SESSION['out']->tableEnd();
$text .= ' ';
// Now to get Federated Stats Stats
$factionstats = $GLOBALS['services']->sql_query('select factions.faction_id,factions.faction,factions.faction_abbrev,
SUM(game_faction.kills) + factions.total_kills as total_kills,
SUM(game_faction.score) + factions.faction_points as faction_points,
SUM(if (won=1,1,0))+faction_wins as faction_wins,
SUM(if (won=0,1,0))+faction_losses as faction_losses
from game_faction
left join factions on game_faction.faction_id=factions.faction_id
group by factions.faction_id
order by faction_points');
// Show each factions stats
while ($array = $GLOBALS['services']->sql_fetchrow($factionstats)){
$pcount = $GLOBALS['services']->sql_autofetch('SELECT COUNT(nick_id) as pilots ,count(DISTINCT squad_id) as squads
FROM onweb WHERE faction='.$array['faction_id']);
$scount = $GLOBALS['services']->sql_autofetch('SELECT COUNT(objective_id) as objectives,count(distinct sector) as sectors
FROM sectors WHERE owner=LOWER("'.$array['faction_abbrev'].'")');
$faction[$array['faction_abbrev']] = $_SESSION['out']->tableStart(7,$array['faction']."'s Statistics");
$faction[$array['faction_abbrev']] .= $_SESSION['out']->tableHeaders(Array('Total Wins','Losses','Kills','Pilots','Squads',
'Objectives | ','Sectors'));
$faction[$array['faction_abbrev']] .= $_SESSION['out']->tableRow(Array(
$array['faction_wins'],
$array['faction_losses'],
$array['total_kills'],
$pcount['pilots'],
$pcount['squads'],
$scount['objectives'],
$scount['sectors']
));
$faction[$array['faction_abbrev']] .= $_SESSION['out']->tableEnd();
}
sort($faction);
foreach($faction as $f) $text .= $f.' ';
/*
// Next, we should show bounties
// We will only show Active and Top 5
// SO first get the active bounties
$bquery = $GLOBALS['services']->sql_query('SELECT nick,price
from hitlist
left join hitmoney on hitlist.hit_id=hitmoney.hit_id
left join nick on nick.nick_id=hitlist.nick_id');
if ($GLOBALS['services']->sql_numrows($bquery) > 0) { // there are active bounties
$text .= $_SESSION['out']->tableStart(3,'Active Bounties');
$text .= $_SESSION['out']->tableHeaders(Array('Bounty Out For','Amount To Be Paid','# Of Times On List'));
while ($array = $GLOBALS['services']->sql_fetchrow($bquery)){
$text .= $_SESSION['out']->tableRow(Array(
$array['nick'],
$array['price'],
'1'
));
}
$text .= $_SESSION['out']->tableEnd();
}
$text .= ' ';
// Now get the top 5
$text .= $_SESSION['out']->tableStart(5,'Top 5 Bounty Hunters [ ALL ]');
$text .= $_SESSION['out']->tableHeaders(Array('Bounty Hunter','Last Tagged','For Amount','Total Money','# of Bounties'));
$bquery = $GLOBALS['services']->sql_query('SELECT hit_id,nick,hitmoney.nick_id,money,num_hits
from hitmoney
left join nick on nick.nick_id=hitmoney.nick_id
ORDER BY money DESC LIMIT 0,5');
while ($array = $GLOBALS['services']->sql_fetchrow($bquery)){
$barray = $GLOBALS['services']->sql_autofetch('SELECT nick,price
FROM completedhits
LEFT JOIN nick ON completedhits.nick_id=nick.nick_id
WHERE hit_by = '.$array['nick_id'].' ORDER BY hit_id');
$text .= $_SESSION['out']->tableRow(Array(
$array['nick'],
$barray['nick'],
$barray['price'],
$array['money'],
$array['num_hits']
));
}
$text .= $_SESSION['out']->tableEnd();
$text .= ' ';
*/
// Battle schedule
$squery = $GLOBALS['services']->sql_query('SELECT event,month,day,year,hour,minute,server,
report,contact,a.squad_name as host,b.squad_name as guest
FROM scheduler
LEFT JOIN squads as a ON a.squad_id=owner
LEFT JOIN squads as b ON b.squad_id=scheduler.against
WHERE scheduler.datetime > UNIX_TIMESTAMP(NOW())
ORDER BY scheduler.datetime');
if ($GLOBALS['services']->sql_numrows($squery) > 0){ // there are scheduled battles
$text .= $_SESSION['out']->tableStart(6,'Scheduled Battles');
$text .= $_SESSION['out']->tableHeaders(Array('Event','Scheduled Time','Server','Host','Guest'));
while ($array = $GLOBALS['services']->sql_fetchrow($squery)){
if (strpos($array['contact'],'@') > 0){ $array['contact'] = '[EMAIL]'; }
if ($array['report'] == 'Yes'){ $array['report'] = '(R)'; } else { $array['report'] = ''; }
$text .= $_SESSION['out']->tableRow(Array(
$array['event'],
$array['month'].' '.$array['day'].' @ '.$array['hour'].':'.$array['minute'],
$array['server'].' '.$array['report'],
$array['host'],
$array['guest'],
$array['contact']
));
}
$text .= $_SESSION['out']->tableEnd();
}
$text .= ' ';
$br = new BattleReport_Class;
$battles = $br->pullBattleReport('',$_GET['start'],PERPAGE,'WHERE game_info.date > UNIX_TIMESTAMP(NOW()) - (60*60*24) ');
$text .= $_SESSION['out']->tableStart(4,'Current Battle Reports (< 24 Hours) [ ALL ]');
$text .= $_SESSION['out']->tableHeaders(Array('Date','Fought On','Location'));
foreach($battles as $array){ // Grab the battle data
// Before we can report the data we need to know if this was a tie or not first
$text .= $_SESSION['out']->tableRow(Array(
date('m/d/Y H:i:s',$array['gamedate']),
''.$array['server_name'].'',
''.$array['name'].'',
'[ VIEW ]'
), 'statsb');
$text .= $_SESSION['out']->tableRow($array['result']);
}
$text .= $_SESSION['out']->tableEnd();
$text .= '
';
}
// Fix caption
$caption =''.$caption.' ';
if ($_GET['cmd']){
$caption .= '[ « ]';
}
$caption .= '[ ^ ] ';
// Display main Box
$ns->gen_tablerend($caption,$text);
?>
// Seconday area for holding things like the search tools and linked pilots info
// Do we have linked pilots?
if ($_SESSION['uobject'] && $_SESSION['uobject']->hasLinkedPilots()){
$ns->tablerender("Linked Pilots",$_SESSION['uobject']->displayPilots());
}
?>
|
// Display external template
require_once(FOOTERF);
?>
|