- Timestamp:
- 11/05/06 22:03:40 (14 years ago)
- Location:
- dev/common
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/autoupgrade.php
r47 r51 52 52 ) TYPE = MYISAM ;'; 53 53 $qry->execute($query); 54 $qry->execute('UPDATE kb3_ships set shp_class = 8 WHERE shp_id=257 limit 1'); 55 $qry->execute('UPDATE kb3_ships set shp_class = 8 WHERE shp_id=252 limit 1'); 56 $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=266 limit 1'); 57 $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=275 limit 1'); 58 $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=272 limit 1'); 59 $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=246 limit 1'); 60 $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=249 limit 1'); 54 61 } 55 62 -
dev/common/class.toplist.php
r2 r51 1 <? 2 require_once( "class.killlist.php");3 require_once( "class.corp.php");4 require_once( "class.alliance.php");5 require_once( "class.system.php");6 require_once( "class.ship.php");7 8 9 1 <?php 2 require_once("class.killlist.php"); 3 require_once("class.corp.php"); 4 require_once("class.alliance.php"); 5 require_once("class.system.php"); 6 require_once("class.ship.php"); 7 8 class TopList 9 { 10 10 function TopList() 11 11 { 12 $this->qry_ = new DBQuery(); 13 $this->exclude_scl_ = array(); 14 $this->vic_scl_id_ = array(); 15 $this->regions_ = array(); 16 } 17 18 function setPodsNoobShips( $flag ) 19 { 20 if ( !$flag ) { 21 array_push( $this->exclude_scl_, 2 ); 22 array_push( $this->exclude_scl_, 3 ); 23 array_push( $this->exclude_scl_, 11 ); 24 } 25 } 26 27 function setSQLTop( $sql ) 28 { 29 $this->sqltop_ = $sql; 30 } 31 32 function setSQLBottom( $sql ) 33 { 34 $this->sqlbottom_ = $sql; 35 } 36 37 function addInvolvedPilot( $pilot ) 38 { 39 $this->inv_plt_ .= $pilot->getID().", "; 40 if ( $this->inv_crp_ || $this->inv_all_ ) 41 $this->mixedinvolved_ = true; 42 } 43 44 function addInvolvedCorp( $corp ) 45 { 46 $this->inv_crp_ .= $corp->getID().", "; 47 if ( $this->inv_plt_ || $this->inv_all_ ) 48 $this->mixedinvolved_ = true; 49 } 50 51 function addInvolvedAlliance( $alliance ) 52 { 53 $this->inv_all_ .= $alliance->getID().", "; 54 if ( $this->inv_plt_ || $this->inv_crp_ ) 55 $this->mixedinvolved_ = true; 56 } 57 58 function addVictimPilot( $pilot ) 59 { 60 $this->vic_plt_ .= $pilot->getID().", "; 61 if ( $this->vic_crp_ || $this->vic_all_ ) 62 $this->mixedvictims_ = true; 63 } 64 65 function addVictimCorp( $corp ) 66 { 67 $this->vic_crp_ .= $corp->getID().", "; 68 if ( $this->vic_plt_ || $this->vic_all_ ) 69 $this->mixedvictims_ = true; 70 } 71 72 function addVictimAlliance( $alliance ) 73 { 74 $this->vic_all_ .= $alliance->getID().", "; 75 if ( $this->vic_plt_ || $this->vic_crp_ ) 76 $this->mixedvictims_ = true; 77 } 78 79 function addVictimShipClass( $shipclass ) 80 { 81 array_push( $this->vic_scl_id_, $shipclass->getID() ); 82 } 83 84 function addVictimShip( $ship ) 85 { 86 } 87 88 function addItemDestroyed( $item ) 89 { 90 } 91 92 function addRegion( $region ) 93 { 94 array_push( $this->regions_, $region->getID() ); 95 } 96 97 function addGroupBy( $groupby ) 98 { 99 array_push( $this->groupby_, $groupby ); 100 } 101 102 function setPageSplitter( $pagesplitter ) 103 { 104 if ( isset( $_GET['page'] ) ) $page = $_GET['page']; else $page = 1; 105 $this->plimit_ = $pagesplitter->getSplit(); 106 $this->poffset_ = ( $page * $this->plimit_ ) - $this->plimit_; 107 //echo $this->offset_; 108 //echo $this->limit_; 109 } 110 111 function setWeek( $weekno ) 112 { 113 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) = "; 114 $this->timeframe_ .= $weekno; 115 } 116 117 function setMonth( $monthno ) 118 { 119 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%c\" ) = "; 120 $this->timeframe_ .= $monthno; 121 } 122 123 function setYear( $yearno ) 124 { 125 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%Y\" ) = "; 126 $this->timeframe_ .= $yearno; 127 } 128 129 function setStartWeek( $weekno ) 130 { 131 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) >= "; 132 $this->timeframe_ .= $weekno; 133 } 134 135 function setStartDate( $timestamp ) 136 { 137 $this->timeframe_ .= " and kll.kll_timestamp >= '".$timestamp."'"; 138 } 139 140 function setEndDate( $timestamp ) 141 { 142 $this->timeframe_ .= " and kll.kll_timestamp <= '".$timestamp."'"; 143 } 144 145 function setGroupBy( $groupby ) 146 { 147 $this->groupby_ = $groupby; 148 } 149 12 $this->qry_ = new DBQuery(); 13 $this->exclude_scl_ = array(); 14 $this->vic_scl_id_ = array(); 15 $this->regions_ = array(); 16 } 17 18 function setPodsNoobShips($flag) 19 { 20 if (!$flag) 21 { 22 array_push($this->exclude_scl_, 2); 23 array_push($this->exclude_scl_, 3); 24 array_push($this->exclude_scl_, 11); 25 } 26 } 27 28 function setSQLTop($sql) 29 { 30 $this->sqltop_ = $sql; 31 } 32 33 function setSQLBottom($sql) 34 { 35 $this->sqlbottom_ = $sql; 36 } 37 38 function addInvolvedPilot($pilot) 39 { 40 $this->inv_plt_ .= $pilot->getID() . ", "; 41 if ($this->inv_crp_ || $this->inv_all_) 42 $this->mixedinvolved_ = true; 43 } 44 45 function addInvolvedCorp($corp) 46 { 47 $this->inv_crp_ .= $corp->getID() . ", "; 48 if ($this->inv_plt_ || $this->inv_all_) 49 $this->mixedinvolved_ = true; 50 } 51 52 function addInvolvedAlliance($alliance) 53 { 54 $this->inv_all_ .= $alliance->getID() . ", "; 55 if ($this->inv_plt_ || $this->inv_crp_) 56 $this->mixedinvolved_ = true; 57 } 58 59 function addVictimPilot($pilot) 60 { 61 $this->vic_plt_ .= $pilot->getID() . ", "; 62 if ($this->vic_crp_ || $this->vic_all_) 63 $this->mixedvictims_ = true; 64 } 65 66 function addVictimCorp($corp) 67 { 68 $this->vic_crp_ .= $corp->getID() . ", "; 69 if ($this->vic_plt_ || $this->vic_all_) 70 $this->mixedvictims_ = true; 71 } 72 73 function addVictimAlliance($alliance) 74 { 75 $this->vic_all_ .= $alliance->getID() . ", "; 76 if ($this->vic_plt_ || $this->vic_crp_) 77 $this->mixedvictims_ = true; 78 } 79 80 function addVictimShipClass($shipclass) 81 { 82 array_push($this->vic_scl_id_, $shipclass->getID()); 83 } 84 85 function addVictimShip($ship) 86 { 87 } 88 89 function addItemDestroyed($item) 90 { 91 } 92 93 function addRegion($region) 94 { 95 array_push($this->regions_, $region->getID()); 96 } 97 98 function addGroupBy($groupby) 99 { 100 array_push($this->groupby_, $groupby); 101 } 102 103 function setPageSplitter($pagesplitter) 104 { 105 if (isset($_GET['page'])) $page = $_GET['page']; 106 else $page = 1; 107 $this->plimit_ = $pagesplitter->getSplit(); 108 $this->poffset_ = ($page * $this->plimit_) - $this->plimit_; 109 // echo $this->offset_; 110 // echo $this->limit_; 111 } 112 113 function setWeek($weekno) 114 { 115 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) = "; 116 $this->timeframe_ .= $weekno; 117 } 118 119 function setMonth($monthno) 120 { 121 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%c\" ) = "; 122 $this->timeframe_ .= $monthno; 123 } 124 125 function setYear($yearno) 126 { 127 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%Y\" ) = "; 128 $this->timeframe_ .= $yearno; 129 } 130 131 function setStartWeek($weekno) 132 { 133 $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) >= "; 134 $this->timeframe_ .= $weekno; 135 } 136 137 function setStartDate($timestamp) 138 { 139 $this->timeframe_ .= " and kll.kll_timestamp >= '" . $timestamp . "'"; 140 } 141 142 function setEndDate($timestamp) 143 { 144 $this->timeframe_ .= " and kll.kll_timestamp <= '" . $timestamp . "'"; 145 } 146 147 function setGroupBy($groupby) 148 { 149 $this->groupby_ = $groupby; 150 } 151 150 152 function execQuery() 151 153 { 152 $this->sql_ .= $this->sqltop_; 153 154 // involved 155 156 if ( $this->inv_plt_ ) 157 $this->sql_ .= " inner join kb3_inv_plt inp 158 on ( inp.inp_plt_id in ( ".substr( $this->inv_plt_, 0, strlen( $this->inv_plt_ ) - 2 )." ) and kll.kll_id = inp.inp_kll_id ) "; 159 if ( $this->inv_crp_ ) 160 $this->sql_ .= " inner join kb3_inv_crp inc 161 on ( inc.inc_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." ) and kll.kll_id = inc.inc_kll_id ) "; 162 163 if ( $this->inv_all_ ) 164 $this->sql_ .= " inner join kb3_inv_all ina 165 on ( ina.ina_all_id in ( ".substr( $this->inv_all_, 0, strlen( $this->inv_all_ ) - 2 )." ) and kll.kll_id = ina.ina_kll_id ) "; 166 167 if ( count( $this->exclude_scl_ ) ) { 168 $this->sql_ .= " inner join kb3_ships shp 154 $this->sql_ .= $this->sqltop_; 155 // involved 156 if ($this->inv_plt_) 157 $this->sql_ .= " inner join kb3_inv_plt inp 158 on ( inp.inp_plt_id in ( " . substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2) . " ) and kll.kll_id = inp.inp_kll_id ) "; 159 if ($this->inv_crp_) 160 $this->sql_ .= " inner join kb3_inv_crp inc 161 on ( inc.inc_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " ) and kll.kll_id = inc.inc_kll_id ) "; 162 163 if ($this->inv_all_) 164 $this->sql_ .= " inner join kb3_inv_all ina 165 on ( ina.ina_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) . " ) and kll.kll_id = ina.ina_kll_id ) "; 166 167 if (count($this->exclude_scl_)) 168 { 169 $this->sql_ .= " inner join kb3_ships shp 169 170 on ( shp.shp_id = kll.kll_ship_id ) 170 171 inner join kb3_ship_classes scl 171 172 on ( scl.scl_id = shp.shp_class )"; 172 $this->sql_ .= " and scl.scl_id not in ( ".implode( ",", $this->exclude_scl_ )." )"; 173 } 174 175 if ( count( $this->vic_scl_id_ ) ) { 176 $this->sql_ .= " inner join kb3_ships shp 173 $this->sql_ .= " and scl.scl_id not in ( " . implode(",", $this->exclude_scl_) . " )"; 174 } 175 176 if (count($this->vic_scl_id_)) 177 { 178 $this->sql_ .= " inner join kb3_ships shp 177 179 on ( shp.shp_id = kll.kll_ship_id ) 178 180 inner join kb3_ship_classes scl 179 181 on ( scl.scl_id = shp.shp_class )"; 180 $this->sql_ .= " and scl.scl_id in ( ".implode( ",", $this->vic_scl_id_ )." )"; 181 } 182 183 if ( count( $this->regions_ ) ) { 184 $this->sql_ .= " inner join kb3_systems sys 182 $this->sql_ .= " and scl.scl_id in ( " . implode(",", $this->vic_scl_id_) . " )"; 183 } 184 185 if (count($this->regions_)) 186 { 187 $this->sql_ .= " inner join kb3_systems sys 185 188 on ( sys.sys_id = kll.kll_system_id ) 186 189 inner join kb3_constellations con … … 188 191 inner join kb3_regions reg 189 192 on ( reg.reg_id = con.con_reg_id 190 and reg.reg_id in ( ".implode( $this->regions_, "," )." ) )"; 191 } 192 193 194 195 // victim filter 196 if ( $this->mixedvictims_ ) { 197 $this->sql_ .= " and ( 1 = 0 "; 198 $op = "or"; 199 } 200 else $op = "and"; 201 202 if ( $this->vic_plt_ ) 203 $this->sql_ .= " ".$op." kll.kll_victim_id in ( ".substr( $this->vic_plt_, 0, strlen( $this->vic_plt_ ) - 2 )." )"; 204 if ( $this->vic_crp_ ) 205 $this->sql_ .= " ".$op." kll.kll_crp_id in ( ".substr( $this->vic_crp_, 0, strlen( $this->vic_crp_ ) - 2 )." )"; 206 if ( $this->vic_all_ ) 207 $this->sql_ .= " ".$op." kll.kll_all_id in ( ".substr( $this->vic_all_, 0, strlen( $this->vic_all_ ) - 2 )." )"; 208 209 if ( $this->mixedvictims_ ) 210 $this->sql_ .= " ) "; 211 212 if ( $this->timeframe_ ) $this->sql_ .= $this->timeframe_; 213 214 $this->sql_ .= " ".$this->sqlbottom_; 215 //echo $this->sql_."<br>"; 216 $this->qry_->execute( $this->sql_ ); 217 } 218 193 and reg.reg_id in ( " . implode($this->regions_, ",") . " ) )"; 194 } 195 // victim filter 196 if ($this->mixedvictims_) 197 { 198 $this->sql_ .= " and ( 1 = 0 "; 199 $op = "or"; 200 } 201 else $op = "and"; 202 203 if ($this->vic_plt_) 204 $this->sql_ .= " " . $op . " kll.kll_victim_id in ( " . substr($this->vic_plt_, 0, strlen($this->vic_plt_) - 2) . " )"; 205 if ($this->vic_crp_) 206 $this->sql_ .= " " . $op . " kll.kll_crp_id in ( " . substr($this->vic_crp_, 0, strlen($this->vic_crp_) - 2) . " )"; 207 if ($this->vic_all_) 208 $this->sql_ .= " " . $op . " kll.kll_all_id in ( " . substr($this->vic_all_, 0, strlen($this->vic_all_) - 2) . " )"; 209 210 if ($this->mixedvictims_) 211 $this->sql_ .= " ) "; 212 213 if ($this->timeframe_) $this->sql_ .= $this->timeframe_; 214 215 $this->sql_ .= " " . $this->sqlbottom_; 216 // echo $this->sql_."<br>"; 217 $this->qry_->execute($this->sql_); 218 } 219 219 220 function getRow() 220 221 { 221 if ( !$this->qry_->executed())222 $this->execQuery();223 224 $row = $this->qry_->getRow();225 return $row;226 } 222 if (!$this->qry_->executed()) 223 $this->execQuery(); 224 225 $row = $this->qry_->getRow(); 226 return $row; 227 } 227 228 228 229 function getTimeFrameSQL() 229 230 { 230 return $this->timeframe_;231 } 232 233 234 235 231 return $this->timeframe_; 232 } 233 } 234 235 class TopKillsList extends TopList 236 { 236 237 function TopKillsList() 237 238 { 238 $this->TopList();239 } 240 241 function generate() 242 { 243 $sql = "select count(*) as cnt, ind.ind_plt_id as plt_id239 $this->TopList(); 240 } 241 242 function generate() 243 { 244 $sql = "select count(*) as cnt, ind.ind_plt_id as plt_id 244 245 from kb3_kills kll 245 inner join kb3_inv_detail ind 246 inner join kb3_inv_detail ind 246 247 on ( ind.ind_kll_id = kll.kll_id ) 247 248 inner join kb3_pilots plt 248 249 on ( plt.plt_id = ind.ind_plt_id "; 249 if ( $this->inv_crp_ ) 250 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )"; 251 252 $sql .= ")"; 253 254 $this->setSQLTop( $sql ); 255 256 $this->setSQLBottom( "group by ind.ind_plt_id order by 1 desc 257 limit 30" ); 258 $this->setPodsNoobShips( false ); 259 } 260 } 261 262 class TopCorpKillsList extends TopList 263 { 250 if ($this->inv_crp_) 251 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 252 $sql .= ")"; 253 254 if ($this->inv_all_) 255 { 256 $sql .= ' inner join kb3_corps crp on ( crp.crp_id = ind.ind_crp_id '; 257 $sql .= " and crp.crp_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) . " )"; 258 $sql .= ')'; 259 } 260 261 262 $this->setSQLTop($sql); 263 264 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 265 limit 30"); 266 $this->setPodsNoobShips(false); 267 } 268 } 269 270 class TopCorpKillsList extends TopList 271 { 264 272 function TopKillsList() 265 273 { 266 $this->TopList();267 } 268 269 function generate() 270 { 271 $sql = "select count(*) as cnt, ind.ind_crp_id as crp_id274 $this->TopList(); 275 } 276 277 function generate() 278 { 279 $sql = "select count(*) as cnt, ind.ind_crp_id as crp_id 272 280 from kb3_kills kll 273 inner join kb3_inv_detail ind 281 inner join kb3_inv_detail ind 274 282 on ( ind.ind_kll_id = kll.kll_id ) 275 283 inner join kb3_corps crp 276 284 on ( crp.crp_id = ind.ind_crp_id "; 277 if ( $this->invall_ ) 278 $sql .= " and crp.crp_all_id in ( ".substr( $this->invall_, 0, strlen( $this->invall_ ) - 2 )." )"; 279 280 281 $sql .= ")"; 282 283 $this->setSQLTop( $sql ); 284 285 $this->setSQLBottom( "group by ind.ind_crp_id order by 1 desc 286 limit 30" ); 287 $this->setPodsNoobShips( false ); 288 } 289 } 290 291 class TopScoreList extends TopList 292 { 285 if ($this->inv_all_) 286 $sql .= " and crp.crp_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) . " )"; 287 288 $sql .= ")"; 289 290 $this->setSQLTop($sql); 291 292 $this->setSQLBottom("group by ind.ind_crp_id order by 1 desc 293 limit 30"); 294 $this->setPodsNoobShips(false); 295 } 296 } 297 298 class TopScoreList extends TopList 299 { 293 300 function TopScoreList() 294 301 { 295 $this->TopList();296 } 297 298 function generate() 299 { 300 $sql = "select sum(kll.kll_points) as cnt, ind.ind_plt_id as plt_id302 $this->TopList(); 303 } 304 305 function generate() 306 { 307 $sql = "select sum(kll.kll_points) as cnt, ind.ind_plt_id as plt_id 301 308 from kb3_kills kll 302 inner join kb3_inv_detail ind 309 inner join kb3_inv_detail ind 303 310 on ( ind.ind_kll_id = kll.kll_id ) 304 311 inner join kb3_pilots plt 305 312 on ( plt.plt_id = ind.ind_plt_id "; 306 if ( $this->inv_crp_ ) 307 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )"; 308 309 $sql .= ")"; 310 311 $this->setSQLTop( $sql ); 312 313 $this->setSQLBottom( "group by ind.ind_plt_id order by 1 desc 314 limit 30" ); 315 $this->setPodsNoobShips( false ); 316 } 317 318 } 319 320 class TopLossesList extends TopList 321 { 313 if ($this->inv_crp_) 314 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 315 316 $sql .= ")"; 317 318 if ($this->inv_all_) 319 { 320 $sql .= ' inner join kb3_corps crp on ( crp.crp_id = ind.ind_crp_id '; 321 $sql .= " and crp.crp_all_id in ( " . substr($this->inv_all_, 0, strlen($this->inv_all_) - 2) . " )"; 322 $sql .= ')'; 323 } 324 325 $this->setSQLTop($sql); 326 327 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 328 limit 30"); 329 $this->setPodsNoobShips(false); 330 } 331 } 332 333 class TopLossesList extends TopList 334 { 322 335 function TopScoreList() 323 336 { 324 $this->TopList();325 } 326 327 function generate() 328 { 329 $this->setSQLTop("select count(*) as cnt, kll.kll_victim_id as plt_id330 from kb3_kills kll" 331 $this->setSQLBottom("group by kll.kll_victim_id order by 1 desc332 limit 30" 333 $this->setPodsNoobShips( false);334 } 335 336 337 338 337 $this->TopList(); 338 } 339 340 function generate() 341 { 342 $this->setSQLTop("select count(*) as cnt, kll.kll_victim_id as plt_id 343 from kb3_kills kll"); 344 $this->setSQLBottom("group by kll.kll_victim_id order by 1 desc 345 limit 30"); 346 $this->setPodsNoobShips(false); 347 } 348 } 349 350 class TopCorpLossesList extends TopList 351 { 339 352 function TopScoreList() 340 353 { 341 $this->TopList();342 } 343 344 function generate() 345 { 346 $this->setSQLTop("select count(*) as cnt, kll.kll_crp_id as crp_id347 from kb3_kills kll" 348 $this->setSQLBottom("group by kll.kll_crp_id order by 1 desc349 limit 30" 350 $this->setPodsNoobShips( false);351 } 352 353 354 355 354 $this->TopList(); 355 } 356 357 function generate() 358 { 359 $this->setSQLTop("select count(*) as cnt, kll.kll_crp_id as crp_id 360 from kb3_kills kll"); 361 $this->setSQLBottom("group by kll.kll_crp_id order by 1 desc 362 limit 30"); 363 $this->setPodsNoobShips(false); 364 } 365 } 366 367 class TopFinalBlowList extends TopList 368 { 356 369 function TopFinalBlowList() 357 370 { 358 $this->TopList();359 } 360 361 function generate() 362 { 363 $sql = "select count(kll.kll_id) as cnt, kll.kll_fb_plt_id as plt_id371 $this->TopList(); 372 } 373 374 function generate() 375 { 376 $sql = "select count(kll.kll_id) as cnt, kll.kll_fb_plt_id as plt_id 364 377 from kb3_kills kll 365 inner join kb3_inv_detail ind 378 inner join kb3_inv_detail ind 366 379 on ( ind.ind_kll_id = kll.kll_id) 367 380 inner join kb3_pilots plt 368 381 on ( plt.plt_id = ind.ind_plt_id "; 369 if ( $this->inv_crp_ ) 370 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )"; 371 372 $sql .= ")"; 373 374 $this->setSQLTop( $sql ); 375 376 $this->setSQLBottom( "group by kll.kll_fb_plt_id order by 1 desc 377 limit 30" ); 378 $this->setPodsNoobShips( false ); 379 } 380 381 } 382 383 class TopDamageDealerList extends TopList 384 { 382 if ($this->inv_crp_) 383 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 384 385 $sql .= ")"; 386 387 $this->setSQLTop($sql); 388 389 $this->setSQLBottom("group by kll.kll_fb_plt_id order by 1 desc 390 limit 30"); 391 $this->setPodsNoobShips(false); 392 } 393 } 394 395 class TopDamageDealerList extends TopList 396 { 385 397 function TopDamageDealerList() 386 398 { 387 $this->TopList();388 } 389 390 function generate() 391 { 392 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id399 $this->TopList(); 400 } 401 402 function generate() 403 { 404 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id 393 405 from kb3_kills kll 394 inner join kb3_inv_detail ind 406 inner join kb3_inv_detail ind 395 407 on ( ind.ind_kll_id = kll.kll_id and ind.ind_order = 0) 396 408 inner join kb3_pilots plt 397 409 on ( plt.plt_id = ind.ind_plt_id "; 398 if ( $this->inv_crp_ ) 399 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )"; 400 401 $sql .= ")"; 402 403 $this->setSQLTop( $sql ); 404 405 $this->setSQLBottom( "group by ind.ind_plt_id order by 1 desc 406 limit 30" ); 407 $this->setPodsNoobShips( false ); 408 } 409 410 } 411 412 class TopSoloKillerList extends TopList 413 { 410 if ($this->inv_crp_) 411 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 412 413 $sql .= ")"; 414 415 $this->setSQLTop($sql); 416 417 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 418 limit 30"); 419 $this->setPodsNoobShips(false); 420 } 421 } 422 423 class TopSoloKillerList extends TopList 424 { 414 425 function TopSoloKillerList() 415 426 { 416 $this->TopList();417 } 418 419 function generate() 420 { 421 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id427 $this->TopList(); 428 } 429 430 function generate() 431 { 432 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id 422 433 from kb3_kills kll 423 inner join kb3_inv_detail ind 434 inner join kb3_inv_detail ind 424 435 on ( ind.ind_kll_id = kll.kll_id and ind.ind_order = 0) 425 inner join kb3_inv_detail ind2 436 inner join kb3_inv_detail ind2 426 437 on ( ind2.ind_kll_id = ind.ind_kll_id 427 438 and not (ind2.ind_order > 0 ) ) … … 429 440 on ( plt.plt_id = ind.ind_plt_id 430 441 and kll.kll_fb_plt_id = plt.plt_id"; 431 if ( $this->inv_crp_ ) 432 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )"; 433 434 $sql .= ")"; 435 436 $this->setSQLTop( $sql ); 437 438 $this->setSQLBottom( "group by ind.ind_plt_id order by 1 desc 439 limit 30" ); 440 $this->setPodsNoobShips( false ); 441 442 } 443 } 444 445 class TopPodKillerList extends TopList 446 { 442 if ($this->inv_crp_) 443 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 444 445 $sql .= ")"; 446 447 $this->setSQLTop($sql); 448 449 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 450 limit 30"); 451 $this->setPodsNoobShips(false); 452 } 453 } 454 455 class TopPodKillerList extends TopList 456 { 447 457 function TopPodKillerList() 448 458 { 449 $this->TopList();450 } 451 452 function generate() 453 { 454 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id459 $this->TopList(); 460 } 461 462 function generate() 463 { 464 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id 455 465 from kb3_kills kll 456 inner join kb3_inv_detail ind 466 inner join kb3_inv_detail ind 457 467 on ( ind.ind_kll_id = kll.kll_id ) 458 468 inner join kb3_pilots plt 459 469 on ( plt.plt_id = ind.ind_plt_id"; 460 if ( $this->inv_crp_)461 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )";462 463 $sql .= ")";464 465 $this->setSQLTop( $sql );466 467 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc468 limit 30" 469 $this->addVictimShipClass( new ShipClass( 2 )); // capsule470 } 471 472 473 474 470 if ($this->inv_crp_) 471 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 472 473 $sql .= ")"; 474 475 $this->setSQLTop($sql); 476 477 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 478 limit 30"); 479 $this->addVictimShipClass(new ShipClass(2)); // capsule 480 } 481 } 482 483 class TopGrieferList extends TopList 484 { 475 485 function TopGrieferList() 476 486 { 477 $this->TopList();478 } 479 480 function generate() 481 { 482 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id487 $this->TopList(); 488 } 489 490 function generate() 491 { 492 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id 483 493 from kb3_kills kll 484 inner join kb3_inv_detail ind 494 inner join kb3_inv_detail ind 485 495 on ( ind.ind_kll_id = kll.kll_id ) 486 496 inner join kb3_pilots plt 487 497 on ( plt.plt_id = ind.ind_plt_id"; 488 if ( $this->inv_crp_)489 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )";490 491 $sql .= ")";492 493 $this->setSQLTop( $sql );494 495 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc496 limit 30" 497 $this->addVictimShipClass( new ShipClass( 20 )); // freighter498 $this->addVictimShipClass( new ShipClass( 22 )); // exhumer499 $this->addVictimShipClass( new ShipClass( 7 ) );// industrial500 $this->addVictimShipClass( new ShipClass( 12 )); // barge501 $this->addVictimShipClass( new ShipClass( 14 )); // transport502 } 503 504 505 506 498 if ($this->inv_crp_) 499 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 500 501 $sql .= ")"; 502 503 $this->setSQLTop($sql); 504 505 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 506 limit 30"); 507 $this->addVictimShipClass(new ShipClass(20)); // freighter 508 $this->addVictimShipClass(new ShipClass(22)); // exhumer 509 $this->addVictimShipClass(new ShipClass(7)); // industrial 510 $this->addVictimShipClass(new ShipClass(12)); // barge 511 $this->addVictimShipClass(new ShipClass(14)); // transport 512 } 513 } 514 515 class TopCapitalShipKillerList extends TopList 516 { 507 517 function TopCapitalShipKillerList() 508 518 { 509 $this->TopList();510 } 511 512 function generate() 513 { 514 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id519 $this->TopList(); 520 } 521 522 function generate() 523 { 524 $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id 515 525 from kb3_kills kll 516 inner join kb3_inv_detail ind 526 inner join kb3_inv_detail ind 517 527 on ( ind.ind_kll_id = kll.kll_id ) 518 528 inner join kb3_pilots plt 519 529 on ( plt.plt_id = ind.ind_plt_id"; 520 if ( $this->inv_crp_)521 $sql .= " and plt.plt_crp_id in ( ".substr( $this->inv_crp_, 0, strlen( $this->inv_crp_ ) - 2 )." )";522 523 $sql .= ")";524 525 $this->setSQLTop( $sql );526 527 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc528 limit 30" 529 $this->addVictimShipClass( new ShipClass( 20 )); // freighter530 $this->addVictimShipClass( new ShipClass( 19 )); // dread531 $this->addVictimShipClass( new ShipClass( 27 )); // carrier532 $this->addVictimShipClass( new ShipClass( 28 )); // mothership533 $this->addVictimShipClass( new ShipClass( 26 )); // titan534 } 535 536 537 538 530 if ($this->inv_crp_) 531 $sql .= " and plt.plt_crp_id in ( " . substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2) . " )"; 532 533 $sql .= ")"; 534 535 $this->setSQLTop($sql); 536 537 $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc 538 limit 30"); 539 $this->addVictimShipClass(new ShipClass(20)); // freighter 540 $this->addVictimShipClass(new ShipClass(19)); // dread 541 $this->addVictimShipClass(new ShipClass(27)); // carrier 542 $this->addVictimShipClass(new ShipClass(28)); // mothership 543 $this->addVictimShipClass(new ShipClass(26)); // titan 544 } 545 } 546 547 class TopContractKillsList extends TopKillsList 548 { 539 549 function TopContractKillsList() 540 550 { 541 $this->TopKillsList(); 542 } 543 544 function generate() 545 { 546 parent::generate(); 547 } 548 549 function setContract( $contract ) 550 { 551 $this->setStartDate( $contract->getStartDate() ); 552 if ( $contract->getEndDate() != "" ) 553 $this->setEndDate( $contract->getEndDate() ); 554 555 while ( $target = $contract->getContractTarget() ) { 556 switch( $target->getType() ) { 557 case "corp": 558 $this->addVictimCorp( new Corporation( $target->getID() ) ); 559 break; 560 case "alliance": 561 $this->addVictimAlliance( new Alliance( $target->getID() ) ); 562 break; 563 case "region": 564 $this->addRegion( new Region( $target->getID() ) ); 565 break; 566 } 567 } 568 } 569 570 } 571 572 class TopContractScoreList extends TopScoreList 573 { 551 $this->TopKillsList(); 552 } 553 554 function generate() 555 { 556 parent::generate(); 557 } 558 559 function setContract($contract) 560 { 561 $this->setStartDate($contract->getStartDate()); 562 if ($contract->getEndDate() != "") 563 $this->setEndDate($contract->getEndDate()); 564 565 while ($target = $contract->getContractTarget()) 566 { 567 switch ($target->getType()) 568 { 569 case "corp": 570 $this->addVictimCorp(new Corporation($target->getID())); 571 break; 572 case "alliance": 573 $this->addVictimAlliance(new Alliance($target->getID())); 574 break; 575 case "region": 576 $this->addRegion(new Region($target->getID())); 577 break; 578 } 579 } 580 } 581 } 582 583 class TopContractScoreList extends TopScoreList 584 { 574 585 function TopContractScoreList() 575 586 { 576 $this->TopScoreList(); 577 } 578 579 function generate() 580 { 581 parent::generate(); 582 } 583 584 function setContract( $contract ) 585 { 586 $this->setStartDate( $contract->getStartDate() ); 587 if ( $contract->getEndDate() != "" ) 588 $this->setEndDate( $contract->getEndDate() ); 589 590 while ( $target = $contract->getContractTarget() ) { 591 switch( $target->getType() ) { 592 case "corp": 593 $this->addVictimCorp( new Corporation( $target->getID() ) ); 594 break; 595 case "alliance": 596 $this->addVictimAlliance( new Alliance( $target->getID() ) ); 597 break; 598 case "region": 599 $this->addRegion( new Region( $target->getID() ) ); 600 break; 601 } 602 } 603 } 604 } 605 606 class TopPilotTable 607 { 608 function TopPilotTable( $toplist, $entity ) 609 { 610 $this->toplist_ = $toplist; 611 $this->entity_ = $entity; 612 } 613 614 function generate() 615 { 616 $this->toplist_->generate(); 617 618 $html .= "<table class=kb-table cellspacing=1>"; 619 $html .= "<tr class=kb-table-header>"; 620 $html .= "<td class=kb-table-cell align=center colspan=2>Pilot</td>"; 621 $html .= "<td class=kb-table-cell align=center width=60>".$this->entity_."</td>"; 622 $html .= "</tr>"; 623 624 $odd = true; 625 $i = 1; 626 while( $row = $this->toplist_->getRow() ) { 627 $pilot = new Pilot( $row['plt_id'] ); 628 if ( $odd ) { 629 $class = "kb-table-row-odd"; 630 $odd = false; 631 } else { 632 $class = "kb-table-row-even"; 633 $odd = true; 634 } 635 $html .= "<tr class=".$class.">"; 636 $html .= "<td><img src=\"".$pilot->getPortraitURL( 32 )."\"></td>"; 637 $html .= "<td class=kb-table-cell width=200><b>".$i.".</b> <a class=kb-shipclass href=\"?a=pilot_detail&plt_id=".$row['plt_id']."\">".$pilot->getName()."</a></td>"; 638 $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; 639 587 $this->TopScoreList(); 588 } 589 590 function generate() 591 { 592 parent::generate(); 593 } 594 595 function setContract($contract) 596 { 597 $this->setStartDate($contract->getStartDate()); 598 if ($contract->getEndDate() != "") 599 $this->setEndDate($contract->getEndDate()); 600 601 while ($target = $contract->getContractTarget()) 602 { 603 switch ($target->getType()) 604 { 605 case "corp": 606 $this->addVictimCorp(new Corporation($target->getID())); 607 break; 608 case "alliance": 609 $this->addVictimAlliance(new Alliance($target->getID())); 610 break; 611 case "region": 612 $this->addRegion(new Region($target->getID())); 613 break; 614 } 615 } 616 } 617 } 618 619 class TopPilotTable 620 { 621 function TopPilotTable($toplist, $entity) 622 { 623 $this->toplist_ = $toplist; 624 $this->entity_ = $entity; 625 } 626 627 function generate() 628 { 629 $this->toplist_->generate(); 630 631 $html .= "<table class=kb-table cellspacing=1>"; 632 $html .= "<tr class=kb-table-header>"; 633 $html .= "<td class=kb-table-cell align=center colspan=2>Pilot</td>"; 634 $html .= "<td class=kb-table-cell align=center width=60>" . $this->entity_ . "</td>"; 640 635 $html .= "</tr>"; 641 $i++; 642 } 643 644 $html .= "</table>"; 645 646 return $html; 647 } 648 } 649 650 class TopCorpTable 651 { 652 function TopCorpTable( $toplist, $entity ) 653 { 654 $this->toplist_ = $toplist; 655 $this->entity_ = $entity; 656 } 657 658 function generate() 659 { 660 $this->toplist_->generate(); 661 662 $html .= "<table class=kb-table cellspacing=1>"; 663 $html .= "<tr class=kb-table-header>"; 664 $html .= "<td class=kb-table-cell align=center>#</td>"; 665 $html .= "<td class=kb-table-cell align=center>Corporation</td>"; 666 $html .= "<td class=kb-table-cell align=center width=60>".$this->entity_."</td>"; 667 $html .= "</tr>"; 668 669 $odd = true; 670 $i = 1; 671 while( $row = $this->toplist_->getRow() ) { 672 $corp = new Corporation( $row['crp_id'] ); 673 if ( $odd ) { 674 $class = "kb-table-row-odd"; 675 $odd = false; 676 } else { 677 $class = "kb-table-row-even"; 678 $odd = true; 679 } 680 $html .= "<tr class=".$class.">"; 681 $html .= "<td class=kb-table-cell align=center><b>".$i.".</b></td>"; 682 $html .= "<td class=kb-table-cell width=200><a href=\"?a=corp_detail&crp_id=".$row['crp_id']."\">".$corp->getName()."</a></td>"; 683 $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; 684 636 637 $odd = true; 638 $i = 1; 639 while ($row = $this->toplist_->getRow()) 640 { 641 $pilot = new Pilot($row['plt_id']); 642 if ($odd) 643 { 644 $class = "kb-table-row-odd"; 645 $odd = false; 646 } 647 else 648 { 649 $class = "kb-table-row-even"; 650 $odd = true; 651 } 652 $html .= "<tr class=" . $class . ">"; 653 $html .= "<td><img src=\"" . $pilot->getPortraitURL(32) . "\"></td>"; 654 $html .= "<td class=kb-table-cell width=200><b>" . $i . ".</b> <a class=kb-shipclass href=\"?a=pilot_detail&plt_id=" . $row['plt_id'] . "\">" . $pilot->getName() . "</a></td>"; 655 $html .= "<td class=kb-table-cell align=center><b>" . $row['cnt'] . "</b></td>"; 656 657 $html .= "</tr>"; 658 $i++; 659 } 660 661 $html .= "</table>"; 662 663 return $html; 664 } 665 } 666 667 class TopCorpTable 668 { 669 function TopCorpTable($toplist, $entity) 670 { 671 $this->toplist_ = $toplist; 672 $this->entity_ = $entity; 673 } 674 675 function generate() 676 { 677 $this->toplist_->generate(); 678 679 $html .= "<table class=kb-table cellspacing=1>"; 680 $html .= "<tr class=kb-table-header>"; 681 $html .= "<td class=kb-table-cell align=center>#</td>"; 682 $html .= "<td class=kb-table-cell align=center>Corporation</td>"; 683 $html .= "<td class=kb-table-cell align=center width=60>" . $this->entity_ . "</td>"; 685 684 $html .= "</tr>"; 686 $i++; 687 } 688 689 $html .= "</table>"; 690 691 return $html; 692 } 693 } 694 695 class TopShipList extends TopList 696 { 685 686 $odd = true; 687 $i = 1; 688 while ($row = $this->toplist_->getRow()) 689 { 690 $corp = new Corporation($row['crp_id']); 691 if ($odd) 692 { 693 $class = "kb-table-row-odd"; 694 $odd = false; 695 } 696 else 697 { 698 $class = "kb-table-row-even"; 699 $odd = true; 700 } 701 $html .= "<tr class=" . $class . ">"; 702 $html .= "<td class=kb-table-cell align=center><b>" . $i . ".</b></td>"; 703 $html .= "<td class=kb-table-cell width=200><a href=\"?a=corp_detail&crp_id=" . $row['crp_id'] . "\">" . $corp->getName() . "</a></td>"; 704 $html .= "<td class=kb-table-cell align=center><b>" . $row['cnt'] . "</b></td>"; 705 706 $html .= "</tr>"; 707 $i++; 708 } 709 710 $html .= "</table>"; 711 712 return $html; 713 } 714 } 715 716 class TopShipList extends TopList 717 { 697 718 function TopShipList() 698 719 { 699 $this->TopList();700 } 701 702 function addInvolvedPilot( $pilot)703 { 704 $this->invplt_ = $pilot;705 } 706 707 function addInvolvedCorp( $corp)708 { 709 $this->invcrp_ = $corp;710 } 711 712 function addInvolvedAlliance( $alliance)713 { 714 $this->invall_ = $alliance;715 } 716 717 function generate() 718 { 719 $sql = "select count(*) as cnt, ind.ind_shp_id as shp_id720 $this->TopList(); 721 } 722 723 function addInvolvedPilot($pilot) 724 { 725 $this->invplt_ = $pilot; 726 } 727 728 function addInvolvedCorp($corp) 729 { 730 $this->invcrp_ = $corp; 731 } 732 733 function addInvolvedAlliance($alliance) 734 { 735 $this->invall_ = $alliance; 736 } 737 738 function generate() 739 { 740 $sql = "select count(*) as cnt, ind.ind_shp_id as shp_id 720 741 from kb3_inv_detail ind 721 742 inner join kb3_ships shp on ( shp_id = ind.ind_shp_id )"; 722 743 723 if ( $this->invplt_)724 $sql .= " inner join kb3_inv_plt inp744 if ($this->invplt_) 745 $sql .= " inner join kb3_inv_plt inp 725 746 on ( inp.inp_kll_id = ind.ind_kll_id 726 747 and inp.inp_plt_id = ind.ind_plt_id 727 and inp.inp_plt_id = " .$this->invplt_->getID().")";728 729 if ( $this->invcrp_)730 $sql .= " inner join kb3_inv_crp inc748 and inp.inp_plt_id = " . $this->invplt_->getID() . ")"; 749 750 if ($this->invcrp_) 751 $sql .= " inner join kb3_inv_crp inc 731 752 on ( inc.inc_kll_id = ind.ind_kll_id 732 753 and inc.inc_crp_id = ind.ind_crp_id 733 and inc.inc_crp_id = " .$this->invcrp_->getID().")";734 735 if ( $this->invall_)736 $sql .= " inner join kb3_inv_all ina754 and inc.inc_crp_id = " . $this->invcrp_->getID() . ")"; 755 756 if ($this->invall_) 757 $sql .= " inner join kb3_inv_all ina 737 758 on ( ina.ina_kll_id = ind.ind_kll_id 738 759 and ina.ina_all_id = ind.ind_all_id 739 and ina.ina_all_id = " .$this->invall_->getID().")";740 741 $this->setSQLTop( $sql);742 $this->setSQLBottom(" and ind.ind_shp_id not in ( 6, 31 )760 and ina.ina_all_id = " . $this->invall_->getID() . ")"; 761 762 $this->setSQLTop($sql); 763 $this->setSQLBottom(" and ind.ind_shp_id not in ( 6, 31 ) 743 764 and shp.shp_class != 17 744 765 group by ind.ind_shp_id order by 1 desc 745 limit 20" ); 746 } 747 } 748 749 class TopShipListTable 750 { 751 function TopShipListTable( $toplist ) 752 { 753 $this->toplist_ = $toplist; 754 } 755 756 function generate() 757 { 758 $this->toplist_->generate(); 759 760 $html .= "<table class=kb-table cellspacing=1>"; 761 $html .= "<tr class=kb-table-header>"; 762 $html .= "<td class=kb-table-cell align=center colspan=2>Ship</td>"; 763 $html .= "<td class=kb-table-cell align=center width=60>Kills</td>"; 764 $html .= "</tr>"; 765 766 $odd = true; 767 while( $row = $this->toplist_->getRow() ) { 768 $ship = new Ship( $row['shp_id'] ); 769 $shipclass = $ship->getClass(); 770 if ( $odd ) { 771 $class = "kb-table-row-odd"; 772 $odd = false; 773 } else { 774 $class = "kb-table-row-even"; 775 $odd = true; 776 } 777 $html .= "<tr class=".$class.">"; 778 $html .= "<td><img src=\"".$ship->getImage( 32 )."\"></td>"; 779 $html .= "<td class=kb-table-cell width=200><b>".$ship->getName()."</b><br>".$shipclass->getName()."</td>"; 780 $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; 781 766 limit 20"); 767 } 768 } 769 770 class TopShipListTable 771 { 772 function TopShipListTable($toplist) 773 { 774 $this->toplist_ = $toplist; 775 } 776 777 function generate() 778 { 779 $this->toplist_->generate(); 780 781 $html .= "<table class=kb-table cellspacing=1>"; 782 $html .= "<tr class=kb-table-header>"; 783 $html .= "<td class=kb-table-cell align=center colspan=2>Ship</td>"; 784 $html .= "<td class=kb-table-cell align=center width=60>Kills</td>"; 782 785 $html .= "</tr>"; 783 } 784 785 $html .= "</table>"; 786 787 return $html; 788 } 789 } 790 791 class TopWeaponList extends TopList 792 { 786 787 $odd = true; 788 while ($row = $this->toplist_->getRow()) 789 { 790 $ship = new Ship($row['shp_id']); 791 $shipclass = $ship->getClass(); 792 if ($odd) 793 { 794 $class = "kb-table-row-odd"; 795 $odd = false; 796 } 797 else 798 { 799 $class = "kb-table-row-even"; 800 $odd = true; 801 } 802 $html .= "<tr class=" . $class . ">"; 803 $html .= "<td><img src=\"" . $ship->getImage(32) . "\"></td>"; 804 $html .= "<td class=kb-table-cell width=200><b>" . $ship->getName() . "</b><br>" . $shipclass->getName() . "</td>"; 805 $html .= "<td class=kb-table-cell align=center><b>" . $row['cnt'] . "</b></td>"; 806 807 $html .= "</tr>"; 808 } 809 810 $html .= "</table>"; 811 812 return $html; 813 } 814 } 815 816 class TopWeaponList extends TopList 817 { 793 818 function TopWeaponList() 794 819 { 795 $this->TopList();796 } 797 798 function addInvolvedPilot( $pilot)799 { 800 $this->invplt_ = $pilot;801 } 802 803 function addInvolvedCorp( $corp)804 { 805 $this->invcrp_ = $corp;806 } 807 808 function addInvolvedAlliance( $alliance)809 { 810 $this->invall_ = $alliance;811 } 812 813 function generate() 814 { 815 $sql = "select count(*) as cnt, ind.ind_wep_id as itm_id820 $this->TopList(); 821 } 822 823 function addInvolvedPilot($pilot) 824 { 825 $this->invplt_ = $pilot; 826 } 827 828 function addInvolvedCorp($corp) 829 { 830 $this->invcrp_ = $corp; 831 } 832 833 function addInvolvedAlliance($alliance) 834 { 835 $this->invall_ = $alliance; 836 } 837 838 function generate() 839 { 840 $sql = "select count(*) as cnt, ind.ind_wep_id as itm_id 816 841 from kb3_inv_detail ind 817 842 inner join kb3_items itm on ( itm_id = ind.ind_wep_id )"; 818 843 819 if ( $this->invplt_)820 $sql .= " inner join kb3_inv_plt inp844 if ($this->invplt_) 845 $sql .= " inner join kb3_inv_plt inp 821 846 on ( inp.inp_kll_id = ind.ind_kll_id 822 847 and inp.inp_plt_id = ind.ind_plt_id 823 and inp.inp_plt_id = " .$this->invplt_->getID().")";824 825 if ( $this->invcrp_)826 $sql .= " inner join kb3_inv_crp inc848 and inp.inp_plt_id = " . $this->invplt_->getID() . ")"; 849 850 if ($this->invcrp_) 851 $sql .= " inner join kb3_inv_crp inc 827 852 on ( inc.inc_kll_id = ind.ind_kll_id 828 853 and inc.inc_crp_id = ind.ind_crp_id 829 and inc.inc_crp_id = " .$this->invcrp_->getID().")";830 831 if ( $this->invall_)832 $sql .= " inner join kb3_inv_all ina854 and inc.inc_crp_id = " . $this->invcrp_->getID() . ")"; 855 856 if ($this->invall_) 857 $sql .= " inner join kb3_inv_all ina 833 858 on ( ina.ina_kll_id = ind.ind_kll_id 834 859 and ina.ina_all_id = ind.ind_all_id 835 and ina.ina_all_id = " .$this->invall_->getID().")";836 837 $this->setSQLTop( $sql);838 $this->setSQLBottom(" and itm.itm_icon not in ( '1', 'icon_null' )860 and ina.ina_all_id = " . $this->invall_->getID() . ")"; 861 862 $this->setSQLTop($sql); 863 $this->setSQLBottom(" and itm.itm_icon not in ( '1', 'icon_null' ) 839 864 and itm.itm_name != 'Unknown' 840 865 group by ind.ind_wep_id order by 1 desc 841 limit 20" ); 842 } 843 } 844 845 class TopWeaponListTable 846 { 847 function TopWeaponListTable( $toplist ) 848 { 849 $this->toplist_ = $toplist; 850 } 851 852 function generate() 853 { 854 $this->toplist_->generate(); 855 856 $html .= "<table class=kb-table cellspacing=1>"; 857 $html .= "<tr class=kb-table-header>"; 858 $html .= "<td class=kb-table-cell align=center colspan=2>Weapon</td>"; 859 $html .= "<td class=kb-table-cell align=center width=60>Kills</td>"; 860 $html .= "</tr>"; 861 862 $odd = true; 863 while( $row = $this->toplist_->getRow() ) { 864 $item = new Item( $row['itm_id'] ); 865 if ( $odd ) { 866 $class = "kb-table-row-odd"; 867 $odd = false; 868 } else { 869 $class = "kb-table-row-even"; 870 $odd = true; 871 } 872 $html .= "<tr class=".$class.">"; 873 $html .= $item->getIcon( 32 ); 874 $html .= "<td class=kb-table-cell width=200><b>".$item->getName()."</b></td>"; 875 $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; 876 866 limit 20"); 867 } 868 } 869 870 class TopWeaponListTable 871 { 872 function TopWeaponListTable($toplist) 873 { 874 $this->toplist_ = $toplist; 875 } 876 877 function generate() 878 { 879 $this->toplist_->generate(); 880 881 $html .= "<table class=kb-table cellspacing=1>"; 882 $html .= "<tr class=kb-table-header>"; 883 $html .= "<td class=kb-table-cell align=center colspan=2>Weapon</td>"; 884 $html .= "<td class=kb-table-cell align=center width=60>Kills</td>"; 877 885 $html .= "</tr>"; 878 } 879 880 $html .= "</table>"; 881 882 return $html; 883 } 884 } 886 887 $odd = true; 888 while ($row = $this->toplist_->getRow()) 889 { 890 $item = new Item($row['itm_id']); 891 if ($odd) 892 { 893 $class = "kb-table-row-odd"; 894 $odd = false; 895 } 896 else 897 { 898 $class = "kb-table-row-even"; 899 $odd = true; 900 } 901 $html .= "<tr class=" . $class . ">"; 902 $html .= $item->getIcon(32); 903 $html .= "<td class=kb-table-cell width=200><b>" . $item->getName() . "</b></td>"; 904 $html .= "<td class=kb-table-cell align=center><b>" . $row['cnt'] . "</b></td>"; 905 906 $html .= "</tr>"; 907 } 908 909 $html .= "</table>"; 910 911 return $html; 912 } 913 } 885 914 ?>