root/dev/mods/monthly_views/lossesmonthly.php @ 343

Revision 343, 2.6 KB (checked in by beans, 12 years ago)

A lot of updates done by Karbowiak (LaMaH).
See them here:  http://eve-id.net/forum/viewtopic.php?f=503&t=13204&p=15284#p15284

Highlights:
* Integrated feed fetcher & API Mod into the core
* memcached support in core

Line 
1<?php
2require_once('common/includes/class.corp.php');
3require_once('common/includes/class.alliance.php');
4require_once('common/includes/class.killlist.php');
5require_once('common/includes/class.killlisttable.php');
6require_once('common/includes/class.killsummarytable.php');
7require_once('common/includes/class.toplist.php');
8
9if (config::get('public_losses')){
10        die('Forbidden');
11}
12
13$week = $_GET['w'];
14$year = $_GET['y'];
15$month = $_GET['m'];
16
17if ($week == "") {
18    $week = kbdate("W");
19}
20
21if ($year == "") {
22    $year = kbdate("Y");
23}
24
25if ($month == "") {
26    $month = kbdate("n");
27}
28
29if ($month == 1)
30{
31    $pyear = $year - 1;
32    $pmonth = 12;
33}
34else
35{
36    $pyear = $year;
37    $pmonth = $month - 1;
38}
39
40if ($month == 12)
41{
42    $nmonth = 1;
43    $nyear = $year + 1;
44}
45else
46{
47    $nmonth = $month + 1;
48    $nyear = $year;
49}
50
51$page = new Page("Losses - ".date('F Y', mktime(0,0,0,$month, 1, $year)));
52
53$klist = new KillList();
54$klist->setStartDate($year.'-'.$month.'-1 00:00:00');
55$klist->setEndDate($year.'-'.$month.'-31 23:59:59');
56involved::load($klist,'kill');
57
58$lslist = new KillList();
59$lslist->setStartDate($year.'-'.$month.'-1 00:00:00');
60$lslist->setEndDate($year.'-'.$month.'-31 23:59:59');
61involved::load($lslist,'loss');
62
63if (config::get('summarytable')){
64$summarytable = new KillSummaryTable($klist, $lslist);
65$summarytable->setBreak(config::get('summarytable_rowcount'));
66$html .= $summarytable->generate();
67}
68
69$llist = new KillList();
70$llist->setOrdered(true);
71$llist->setStartDate($year.'-'.$month.'-1 00:00:00');
72$llist->setEndDate($year.'-'.$month.'-31 23:59:59');
73involved::load($llist,'loss');
74if ($_GET['scl_id'])
75    $llist->addVictimShipClass(new ShipClass($_GET['scl_id']));
76else
77    $llist->setPodsNoobShips(false);
78
79$table = new KillListTable($llist);
80$html .= $table->generate();
81
82$menubox = new box("Menu");
83$menubox->setIcon("menu-item.gif");
84$menubox->addOption("caption", "Navigation");
85$menubox->addOption("link","Previous month", "?a=lossesmonthly&m=" . $pmonth . "&y=" . $pyear);
86if ($month != date("m"))
87{
88    $menubox->addOption('link', "Next month", "?a=lossesmonthly&m=".$nmonth."&y=".$nyear);
89}
90$menubox->addOption('link', "Kills this month", "?a=killsmonthly&m=".$month."&y=".$year);
91$page->addContext($menubox->generate());
92
93$tllist = new TopLossesList();
94$tllist->setStartDate($year.'-'.$month.'-1 00:00:00');
95$tllist->setEndDate($year.'-'.$month.'-31 23:59:59');
96involved::load($tllist,'loss');
97
98$tllist->generate();
99$tlbox = new AwardBox($tllist, "Top losers", "losses ". date('F Y', mktime(0,0,0,$month, 1, $year)), "losses", "moon");
100$page->addContext($tlbox->generate());
101
102$page->setContent($html);
103$page->generate();
104?>
Note: See TracBrowser for help on using the browser.