2015-11-17 15:10:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class EchoRevertedPresentationModel extends EchoEventPresentationModel {
|
|
|
|
|
|
|
|
public function getIconType() {
|
|
|
|
return 'revert';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function canRender() {
|
|
|
|
return (bool)$this->event->getTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHeaderMessage() {
|
|
|
|
$msg = parent::getHeaderMessage();
|
|
|
|
$msg->params( $this->event->getTitle()->getPrefixedText() );
|
|
|
|
$msg->params( $this->getNumberOfEdits() );
|
|
|
|
return $msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPrimaryLink() {
|
|
|
|
$url = $this->event->getTitle()->getLocalURL( array(
|
|
|
|
'oldid' => 'prev',
|
|
|
|
'diff' => $this->event->getExtraParam( 'revid' )
|
|
|
|
) );
|
|
|
|
return array(
|
2015-12-16 16:52:02 +00:00
|
|
|
'url' => $url,
|
|
|
|
'label' => $this->msg( 'notification-link-text-view-changes' )->text()
|
2015-11-17 15:10:33 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-12-22 15:57:13 +00:00
|
|
|
public function getSecondaryLinks() {
|
|
|
|
return array( $this->getAgentLink() );
|
|
|
|
}
|
2015-11-17 15:10:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a number that represents if one or multiple edits
|
|
|
|
* have been reverted for formatting purposes.
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
private function getNumberOfEdits() {
|
|
|
|
$method = $this->event->getExtraParam( 'method' );
|
|
|
|
if ( $method && $method === 'rollback' ) {
|
|
|
|
return 2;
|
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|