2013-01-25 02:23:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group conpherence
|
|
|
|
*/
|
|
|
|
final class ConpherenceMenuItemView extends AphrontTagView {
|
|
|
|
|
|
|
|
private $title;
|
|
|
|
private $subtitle;
|
|
|
|
private $imageURI;
|
|
|
|
private $href;
|
|
|
|
private $epoch;
|
|
|
|
private $unreadCount;
|
|
|
|
|
|
|
|
public function setUnreadCount($unread_count) {
|
|
|
|
$this->unreadCount = $unread_count;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getUnreadCount() {
|
|
|
|
return $this->unreadCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setEpoch($epoch) {
|
|
|
|
$this->epoch = $epoch;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getEpoch() {
|
|
|
|
return $this->epoch;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setHref($href) {
|
|
|
|
$this->href = $href;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getHref() {
|
|
|
|
return $this->href;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setImageURI($image_uri) {
|
|
|
|
$this->imageURI = $image_uri;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getImageURI() {
|
|
|
|
return $this->imageURI;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSubtitle($subtitle) {
|
|
|
|
$this->subtitle = $subtitle;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getSubtitle() {
|
|
|
|
return $this->subtitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTitle($title) {
|
|
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
|
|
|
return $this->title;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagName() {
|
|
|
|
return 'a';
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagAttributes() {
|
|
|
|
$classes = array('conpherence-menu-item-view');
|
|
|
|
return array(
|
|
|
|
'class' => $classes,
|
|
|
|
'href' => $this->href,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagContent() {
|
|
|
|
$image = null;
|
|
|
|
if ($this->imageURI) {
|
2013-01-25 14:50:50 +01:00
|
|
|
$image = phutil_tag(
|
2013-01-25 02:23:05 +01:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'conpherence-menu-item-image',
|
|
|
|
'style' => 'background-image: url('.$this->imageURI.');'
|
|
|
|
),
|
|
|
|
'');
|
|
|
|
}
|
|
|
|
$title = null;
|
|
|
|
if ($this->title) {
|
2013-01-25 14:50:50 +01:00
|
|
|
$title = phutil_tag(
|
2013-01-25 02:23:05 +01:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'conpherence-menu-item-title',
|
|
|
|
),
|
2013-01-25 14:50:50 +01:00
|
|
|
$this->title);
|
2013-01-25 02:23:05 +01:00
|
|
|
}
|
|
|
|
$subtitle = null;
|
|
|
|
if ($this->subtitle) {
|
2013-01-25 14:50:50 +01:00
|
|
|
$subtitle = phutil_tag(
|
2013-01-25 02:23:05 +01:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'conpherence-menu-item-subtitle',
|
|
|
|
),
|
2013-01-25 14:50:50 +01:00
|
|
|
$this->subtitle);
|
2013-01-25 02:23:05 +01:00
|
|
|
}
|
|
|
|
$epoch = null;
|
|
|
|
if ($this->epoch) {
|
2013-01-25 14:50:50 +01:00
|
|
|
$epoch = phutil_tag(
|
2013-01-25 02:23:05 +01:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'conpherence-menu-item-date',
|
|
|
|
),
|
|
|
|
phabricator_relative_date($this->epoch, $this->user));
|
|
|
|
}
|
|
|
|
$unread_count = null;
|
|
|
|
if ($this->unreadCount) {
|
2013-01-25 14:50:50 +01:00
|
|
|
$unread_count = phutil_tag(
|
2013-01-25 02:23:05 +01:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'conpherence-menu-item-unread-count'
|
|
|
|
),
|
2013-01-25 14:50:50 +01:00
|
|
|
(int)$this->unreadCount);
|
2013-01-25 02:23:05 +01:00
|
|
|
}
|
|
|
|
|
2013-03-09 22:52:41 +01:00
|
|
|
return array(
|
|
|
|
$image,
|
|
|
|
$title,
|
|
|
|
$subtitle,
|
|
|
|
$epoch,
|
|
|
|
$unread_count,
|
|
|
|
);
|
2013-01-25 02:23:05 +01:00
|
|
|
}
|
|
|
|
}
|