1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +01:00
phorge-phorge/src/view/phui/PHUITimelineView.php

49 lines
918 B
PHP
Raw Normal View History

<?php
final class PHUITimelineView extends AphrontView {
private $events = array();
private $id;
public function setID($id) {
$this->id = $id;
return $this;
}
public function addEvent(PHUITimelineEventView $event) {
$this->events[] = $event;
return $this;
}
public function render() {
require_celerity_resource('phui-timeline-view-css');
$spacer = self::renderSpacer();
$events = array();
foreach ($this->events as $event) {
$events[] = $spacer;
$events[] = $event;
}
$events[] = $spacer;
return phutil_tag(
'div',
array(
'class' => 'phui-timeline-view',
'id' => $this->id,
),
$events);
}
public static function renderSpacer() {
return phutil_tag(
'div',
array(
'class' => 'phui-timeline-event-view '.
'phui-timeline-spacer',
),
'');
}
}