Merge "Remove not used private member variable mParserWarnings from OutputPage"
[mediawiki.git] / includes / changetags / ChangeTagsLogItem.php
blob565d159aa9063b5b1e310709c73c3b51d415b920
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
18 * @file
19 * @ingroup Change tagging
22 /**
23 * Item class for a logging table row with its associated change tags.
24 * @todo Abstract out a base class for this and RevDelLogItem, similar to the
25 * RevisionItem class but specifically for log items.
26 * @since 1.25
28 class ChangeTagsLogItem extends RevisionItemBase {
29 public function getIdField() {
30 return 'log_id';
33 public function getTimestampField() {
34 return 'log_timestamp';
37 public function getAuthorIdField() {
38 return 'log_user';
41 public function getAuthorNameField() {
42 return 'log_user_text';
45 public function canView() {
46 return LogEventsList::userCan( $this->row, Revision::DELETED_RESTRICTED, $this->list->getUser() );
49 public function canViewContent() {
50 return true; // none
53 /**
54 * @return string Comma-separated list of tags
56 public function getTags() {
57 return $this->row->ts_tags;
60 /**
61 * @return string A HTML <li> element representing this revision, showing
62 * change tags and everything
64 public function getHTML() {
65 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
66 $this->row->log_timestamp, $this->list->getUser() ) );
67 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
68 $formatter = LogFormatter::newFromRow( $this->row );
69 $formatter->setContext( $this->list->getContext() );
70 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
72 // Log link for this page
73 $loglink = Linker::link(
74 SpecialPage::getTitleFor( 'Log' ),
75 $this->list->msg( 'log' )->escaped(),
76 array(),
77 array( 'page' => $title->getPrefixedText() )
79 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
80 // User links and action text
81 $action = $formatter->getActionText();
82 // Comment
83 $comment = $this->list->getLanguage()->getDirMark() .
84 $formatter->getComment();
86 if ( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) {
87 $comment = '<span class="history-deleted">' . $comment . '</span>';
90 $content = "$loglink $date $action $comment";
91 $attribs = array();
92 $tags = $this->getTags();
93 if ( $tags ) {
94 list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow( $tags, 'edittags' );
95 $content .= " $tagSummary";
96 $attribs['class'] = implode( ' ', $classes );
98 return Xml::tags( 'li', $attribs, $content );