root/dev/common/cc_detail.php @ 325

Revision 289, 10.2 KB (checked in by exi, 14 years ago)

Added the change from ticket:54 - customizable rowcount on KillSummaryTable?.
Added the change from ticket:55 - ship classes shouldnt wrap anymore.
Added the fix from ticket:56 - proper png output by the signature generator.

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(config::get('summarytable_rowcount'));
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(13);
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));
209involved::load($tklist,'kill');
210
211$tklist->generate();
212if ($contract->getCampaign())
213    $campaign = "campaign";
214else
215    $campaign = "contract";
216$tkbox = new AwardBox($tklist, "Top killers", "kills in this ".$campaign, "kills", "eagle");
217
218$page->addContext($tkbox->generate());
219
220if (config::get('kill_points'))
221{
222    $tklist = new TopContractScoreList();
223    $tklist->setContract(new Contract($ctr_id));
224    involved::load($tklist,'kill');
225
226    $tklist->generate();
227    $tkbox = new AwardBox($tklist, "Top scorers", "points in this ".$campaign, "points", "redcross");
228    $page->addContext($tkbox->generate());
229}
230
231$page->setContent($html);
232$page->generate();
233?>
Note: See TracBrowser for help on using the browser.