X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialPagesWithProp.php;h=34fcc78c7eb8dba280cddd25160e2bdd461db864;hb=f3a51244a3d19862044b4832dc2bd332c89fc028;hp=37006d8f7a5c0b54080a68e7f87166b0a0dbfc6d;hpb=3a2853e218acb586a00f2e59638de4176aee287f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialPagesWithProp.php b/includes/specials/SpecialPagesWithProp.php index 37006d8f7a..34fcc78c7e 100644 --- a/includes/specials/SpecialPagesWithProp.php +++ b/includes/specials/SpecialPagesWithProp.php @@ -20,7 +20,6 @@ * @since 1.21 * @file * @ingroup SpecialPage - * @author Brad Jorsch */ /** @@ -29,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 ); } @@ -47,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(); @@ -59,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' ] ); @@ -123,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; } /**