2014-02-06 19:10:27 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorCalendarEventViewController
|
2014-02-18 01:08:50 +01:00
|
|
|
extends PhabricatorCalendarController {
|
2014-02-06 19:10:27 +01:00
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
2014-05-14 19:00:46 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-02-06 19:10:27 +01:00
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->id = $data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $request->getUser();
|
2015-05-29 02:27:25 +02:00
|
|
|
$sequence = $request->getURIData('sequence');
|
|
|
|
|
2015-06-30 20:47:53 +02:00
|
|
|
$timeline = null;
|
|
|
|
|
2014-02-06 19:10:27 +01:00
|
|
|
$event = id(new PhabricatorCalendarEventQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($this->id))
|
|
|
|
->executeOne();
|
|
|
|
if (!$event) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
2015-06-06 22:03:21 +02:00
|
|
|
if ($sequence) {
|
|
|
|
$result = $this->getEventAtIndexForGhostPHID(
|
|
|
|
$viewer,
|
|
|
|
$event->getPHID(),
|
|
|
|
$sequence);
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
$parent_event = $event;
|
|
|
|
$event = $result;
|
|
|
|
$event->attachParentEvent($parent_event);
|
|
|
|
return id(new AphrontRedirectResponse())
|
|
|
|
->setURI('/E'.$result->getID());
|
|
|
|
} else if ($sequence && $event->getIsRecurring()) {
|
|
|
|
$parent_event = $event;
|
|
|
|
$event = $event->generateNthGhost($sequence, $viewer);
|
|
|
|
$event->attachParentEvent($parent_event);
|
|
|
|
} else if ($sequence) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
2015-05-29 02:27:25 +02:00
|
|
|
|
2015-06-08 20:05:54 +02:00
|
|
|
$title = $event->getMonogram().' ('.$sequence.')';
|
|
|
|
$page_title = $title.' '.$event->getName();
|
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
$crumbs->addTextCrumb($title, '/'.$event->getMonogram().'/'.$sequence);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$title = 'E'.$event->getID();
|
|
|
|
$page_title = $title.' '.$event->getName();
|
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
$crumbs->addTextCrumb($title, '/E'.$event->getID());
|
|
|
|
}
|
2014-02-06 19:10:27 +01:00
|
|
|
|
2015-06-30 20:47:53 +02:00
|
|
|
if (!$event->getIsGhostEvent()) {
|
|
|
|
$timeline = $this->buildTransactionTimeline(
|
|
|
|
$event,
|
|
|
|
new PhabricatorCalendarEventTransactionQuery());
|
|
|
|
}
|
2015-04-28 15:26:48 +02:00
|
|
|
|
2014-02-06 19:10:27 +01:00
|
|
|
$header = $this->buildHeaderView($event);
|
|
|
|
$actions = $this->buildActionView($event);
|
|
|
|
$properties = $this->buildPropertyView($event);
|
|
|
|
|
|
|
|
$properties->setActionList($actions);
|
|
|
|
$box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
|
|
|
->addPropertyList($properties);
|
|
|
|
|
2015-05-01 02:38:04 +02:00
|
|
|
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
|
|
|
$add_comment_header = $is_serious
|
|
|
|
? pht('Add Comment')
|
|
|
|
: pht('Add To Plate');
|
|
|
|
$draft = PhabricatorDraft::newFromUserAndKey($viewer, $event->getPHID());
|
2015-06-30 20:47:53 +02:00
|
|
|
if ($sequence) {
|
|
|
|
$comment_uri = $this->getApplicationURI(
|
|
|
|
'/event/comment/'.$event->getID().'/'.$sequence.'/');
|
|
|
|
} else {
|
|
|
|
$comment_uri = $this->getApplicationURI(
|
|
|
|
'/event/comment/'.$event->getID().'/');
|
|
|
|
}
|
2015-05-01 02:38:04 +02:00
|
|
|
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setObjectPHID($event->getPHID())
|
|
|
|
->setDraft($draft)
|
|
|
|
->setHeaderText($add_comment_header)
|
2015-06-30 20:47:53 +02:00
|
|
|
->setAction($comment_uri)
|
2015-05-01 02:38:04 +02:00
|
|
|
->setSubmitButtonName(pht('Add Comment'));
|
|
|
|
|
2014-02-06 19:10:27 +01:00
|
|
|
return $this->buildApplicationPage(
|
|
|
|
array(
|
|
|
|
$crumbs,
|
|
|
|
$box,
|
2015-04-28 15:26:48 +02:00
|
|
|
$timeline,
|
2015-05-01 02:38:04 +02:00
|
|
|
$add_comment_form,
|
2014-02-06 19:10:27 +01:00
|
|
|
),
|
|
|
|
array(
|
2015-04-28 17:34:26 +02:00
|
|
|
'title' => $page_title,
|
2014-02-06 19:10:27 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildHeaderView(PhabricatorCalendarEvent $event) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
2015-04-30 04:48:46 +02:00
|
|
|
$id = $event->getID();
|
|
|
|
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
$is_cancelled = $event->getIsCancelled();
|
|
|
|
$icon = $is_cancelled ? ('fa-times') : ('fa-calendar');
|
|
|
|
$color = $is_cancelled ? ('grey') : ('green');
|
2015-05-06 20:11:38 +02:00
|
|
|
$status = $is_cancelled ? pht('Cancelled') : pht('Active');
|
2014-02-06 19:10:27 +01:00
|
|
|
|
2015-04-30 04:48:46 +02:00
|
|
|
$invite_status = $event->getUserInviteStatus($viewer->getPHID());
|
|
|
|
$status_invited = PhabricatorCalendarEventInvitee::STATUS_INVITED;
|
|
|
|
$is_invite_pending = ($invite_status == $status_invited);
|
|
|
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
2014-02-06 19:10:27 +01:00
|
|
|
->setUser($viewer)
|
2015-04-28 17:34:26 +02:00
|
|
|
->setHeader($event->getName())
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
->setStatus($icon, $color, $status)
|
2014-02-06 19:10:27 +01:00
|
|
|
->setPolicyObject($event);
|
2015-04-30 04:48:46 +02:00
|
|
|
|
|
|
|
if ($is_invite_pending) {
|
|
|
|
$decline_button = id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setIcon(id(new PHUIIconView())
|
|
|
|
->setIconFont('fa-times grey'))
|
|
|
|
->setHref($this->getApplicationURI("/event/decline/{$id}/"))
|
|
|
|
->setWorkflow(true)
|
|
|
|
->setText(pht('Decline'));
|
|
|
|
|
|
|
|
$accept_button = id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setIcon(id(new PHUIIconView())
|
|
|
|
->setIconFont('fa-check green'))
|
|
|
|
->setHref($this->getApplicationURI("/event/accept/{$id}/"))
|
|
|
|
->setWorkflow(true)
|
|
|
|
->setText(pht('Accept'));
|
|
|
|
|
|
|
|
$header->addActionLink($decline_button)
|
|
|
|
->addActionLink($accept_button);
|
|
|
|
}
|
|
|
|
return $header;
|
2014-02-06 19:10:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function buildActionView(PhabricatorCalendarEvent $event) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
$id = $event->getID();
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
$is_cancelled = $event->getIsCancelled();
|
2015-04-30 03:18:27 +02:00
|
|
|
$is_attending = $event->getIsUserAttending($viewer->getPHID());
|
2014-02-06 19:10:27 +01:00
|
|
|
|
|
|
|
$actions = id(new PhabricatorActionListView())
|
|
|
|
->setObjectURI($this->getApplicationURI('event/'.$id.'/'))
|
2015-04-28 19:40:35 +02:00
|
|
|
->setUser($viewer)
|
|
|
|
->setObject($event);
|
2014-02-06 19:10:27 +01:00
|
|
|
|
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
|
|
$viewer,
|
|
|
|
$event,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
|
2015-06-02 16:29:48 +02:00
|
|
|
$edit_label = false;
|
|
|
|
$edit_uri = false;
|
2015-06-01 00:04:48 +02:00
|
|
|
|
2015-06-02 16:29:48 +02:00
|
|
|
if ($event->getIsGhostEvent()) {
|
|
|
|
$index = $event->getSequenceIndex();
|
|
|
|
$edit_label = pht('Edit This Instance');
|
|
|
|
$edit_uri = "event/edit/{$id}/{$index}/";
|
2015-06-09 06:40:32 +02:00
|
|
|
} else if ($event->getIsRecurrenceException()) {
|
2015-06-02 16:29:48 +02:00
|
|
|
$edit_label = pht('Edit This Instance');
|
|
|
|
$edit_uri = "event/edit/{$id}/";
|
2015-06-10 02:22:08 +02:00
|
|
|
} else {
|
2015-06-02 16:29:48 +02:00
|
|
|
$edit_label = pht('Edit');
|
|
|
|
$edit_uri = "event/edit/{$id}/";
|
2015-06-01 00:04:48 +02:00
|
|
|
}
|
|
|
|
|
2015-06-02 16:29:48 +02:00
|
|
|
if ($edit_label && $edit_uri) {
|
2015-05-29 02:27:25 +02:00
|
|
|
$actions->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
2015-06-02 16:29:48 +02:00
|
|
|
->setName($edit_label)
|
2015-05-29 02:27:25 +02:00
|
|
|
->setIcon('fa-pencil')
|
2015-06-02 16:29:48 +02:00
|
|
|
->setHref($this->getApplicationURI($edit_uri))
|
2015-05-29 02:27:25 +02:00
|
|
|
->setDisabled(!$can_edit)
|
|
|
|
->setWorkflow(!$can_edit));
|
|
|
|
}
|
2014-02-06 19:10:27 +01:00
|
|
|
|
2015-04-30 03:18:27 +02:00
|
|
|
if ($is_attending) {
|
|
|
|
$actions->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('Decline Event'))
|
|
|
|
->setIcon('fa-user-times')
|
|
|
|
->setHref($this->getApplicationURI("event/join/{$id}/"))
|
|
|
|
->setWorkflow(true));
|
|
|
|
} else {
|
|
|
|
$actions->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('Join Event'))
|
|
|
|
->setIcon('fa-user-plus')
|
|
|
|
->setHref($this->getApplicationURI("event/join/{$id}/"))
|
|
|
|
->setWorkflow(true));
|
|
|
|
}
|
|
|
|
|
2015-06-06 22:03:21 +02:00
|
|
|
$cancel_uri = $this->getApplicationURI("event/cancel/{$id}/");
|
|
|
|
|
|
|
|
if ($event->getIsGhostEvent()) {
|
|
|
|
$index = $event->getSequenceIndex();
|
|
|
|
$can_reinstate = $event->getIsParentCancelled();
|
|
|
|
|
|
|
|
$cancel_label = pht('Cancel This Instance');
|
|
|
|
$reinstate_label = pht('Reinstate This Instance');
|
|
|
|
$cancel_disabled = (!$can_edit || $can_reinstate);
|
|
|
|
$cancel_uri = $this->getApplicationURI("event/cancel/{$id}/{$index}/");
|
2015-06-09 06:40:32 +02:00
|
|
|
} else if ($event->getIsRecurrenceException()) {
|
2015-06-06 22:03:21 +02:00
|
|
|
$can_reinstate = $event->getIsParentCancelled();
|
|
|
|
$cancel_label = pht('Cancel This Instance');
|
|
|
|
$reinstate_label = pht('Reinstate This Instance');
|
|
|
|
$cancel_disabled = (!$can_edit || $can_reinstate);
|
2015-06-09 06:40:32 +02:00
|
|
|
} else if ($event->getIsRecurrenceParent()) {
|
2015-06-06 22:03:21 +02:00
|
|
|
$cancel_label = pht('Cancel Recurrence');
|
|
|
|
$reinstate_label = pht('Reinstate Recurrence');
|
|
|
|
$cancel_disabled = !$can_edit;
|
|
|
|
} else {
|
|
|
|
$cancel_label = pht('Cancel Event');
|
|
|
|
$reinstate_label = pht('Reinstate Event');
|
|
|
|
$cancel_disabled = !$can_edit;
|
|
|
|
}
|
|
|
|
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
if ($is_cancelled) {
|
|
|
|
$actions->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
2015-06-06 22:03:21 +02:00
|
|
|
->setName($reinstate_label)
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
->setIcon('fa-plus')
|
2015-06-06 22:03:21 +02:00
|
|
|
->setHref($cancel_uri)
|
|
|
|
->setDisabled($cancel_disabled)
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
->setWorkflow(true));
|
|
|
|
} else {
|
|
|
|
$actions->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
2015-06-06 22:03:21 +02:00
|
|
|
->setName($cancel_label)
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
->setIcon('fa-times')
|
2015-06-06 22:03:21 +02:00
|
|
|
->setHref($cancel_uri)
|
|
|
|
->setDisabled($cancel_disabled)
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
->setWorkflow(true));
|
|
|
|
}
|
2014-02-06 19:10:27 +01:00
|
|
|
|
|
|
|
return $actions;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function buildPropertyView(PhabricatorCalendarEvent $event) {
|
|
|
|
$viewer = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$properties = id(new PHUIPropertyListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setObject($event);
|
|
|
|
|
2015-05-08 17:08:26 +02:00
|
|
|
if ($event->getIsAllDay()) {
|
|
|
|
$date_start = phabricator_date($event->getDateFrom(), $viewer);
|
|
|
|
$date_end = phabricator_date($event->getDateTo(), $viewer);
|
|
|
|
|
|
|
|
if ($date_start == $date_end) {
|
|
|
|
$properties->addProperty(
|
|
|
|
pht('Time'),
|
|
|
|
phabricator_date($event->getDateFrom(), $viewer));
|
|
|
|
} else {
|
|
|
|
$properties->addProperty(
|
|
|
|
pht('Starts'),
|
|
|
|
phabricator_date($event->getDateFrom(), $viewer));
|
|
|
|
$properties->addProperty(
|
|
|
|
pht('Ends'),
|
|
|
|
phabricator_date($event->getDateTo(), $viewer));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$properties->addProperty(
|
|
|
|
pht('Starts'),
|
|
|
|
phabricator_datetime($event->getDateFrom(), $viewer));
|
2014-02-06 19:10:27 +01:00
|
|
|
|
2015-05-08 17:08:26 +02:00
|
|
|
$properties->addProperty(
|
|
|
|
pht('Ends'),
|
|
|
|
phabricator_datetime($event->getDateTo(), $viewer));
|
|
|
|
}
|
2014-02-06 19:10:27 +01:00
|
|
|
|
2015-05-29 02:27:25 +02:00
|
|
|
if ($event->getIsRecurring()) {
|
|
|
|
$properties->addProperty(
|
|
|
|
pht('Recurs'),
|
2015-05-29 22:58:53 +02:00
|
|
|
ucwords(idx($event->getRecurrenceFrequency(), 'rule')));
|
2015-06-02 03:56:11 +02:00
|
|
|
|
|
|
|
if ($event->getRecurrenceEndDate()) {
|
|
|
|
$properties->addProperty(
|
|
|
|
pht('Recurrence Ends'),
|
|
|
|
phabricator_datetime($event->getRecurrenceEndDate(), $viewer));
|
|
|
|
}
|
|
|
|
|
2015-06-01 00:04:48 +02:00
|
|
|
if ($event->getInstanceOfEventPHID()) {
|
2015-05-29 22:58:53 +02:00
|
|
|
$properties->addProperty(
|
|
|
|
pht('Recurrence of Event'),
|
2015-06-16 22:41:55 +02:00
|
|
|
pht('%s of %s',
|
|
|
|
$event->getSequenceIndex(),
|
|
|
|
$viewer->renderHandle($event->getInstanceOfEventPHID())->render()));
|
2015-05-29 22:58:53 +02:00
|
|
|
}
|
2015-05-29 02:27:25 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 19:26:15 +02:00
|
|
|
$properties->addProperty(
|
|
|
|
pht('Host'),
|
|
|
|
$viewer->renderHandle($event->getUserPHID()));
|
|
|
|
|
2015-04-29 22:51:09 +02:00
|
|
|
$invitees = $event->getInvitees();
|
2015-05-05 19:26:15 +02:00
|
|
|
foreach ($invitees as $key => $invitee) {
|
2015-04-30 00:31:02 +02:00
|
|
|
if ($invitee->isUninvited()) {
|
2015-05-05 19:26:15 +02:00
|
|
|
unset($invitees[$key]);
|
2015-04-30 00:31:02 +02:00
|
|
|
}
|
2015-04-29 22:51:09 +02:00
|
|
|
}
|
|
|
|
|
2015-05-05 19:26:15 +02:00
|
|
|
if ($invitees) {
|
|
|
|
$invitee_list = new PHUIStatusListView();
|
2015-05-05 21:29:04 +02:00
|
|
|
|
|
|
|
$icon_invited = PHUIStatusItemView::ICON_OPEN;
|
|
|
|
$icon_attending = PHUIStatusItemView::ICON_ACCEPT;
|
|
|
|
$icon_declined = PHUIStatusItemView::ICON_REJECT;
|
|
|
|
|
|
|
|
$status_invited = PhabricatorCalendarEventInvitee::STATUS_INVITED;
|
|
|
|
$status_attending = PhabricatorCalendarEventInvitee::STATUS_ATTENDING;
|
|
|
|
$status_declined = PhabricatorCalendarEventInvitee::STATUS_DECLINED;
|
|
|
|
|
|
|
|
$icon_map = array(
|
|
|
|
$status_invited => $icon_invited,
|
|
|
|
$status_attending => $icon_attending,
|
|
|
|
$status_declined => $icon_declined,
|
|
|
|
);
|
|
|
|
|
|
|
|
$icon_color_map = array(
|
|
|
|
$status_invited => null,
|
|
|
|
$status_attending => 'green',
|
|
|
|
$status_declined => 'red',
|
|
|
|
);
|
|
|
|
|
2015-05-05 19:26:15 +02:00
|
|
|
foreach ($invitees as $invitee) {
|
|
|
|
$item = new PHUIStatusItemView();
|
|
|
|
$invitee_phid = $invitee->getInviteePHID();
|
2015-05-05 21:29:04 +02:00
|
|
|
$status = $invitee->getStatus();
|
2015-05-05 19:26:15 +02:00
|
|
|
$target = $viewer->renderHandle($invitee_phid);
|
2015-05-05 21:29:04 +02:00
|
|
|
$icon = $icon_map[$status];
|
|
|
|
$icon_color = $icon_color_map[$status];
|
|
|
|
|
|
|
|
$item->setIcon($icon, $icon_color)
|
2015-05-05 19:26:15 +02:00
|
|
|
->setTarget($target);
|
|
|
|
$invitee_list->addItem($item);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$invitee_list = phutil_tag(
|
|
|
|
'em',
|
|
|
|
array(),
|
|
|
|
pht('None'));
|
|
|
|
}
|
2015-05-04 00:29:42 +02:00
|
|
|
|
2015-04-29 22:51:09 +02:00
|
|
|
$properties->addProperty(
|
|
|
|
pht('Invitees'),
|
|
|
|
$invitee_list);
|
|
|
|
|
2015-04-28 19:40:35 +02:00
|
|
|
$properties->invokeWillRenderEvent();
|
|
|
|
|
2015-05-19 22:09:28 +02:00
|
|
|
$icon_display = PhabricatorCalendarIcon::renderIconForChooser(
|
|
|
|
$event->getIcon());
|
|
|
|
$properties->addProperty(
|
|
|
|
pht('Icon'),
|
|
|
|
$icon_display);
|
|
|
|
|
2015-06-19 17:32:50 +02:00
|
|
|
if (strlen($event->getDescription())) {
|
|
|
|
|
|
|
|
$description = PhabricatorMarkupEngine::renderOneObject(
|
|
|
|
id(new PhabricatorMarkupOneOff())->setContent($event->getDescription()),
|
|
|
|
'default',
|
|
|
|
$viewer);
|
|
|
|
|
|
|
|
$properties->addSectionHeader(
|
|
|
|
pht('Description'),
|
|
|
|
PHUIPropertyListView::ICON_SUMMARY);
|
|
|
|
|
|
|
|
$properties->addTextContent($description);
|
|
|
|
}
|
2014-02-18 01:08:25 +01:00
|
|
|
|
2014-02-06 19:10:27 +01:00
|
|
|
return $properties;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|