MediaWiki  master
ChangeTagsLogItem.php
Go to the documentation of this file.
1 <?php
24 
32  public function getIdField() {
33  return 'log_id';
34  }
35 
36  public function getTimestampField() {
37  return 'log_timestamp';
38  }
39 
40  public function getAuthorIdField() {
41  return 'log_user';
42  }
43 
44  public function getAuthorNameField() {
45  return 'log_user_text';
46  }
47 
48  public function getAuthorActorField() {
49  return 'log_actor';
50  }
51 
52  public function canView() {
54  $this->row, RevisionRecord::SUPPRESSED_ALL, $this->list->getUser()
55  );
56  }
57 
58  public function canViewContent() {
59  return true; // none
60  }
61 
65  public function getTags() {
66  return $this->row->ts_tags;
67  }
68 
73  public function getHTML() {
74  $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
75  $this->row->log_timestamp, $this->list->getUser() ) );
76  $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
77  $formatter = LogFormatter::newFromRow( $this->row );
78  $formatter->setContext( $this->list->getContext() );
79  $formatter->setAudience( LogFormatter::FOR_THIS_USER );
80 
81  // Log link for this page
82  $loglink = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink(
83  SpecialPage::getTitleFor( 'Log' ),
84  $this->list->msg( 'log' )->text(),
85  [],
86  [ 'page' => $title->getPrefixedText() ]
87  );
88  $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
89  // User links and action text
90  $action = $formatter->getActionText();
91 
92  $comment = $this->list->getLanguage()->getDirMark() .
93  $formatter->getComment();
94 
96  $comment = '<span class="history-deleted">' . $comment . '</span>';
97  }
98 
99  $content = "$loglink $date $action $comment";
100  $attribs = [];
101  $tags = $this->getTags();
102  if ( $tags ) {
103  list( $tagSummary, $classes ) = ChangeTags::formatSummaryRow(
104  $tags,
105  'edittags',
106  $this->list->getContext()
107  );
108  $content .= " $tagSummary";
109  $attribs['class'] = implode( ' ', $classes );
110  }
111  return Xml::tags( 'li', $attribs, $content );
112  }
113 }
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, $page, MessageLocalizer $localizer=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:182
static userCan( $row, $field, Authority $performer)
Determine if the current user is allowed to view a particular field of this log row,...
static isDeleted( $row, $field)
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
const FOR_THIS_USER
const DELETED_COMMENT
Definition: LogPage.php:41
Service locator for MediaWiki core services.
Page revision base class.
Abstract base class for revision items.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:638
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:134
$content
Definition: router.php:76