X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialPagesWithProp.php;h=34fcc78c7eb8dba280cddd25160e2bdd461db864;hp=5878e1ffb178a1cb95c80a585892ca2b1d8323af;hb=89539f2aa1b158fdcc703ad053e2580cb97a6385;hpb=08e0ed2b70ba5986a96c701f84a7679c98a6f2fd diff --git a/includes/specials/SpecialPagesWithProp.php b/includes/specials/SpecialPagesWithProp.php index 5878e1ffb1..34fcc78c7e 100644 --- a/includes/specials/SpecialPagesWithProp.php +++ b/includes/specials/SpecialPagesWithProp.php @@ -28,9 +28,27 @@ * @since 1.21 */ class SpecialPagesWithProp extends QueryPage { + + /** + * @var string|null + */ private $propName = null; + + /** + * @var string[]|null + */ private $existingPropNames = null; + /** + * @var bool + */ + private $reverse = false; + + /** + * @var bool + */ + private $sortByValue = false; + function __construct( $name = 'PagesWithProp' ) { parent::__construct( $name ); } @@ -46,6 +64,8 @@ class SpecialPagesWithProp extends QueryPage { $request = $this->getRequest(); $propname = $request->getVal( 'propname', $par ); + $this->reverse = $request->getBool( 'reverse' ); + $this->sortByValue = $request->getBool( 'sortbyvalue' ); $propnames = $this->getExistingPropNames(); @@ -58,6 +78,20 @@ class SpecialPagesWithProp extends QueryPage { 'label-message' => 'pageswithprop-prop', 'required' => true, ], + 'reverse' => [ + 'type' => 'check', + 'name' => 'reverse', + 'default' => $this->reverse, + 'label-message' => 'pageswithprop-reverse', + 'required' => false, + ], + 'sortbyvalue' => [ + 'type' => 'check', + 'name' => 'sortbyvalue', + 'default' => $this->sortByValue, + 'label-message' => 'pageswithprop-sortbyvalue', + 'required' => false, + ] ], $this->getContext() ); $form->setMethod( 'get' ); $form->setSubmitCallback( [ $this, 'onSubmit' ] ); @@ -122,7 +156,18 @@ class SpecialPagesWithProp extends QueryPage { } function getOrderFields() { - return [ 'page_id' ]; + $sort = [ 'page_id' ]; + if ( $this->sortByValue ) { + array_unshift( $sort, 'pp_sortkey' ); + } + return $sort; + } + + /** + * @return bool + */ + public function sortDescending() { + return !$this->reverse; } /**