MediaWiki master
ChangeTagsLogItem.php
Go to the documentation of this file.
1<?php
27
35 public function getIdField() {
36 return 'log_id';
37 }
38
39 public function getTimestampField() {
40 return 'log_timestamp';
41 }
42
43 public function getAuthorIdField() {
44 return 'log_user';
45 }
46
47 public function getAuthorNameField() {
48 return 'log_user_text';
49 }
50
51 public function getAuthorActorField() {
52 return 'log_actor';
53 }
54
55 public function canView() {
56 return LogEventsList::userCan(
57 $this->row, LogPage::DELETED_RESTRICTED, $this->list->getAuthority()
58 );
59 }
60
61 public function canViewContent() {
62 return true; // none
63 }
64
68 public function getTags() {
69 return $this->row->ts_tags;
70 }
71
76 public function getHTML() {
77 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
78 $this->row->log_timestamp, $this->list->getUser() ) );
79 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
80 $formatter = LogFormatter::newFromRow( $this->row );
81 $formatter->setContext( $this->list->getContext() );
82 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
83
84 // Log link for this page
85 $loglink = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink(
86 SpecialPage::getTitleFor( 'Log' ),
87 $this->list->msg( 'log' )->text(),
88 [],
89 [ 'page' => $title->getPrefixedText() ]
90 );
91 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
92 // User links and action text
93 $action = $formatter->getActionText();
94
95 $comment = $this->list->getLanguage()->getDirMark() .
96 $formatter->getComment();
97
98 $content = "$loglink $date $action $comment";
99 $attribs = [];
100 $tags = $this->getTags();
101 if ( $tags ) {
102 [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
103 $tags,
104 'edittags',
105 $this->list->getContext()
106 );
107 $content .= " $tagSummary";
108 $attribs['class'] = implode( ' ', $classes );
109 }
110 return Html::rawElement( 'li', $attribs, $content );
111 }
112}
Item class for a logging table row with its associated change tags.
getAuthorNameField()
Get the DB field name storing user names.
getIdField()
Get the DB field name associated with the ID list.
canViewContent()
Returns true if the current user can view the item text/file.
getAuthorIdField()
Get the DB field name storing user ids.
getAuthorActorField()
Get the DB field name storing actor ids.
getTimestampField()
Get the DB field name storing timestamps.
canView()
Returns true if the current user can view the item.
static formatSummaryRow( $tags, $unused, MessageLocalizer $localizer=null)
Creates HTML for the given tags.
This class is a collection of static functions that serve two purposes:
Definition Html.php:56
Service locator for MediaWiki core services.
Abstract base class for revision items.
Parent class for all special pages.
Represents a title within MediaWiki.
Definition Title.php:78