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
27 * Special:PagesWithProp to search the page_props table
28 * @ingroup SpecialPage
31 class SpecialPagesWithProp
extends QueryPage
{
32 private $propName = null;
34 function __construct( $name = 'PagesWithProp' ) {
35 parent
::__construct( $name );
38 function isCacheable() {
42 function execute( $par ) {
44 $this->outputHeader();
46 $request = $this->getRequest();
47 $propname = $request->getVal( 'propname', $par );
49 $dbr = wfGetDB( DB_SLAVE
);
55 array( 'DISTINCT', 'ORDER BY' => 'pp_propname' )
57 foreach ( $res as $row ) {
58 $propnames[$row->pp_propname
] = $row->pp_propname
;
61 $form = new HTMLForm( array(
63 'type' => 'selectorother',
65 'options' => $propnames,
66 'default' => $propname,
67 'label-message' => 'pageswithprop-prop',
70 ), $this->getContext() );
71 $form->setMethod( 'get' );
72 $form->setSubmitCallback( array( $this, 'onSubmit' ) );
73 $form->setWrapperLegendMsg( 'pageswithprop-legend' );
74 $form->addHeaderText( $this->msg( 'pageswithprop-text' )->parseAsBlock() );
75 $form->setSubmitTextMsg( 'pageswithprop-submit' );
78 $form->displayForm( false );
79 if ( $propname !== '' && $propname !== null ) {
84 public function onSubmit( $data, $form ) {
85 $this->propName
= $data['propname'];
86 parent
::execute( $data['propname'] );
90 * Disable RSS/Atom feeds
93 function isSyndicated() {
97 function getQueryInfo() {
99 'tables' => array( 'page_props', 'page' ),
101 'page_id' => 'pp_page',
111 'pp_propname' => $this->propName
,
117 function getOrderFields() {
118 return array( 'page_id' );
123 * @param object $result Result row
126 function formatResult( $skin, $result ) {
127 $title = Title
::newFromRow( $result );
128 $ret = Linker
::link( $title, null, array(), array(), array( 'known' ) );
129 if ( $result->pp_value
!== '' ) {
130 $propValue = Html
::element( 'span', array( 'class' => 'prop-value' ), $result->pp_value
);
131 $value = $this->msg( 'parentheses' )->rawParams( $propValue )->escaped();
138 protected function getGroupName() {