36 parent::__construct( $name );
38 $this->shownavigation =
false;
39 $this->activeUsers = $this->
getConfig()->get(
'SpecialGadgetUsageActiveUsers' );
46 parent::execute( $par );
82 if ( !$this->activeUsers ) {
84 'tables' => [
'user_properties' ],
86 'title' =>
'up_property',
87 'value' =>
'SUM( up_value )',
88 'namespace' => NS_GADGET
91 'up_property' .
$dbr->buildLike(
'gadget-',
$dbr->anyString() )
94 'GROUP BY' => [
'up_property' ]
99 'tables' => [
'user_properties',
'user',
'querycachetwo' ],
101 'title' =>
'up_property',
102 'value' =>
'SUM( up_value )',
104 'namespace' =>
'COUNT( qcc_title )'
107 'up_property' .
$dbr->buildLike(
'gadget-',
$dbr->anyString() )
110 'GROUP BY' => [
'up_property' ]
120 'user_name = qcc_title',
121 'qcc_type = "activeusers"',
140 $html = Html::openElement(
'table', [
'class' => [
'sortable',
'wikitable' ] ] );
141 $html .= Html::openElement(
'thead', [] );
142 $html .= Html::openElement(
'tr', [] );
143 $headers = [
'gadgetusage-gadget',
'gadgetusage-usercount' ];
144 if ( $this->activeUsers ) {
145 $headers[] =
'gadgetusage-activeusers';
147 foreach ( $headers as $h ) {
148 if ( $h ==
'gadgetusage-gadget' ) {
149 $html .= Html::element(
'th', [], $this->
msg( $h )->text() );
151 $html .= Html::element(
'th', [
'data-sort-type' =>
'number' ],
152 $this->
msg( $h )->text() );
155 $html .= Html::closeElement(
'tr' );
156 $html .= Html::closeElement(
'thead' );
157 $html .= Html::openElement(
'tbody', [] );
159 $this->
getOutput()->addModuleStyles(
'jquery.tablesorter.styles' );
160 $this->
getOutput()->addModules(
'jquery.tablesorter' );
169 Html::closeElement(
'tbody' ) .
170 Html::closeElement(
'table' )
180 $gadgetTitle = substr( $result->title, 7 );
181 $gadgetUserCount = $this->
getLanguage()->formatNum( $result->value );
182 if ( $gadgetTitle ) {
183 $html = Html::openElement(
'tr', [] );
184 $html .= Html::element(
'td', [], $gadgetTitle );
185 $html .= Html::element(
'td', [], $gadgetUserCount );
186 if ( $this->activeUsers ==
true ) {
187 $activeUserCount = $this->
getLanguage()->formatNum( $result->namespace );
188 $html .= Html::element(
'td', [], $activeUserCount );
190 $html .= Html::closeElement(
'tr' );
204 foreach ( $gadgetIds as $g ) {
205 $gadget = $gadgetRepo->getGadget( $g );
206 if ( $gadget->isOnByDefault() ) {
207 $gadgetsList[] = $gadget->getName();
210 asort( $gadgetsList, SORT_STRING | SORT_FLAG_CASE );
227 $gadgetIds = $gadgetRepo->getGadgetIds();
229 if ( $this->activeUsers ) {
231 $this->
msg(
'gadgetusage-intro' )
232 ->numParams( $this->
getConfig()->
get(
'ActiveUserDays' ) )->parseAsBlock()
236 $this->
msg(
'gadgetusage-intro-noactive' )->parseAsBlock()
242 foreach ( $defaultGadgets as $default ) {
243 $html = Html::openElement(
'tr', [] );
244 $html .= Html::element(
'td', [], $default );
245 $html .= Html::element(
'td', [
'data-sort-value' =>
'Infinity' ],
246 $this->
msg(
'gadgetusage-default' )->text() );
247 if ( $this->activeUsers ) {
248 $html .= Html::element(
'td', [
'data-sort-value' =>
'Infinity' ],
249 $this->
msg(
'gadgetusage-default' )->text() );
251 $html .= Html::closeElement(
'tr' );
252 $out->addHTML( $html );
254 foreach (
$res as $row ) {
257 if ( !in_array( substr( $row->title, 7 ), $defaultGadgets ) ) {
259 if ( in_array( substr( $row->title, 7 ), $gadgetIds ) ) {
262 $out->addHTML(
$line );
271 $this->
msg(
'gadgetusage-noresults' )->parseAsBlock()