<?php
/**
- * Copyright (C) 2008 Aaron Schulz
+ * Implements Special:Activeusers
+ *
+ * Copyright © 2008 Aaron Schulz
*
* 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
* 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
*/
/**
* rights (sysop, bureaucrat, developer) will have them displayed
* next to their names.
*
- * @file
* @ingroup SpecialPage
*/
class ActiveUsersPager extends UsersPager {
+ /**
+ * @var FormOptions
+ */
+ protected $opts;
+
+ /**
+ * @var Array
+ */
+ protected $groups;
+
function __construct( $group = null ) {
global $wgRequest, $wgActiveUserDays;
$this->RCMaxAge = $wgActiveUserDays;
$this->requestedUser = $username->getText();
}
}
-
+
$this->setupOptions();
-
+
parent::__construct();
}
+ function getTitle() {
+ return SpecialPage::getTitleFor( 'Activeusers' );
+ }
+
public function setupOptions() {
global $wgRequest;
-
+
$this->opts = new FormOptions();
$this->opts->add( 'hidebots', false, FormOptions::BOOL );
$this->opts->fetchValuesFromRequest( $wgRequest );
$this->groups = array();
- if ($this->opts->getValue('hidebots') == 1)
+ if ( $this->opts->getValue( 'hidebots' ) == 1 ) {
$this->groups['bot'] = true;
- if ($this->opts->getValue('hidesysops') == 1)
+ }
+ if ( $this->opts->getValue( 'hidesysops' ) == 1 ) {
$this->groups['sysop'] = true;
+ }
}
function getIndexField() {
$conds[] = 'ipb_deleted IS NULL'; // don't show hidden names
$conds[] = "rc_log_type IS NULL OR rc_log_type != 'newusers'";
$conds[] = "rc_timestamp >= '{$dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 )}'";
-
+
if( $this->requestedUser != '' ) {
$conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser );
}
function formatRow( $row ) {
global $wgLang;
$userName = $row->user_name;
-
+
$ulinks = $this->getSkin()->userLink( $row->user_id, $userName );
$ulinks .= $this->getSkin()->userToolLinks( $row->user_id, $userName );
$list = array();
foreach( self::getGroups( $row->user_id ) as $group ) {
- if (isset($this->groups[$group]))
+ if ( isset( $this->groups[$group] ) ) {
return;
+ }
$list[] = self::buildGroupLink( $group );
}
$groups = $wgLang->commaList( $list );
global $wgScript;
$self = $this->getTitle();
- $limit = $this->mLimit ? Xml::hidden( 'limit', $this->mLimit ) : '';
+ $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : '';
- $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag
+ $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag
$out .= Xml::fieldset( wfMsg( 'activeusers' ) ) . "\n";
- $out .= Xml::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n";
+ $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n";
$out .= Xml::inputLabel( wfMsg( 'activeusers-from' ), 'username', 'offset', 20, $this->requestedUser ) . '<br />';# Username field
$out .= Xml::checkLabel( wfMsg('activeusers-hidesysops'), 'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ) ) . '<br />';
- $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n";# Submit button and form bottom
+ $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n";# Submit button and form bottom
$out .= Xml::closeElement( 'fieldset' );
$out .= Xml::closeElement( 'form' );
-
+
return $out;
}
}
/**
* Constructor
*/
- public function __construct() {
+ public function __construct() {
parent::__construct( 'Activeusers' );
}