/*
+---------------------------------------------------------------+
| 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);
?>
|
$stats = new Stats_Class;
// Area Identification
$caption = 'View In-Game Stats';
$text = ' ';
if ($_POST['search'] != ''){
if ($_POST['s_in'] == 'pilot'){
$sqlwhere = ' nick.nick LIKE "%'.$_POST['search'].'%" AND ';
} else if ($_POST['s_in'] == 'squad'){
$sqlwhere = ' squads.squad_name LIKE "%'.$_POST['search'].'%" AND ';
} else if ($_POST['s_in'] == 'group'){
$sqlwhere = ' groups.group_name LIKE "%'.$_POST['search'].'%" AND ';
}
$_GET['cmd'] = $_POST['s_in'];
} else if ($_GET['search']){
if ($_POST['s_in'].$_GET['cmd'] == 'pilot'){
$sqlwhere = ' nick.nick LIKE "%'.$_GET['search'].$_POST['search'].'%" AND ';
} else if ($_POST['s_in'].$_GET['cmd'] == 'squad'){
$sqlwhere = ' squads.squad_name LIKE "%'.$_GET['search'].$_POST['search'].'%" AND ';
} else if ($_POST['s_in'].$_GET['cmd'] == 'group'){
$sqlwhere = ' groups.group_name LIKE "%'.$_GET['search'].$_POST['search'].'%" AND ';
}
}
// Display processing follows here
if ($_GET['cmd']=='group'){
if ($_GET['id']){
list($gstats) = $stats->pullGroupsStats($_GET['id']); // Pull in the top 20 pilots stats
$text .= '| '.$gstats['group_name'].'
[ ALL ] | ';
$text .= '| Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$text .= '
| '.$gstats['squad_name'].' |
'.$gstats['kills'].' |
'.$gstats['deaths'].' ('.$gstats['suicides'].') |
'.intval((($gstats['kills']/($gstats['deaths']+$gstats['suicides']))*100)).'% |
'.$gstats['objectives'].' |
'.$gstats['score'].' |
';
$text .= ' ';
$text .= ' ';
// Now get the pilots for this group
$result = $GLOBALS['services']->sql_query('SELECT onweb.nick_id,nick.nick
FROM onweb,nick
WHERE onweb.nick_id=nick.nick_id
AND group_id = '.$_GET['id']);
if ($GLOBALS['services']->sql_numrows($result) > 0){ // there are pilots assigned to this group
$text .= '| '.$gstats['group_name'].'\'s Pilots
| ';
$text .= '| Pilot | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
while($array = $GLOBALS['services']->sql_fetchrow($result)){
list($ptemp) = $stats->pullPilotsStats($array['nick_id']); // Pull in the top 5 pilots stats
$parray[] = $ptemp;
}
foreach($parray as $pstats){
$text .= '
| '.$pstats['nick'].' |
'.$pstats['kills'].' |
'.$pstats['deaths'].' ('.$pstats['suicides'].') |
'.intval((($pstats['kills']/($pstats['deaths']+$pstats['suicides']))*100)).'% |
'.$pstats['objectives'].' |
'.$pstats['score'].' |
';
}
$text .= '
';
unset($parray);
}
} else {
$text .= '| Groups
| ';
$text .= '| Group | Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$groups = $stats->pullGroupsStats('',$_GET['start'],PERPAGE, $sqlwhere); // Pull in the top 5 groups stats
foreach($groups as $gstats){
$text .= '
| '.$gstats['group_name'].' |
'.$gstats['squad_name'].' |
'.$gstats['kills'].' |
'.$gstats['deaths'].' ('.$gstats['suicides'].') |
'.intval((($gstats['kills']/($gstats['deaths']+$gstats['suicides']))*100)).'% |
'.$gstats['objectives'].' |
'.$gstats['score'].' |
';
}
$text .= ' | ';
$text .= ' ';
}
} else if ($_GET['cmd']=='squad'){
if ($_GET['id']){
// They passed an ID which means showing squad/group and pilot information
// so first things first, get the squads scores
list($sstats) = $stats->pullSquadsStats($_GET['id']); // Pull in the top 20 pilots stats
$text .= '| '.$sstats['squad_name'].'
[ ALL ] | ';
$text .= '| Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$text .= '
| '.$sstats['kills'].' |
'.$sstats['deaths'].' ('.$sstats['suicides'].') |
'.intval((($sstats['kills']/($sstats['deaths']+$sstats['suicides']))*100)).'% |
'.$sstats['objectives'].' |
'.$sstats['score'].' |
';
$text .= '
';
// Now that we have that, lets pull in the unassigned Pilots information
$result = $GLOBALS['services']->sql_query('SELECT onweb.nick_id,nick.nick
FROM onweb,nick
WHERE onweb.nick_id=nick.nick_id
AND group_id = 0
AND squad_id='.$_GET['id']);
if ($GLOBALS['services']->sql_numrows($result) > 0){ // there are unassigned Pilots
$text .= '| Unassigned Pilots
| ';
$text .= '| Pilot | Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
while($array = $GLOBALS['services']->sql_fetchrow($result)){
list($ptemp) = $stats->pullPilotsStats($array['nick_id']); // Pull in the top 5 pilots stats
$parray[] = $ptemp;
}
foreach($parray as $pstats){
$text .= '
| '.$pstats['nick'].' |
'.$pstats['squad_name'].' |
'.$pstats['kills'].' |
'.$pstats['deaths'].' ('.$pstats['suicides'].') |
'.intval((($pstats['kills']/($pstats['deaths']+$pstats['suicides']))*100)).'% |
'.$pstats['objectives'].' |
'.$pstats['score'].' |
';
}
$text .= '
';
unset($parray);
}
// Okay the are out of the way, now lets do groups and their pilots
$result = $GLOBALS['services']->sql_query('SELECT group_id,group_name FROM groups WHERE squad_id='.$_GET['id']);
// The above query is almost guaranteed to return atleast 1 result, but just in case double check it
if ($GLOBALS['services']->sql_numrows($result) > 0){ // there are groups
while($array = $GLOBALS['services']->sql_fetchrow($result)){
// Okay display the group information
list($gstats) = $stats->pullGroupsStats($array['group_id']);
$text .= '| '.$array['group_name'].'
(Group) | ';
$text .= '| Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$text .= '
| '.$gstats['kills'].' |
'.$gstats['deaths'].' ('.$gstats['suicides'].') |
'.intval((($gstats['kills']/($gstats['deaths']+$gstats['suicides']))*100)).'% |
'.$gstats['objectives'].' |
'.$gstats['score'].' |
';
$text .= '
';
// Now get the pilots for this group
$result2 = $GLOBALS['services']->sql_query('SELECT onweb.nick_id,nick.nick
FROM onweb,nick
WHERE onweb.nick_id=nick.nick_id
AND group_id = '.$array['group_id'].'
AND squad_id='.$_GET['id']);
if ($GLOBALS['services']->sql_numrows($result2) > 0){ // there are pilots assigned to this group
$text .= '| '.$array['group_name'].'\'s Pilots
| ';
$text .= '| Pilot | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
while($array = $GLOBALS['services']->sql_fetchrow($result2)){
list($ptemp) = $stats->pullPilotsStats($array['nick_id']); // Pull in the top 5 pilots stats
$parray[] = $ptemp;
}
foreach($parray as $pstats){
$text .= '
| '.$pstats['nick'].' |
'.$pstats['kills'].' |
'.$pstats['deaths'].' ('.$pstats['suicides'].') |
'.intval((($pstats['kills']/($pstats['deaths']+$pstats['suicides']))*100)).'% |
'.$pstats['objectives'].' |
'.$pstats['score'].' |
';
}
$text .= '
';
unset($parray);
}
}
}
} else {
$text .= '| Squads
| ';
$text .= '| Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$squads = $stats->pullSquadsStats('',$_GET['start'],PERPAGE, $sqlwhere); // Pull in the top 20 squads stats
foreach($squads as $sstats){
$text .= '
| '.$sstats['squad_name'].' |
'.$sstats['kills'].' |
'.$sstats['deaths'].' ('.$sstats['suicides'].') |
'.intval((($sstats['kills']/($sstats['deaths']+$sstats['suicides']))*100)).'% |
'.$sstats['objectives'].' |
'.$sstats['score'].' |
';
}
$text .= ' | ';
$text .= ' ';
}
} else if ($_GET['cmd']=='pilot'){
if ($_GET['id']){
list($pstats) = $stats->pullPilotsStats($_GET['id']); // Pull in the top 20 pilots stats
$text .= '| '.$pstats['nick'].'
[ ALL ] | ';
$text .= '| Squad | Group | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$text .= '
| '.$pstats['squad_name'].' |
'.$pstats['group_name'].' |
'.$pstats['kills'].' |
'.$pstats['deaths'].' ('.$pstats['suicides'].') |
'.intval((($pstats['kills']/($pstats['deaths']+$pstats['suicides']))*100)).'% |
'.$pstats['objectives'].' |
'.$pstats['score'].' |
';
$text .= ' ';
} else { // no id so get all Pilots
$text .= '| Pilots
| ';
$text .= '| Pilot | Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$pilots = $stats->pullPilotsStats('',$_GET['start'],PERPAGE, $sqlwhere); // Pull in the top 5 pilots stats
foreach($pilots as $pstats){
$text .= '
| '.$pstats['nick'].' |
'.$pstats['squad_name'].' |
'.$pstats['kills'].' |
'.$pstats['deaths'].' ('.$pstats['suicides'].') |
'.intval((($pstats['kills']/($pstats['deaths']+$pstats['suicides']))*100)).'% |
'.$pstats['objectives'].' |
'.$pstats['score'].' |
';
}
$text .= ' | ';
$text .= ' ';
}
} else if ($_GET['cmd']=='top20'){
if (!$_GET['area'] || $_GET['area'] == 'pilot'){
$text .= '| Top 20 Pilots
[ ALL ] | ';
$text .= '| Pilot | Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$pilots = $stats->pullPilotsStats('',0,20); // Pull in the top 20 pilots stats
foreach($pilots as $pstats){
$text .= '
| '.$pstats['nick'].' |
'.$pstats['squad_name'].' |
'.$pstats['kills'].' |
'.$pstats['deaths'].' ('.$pstats['suicides'].') |
'.intval((($pstats['kills']/($pstats['deaths']+$pstats['suicides']))*100)).'% |
'.$pstats['objectives'].' |
'.$pstats['score'].' |
';
}
$text .= ' ';
}
if (!$_GET['area'] || $_GET['area'] == 'squad'){
$text .= '| Top 20 Squads
[ ALL ] | ';
$text .= '| Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$squads = $stats->pullSquadsStats('',0,20); // Pull in the top 20 squads stats
foreach($squads as $sstats){
$text .= '
| '.$sstats['squad_name'].' |
'.$sstats['kills'].' |
'.$sstats['deaths'].' ('.$sstats['suicides'].') |
'.intval((($sstats['kills']/($sstats['deaths']+$sstats['suicides']))*100)).'% |
'.$sstats['objectives'].' |
'.$sstats['score'].' |
';
}
$text .= ' ';
}
if (!$_GET['area'] || $_GET['area'] == 'group'){
$text .= '| Top 20 Groups
[ ALL ] | ';
$text .= '| Group | Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$groups = $stats->pullGroupsStats('',0,20); // Pull in the top 20 groups stats
foreach($groups as $gstats){
$text .= '
| '.$gstats['group_name'].' |
'.$gstats['squad_name'].' |
'.$gstats['kills'].' |
'.$gstats['deaths'].' ('.$gstats['suicides'].') |
'.intval((($gstats['kills']/($gstats['deaths']+$gstats['suicides']))*100)).'% |
'.$gstats['objectives'].' |
'.$gstats['score'].' |
';
}
$text .= ' ';
}
} else { // default display
// We will show the top 5 of each of the areas (pilots,groups,squads,users)
//print_r($stats->pullPilotsStats('',0,5));
//print '
';
//print_r($stats->pullSquadsStats('',0,5));
//print '
';
//print_r($stats->pullGroupsStats('',0,5));
//print '
';
$text .= '| Top 5 Pilots
[ ALL ] | ';
$text .= '| Pilot | Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$pilots = $stats->pullPilotsStats('',0,5); // Pull in the top 5 pilots stats
foreach($pilots as $pstats){
$text .= '
| '.$pstats['nick'].' |
'.$pstats['squad_name'].' |
'.$pstats['kills'].' |
'.$pstats['deaths'].' ('.$pstats['suicides'].') |
'.intval((($pstats['kills']/($pstats['deaths']+$pstats['suicides']))*100)).'% |
'.$pstats['objectives'].' |
'.$pstats['score'].' |
';
}
$text .= ' ';
$text .= ' ';
$text .= '| Top 5 Squads
[ ALL ] | ';
$text .= '| Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$squads = $stats->pullSquadsStats('',0,5); // Pull in the top 5 squads stats
foreach($squads as $sstats){
$text .= '
| '.$sstats['squad_name'].' |
'.$sstats['kills'].' |
'.$sstats['deaths'].' ('.$sstats['suicides'].') |
'.intval((($sstats['kills']/($sstats['deaths']+$sstats['suicides']))*100)).'% |
'.$sstats['objectives'].' |
'.$sstats['score'].' |
';
}
$text .= ' ';
$text .= ' ';
$text .= '| Top 5 Groups
[ ALL ] | ';
$text .= '| Group | Squad | Kills |
Deaths | Kill Ratio |
Objs. | Score | ';
$groups = $stats->pullGroupsStats('',0,5); // Pull in the top 5 groups stats
foreach($groups as $gstats){
$text .= '
| '.$gstats['group_name'].' |
'.$gstats['squad_name'].' |
'.$gstats['kills'].' |
'.$gstats['deaths'].' ('.$gstats['suicides'].') |
'.intval((($gstats['kills']/($gstats['deaths']+$gstats['suicides']))*100)).'% |
'.$gstats['objectives'].' |
'.$gstats['score'].' |
';
}
$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
// Stats doesn't show linked pilots
// But it does have a search feature
if (!$_POST['s_in']){ $_POST['s_in'] = 'pilot'; }
$stext .= ' ';
$stext .= $_SESSION['out']->formStart();
$stext .= $_SESSION['out']->formLine('','text','search',$_GET['search'].$_POST['search'], Array('size'=>'10'));
$stext .= $_SESSION['out']->formLine('In:','radio','s_in',$_GET['cmd'].$_POST['s_in'],Array(
Array('pilot','Pilots '),
Array('squad','Squads '),
Array('group','Groups ')
));
$stext .= $_SESSION['out']->formEnd('Go Find -->');
$ns->tablerender("Search Stats For",$stext);
if ($_SESSION['uobject'] && $_SESSION['uobject']->hasLinkedPilots()){
$ns->tablerender("Linked Pilots",$_SESSION['uobject']->displayPilots());
}
?>
|
// Display external template
require_once(FOOTERF);
?> |