root/dev/common/cc_detail.php @ 213

Revision 213, 10.4 KB (checked in by ralle030583, 15 years ago)

All files (i hope i havent forgott something) was modified to use the the config in this way:
- config::get($key)
- config::del($key)
- config::set($key,value)

Exception Templates/Smarty?:
The templates still uses $config->get($key) and $config->set($key,$value) cause
it seems that smarty dont like the :: notification

Line 
1<?php
2require_once('common/includes/class.killlist.php');
3require_once('common/includes/class.killlisttable.php');
4require_once('common/includes/class.killsummarytable.php');
5require_once('common/includes/class.contract.php');
6require_once('common/includes/class.toplist.php');
7
8$ctr_id = $_GET['ctr_id'];
9
10$contract = new Contract($ctr_id);
11
12if ($contract->getCampaign())
13    $title = 'Campaign details';
14else
15    $title = 'Contract details';
16
17$page = new Page($title.' - '.$contract->getName());
18
19$html .= "<table align=center class=kb-table width=\"100%\" height=\"80\" border=\"0\" cellspacing=1><tr class=kb-table-row-even><td rowspan=5 align=center width=80 height=80>";
20// table class=kb-subtable cellspacing=0><tr class=kb-table-row-even><td width=80 height=80 align=center>";
21if ($contract->getCampaign())
22    $html .= "<img src=\"".IMG_URL."/campaign-big.gif\" align=center>";
23else
24    $html .= "<img src=\"".IMG_URL."/contract-big.gif\" align=center>";
25
26$html .= "</td>";
27// $html .= "<td valign=top align=left height=80>";
28// $html .= "<table class=kb-subtable width=\"100%\" height=\"100%\" cellspacing=1 border=\"0\">";
29if ($contract->getEndDate() == "")
30    $ended = "Active";
31else
32    $ended = substr($contract->getEndDate(), 0, 10);
33$html .= "<td class=kb-table-cell><b>Start date:</b></td><td class=kb-table-cell width=120><b>".substr($contract->getStartDate(), 0, 10)."</b></td><td class=kb-table-cell><b>End date:</b></td><td class=kb-table-cell width=120><b>".$ended."</b></td></tr>";
34$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$contract->getKills()."</td><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$contract->getLosses()."</td></tr>";
35$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($contract->getKillISK()/1000000, 2)."M</td><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($contract->getLossISK()/1000000, 2)."M</td></tr>";
36$html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Runtime:</b></td><td class=kb-table-cell><b>".$contract->getRunTime()." days</b></td><td class=kb-table-cell><b>Efficiency:</b></td><td class=kb-table-cell><b>".$contract->getEfficiency()."%</b></td></tr>";
37$html .= "</table>";
38// $html .= "</td></tr></table>";
39$klist = $contract->getKillList();
40$llist = $contract->getLossList();
41$killsummary = new KillSummaryTable($klist, $llist);
42$killsummary->setBreak(6);
43if ($_GET['view'] == "")
44    $killsummary->setFilter(false);
45
46$html .= "<br>";
47$html .= $killsummary->generate();
48
49switch ($_GET['view'])
50{
51    case "":
52        while ($target = &$contract->getContractTarget())
53        {
54            $kl = &$target->getKillList();
55            $ll = &$target->getLossList();
56            $summary = new KillSummaryTable($kl, $ll);
57            $summary->setVerbose(true);
58            $summary->setBreak(12);
59            $summary->setView('combined');
60
61            $html .= "<br><div class=kb-contract-target-header>Target ".$target->getType()." - ";
62            switch ($target->getType()) {
63                case "corp":
64                    $html .= "<a class=kb-contract href=\"?a=".$target->getType()."_detail&crp_id=".$target->getID()."\">".$target->getName()."</a>";
65                    break;
66                case "alliance":
67                    $html .= "<a class=kb-contract href=\"?a=".$target->getType()."_detail&all_id=".$target->getID()."\">".$target->getName()."</a>";
68                    break;
69                case "system":
70                    $html .= "<a class=kb-contract href=\"?a=" .$target->getType()."_detail&sys_id=".$target->getID()."\">".$target->getName()."</a>";
71                    break;
72                case "region":
73                    $html .= $target->getName();
74                    break;
75            }
76            $html .= "</div>";
77            $html .= $summary->generate();
78
79            $html .= "<br><table class=kb-subtable border=\"0\" cellspacing=0 width=\"100%\"><tr><td>";
80
81            if ($summary->getTotalKillISK())
82                $efficiency = round($summary->getTotalKillISK() / ($summary->getTotalKillISK() + $summary->getTotalLossISK()) * 100, 2);
83            else
84                $efficiency = 0;
85
86            $bar = new BarGraph($efficiency, 100, 120);
87            $html .= "<table class=kb-table cellspacing=1 border=\"0\" width=\"100%\"><tr class=kb-table-row-even>";
88            $html .= "<td class=kb-table-cell width=108><b>Totals:</b></td><td class=kl-kill-bg width=60 align=center>".$summary->getTotalKills()."</td><td class=kl-kill-bg width=60 align=center>".round($summary->getTotalKillISK()/1000000, 2)."M</td>";
89            $html .= "<td class=kl-loss-bg width=64 align=center>".$summary->getTotalLosses()."</td><td class=kl-loss-bg width=60 align=center>".round($summary->getTotalLossISK()/1000000, 2)."M</td></tr></table>";
90
91            $html .= "</td><td align=left>";
92
93            $html .= "<table class=kb-table cellspacing=1 border=\"0\"><tr class=kb-table-row-even>";
94            $html .= "<td class=kb-table-cell width=108><b>Efficiency:</b></td><td class=kb-table-cell align=center colspan=2 width=120><b>".$efficiency."%</b></td>";
95            $html .= "<td class=kb-table-cell colspan=2 width=120>".$bar->generate()."</td></tr>";
96            $html .= "</tr></table>";
97
98            $html .= "</td></tr></table>";
99        }
100
101        break;
102    case "recent_activity":
103        $html .= "<div class=kb-kills-header>10 Most recent kills</div>";
104
105        $contract = new Contract($ctr_id);
106        $klist = $contract->getKillList();
107        $klist->setOrdered(true);
108        if ($_GET['scl_id'])
109            $klist->addVictimShipClass(new ShipClass($_GET['scl_id']));
110        else
111            $klist->setPodsNoobShips(false);
112
113        $table = new KillListTable($klist);
114        $table->setLimit(10);
115        $table->setDayBreak(false);
116        $html .= $table->generate();
117
118        $html .= "<div class=kb-losses-header>10 Most recent losses</div>";
119        $llist = $contract->getLossList();
120        $llist->setOrdered(true);
121        if ($_GET['scl_id'])
122            $llist->addVictimShipClass(new ShipClass($_GET['scl_id']));
123        else
124            $llist->setPodsNoobShips(false);
125
126        $table = new KillListTable($llist);
127        $table->setLimit(10);
128        $table->setDayBreak(false);
129        $html .= $table->generate();
130        break;
131    case "kills":
132        $html .= "<div class=kb-kills-header>All kills</div>";
133
134        $contract = new Contract($ctr_id);
135        $list = $contract->getKillList();
136        $list->setOrdered(true);
137        if ($_GET['scl_id'])
138            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
139
140        $pagesplitter = new PageSplitter($list->getCount(), 30);
141        $list->setPageSplitter($pagesplitter);
142        $table = new KillListTable($list);
143        $table->setDayBreak(false);
144        $html .= $table->generate();
145        $html .= $pagesplitter->generate();
146        break;
147    case "losses":
148        $html .= "<div class=kb-losses-header>All losses</div>";
149
150        $contract = new Contract($ctr_id);
151        $llist = $contract->getLossList();
152        $llist->setOrdered(true);
153        if ($_GET['scl_id'])
154            $llist->addVictimShipClass(new ShipClass($_GET['scl_id']));
155
156        $pagesplitter = new PageSplitter($llist->getCount(), 30);
157        $llist->setPageSplitter($pagesplitter);
158        $table = new KillListTable($llist);
159        $table->setDayBreak(false);
160        $html .= $table->generate();
161        $html .= $pagesplitter->generate();
162        break;
163    case "combined":
164        $html .= "<div class=kb-kills-header>All kills</div>";
165
166        $contract = new Contract($ctr_id);
167        $list = $contract->getKillList();
168        $list->setOrdered(true);
169        if ($_GET['scl_id'])
170            $list->addVictimShipClass(new ShipClass($_GET['scl_id']));
171
172        $pagesplitter = new PageSplitter($list->getCount(), 20);
173        $list->setPageSplitter($pagesplitter);
174        $table = new KillListTable($list);
175        $table->setDayBreak(false);
176        $html .= $table->generate();
177        $html .= $pagesplitter->generate();
178
179        $html .= "<div class=kb-losses-header>All losses</div>";
180
181        $contract = new Contract($ctr_id);
182        $llist = $contract->getLossList();
183        $llist->setOrdered(true);
184        if ($_GET['scl_id'])
185            $llist->addVictimShipClass(new ShipClass($_GET['scl_id']));
186
187        $pagesplitter = new PageSplitter($llist->getCount(), 20);
188        $llist->setPageSplitter($pagesplitter);
189        $table = new KillListTable($llist);
190        $table->setDayBreak(false);
191        $html .= $table->generate();
192        $html .= $pagesplitter->generate();
193        break;
194}
195
196$menubox = new box("Menu");
197$menubox->setIcon("menu-item.gif");
198$menubox->addOption("caption","Overview");
199$menubox->addOption("link","Target overview", "?a=cc_detail&ctr_id=".$_GET['ctr_id']);
200$menubox->addOption("caption","Kills & losses");
201$menubox->addOption("link","Recent activity", "?a=cc_detail&ctr_id=".$_GET['ctr_id']."&view=recent_activity");
202$menubox->addOption("link","All kills", "?a=cc_detail&ctr_id=".$_GET['ctr_id']."&view=kills");
203$menubox->addOption("link","All losses", "?a=cc_detail&ctr_id=".$_GET['ctr_id']."&view=losses");
204
205$page->addContext($menubox->generate());
206
207$tklist = new TopContractKillsList();
208$tklist->setContract(new Contract($ctr_id));
209if (CORP_ID)
210    $tklist->addInvolvedCorp(new Corporation(CORP_ID));
211if (ALLIANCE_ID)
212    $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
213
214$tklist->generate();
215if ($contract->getCampaign())
216    $campaign = "campaign";
217else
218    $campaign = "contract";
219$tkbox = new AwardBox($tklist, "Top killers", "kills in this ".$campaign, "kills", "eagle");
220
221$page->addContext($tkbox->generate());
222
223if (config::get('kill_points'))
224{
225    $tklist = new TopContractScoreList();
226    $tklist->setContract(new Contract($ctr_id));
227    if (CORP_ID)
228        $tklist->addInvolvedCorp(new Corporation(CORP_ID));
229    if (ALLIANCE_ID)
230        $tklist->addInvolvedAlliance(new Alliance(ALLIANCE_ID));
231
232    $tklist->generate();
233    $tkbox = new AwardBox($tklist, "Top scorers", "points in this ".$campaign, "points", "redcross");
234    $page->addContext($tkbox->generate());
235}
236
237$page->setContent($html);
238$page->generate();
239?>
Note: See TracBrowser for help on using the browser.