2012-11-22 02:24:56 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorTimelineView extends AphrontView {
|
|
|
|
|
|
|
|
private $events = array();
|
2012-12-11 23:02:12 +01:00
|
|
|
private $id;
|
|
|
|
|
|
|
|
public function setID($id) {
|
|
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
|
|
}
|
2012-11-22 02:24:56 +01:00
|
|
|
|
|
|
|
public function addEvent(PhabricatorTimelineEventView $event) {
|
|
|
|
$this->events[] = $event;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
|
|
|
require_celerity_resource('phabricator-timeline-view-css');
|
|
|
|
|
2012-12-11 23:02:29 +01:00
|
|
|
$spacer = self::renderSpacer();
|
2012-12-11 23:01:35 +01:00
|
|
|
|
2012-11-22 02:24:56 +01:00
|
|
|
$events = array();
|
|
|
|
foreach ($this->events as $event) {
|
2012-12-11 23:01:35 +01:00
|
|
|
$events[] = $spacer;
|
2013-03-09 22:52:41 +01:00
|
|
|
$events[] = $event;
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|
2012-12-11 23:01:35 +01:00
|
|
|
$events[] = $spacer;
|
2012-11-22 02:24:56 +01:00
|
|
|
|
2013-02-04 20:38:04 +01:00
|
|
|
return phutil_tag(
|
2012-11-22 02:24:56 +01:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-timeline-view',
|
2012-12-11 23:02:12 +01:00
|
|
|
'id' => $this->id,
|
2012-11-22 02:24:56 +01:00
|
|
|
),
|
2013-02-04 20:38:04 +01:00
|
|
|
$events);
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 23:02:29 +01:00
|
|
|
public static function renderSpacer() {
|
2013-01-18 03:57:09 +01:00
|
|
|
return phutil_tag(
|
2012-12-11 23:02:29 +01:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-timeline-event-view '.
|
|
|
|
'phabricator-timeline-spacer',
|
|
|
|
),
|
|
|
|
'');
|
|
|
|
}
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|