MediaWiki REL1_33
ImageQueryPage.php
Go to the documentation of this file.
1<?php
26
34abstract class ImageQueryPage extends QueryPage {
46 protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
47 if ( $num > 0 ) {
48 $gallery = ImageGalleryBase::factory( false, $this->getContext() );
49
50 # $res might contain the whole 1,000 rows, so we read up to
51 # $num [should update this to use a Pager]
52 $i = 0;
53 foreach ( $res as $row ) {
54 $i++;
55 $namespace = $row->namespace ?? NS_FILE;
56 $title = Title::makeTitleSafe( $namespace, $row->title );
57 if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
58 $gallery->add( $title, $this->getCellHtml( $row ) );
59 }
60 if ( $i === $num ) {
61 break;
62 }
63 }
64
65 $out->addHTML( $gallery->toHTML() );
66 }
67 }
68
69 // Gotta override this since it's abstract
70 function formatResult( $skin, $result ) {
71 return false;
72 }
73
80 protected function getCellHtml( $row ) {
81 return '';
82 }
83}
static factory( $mode=false, IContextSource $context=null)
Get a new image gallery.
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
outputResults( $out, $skin, $dbr, $res, $num, $offset)
Format and output report results using the given information plus OutputPage.
formatResult( $skin, $result)
Formats the results of the query for display.
getCellHtml( $row)
Get additional HTML to be shown in a results' cell.
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
Definition QueryPage.php:35
int $offset
The offset and limit in use, as passed to the query() function.
Definition QueryPage.php:40
getContext()
Gets the context this SpecialPage is executed in.
Represents a title within MediaWiki.
Definition Title.php:40
getNamespace()
Get the namespace index, i.e.
Definition Title.php:994
$res
Definition database.txt:21
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition hooks.txt:855
const NS_FILE
Definition Defines.php:79
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
Result wrapper for grabbing data queried from an IDatabase object.