3 * Implements Special:PagesWithProp
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 * @ingroup SpecialPage
28 * Special:PagesWithProp to search the page_props table
29 * @ingroup SpecialPage
32 class SpecialPagesWithProp
extends QueryPage
{
33 private $propName = null;
35 function __construct( $name = 'PagesWithProp' ) {
36 parent
::__construct( $name );
39 function isCacheable() {
43 function execute( $par ) {
45 $this->outputHeader();
47 $request = $this->getRequest();
48 $propname = $request->getVal( 'propname', $par );
50 $dbr = wfGetDB( DB_SLAVE
);
56 array( 'DISTINCT', 'ORDER BY' => 'pp_propname' )
58 foreach ( $res as $row ) {
59 $propnames[$row->pp_propname
] = $row->pp_propname
;
62 $form = new HTMLForm( array(
64 'type' => 'selectorother',
66 'options' => $propnames,
67 'default' => $propname,
68 'label-message' => 'pageswithprop-prop',
71 ), $this->getContext() );
72 $form->setMethod( 'get' );
73 $form->setSubmitCallback( array( $this, 'onSubmit' ) );
74 $form->setWrapperLegendMsg( 'pageswithprop-legend' );
75 $form->addHeaderText( $this->msg( 'pageswithprop-text' )->parseAsBlock() );
76 $form->setSubmitTextMsg( 'pageswithprop-submit' );
79 $form->displayForm( false );
80 if ( $propname !== '' && $propname !== null ) {
85 public function onSubmit( $data, $form ) {
86 $this->propName
= $data['propname'];
87 parent
::execute( $data['propname'] );
91 * Disable RSS/Atom feeds
94 function isSyndicated() {
98 function getQueryInfo() {
100 'tables' => array( 'page_props', 'page' ),
102 'page_id' => 'pp_page',
112 'pp_propname' => $this->propName
,
118 function getOrderFields() {
119 return array( 'page_id' );
124 * @param object $result Result row
127 function formatResult( $skin, $result ) {
128 $title = Title
::newFromRow( $result );
129 $ret = Linker
::link( $title, null, array(), array(), array( 'known' ) );
130 if ( $result->pp_value
!== '' ) {
131 $value = $this->msg( 'parentheses' )
132 ->rawParams( Html
::element( 'span', array( 'class' => 'prop-value' ), $result->pp_value
) )
139 protected function getGroupName() {