2015-11-25 04:07:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class EchoForeignPresentationModel extends EchoEventPresentationModel {
|
|
|
|
public function getIconType() {
|
2016-01-15 22:19:01 +00:00
|
|
|
return 'global';
|
2015-11-25 04:07:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getPrimaryLink() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getHeaderMessageKey() {
|
|
|
|
$data = $this->event->getExtra();
|
2016-07-07 22:05:56 +00:00
|
|
|
$section = $data['section'] == 'message' ? 'notice' : $data['section'];
|
2015-11-25 04:07:54 +00:00
|
|
|
|
2016-07-07 22:05:56 +00:00
|
|
|
// notification-header-foreign-alert
|
|
|
|
// notification-header-foreign-notice
|
2015-11-25 04:07:54 +00:00
|
|
|
return "notification-header-{$this->type}-{$section}";
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHeaderMessage() {
|
|
|
|
$msg = parent::getHeaderMessage();
|
|
|
|
|
|
|
|
$data = $this->event->getExtra();
|
2016-03-01 07:11:09 +00:00
|
|
|
$firstWiki = reset( $data['wikis'] );
|
|
|
|
$names = $this->getWikiNames( array( $firstWiki ) );
|
|
|
|
$msg->params( $names[0] );
|
2015-11-25 04:07:54 +00:00
|
|
|
$msg->numParams( count( $data['wikis'] ) - 1 );
|
2016-03-01 07:11:09 +00:00
|
|
|
$msg->numParams( count( $data['wikis'] ) );
|
2015-11-25 04:07:54 +00:00
|
|
|
|
|
|
|
return $msg;
|
|
|
|
}
|
2016-01-26 08:23:32 +00:00
|
|
|
|
2016-03-01 07:11:09 +00:00
|
|
|
public function getBodyMessage() {
|
|
|
|
$data = $this->event->getExtra();
|
|
|
|
$msg = wfMessage( "notification-body-{$this->type}" );
|
|
|
|
$msg->params( $this->language->listToText( $this->getWikiNames( $data['wikis'] ) ) );
|
|
|
|
return $msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getWikiNames( array $wikis ) {
|
2016-04-27 00:25:14 +00:00
|
|
|
$data = EchoForeignNotifications::getApiEndpoints( $wikis );
|
2016-03-01 07:11:09 +00:00
|
|
|
$names = array();
|
|
|
|
foreach ( $wikis as $wiki ) {
|
|
|
|
$names[] = $data[$wiki]['title'];
|
|
|
|
}
|
|
|
|
return $names;
|
2016-01-26 08:23:32 +00:00
|
|
|
}
|
2015-11-25 04:07:54 +00:00
|
|
|
}
|