1 | <?php |
---|
2 | require_once("db.php"); |
---|
3 | require_once("class.killlist.php"); |
---|
4 | require_once("class.graph.php"); |
---|
5 | require_once("class.pagesplitter.php"); |
---|
6 | |
---|
7 | class Contract |
---|
8 | { |
---|
9 | function Contract($ctr_id = 0) |
---|
10 | { |
---|
11 | $this->ctr_id_ = $ctr_id; |
---|
12 | $this->contracttargets_ = array(); |
---|
13 | |
---|
14 | // overall kill/losslist |
---|
15 | $this->klist_ = new KillList(); |
---|
16 | $this->llist_ = new KillList(); |
---|
17 | if (CORP_ID) |
---|
18 | { |
---|
19 | $this->klist_->addInvolvedCorp(new Corporation(CORP_ID)); |
---|
20 | $this->llist_->addVictimCorp(new Corporation(CORP_ID)); |
---|
21 | } |
---|
22 | if (ALLIANCE_ID) |
---|
23 | { |
---|
24 | $this->klist_->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); |
---|
25 | $this->llist_->addVictimAlliance(new Alliance(ALLIANCE_ID)); |
---|
26 | } |
---|
27 | $this->contractpointer_ = 0; |
---|
28 | $this->qry_ = null; |
---|
29 | } |
---|
30 | |
---|
31 | function execQuery() |
---|
32 | { |
---|
33 | if ($this->qry_) |
---|
34 | return; |
---|
35 | |
---|
36 | $this->qry_ = new DBQuery(); |
---|
37 | // general |
---|
38 | $sql = "select * from kb3_contracts ctr |
---|
39 | where ctr.ctr_id = ".$this->ctr_id_; |
---|
40 | |
---|
41 | $this->qry_ = new DBQuery(); |
---|
42 | if (!$this->qry_->execute($sql)) |
---|
43 | die($this->qry_->getErrorMsg()); |
---|
44 | |
---|
45 | $row = $this->qry_->getRow(); |
---|
46 | $this->ctr_name_ = $row['ctr_name']; |
---|
47 | $this->ctr_started_ = $row['ctr_started']; |
---|
48 | $this->ctr_ended_ = $row['ctr_ended']; |
---|
49 | $this->campaign_ = ($row['ctr_campaign'] == "1"); |
---|
50 | |
---|
51 | // get corps & alliances for contract |
---|
52 | $sql = "select ctd.ctd_crp_id, ctd.ctd_all_id, ctd.ctd_reg_id, ctd.ctd_sys_id |
---|
53 | from kb3_contract_details ctd |
---|
54 | where ctd.ctd_ctr_id = ".$row['ctr_id']." |
---|
55 | order by 3, 2, 1"; |
---|
56 | |
---|
57 | $caqry = new DBQuery(); |
---|
58 | if (!$caqry->execute($sql)) |
---|
59 | { |
---|
60 | include_once('autoupgrade.php'); |
---|
61 | check_contracts(); |
---|
62 | $caqry->execute($sql); |
---|
63 | } |
---|
64 | |
---|
65 | while ($carow = $caqry->getRow()) |
---|
66 | { |
---|
67 | $contracttarget = &new ContractTarget($this, $carow['ctd_crp_id'], $carow['ctd_all_id'], $carow['ctd_reg_id'], $carow['ctd_sys_id']); |
---|
68 | array_push($this->contracttargets_, $contracttarget); |
---|
69 | if ($carow['ctd_crp_id']) |
---|
70 | { |
---|
71 | $this->klist_->addVictimCorp(new Corporation($carow['ctd_crp_id'])); |
---|
72 | $this->llist_->addInvolvedCorp(new Corporation($carow['ctd_crp_id'])); |
---|
73 | } |
---|
74 | elseif ($carow['ctd_all_id']) |
---|
75 | { |
---|
76 | $this->klist_->addVictimAlliance(new Alliance($carow['ctd_all_id'])); |
---|
77 | $this->llist_->addInvolvedAlliance(new Alliance($carow['ctd_all_id'])); |
---|
78 | } |
---|
79 | elseif ($carow['ctd_reg_id']) |
---|
80 | { |
---|
81 | $this->klist_->addRegion(new Region($carow['ctd_reg_id'])); |
---|
82 | $this->llist_->addRegion(new Region($carow['ctd_reg_id'])); |
---|
83 | } |
---|
84 | elseif ($carow['ctd_sys_id']) |
---|
85 | { |
---|
86 | $this->klist_->addSystem(new SolarSystem($carow['ctd_sys_id'])); |
---|
87 | $this->llist_->addSystem(new SolarSystem($carow['ctd_sys_id'])); |
---|
88 | } |
---|
89 | } |
---|
90 | |
---|
91 | $this->klist_->setStartDate($this->getStartDate()); |
---|
92 | $this->llist_->setStartDate($this->getStartDate()); |
---|
93 | if ($this->getEndDate() != "") |
---|
94 | { |
---|
95 | $this->klist_->setEndDate($this->getEndDate()); |
---|
96 | $this->llist_->setEndDate($this->getEndDate()); |
---|
97 | } |
---|
98 | } |
---|
99 | |
---|
100 | function getID() |
---|
101 | { |
---|
102 | return $this->ctr_id_; |
---|
103 | } |
---|
104 | |
---|
105 | function getName() |
---|
106 | { |
---|
107 | $this->execQuery(); |
---|
108 | return $this->ctr_name_; |
---|
109 | } |
---|
110 | |
---|
111 | function getStartDate() |
---|
112 | { |
---|
113 | $this->execQuery(); |
---|
114 | return $this->ctr_started_; |
---|
115 | } |
---|
116 | |
---|
117 | function getEndDate() |
---|
118 | { |
---|
119 | $this->execQuery(); |
---|
120 | return $this->ctr_ended_; |
---|
121 | } |
---|
122 | |
---|
123 | function getRunTime() |
---|
124 | { |
---|
125 | if (!$datet = $this->getEndDate()) |
---|
126 | { |
---|
127 | $datet = 'now'; |
---|
128 | } |
---|
129 | |
---|
130 | $diff = strtotime($datet) - strtotime($this->getStartDate()); |
---|
131 | return floor($diff/86400); |
---|
132 | } |
---|
133 | |
---|
134 | function getCampaign() |
---|
135 | { |
---|
136 | $this->execQuery(); |
---|
137 | return $this->campaign_; |
---|
138 | } |
---|
139 | |
---|
140 | function getCorps() |
---|
141 | { |
---|
142 | $this->execQuery(); |
---|
143 | return $this->corps_; |
---|
144 | } |
---|
145 | |
---|
146 | function getAlliances() |
---|
147 | { |
---|
148 | $this->execQuery(); |
---|
149 | return $this->alliances_; |
---|
150 | } |
---|
151 | |
---|
152 | function getKills() |
---|
153 | { |
---|
154 | $this->execQuery(); |
---|
155 | return $this->klist_->getCount(); |
---|
156 | } |
---|
157 | |
---|
158 | function getLosses() |
---|
159 | { |
---|
160 | $this->execQuery(); |
---|
161 | return $this->llist_->getCount(); |
---|
162 | } |
---|
163 | |
---|
164 | function getKillISK() |
---|
165 | { |
---|
166 | $this->execQuery(); |
---|
167 | if (!$this->klist_->getISK()) $this->klist_->getAllKills(); |
---|
168 | return $this->klist_->getISK(); |
---|
169 | } |
---|
170 | |
---|
171 | function getLossISK() |
---|
172 | { |
---|
173 | $this->execQuery(); |
---|
174 | if (!$this->llist_->getISK()) $this->llist_->getAllKills(); |
---|
175 | return $this->llist_->getISK(); |
---|
176 | } |
---|
177 | |
---|
178 | function getEfficiency() |
---|
179 | { |
---|
180 | $this->execQuery(); |
---|
181 | if ($this->klist_->getISK()) |
---|
182 | $efficiency = round($this->klist_->getISK() / ($this->klist_->getISK() + $this->llist_->getISK()) * 100, 2); |
---|
183 | else |
---|
184 | $efficiency = 0; |
---|
185 | |
---|
186 | return $efficiency; |
---|
187 | } |
---|
188 | |
---|
189 | function getKillList() |
---|
190 | { |
---|
191 | $this->execQuery(); |
---|
192 | return $this->klist_; |
---|
193 | } |
---|
194 | |
---|
195 | function getLossList() |
---|
196 | { |
---|
197 | $this->execQuery(); |
---|
198 | return $this->llist_; |
---|
199 | } |
---|
200 | |
---|
201 | function getContractTarget() |
---|
202 | { |
---|
203 | if ($this->contractpointer_ > 30) |
---|
204 | return null; |
---|
205 | |
---|
206 | $target = $this->contracttargets_[$this->contractpointer_]; |
---|
207 | if ($target) |
---|
208 | $this->contractpointer_++; |
---|
209 | return $target; |
---|
210 | } |
---|
211 | |
---|
212 | function add($name, $type, $startdate, $enddate = "") |
---|
213 | { |
---|
214 | $qry = new DBQuery(); |
---|
215 | if ($type == "campaign") $campaign = 1; |
---|
216 | else $campaign = 0; |
---|
217 | if ($enddate != "") $enddate = "'".$enddate." 23:59:59'"; |
---|
218 | else $enddate = "null"; |
---|
219 | |
---|
220 | if (!$this->ctr_id_) |
---|
221 | { |
---|
222 | $sql = "insert into kb3_contracts values ( null, '".$name."', |
---|
223 | '".KB_SITE."', ".$campaign.", |
---|
224 | '".$startdate." 00:00:00', |
---|
225 | ".$enddate." )"; |
---|
226 | $qry->execute($sql) or die($qry->getErrorMsg()); |
---|
227 | $this->ctr_id_ = $qry->getInsertID(); |
---|
228 | } |
---|
229 | else |
---|
230 | { |
---|
231 | $sql = "update kb3_contracts set ctr_name = '".$name."', |
---|
232 | ctr_started = '".$startdate." 00:00:00', |
---|
233 | ctr_ended = ".$enddate." |
---|
234 | where ctr_id = ".$this->ctr_id_; |
---|
235 | $qry->execute($sql) or die($qry->getErrorMsg()); |
---|
236 | $this->ctr_id_ = $qry->getInsertID(); |
---|
237 | } |
---|
238 | } |
---|
239 | |
---|
240 | function remove() |
---|
241 | { |
---|
242 | $qry = new DBQuery(); |
---|
243 | |
---|
244 | $qry->execute("delete from kb3_contracts |
---|
245 | where ctr_id = ".$this->ctr_id_); |
---|
246 | |
---|
247 | $qry->execute("delete from kb3_contract_details |
---|
248 | where ctd_ctr_id = ".$this->ctr_id_); |
---|
249 | } |
---|
250 | |
---|
251 | function validate() |
---|
252 | { |
---|
253 | $qry = new DBQuery(); |
---|
254 | |
---|
255 | $qry->execute("select * from kb3_contracts |
---|
256 | where ctr_id = ".$this->ctr_id_." |
---|
257 | and ctr_site = '".KB_SITE."'"); |
---|
258 | return ($qry->recordCount() > 0); |
---|
259 | } |
---|
260 | } |
---|
261 | |
---|
262 | class ContractTarget |
---|
263 | { |
---|
264 | function ContractTarget($contract, $crp_id, $all_id, $reg_id , $sys_id) |
---|
265 | { |
---|
266 | $this->contract_ = $contract; |
---|
267 | $this->crp_id_ = $crp_id; |
---|
268 | $this->all_id_ = $all_id; |
---|
269 | $this->reg_id_ = $reg_id; |
---|
270 | $this->sys_id_ = $sys_id; |
---|
271 | |
---|
272 | $this->klist_ = &new KillList(); |
---|
273 | $this->llist_ = &new KillList(); |
---|
274 | |
---|
275 | if ($this->crp_id_) |
---|
276 | { |
---|
277 | $this->type_ = "corp"; |
---|
278 | $this->klist_->addVictimCorp(new Corporation($this->crp_id_)); |
---|
279 | $this->llist_->addInvolvedCorp(new Corporation($this->crp_id_)); |
---|
280 | $this->id_ = $this->crp_id_; |
---|
281 | } |
---|
282 | elseif ($this->all_id_) |
---|
283 | { |
---|
284 | $this->type_ = "alliance"; |
---|
285 | $this->klist_->addVictimAlliance(new Alliance($this->all_id_)); |
---|
286 | $this->llist_->addInvolvedAlliance(new Alliance($this->all_id_)); |
---|
287 | $this->id_ = $this->all_id_; |
---|
288 | } |
---|
289 | elseif ($this->reg_id_) |
---|
290 | { |
---|
291 | $this->type_ = "region"; |
---|
292 | $this->klist_->addRegion(new Region($this->reg_id_)); |
---|
293 | $this->llist_->addRegion(new Region($this->reg_id_)); |
---|
294 | $this->id_ = $this->reg_id_; |
---|
295 | } |
---|
296 | elseif ($this->sys_id_) |
---|
297 | { |
---|
298 | $this->type_ = "system"; |
---|
299 | $this->klist_->addSystem(new SolarSystem($this->sys_id_)); |
---|
300 | $this->llist_->addSystem(new SolarSystem($this->sys_id_)); |
---|
301 | $this->id_ = $this->sys_id_; |
---|
302 | } |
---|
303 | if (CORP_ID) |
---|
304 | { |
---|
305 | $this->klist_->addInvolvedCorp(new Corporation(CORP_ID)); |
---|
306 | $this->llist_->addVictimCorp(new Corporation(CORP_ID)); |
---|
307 | } |
---|
308 | if (ALLIANCE_ID) |
---|
309 | { |
---|
310 | $this->klist_->addInvolvedAlliance(new Alliance(ALLIANCE_ID)); |
---|
311 | $this->llist_->addVictimAlliance(new Alliance(ALLIANCE_ID)); |
---|
312 | } |
---|
313 | |
---|
314 | $this->klist_->setStartDate($contract->getStartDate()); |
---|
315 | $this->llist_->setStartDate($contract->getStartDate()); |
---|
316 | if ($contract->getEndDate() != "") |
---|
317 | { |
---|
318 | $this->klist_->setEndDate($contract->getEndDate()); |
---|
319 | $this->llist_->setEndDate($contract->getEndDate()); |
---|
320 | } |
---|
321 | } |
---|
322 | |
---|
323 | function getID() |
---|
324 | { |
---|
325 | return $this->id_; |
---|
326 | } |
---|
327 | |
---|
328 | function getName() |
---|
329 | { |
---|
330 | if ($this->name_ == "") |
---|
331 | { |
---|
332 | $qry = new DBQuery(); |
---|
333 | switch ($this->type_) |
---|
334 | { |
---|
335 | case "corp": |
---|
336 | $qry->execute("select crp_name as name from kb3_corps where crp_id = ".$this->crp_id_); |
---|
337 | break; |
---|
338 | case "alliance": |
---|
339 | $qry->execute("select all_name as name from kb3_alliances where all_id = ".$this->all_id_); |
---|
340 | break; |
---|
341 | case "region": |
---|
342 | $qry->execute("select reg_name as name from kb3_regions where reg_id = ".$this->reg_id_); |
---|
343 | break; |
---|
344 | case "system": |
---|
345 | $qry->execute("select sys_name as name from kb3_systems where sys_id = ".$this->sys_id_); |
---|
346 | break; |
---|
347 | } |
---|
348 | $row = $qry->getRow(); |
---|
349 | $this->name_ = $row['name']; |
---|
350 | } |
---|
351 | return $this->name_; |
---|
352 | } |
---|
353 | |
---|
354 | function getType() |
---|
355 | { |
---|
356 | return $this->type_; |
---|
357 | } |
---|
358 | |
---|
359 | function getKillList() |
---|
360 | { |
---|
361 | return $this->klist_; |
---|
362 | } |
---|
363 | |
---|
364 | function getLossList() |
---|
365 | { |
---|
366 | return $this->llist_; |
---|
367 | } |
---|
368 | |
---|
369 | function getEfficiency() |
---|
370 | { |
---|
371 | if ($this->klist_->getISK()) |
---|
372 | $efficiency = round($this->klist_->getISK() / ($this->klist_->getISK() + $this->llist_->getISK()) * 100, 2); |
---|
373 | else |
---|
374 | $efficiency = 0; |
---|
375 | |
---|
376 | return $efficiency; |
---|
377 | } |
---|
378 | |
---|
379 | function getKills() |
---|
380 | { |
---|
381 | } |
---|
382 | |
---|
383 | function getLosses() |
---|
384 | { |
---|
385 | } |
---|
386 | |
---|
387 | function add() |
---|
388 | { |
---|
389 | $qry = new DBQuery(); |
---|
390 | $sql = "insert into kb3_contract_details |
---|
391 | values ( ".$this->contract_->getID().","; |
---|
392 | switch ($this->type_) |
---|
393 | { |
---|
394 | case "corp": |
---|
395 | $sql .= $this->id_.", 0, 0, 0 )"; |
---|
396 | break; |
---|
397 | case "alliance": |
---|
398 | $sql .= "0, ".$this->id_.", 0, 0 )"; |
---|
399 | break; |
---|
400 | case "region": |
---|
401 | $sql .= "0, 0, ".$this->id_.",0 )"; |
---|
402 | break; |
---|
403 | case "system": |
---|
404 | $sql .= "0, 0, 0, ".$this->id_." )"; |
---|
405 | break; |
---|
406 | } |
---|
407 | $qry->execute($sql) or die($qry->getErrorMsg()); |
---|
408 | } |
---|
409 | |
---|
410 | function remove() |
---|
411 | { |
---|
412 | $qry = new DBQuery(); |
---|
413 | $sql = "delete from kb3_contract_details |
---|
414 | where ctd_ctr_id = ".$this->contract_->getID(); |
---|
415 | switch ($this->type_) |
---|
416 | { |
---|
417 | case "corp": |
---|
418 | $sql .= " and ctd_crp_id = ".$this->id_; |
---|
419 | break; |
---|
420 | case "alliance": |
---|
421 | $sql .= " and ctd_all_id = ".$this->id_; |
---|
422 | break; |
---|
423 | case "region": |
---|
424 | $sql .= " and ctd_reg_id = ".$this->id_; |
---|
425 | break; |
---|
426 | case "system": |
---|
427 | $sql .= " and ctd_sys_id = ".$this->id_; |
---|
428 | break; |
---|
429 | } |
---|
430 | $qry->execute($sql) or die($qry->getErrorMsg()); |
---|
431 | } |
---|
432 | } |
---|
433 | |
---|
434 | class ContractList |
---|
435 | { |
---|
436 | function ContractList() |
---|
437 | { |
---|
438 | $this->qry_ = new DBQuery(); |
---|
439 | $this->active_ = "both"; |
---|
440 | $this->contractcounter_ = 1; |
---|
441 | } |
---|
442 | |
---|
443 | function execQuery() |
---|
444 | { |
---|
445 | if ($this->qry_->executed()) |
---|
446 | return; |
---|
447 | |
---|
448 | $sql = "select ctr.ctr_id, ctr.ctr_started, ctr.ctr_ended, ctr.ctr_name |
---|
449 | from kb3_contracts ctr |
---|
450 | where ctr.ctr_site = '".KB_SITE."'"; |
---|
451 | if ($this->active_ == "yes") |
---|
452 | $sql .= " and ( ctr_ended is null or now() <= ctr_ended )"; |
---|
453 | elseif ($this->active_ == "no") |
---|
454 | $sql .= " and ( now() >= ctr_ended )"; |
---|
455 | |
---|
456 | if ($this->campaigns_) |
---|
457 | $sql .= " and ctr.ctr_campaign = 1"; |
---|
458 | else |
---|
459 | $sql .= " and ctr.ctr_campaign = 0"; |
---|
460 | |
---|
461 | $sql .= " order by ctr_ended, ctr_started desc"; |
---|
462 | // if ( $this->limit_ ) |
---|
463 | // $sql .= " limit ".( $this->page_ / $this->limit_ ).", ".$this->limit_; |
---|
464 | $this->qry_ = new DBQuery(); |
---|
465 | $this->qry_->execute($sql) or die($this->qry_->getErrorMsg()); |
---|
466 | } |
---|
467 | |
---|
468 | function setActive($active) |
---|
469 | { |
---|
470 | $this->active_ = $active; |
---|
471 | } |
---|
472 | |
---|
473 | function setCampaigns($campaigns) |
---|
474 | { |
---|
475 | $this->campaigns_ = $campaigns; |
---|
476 | } |
---|
477 | |
---|
478 | function setLimit($limit) |
---|
479 | { |
---|
480 | $this->limit_ = $limit; |
---|
481 | } |
---|
482 | |
---|
483 | function setPage($page) |
---|
484 | { |
---|
485 | $this->page_ = $page; |
---|
486 | $this->offset_ = ($page * $this->limit_) - $this->limit_; |
---|
487 | } |
---|
488 | |
---|
489 | function getContract() |
---|
490 | { |
---|
491 | // echo "off: ".$this->offset_."<br>"; |
---|
492 | // echo "cnt: ".$this->contractcounter_."<br>"; |
---|
493 | // echo "limit: ".$this->limit_."<br>"; |
---|
494 | $this->execQuery(); |
---|
495 | if ($this->offset_ && $this->contractcounter_ < $this->offset_) |
---|
496 | { |
---|
497 | for ($i = 0; $i < $this->offset_; $i++) |
---|
498 | { |
---|
499 | $row = $this->qry_->getRow(); |
---|
500 | $this->contractcounter_++; |
---|
501 | } |
---|
502 | } |
---|
503 | if ($this->limit_ && ($this->contractcounter_ - $this->offset_) > $this->limit_) |
---|
504 | return null; |
---|
505 | |
---|
506 | $row = $this->qry_->getRow(); |
---|
507 | if ($row) |
---|
508 | { |
---|
509 | $this->contractcounter_++; |
---|
510 | return new Contract($row['ctr_id']); |
---|
511 | } |
---|
512 | else |
---|
513 | return null; |
---|
514 | } |
---|
515 | |
---|
516 | function getCount() |
---|
517 | { |
---|
518 | $this->execQuery(); |
---|
519 | return $this->qry_->recordCount(); |
---|
520 | } |
---|
521 | |
---|
522 | function getActive() |
---|
523 | { |
---|
524 | return $this->active_; |
---|
525 | } |
---|
526 | } |
---|
527 | |
---|
528 | class ContractListTable |
---|
529 | { |
---|
530 | function ContractListTable($contractlist) |
---|
531 | { |
---|
532 | $this->contractlist_ = $contractlist; |
---|
533 | } |
---|
534 | |
---|
535 | function paginate($paginate, $page = 1) |
---|
536 | { |
---|
537 | if (!$page) $page = 1; |
---|
538 | $this->paginate_ = $paginate; |
---|
539 | $this->contractlist_->setLimit($paginate); |
---|
540 | $this->contractlist_->setPage($page); |
---|
541 | } |
---|
542 | |
---|
543 | function generate() |
---|
544 | { |
---|
545 | if ($this->contractlist_->getCount()) |
---|
546 | { |
---|
547 | $rowid = 0; |
---|
548 | $html .= "<table class=kb-table width=\"98%\" align=center cellspacing=1>"; |
---|
549 | $html .= "<tr class=kb-table-header>"; |
---|
550 | $html .= "<td class=kb-table-cell width=180>Name</td>"; |
---|
551 | $html .= "<td class=kb-table-cell width=80 align=center>Start date</td>"; |
---|
552 | if ($this->contractlist_->getActive() == "no") |
---|
553 | $html .= "<td class=kb-table-cell width=80 align=center>End date</td>"; |
---|
554 | $html .= "<td class=kb-table-cell width=50 align=center>Kills</td>"; |
---|
555 | $html .= "<td class=kb-table-cell width=70 align=center>ISK (M)</td>"; |
---|
556 | $html .= "<td class=kb-table-cell width=50 align=center>Losses</td>"; |
---|
557 | $html .= "<td class=kb-table-cell width=70 align=center>ISK (M)</td>"; |
---|
558 | $html .= "<td class=kb-table-cell width=70 align=center colspan=2>Efficiency</td>"; |
---|
559 | $html .= "</tr>"; |
---|
560 | |
---|
561 | $odd = false; |
---|
562 | $rowclass = "kb-table-row-even"; |
---|
563 | while ($contract = $this->contractlist_->getContract()) |
---|
564 | { |
---|
565 | if ($odd) |
---|
566 | { |
---|
567 | $rowclass = "kb-table-row-even"; |
---|
568 | $odd = false; |
---|
569 | } |
---|
570 | else |
---|
571 | { |
---|
572 | $rowclass = "kb-table-row-odd"; |
---|
573 | $odd = true; |
---|
574 | } |
---|
575 | |
---|
576 | $html .= "<tr class=".$rowclass." onmouseover=\"this.className='kb-table-row-hover';\" onmouseout=\"this.className='".$rowclass."';\" onClick=\"window.location.href='?a=cc_detail&ctr_id=".$contract->getID()."';\">"; |
---|
577 | $html .= "<td class=kb-table-cell><b>".$contract->getName()."</b></td>"; |
---|
578 | $html .= "<td class=kb-table-cell align=center>".substr($contract->getStartDate(), 0, 10)."</td>"; |
---|
579 | if ($this->contractlist_->getActive() == "no") |
---|
580 | { |
---|
581 | if ($contract->getEndDate() == "") |
---|
582 | $ended = "Active"; |
---|
583 | else |
---|
584 | $ended = substr($contract->getEndDate(), 0, 10); |
---|
585 | $html .= "<td class=kb-table-cell align=center>".$ended."</td>"; |
---|
586 | } |
---|
587 | if ($contract->getKills() == 0) |
---|
588 | $kclass = "kl-null"; |
---|
589 | else |
---|
590 | $kclass = "kl-kill"; |
---|
591 | |
---|
592 | if ($contract->getLosses() == 0) |
---|
593 | $lclass = "kl-null"; |
---|
594 | else |
---|
595 | $lclass = "kl-loss"; |
---|
596 | |
---|
597 | $html .= "<td class=".$kclass." align=center>".$contract->getKills()."</td>"; |
---|
598 | $html .= "<td class=".$kclass." align=center>".$contract->getKillISK()."</td>"; |
---|
599 | $html .= "<td class=".$lclass." align=center>".$contract->getLosses()."</td>"; |
---|
600 | $html .= "<td class=".$lclass." align=center>".$contract->getLossISK()."</td>"; |
---|
601 | $bar = new BarGraph($contract->getEfficiency(), 100, 75); |
---|
602 | $html .= "<td class=kb-table-cell align=center width=40><b>".$contract->getEfficiency()."%</b></td>"; |
---|
603 | $html .= "<td class=kb-table-cell align=left width=75>".$bar->generate()."</td>"; |
---|
604 | $html .= "</tr>"; |
---|
605 | } |
---|
606 | $html .= "</table>"; |
---|
607 | $pagesplitter = new PageSplitter($this->contractlist_->getCount(), 10); |
---|
608 | $html .= $pagesplitter->generate(); |
---|
609 | } |
---|
610 | else $html .= "None."; |
---|
611 | |
---|
612 | return $html; |
---|
613 | } |
---|
614 | } |
---|
615 | ?> |
---|