Remove silly 'm' prefix from StubObject/DeprecatedGlobal members
[mediawiki.git] / includes / ImageQueryPage.php
blobb0266cbaf76da4d829349026bc0f3cf48808256d
1 <?php
2 /**
3 * Variant of QueryPage which uses a gallery to output results.
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
20 * @file
21 * @ingroup SpecialPage
24 /**
25 * Variant of QueryPage which uses a gallery to output results, thus
26 * suited for reports generating images
28 * @ingroup SpecialPage
29 * @author Rob Church <robchur@gmail.com>
31 abstract class ImageQueryPage extends QueryPage {
32 /**
33 * Format and output report results using the given information plus
34 * OutputPage
36 * @param OutputPage $out OutputPage to print to
37 * @param Skin $skin User skin to use [unused]
38 * @param DatabaseBase $dbr (read) connection to use
39 * @param int $res Result pointer
40 * @param int $num Number of available result rows
41 * @param int $offset Paging offset
43 protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
44 if ( $num > 0 ) {
45 $gallery = ImageGalleryBase::factory();
46 $gallery->setContext( $this->getContext() );
48 # $res might contain the whole 1,000 rows, so we read up to
49 # $num [should update this to use a Pager]
50 $i = 0;
51 foreach ( $res as $row ) {
52 $i++;
53 $namespace = isset( $row->namespace ) ? $row->namespace : NS_FILE;
54 $title = Title::makeTitleSafe( $namespace, $row->title );
55 if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
56 $gallery->add( $title, $this->getCellHtml( $row ) );
58 if ( $i === $num ) {
59 break;
63 $out->addHTML( $gallery->toHtml() );
67 // Gotta override this since it's abstract
68 function formatResult( $skin, $result ) {
71 /**
72 * Get additional HTML to be shown in a results' cell
74 * @param object $row Result row
75 * @return string
77 protected function getCellHtml( $row ) {
78 return '';