MediaWiki  1.34.0
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 }
LogFormatter\FOR_THIS_USER
const FOR_THIS_USER
Definition: LogFormatter.php:41
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:46
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
RevisionItemBase
Abstract base class for revision items.
Definition: RevisionItemBase.php:28
ChangeTagsLogItem\canViewContent
canViewContent()
Returns true if the current user can view the item text/file.
Definition: ChangeTagsLogItem.php:58
ChangeTagsLogItem
Item class for a logging table row with its associated change tags.
Definition: ChangeTagsLogItem.php:31
SpecialPage\getTitleFor
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,...
Definition: SpecialPage.php:83
ChangeTagsLogItem\getTimestampField
getTimestampField()
Get the DB field name storing timestamps.
Definition: ChangeTagsLogItem.php:36
ChangeTagsLogItem\getAuthorActorField
getAuthorActorField()
Get the DB field name storing actor ids.
Definition: ChangeTagsLogItem.php:48
LogPage\DELETED_COMMENT
const DELETED_COMMENT
Definition: LogPage.php:35
LogFormatter\newFromRow
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
Definition: LogFormatter.php:70
ChangeTagsLogItem\getIdField
getIdField()
Get the DB field name associated with the ID list.
Definition: ChangeTagsLogItem.php:32
$title
$title
Definition: testCompression.php:34
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:586
$content
$content
Definition: router.php:78
Xml\tags
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:130
ChangeTagsLogItem\getAuthorIdField
getAuthorIdField()
Get the DB field name storing user ids.
Definition: ChangeTagsLogItem.php:40
ChangeTagsLogItem\getHTML
getHTML()
Definition: ChangeTagsLogItem.php:73
ChangeTagsLogItem\canView
canView()
Returns true if the current user can view the item.
Definition: ChangeTagsLogItem.php:52
ChangeTagsLogItem\getAuthorNameField
getAuthorNameField()
Get the DB field name storing user names.
Definition: ChangeTagsLogItem.php:44
LogEventsList\userCan
static userCan( $row, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
Definition: LogEventsList.php:533
LogEventsList\isDeleted
static isDeleted( $row, $field)
Definition: LogEventsList.php:595
ChangeTagsLogItem\getTags
getTags()
Definition: ChangeTagsLogItem.php:65
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, IContextSource $context=null)
Creates HTML for the given tags.
Definition: ChangeTags.php:94