MediaWiki master
ChangeTagsLogItem.php
Go to the documentation of this file.
1<?php
26
34 public function getIdField() {
35 return 'log_id';
36 }
37
38 public function getTimestampField() {
39 return 'log_timestamp';
40 }
41
42 public function getAuthorIdField() {
43 return 'log_user';
44 }
45
46 public function getAuthorNameField() {
47 return 'log_user_text';
48 }
49
50 public function getAuthorActorField() {
51 return 'log_actor';
52 }
53
54 public function canView() {
55 return LogEventsList::userCan(
56 $this->row, LogPage::DELETED_RESTRICTED, $this->list->getAuthority()
57 );
58 }
59
60 public function canViewContent() {
61 return true; // none
62 }
63
67 public function getTags() {
68 return $this->row->ts_tags;
69 }
70
75 public function getHTML() {
76 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
77 $this->row->log_timestamp, $this->list->getUser() ) );
78 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
79 $formatter = LogFormatter::newFromRow( $this->row );
80 $formatter->setContext( $this->list->getContext() );
81 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
82
83 // Log link for this page
84 $loglink = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink(
85 SpecialPage::getTitleFor( 'Log' ),
86 $this->list->msg( 'log' )->text(),
87 [],
88 [ 'page' => $title->getPrefixedText() ]
89 );
90 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
91 // User links and action text
92 $action = $formatter->getActionText();
93
94 $comment = $this->list->getLanguage()->getDirMark() .
95 $formatter->getComment();
96
97 $content = "$loglink $date $action $comment";
98 $attribs = [];
99 $tags = $this->getTags();
100 if ( $tags ) {
101 [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
102 $tags,
103 'edittags',
104 $this->list->getContext()
105 );
106 $content .= " $tagSummary";
107 $attribs['class'] = implode( ' ', $classes );
108 }
109 return Html::rawElement( 'li', $attribs, $content );
110 }
111}
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.
Parent class for all special pages.
Represents a title within MediaWiki.
Definition Title.php:78
Abstract base class for revision items.