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