* @since 1.21
* @file
* @ingroup SpecialPage
- * @author Brad Jorsch
*/
/**
* @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 );
}
$request = $this->getRequest();
$propname = $request->getVal( 'propname', $par );
+ $this->reverse = $request->getBool( 'reverse' );
+ $this->sortByValue = $request->getBool( 'sortbyvalue' );
$propnames = $this->getExistingPropNames();
'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' ] );
}
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;
}
/**