2007-03-28 21:01:58 +00:00
|
|
|
<?php
|
2012-05-12 20:33:02 +00:00
|
|
|
/**
|
|
|
|
|
* Variant of QueryPage which uses a gallery to output results.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup SpecialPage
|
|
|
|
|
*/
|
2007-03-28 21:01:58 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Variant of QueryPage which uses a gallery to output results, thus
|
|
|
|
|
* suited for reports generating images
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup SpecialPage
|
2007-03-28 21:01:58 +00:00
|
|
|
* @author Rob Church <robchur@gmail.com>
|
|
|
|
|
*/
|
2010-12-22 14:16:25 +00:00
|
|
|
abstract class ImageQueryPage extends QueryPage {
|
2007-03-28 21:01:58 +00:00
|
|
|
/**
|
|
|
|
|
* Format and output report results using the given information plus
|
|
|
|
|
* OutputPage
|
|
|
|
|
*
|
2013-04-14 19:18:38 +00:00
|
|
|
* @param OutputPage $out OutputPage to print to
|
|
|
|
|
* @param Skin $skin User skin to use [unused]
|
|
|
|
|
* @param DatabaseBase $dbr (read) connection to use
|
|
|
|
|
* @param int $res Result pointer
|
|
|
|
|
* @param int $num Number of available result rows
|
|
|
|
|
* @param int $offset Paging offset
|
2007-03-28 21:01:58 +00:00
|
|
|
*/
|
|
|
|
|
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
|
|
|
|
|
if( $num > 0 ) {
|
2008-07-30 03:07:54 +00:00
|
|
|
$gallery = new ImageGallery();
|
|
|
|
|
|
|
|
|
|
# $res might contain the whole 1,000 rows, so we read up to
|
|
|
|
|
# $num [should update this to use a Pager]
|
|
|
|
|
for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
|
2010-12-22 16:20:16 +00:00
|
|
|
$namespace = isset( $row->namespace ) ? $row->namespace : NS_FILE;
|
|
|
|
|
$title = Title::makeTitleSafe( $namespace, $row->title );
|
|
|
|
|
if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
|
2011-05-12 11:51:53 +00:00
|
|
|
$gallery->add( $title, $this->getCellHtml( $row ) );
|
2007-04-21 14:44:56 +00:00
|
|
|
}
|
2007-03-28 21:01:58 +00:00
|
|
|
}
|
2007-04-21 14:44:56 +00:00
|
|
|
|
2008-11-06 22:20:29 +00:00
|
|
|
$out->addHTML( $gallery->toHtml() );
|
2007-03-28 21:01:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
2010-12-22 16:20:16 +00:00
|
|
|
|
2010-12-22 14:16:25 +00:00
|
|
|
// Gotta override this since it's abstract
|
|
|
|
|
function formatResult( $skin, $result ) { }
|
2007-04-21 14:44:56 +00:00
|
|
|
|
2007-03-28 21:01:58 +00:00
|
|
|
/**
|
|
|
|
|
* Get additional HTML to be shown in a results' cell
|
|
|
|
|
*
|
2013-04-14 19:18:38 +00:00
|
|
|
* @param object $row Result row
|
|
|
|
|
* @return string
|
2007-03-28 21:01:58 +00:00
|
|
|
*/
|
|
|
|
|
protected function getCellHtml( $row ) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|