3 final class PHUICalendarListView
extends AphrontTagView
{
5 private $events = array();
10 public function setMoreLink($more_link) {
11 $this->moreLink
= $more_link;
15 public function getMoreLink() {
16 return $this->moreLink
;
19 private function getView() {
23 public function setView($view) {
28 public function addEvent(AphrontCalendarEventView
$event) {
29 $this->events
[] = $event;
33 public function showBlankState($state) {
34 $this->blankState
= $state;
38 protected function getTagName() {
42 protected function getTagAttributes() {
43 require_celerity_resource('phui-calendar-css');
44 require_celerity_resource('phui-calendar-list-css');
47 'sigil' => 'calendar-event-list',
48 'class' => 'phui-calendar-event-list',
52 protected function getTagContent() {
53 if (!$this->blankState
&& empty($this->events
)) {
57 Javelin
::initBehavior('phabricator-tooltips');
59 $singletons = array();
60 foreach ($this->events
as $event) {
61 $start_epoch = $event->getEpochStart();
63 if ($event->getIsAllDay()) {
64 $timelabel = pht('All Day');
66 $timelabel = phabricator_time(
67 $event->getEpochStart(),
71 $icon_icon = $event->getIcon();
72 $icon_color = $event->getIconColor();
74 $icon = id(new PHUIIconView())
75 ->setIcon($icon_icon, $icon_color)
76 ->addClass('phui-calendar-list-item-icon');
81 'class' => 'phui-calendar-list-title',
83 $this->getEventTitle($event));
87 'class' => 'phui-calendar-list-time',
91 $event_classes = array();
92 $event_classes[] = 'phui-calendar-list-item';
93 if ($event->getIsAllDay()) {
94 $event_classes[] = 'all-day';
97 if ($event->getIsCancelled()) {
98 $event_classes[] = 'event-cancelled';
101 $tip = $event->getDateTimeSummary();
102 if ($this->getView() == 'day') {
104 } else if ($this->getView() == 'month') {
110 $content = javelin_tag(
113 'href' => $event->getURI(),
114 'sigil' => 'has-tooltip',
118 'align' => $tip_align,
127 $singletons[] = phutil_tag(
130 'class' => implode(' ', $event_classes),
135 if ($this->moreLink
) {
136 $singletons[] = phutil_tag(
139 'class' => 'phui-calendar-list-item',
144 'href' => $this->moreLink
,
145 'class' => 'phui-calendar-list-more',
148 id(new PHUIIconView())->setIcon('fa-ellipsis-h grey'),
152 'class' => 'phui-calendar-list-title',
154 pht('View More...')),
158 if (empty($singletons)) {
159 $singletons[] = phutil_tag(
162 'class' => 'phui-calendar-list-item-empty',
164 pht('Clear sailing ahead.'));
170 'class' => 'phui-calendar-list',
177 private function getEventTitle($event) {
178 $class = 'phui-calendar-item';
187 public function getIsViewerInvitedOnList() {
188 foreach ($this->events
as $event) {
189 if ($event->getViewerIsInvited()) {