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