1 | <? |
---|
2 | require_once( "class.graph.php" ); |
---|
3 | |
---|
4 | class Box |
---|
5 | { |
---|
6 | function Box( $title = "" ) |
---|
7 | { |
---|
8 | $this->title_ = $title; |
---|
9 | } |
---|
10 | |
---|
11 | function setContent( $html ) |
---|
12 | { |
---|
13 | $this->content_ = $html; |
---|
14 | } |
---|
15 | |
---|
16 | function setHeight( $height ) |
---|
17 | { |
---|
18 | $this->height_ = $height; |
---|
19 | } |
---|
20 | |
---|
21 | function setIcon( $icon ) |
---|
22 | { |
---|
23 | $this->icon_ = $icon; |
---|
24 | } |
---|
25 | |
---|
26 | function generate() |
---|
27 | { |
---|
28 | $html = "<table class=kb-table width=150"; |
---|
29 | if ( $this->height_ ) $html .= " height=".$this->height_; |
---|
30 | $html .= " cellspacing=\"1\"><tr>"; |
---|
31 | $html .= "<td class=kb-table-header align=center>"; |
---|
32 | if ( $this->icon_ ) $html .= "<img src=\"".IMG_URL."/".$this->icon_."\" border=\"0\">"; |
---|
33 | $html .= $this->title_."</td></tr>"; |
---|
34 | $html .= "<tr class=kb-table-row-even><td>".$this->content_."</td></tr>"; |
---|
35 | $html .= "</table><p>"; |
---|
36 | |
---|
37 | return $html; |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | class MenuBox |
---|
42 | { |
---|
43 | function MenuBox() |
---|
44 | { |
---|
45 | $this->box_ = new Box( "Menu" ); |
---|
46 | //$this->box_->setIcon( "menu.gif" ); |
---|
47 | } |
---|
48 | |
---|
49 | function addCaption( $name ) |
---|
50 | { |
---|
51 | $this->html_ .= "<div class=menu-caption>".$name."</div>"; |
---|
52 | } |
---|
53 | |
---|
54 | function addOption( $name, $url, $icon = "" ) |
---|
55 | { |
---|
56 | $this->html_ .= "<div class=menu-item>"; |
---|
57 | if ( $icon == "" ) $icon = "menu-item.gif"; |
---|
58 | $this->html_ .= "<img src=\"".IMG_URL."/".$icon."\" border=\"0\"> <a href=\"".$url."\">".$name."</a><br>"; |
---|
59 | $this->html_ .= "</div>"; |
---|
60 | } |
---|
61 | |
---|
62 | function setHeight( $height ) |
---|
63 | { |
---|
64 | $this->box_->setHeight( $height ); |
---|
65 | } |
---|
66 | |
---|
67 | function generate() |
---|
68 | { |
---|
69 | $this->box_->setContent( "<div class=menu-wrapper>".$this->html_."</div>" ); |
---|
70 | return $this->box_->generate(); |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | class AwardBox |
---|
75 | { |
---|
76 | function AwardBox( $list, $title, $comment, $entity, $award ) |
---|
77 | { |
---|
78 | $this->toplist_ = $list; |
---|
79 | $this->box_ = new Box( $title ); |
---|
80 | $this->comment_ = $comment; |
---|
81 | $this->entity_ = $entity; |
---|
82 | $this->award_ = $award; |
---|
83 | } |
---|
84 | |
---|
85 | function generate() |
---|
86 | { |
---|
87 | $rows = array(); |
---|
88 | $max = 0; |
---|
89 | for ( $i = 1; $i < 4; $i++ ) { |
---|
90 | $row = $this->toplist_->getRow(); |
---|
91 | if ( $row ) array_push( $rows, $row ); |
---|
92 | if ( $row['cnt'] > $max ) $max = $row['cnt']; |
---|
93 | } |
---|
94 | if ( !$rows[0]['plt_id'] ) return; |
---|
95 | $pilot = new Pilot( $rows[0]['plt_id'] ); |
---|
96 | |
---|
97 | $html .= "<table class=kb-subtable cellspacing=0 border=0 width=\"100%\"><tr class=kb-table-row-odd>"; |
---|
98 | $html .= "<td align=left>"; |
---|
99 | $html .= "<img src=\"".$pilot->getPortraitURL( 64 )."\">"; |
---|
100 | $html .= "</td><td align=center>"; |
---|
101 | $html .= "<img src=\"".IMG_URL."/awards/".$this->award_.".gif\">"; |
---|
102 | $html .= "</td>"; |
---|
103 | $html .= "</tr></table>"; |
---|
104 | $html .= "<table class=kb-subtable cellspacing=0 border=0 width=\"100%\">"; |
---|
105 | $html .= "<tr><td width=15><b>1.</b></td><td align=left colspan=2><a class=kb-shipclass href=\"?a=pilot_detail&plt_id=".$rows[0]['plt_id']."\">".$pilot->getName()."</a></td><td></td></tr><tr>"; |
---|
106 | $bar = new BarGraph( $rows[0]['cnt'], $max, 60 ); |
---|
107 | $html .= "<td></td><td align=left>".$bar->generate()."</td>"; |
---|
108 | $html .= "<td align=right><b>".$rows[0]['cnt']."</b></td><td></td></tr>"; |
---|
109 | |
---|
110 | for ( $i = 2; $i < 4; $i++ ) { |
---|
111 | if ( !$rows[$i - 1]['plt_id'] ) break; |
---|
112 | $pilot = new Pilot( $rows[$i - 1]['plt_id'] ); |
---|
113 | $html .= "<tr><td><b>".$i.".</b></td><td colspan=2><a class=kb-shipclass href=\"?a=pilot_detail&plt_id=".$rows[$i - 1]['plt_id']."\">".$pilot->getName()."</a></td></tr><tr>"; |
---|
114 | $bar = new BarGraph( $rows[$i - 1]['cnt'], $max, 60 ); |
---|
115 | $html .= "<td></td><td align=left>".$bar->generate()."</td>"; |
---|
116 | $html .= "<td align=right><b>".$rows[$i - 1]['cnt']."</b></td></tr>"; |
---|
117 | } |
---|
118 | |
---|
119 | $html .= "<tr><td colspan=3 align=center>(".$this->comment_.")</td></tr>"; |
---|
120 | |
---|
121 | $html .= "</table>"; |
---|
122 | |
---|
123 | $this->box_->setContent( $html ); |
---|
124 | return $this->box_->generate(); |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | ?> |
---|