*/
protected $showTagEditUI;
+ /**
+ * @var array
+ */
+ protected $allowedActions = null;
+
/**
* Constructor.
* The first two parameters used to be $skin and $out, but now only a context
* @param int $month Month
* @param array $filter
* @param string $tagFilter Tag to select by default
+ * @param string $action
*/
public function showOptions( $types = [], $user = '', $page = '', $pattern = '', $year = 0,
- $month = 0, $filter = null, $tagFilter = ''
+ $month = 0, $filter = null, $tagFilter = '', $action = null
) {
global $wgScript, $wgMiserMode;
$html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) );
}
+ // Action filter
+ if ( $action !== null ) {
+ $html .= Xml::tags( 'p', null, $this->getActionSelector( $types, $action ) );
+ }
+
// Submit button
$html .= Xml::submitButton( $this->msg( 'logeventslist-submit' )->text() );
return '';
}
+ /**
+ * Drop down menu for selection of actions that can be used to filter the log
+ * @param array $types
+ * @param string $action
+ * @return string
+ * @since 1.27
+ */
+ private function getActionSelector( $types, $action ) {
+ if ( $this->allowedActions === null || !count( $this->allowedActions ) ) {
+ return '';
+ }
+ $html = '';
+ $html .= xml::label( wfMessage( 'log-action-filter-' . $types[0] )->text(),
+ 'action-filter-' .$types[0] ) . "\n";
+ $select = new XmlSelect( 'subtype' );
+ $select->addOption( wfMessage( 'log-action-filter-all' )->text(), '' );
+ foreach ( $this->allowedActions as $value ) {
+ $msgKey = 'log-action-filter-' . $types[0] . '-' . $value;
+ $select->addOption( wfMessage( $msgKey )->text(), $value );
+ }
+ $select->setDefault( $action );
+ $html .= $select->getHtml();
+ return $html;
+ }
+
+ /**
+ * Sets the action types allowed for log filtering
+ * To one action type may correspond several log_actions
+ * @param array $actions
+ * @since 1.27
+ */
+ public function setAllowedActions( $actions ) {
+ $this->allowedActions = $actions;
+ }
+
/**
* @return string
*/