1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/feed/view/PhabricatorFeedStoryView.php

154 lines
2.9 KiB
PHP
Raw Normal View History

<?php
final class PhabricatorFeedStoryView extends PhabricatorFeedView {
private $title;
private $image;
private $imageHref;
private $appIcon;
private $phid;
private $epoch;
private $viewed;
private $href;
public function setTitle($title) {
$this->title = $title;
return $this;
}
public function setEpoch($epoch) {
$this->epoch = $epoch;
return $this;
}
public function setImage($image) {
$this->image = $image;
return $this;
}
public function setImageHref($image_href) {
$this->imageHref = $image_href;
return $this;
}
public function setAppIcon($icon) {
$this->appIcon = $icon;
return $this;
}
public function setViewed($viewed) {
$this->viewed = $viewed;
return $this;
}
public function getViewed() {
return $this->viewed;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function getHref() {
return $this->href;
}
public function renderNotification() {
$classes = array(
'phabricator-notification',
);
if (!$this->viewed) {
$classes[] = 'phabricator-notification-unread';
}
2013-02-13 23:50:15 +01:00
return javelin_tag(
'div',
array(
'class' => implode(' ', $classes),
'sigil' => 'notification',
'meta' => array(
'href' => $this->getHref(),
),
),
$this->title);
}
public function render() {
$actor = '';
if ($this->image) {
$actor = new PhabricatorActionIconView();
$actor->setImage($this->image);
if ($this->imageHref) {
$actor->setHref($this->imageHref);
}
}
2013-02-13 23:50:15 +01:00
$head = phutil_tag(
'div',
array(
'class' => 'phabricator-feed-story-head',
),
array(
$actor,
nonempty($this->title, pht('Untitled Story')),
));
$body = null;
$foot = null;
$image_style = null;
$body = phutil_tag(
'div',
array(
'class' => 'phabricator-feed-story-body',
),
$this->renderChildren());
if ($this->epoch) {
$foot = phabricator_datetime($this->epoch, $this->user);
} else {
$foot = pht('No time specified.');
}
$icon = null;
if ($this->appIcon) {
$icon = new PhabricatorActionIconView();
$icon->setSpriteIcon($this->appIcon);
$icon->setSpriteSheet(PhabricatorActionIconView::SPRITE_APPS);
}
$foot = phutil_tag(
'div',
array(
'class' => 'phabricator-feed-story-foot',
),
array(
$icon,
$foot));
require_celerity_resource('phabricator-feed-css');
$story = phutil_tag(
'div',
array(
'class' => 'phabricator-feed-story',
'style' => $image_style,
),
array(
$head,
$body,
$foot));
2013-02-13 23:50:15 +01:00
return phutil_tag(
'div',
array(
'class' => 'phabricator-feed-wrap'
),
$story);
}
}