Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / countdown / view / PhabricatorCountdownView.php
blobf88c5a9d9c3abfbe2455b3ec3d408e3e1318156b
1 <?php
3 final class PhabricatorCountdownView extends AphrontView {
5 private $countdown;
7 public function setCountdown(PhabricatorCountdown $countdown) {
8 $this->countdown = $countdown;
9 return $this;
12 public function render() {
13 $countdown = $this->countdown;
14 require_celerity_resource('phabricator-countdown-css');
16 $header_text = array(
17 $countdown->getMonogram(),
18 ' ',
19 phutil_tag(
20 'a',
21 array(
22 'href' => $countdown->getURI(),
24 $countdown->getTitle()),
27 $header = id(new PHUIHeaderView())
28 ->setHeader($header_text);
30 $ths = array(
31 phutil_tag('th', array(), pht('Days')),
32 phutil_tag('th', array(), pht('Hours')),
33 phutil_tag('th', array(), pht('Minutes')),
34 phutil_tag('th', array(), pht('Seconds')),
37 $dashes = array(
38 javelin_tag('td', array('sigil' => 'phabricator-timer-days'), '-'),
39 javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), '-'),
40 javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), '-'),
41 javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), '-'),
44 $epoch = $countdown->getEpoch();
45 $launch_date = phabricator_datetime($epoch, $this->getUser());
46 $foot = phutil_tag(
47 'td',
48 array(
49 'colspan' => '4',
50 'class' => 'phabricator-timer-foot',
52 $launch_date);
54 $description = $countdown->getDescription();
55 if (strlen($description)) {
56 $description = new PHUIRemarkupView($this->getUser(), $description);
57 $description = phutil_tag(
58 'div',
59 array(
60 'class' => 'countdown-description phabricator-remarkup',
62 $description);
65 $container = celerity_generate_unique_node_id();
66 $content = phutil_tag(
67 'div',
68 array('class' => 'phabricator-timer', 'id' => $container),
69 array(
70 $description,
71 phutil_tag('table', array('class' => 'phabricator-timer-table'), array(
72 phutil_tag('tr', array(), $ths),
73 phutil_tag('tr', array(), $dashes),
74 phutil_tag('tr', array(), $foot),
75 )),
76 ));
78 Javelin::initBehavior('countdown-timer', array(
79 'timestamp' => $countdown->getEpoch(),
80 'container' => $container,
81 ));
83 return id(new PHUIObjectBoxView())
84 ->setHeader($header)
85 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
86 ->addClass('phabricator-timer-view')
87 ->appendChild($content);