Changeset 1515807
- Timestamp:
- 10/16/2016 09:47:57 AM (9 years ago)
- Location:
- eve-shipinfo/trunk
- Files:
-
- 4 edited
-
classes/EVEShipInfo/Collection.php (modified) (1 diff)
-
classes/EVEShipInfo/Collection/Filter.php (modified) (1 diff)
-
classes/EVEShipInfo/Shortcode/ShipList.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
eve-shipinfo/trunk/classes/EVEShipInfo/Collection.php
r1515539 r1515807 420 420 return ''; 421 421 } 422 423 protected $propertyColumns = array( 424 'mass', 425 'volume', 426 'capacity', 427 ); 428 429 /** 430 * Gets the minimum and maximum values for the specified ship property 431 * from the database. 432 * 433 * @param string $name 434 * @return NULL|array An array with two keys, "min" and "max" 435 */ 436 public function getPropertyValueRange($name) 437 { 438 if(!in_array($name, $this->propertyColumns)) { 439 return null; 440 } 441 442 $entry = $this->plugin->dbFetch( 443 "SELECT 444 MAX(".$name.") AS maximum, 445 MIN(".$name.") AS minimum 446 FROM 447 ".$this->plugin->getTableName('ships')."" 448 ); 449 450 if(is_array($entry) && isset($entry['maximum'])) { 451 return array( 452 'min' => $entry['minimum'], 453 'max' => $entry['maximum'] 454 ); 455 } 456 457 return null; 458 } 422 459 } -
eve-shipinfo/trunk/classes/EVEShipInfo/Collection/Filter.php
r1515539 r1515807 872 872 public function selectLauncherSlots($expression) { return $this->selectAttribute('launcherSlotsLeft', 'numeric', $expression); } 873 873 public function selectTechLevel($expression) { return $this->selectAttribute('techLevel', 'numeric', $expression); } 874 public function selectMass($expression) { return $this->selectProperty('mass', 'numeric', $expression); } 874 875 875 876 protected $search; -
eve-shipinfo/trunk/classes/EVEShipInfo/Shortcode/ShipList.php
r1515539 r1515807 72 72 'turrets' => '', 73 73 'techlevel' => '', 74 'ships' => '' 74 'ships' => '', 75 'mass' => '' 75 76 ); 76 77 } … … 80 81 $filter = $this->collection->createFilter(); 81 82 $list = $this->collection->createList($filter); 82 83 84 $massRange = $this->collection->getPropertyValueRange('mass'); 85 83 86 $attribs = array( 84 87 'settings' => array( … … 315 318 'type' => 'text', 316 319 'values' => $this->describeNumericExpressions() 317 ) 320 ), 321 'mass' => array( 322 'descr' => __('The ship\'s mass to limit the list to.', 'eve-shipinfo').' '. 323 sprintf( 324 __('The values range from %1$s to %2$s according to the current database.', 'eve-shipinfo'), 325 number_format($massRange['min'], 0, ' ', ' '), 326 number_format($massRange['max'], 0, ' ', ' ') 327 ).' '. 328 __('This allows complex selections using expressions.', 'eve-shipinfo'), 329 'optional' => true, 330 'type' => 'text', 331 'values' => $this->describeNumericExpressions() 332 ), 318 333 ) 319 334 ) … … 520 535 $this->filter->selectTechLevel($techlevel); 521 536 } 537 538 $mass = trim($this->getAttribute('mass')); 539 if(!empty($mass)) { 540 $this->filter->selectMass($mass); 541 } 522 542 } 523 543 -
eve-shipinfo/trunk/readme.txt
r1515539 r1515807 55 55 = 2.1 = 56 56 * Added the "ships" filter to the list shortcodes to display specific ships by name or id 57 * Added the "mass" filter to the list shortcodes to limit the list by ship mass 57 58 58 59 = 2.0 =
Note: See TracChangeset
for help on using the changeset viewer.