Page MenuHomePhabricator

D13318.id32232.diff
No OneTemporary

D13318.id32232.diff

diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
@@ -313,17 +313,31 @@
$list = new PHUIObjectItemListView();
foreach ($events as $event) {
$from = phabricator_datetime($event->getDateFrom(), $viewer);
- $to = phabricator_datetime($event->getDateTo(), $viewer);
+ $duration = '';
$creator_handle = $handles[$event->getUserPHID()];
+ $attendees = array();
+ foreach ($event->getInvitees() as $invitee) {
+ $attendees[] = $invitee->getInviteePHID();
+ }
+
+ $attendees = pht(
+ 'Attending: %s',
+ $viewer->renderHandleList($attendees)
+ ->setAsInline(1)
+ ->render());
+
+ if (strlen($event->getDuration()) > 0) {
+ $duration = pht(
+ 'Duration: %s',
+ $event->getDuration());
+ }
+
$item = id(new PHUIObjectItemView())
- ->setHeader($event->getName())
- ->setHref($event->getURI())
- ->addByline(pht('Creator: %s', $creator_handle->renderLink()))
- ->addAttribute(pht('From %s to %s', $from, $to))
- ->addAttribute(id(new PhutilUTF8StringTruncator())
- ->setMaximumGlyphs(64)
- ->truncateString($event->getDescription()));
+ ->setHeader($viewer->renderHandle($event->getPHID())->render())
+ ->addAttribute($attendees)
+ ->addByLine($from)
+ ->addByLine($duration);
$list->addItem($item);
}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -373,6 +373,74 @@
return false;
}
+ public function getDuration() {
+ $seconds = $this->dateTo - $this->dateFrom;
+ $minutes = $seconds / 60;
+ $hours = $minutes / 60;
+ $days = $hours / 24;
+
+ $days = round($days, 0);
+ $hours = round($hours - ($days * 24), 0);
+ $minutes = round($minutes - ($days * 24 * 60) - ($hours * 60), 0);
+
+ $duration = '';
+
+ if ($days >= 1) {
+ if ($days > 1) {
+ $units = pht('days');
+ } else {
+ $units = pht('day');
+ }
+
+ $duration = pht(
+ '%s %s',
+ $days,
+ $units);
+ }
+ if ($hours >= 1) {
+ if ($hours > 1) {
+ $units = pht('hours');
+ } else {
+ $units = pht('hour');
+ }
+
+ if (strlen($duration) > 0) {
+ $duration = pht(
+ '%s, %s %s',
+ $duration,
+ $hours,
+ $units);
+ } else {
+ $duration = pht(
+ '%s %s',
+ $hours,
+ $units);
+ }
+ }
+ if ($minutes >= 1) {
+ if ($minutes > 1) {
+ $units = pht('minutes');
+ } else {
+ $units = pht('minute');
+ }
+
+ if (strlen($duration) > 0) {
+ $duration = pht(
+ '%s, %s %s',
+ $duration,
+ $minutes,
+ $units);
+ } else {
+ $duration = pht(
+ '%s %s',
+ $minutes,
+ $units);
+ }
+ }
+
+ return $duration;
+ }
+
/* -( Markup Interface )--------------------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Oct 30 2025, 5:39 PM (7 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
12380230
Default Alt Text
D13318.id32232.diff (3 KB)

Event Timeline