$this->setHeaders();
$this->outputHeader();
- $out = $this->getOutput();
$pager = new NewFilesPager( $this->getContext(), $par );
if ( !$this->including() ) {
- $out->addHTML( $pager->buildHTMLForm() );
+ $form = $pager->getForm();
+ $form->prepareForm();
+ $form->displayForm( '' );
}
- $out->addHTML( $pager->getBody() );
+ $this->getOutput()->addHTML( $pager->getBody() );
if ( !$this->including() ) {
- $out->addHTML( $pager->getNavigationBar() );
+ $this->getOutput()->addHTML( $pager->getNavigationBar() );
}
}
}
function __construct( IContextSource $context, $par = null ) {
$this->like = $context->getRequest()->getText( 'like' );
$this->showbots = $context->getRequest()->getBool( 'showbots' , 0 );
+ if ( is_numeric( $par ) ) {
+ $this->setLimit( $par );
+ }
parent::__construct( $context );
}
$tables = array( 'image' );
if( !$this->showbots ) {
- $tables[] = 'user_groups';
- $conds[] = 'ug_group IS NULL';
- $jconds['user_groups'] = array(
- 'LEFT JOIN',
- array(
- 'ug_group' => User::getGroupsWithPermission( 'bot' ),
- 'ug_user = img_user'
- )
- );
+ $groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );
+ if( count( $groupsWithBotPermission ) ) {
+ $tables[] = 'user_groups';
+ $conds[] = 'ug_group IS NULL';
+ $jconds['user_groups'] = array(
+ 'LEFT JOIN',
+ array(
+ 'ug_group' => $groupsWithBotPermission,
+ 'ug_user = img_user'
+ )
+ );
+ }
}
if( !$wgMiserMode && $this->like !== null ){
}
function getStartBody(){
- $this->gallery = new ImageGallery();
+ if ( !$this->gallery ) {
+ $this->gallery = new ImageGallery();
+ }
+ return '';
}
function getEndBody(){
$this->gallery->add(
$title,
"$ul<br />\n<i>"
- . htmlspecialchars( $this->getLanguage()->timeanddate( $row->img_timestamp, true ) )
+ . htmlspecialchars( $this->getLanguage()->userTimeAndDate( $row->img_timestamp, $this->getUser() ) )
. "</i><br />\n"
);
}
- protected function getHTMLFormFields() {
+ function getForm() {
global $wgMiserMode;
$fields = array(
),
'showbots' => array(
'type' => 'check',
- 'label' => wfMessage( 'showhidebots', wfMsg( 'show' ) ),
+ 'label' => $this->msg( 'showhidebots', $this->msg( 'show' )->plain() )->escaped(),
'name' => 'showbots',
+ # 'default' => $this->getRequest()->getBool( 'showbots', 0 ),
+ ),
+ 'limit' => array(
+ 'type' => 'hidden',
+ 'default' => $this->mLimit,
+ 'name' => 'limit',
+ ),
+ 'offset' => array(
+ 'type' => 'hidden',
+ 'default' => $this->getRequest()->getText( 'offset' ),
+ 'name' => 'offset',
),
);
unset( $fields['like'] );
}
- return $fields;
- }
-
- protected function getHTMLFormLegend() {
- return 'newimages-legend';
- }
+ $form = new HTMLForm( $fields, $this->getContext() );
+ $form->setTitle( $this->getTitle() );
+ $form->setSubmitTextMsg( 'ilsubmit' );
+ $form->setMethod( 'get' );
+ $form->setWrapperLegendMsg( 'newimages-legend' );
- protected function getHTMLFormSubmit() {
- return 'ilsubmit';
+ return $form;
}
}