Differential D10585 Diff 25583 src/applications/conpherence/controller/ConpherenceWidgetController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/controller/ConpherenceWidgetController.php
| Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | $widgets[] = javelin_tag( | ||||
| ->setConpherence($conpherence) | ->setConpherence($conpherence) | ||||
| ->setUpdateURI($this->getWidgetURI())); | ->setUpdateURI($this->getWidgetURI())); | ||||
| $widgets[] = javelin_tag( | $widgets[] = javelin_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'widgets-body', | 'class' => 'widgets-body', | ||||
| 'id' => 'widgets-files', | 'id' => 'widgets-files', | ||||
| 'sigil' => 'widgets-files', | 'sigil' => 'widgets-files', | ||||
| 'style' => 'display: none;' | 'style' => 'display: none;', | ||||
| ), | ), | ||||
| id(new ConpherenceFileWidgetView()) | id(new ConpherenceFileWidgetView()) | ||||
| ->setUser($user) | ->setUser($user) | ||||
| ->setConpherence($conpherence) | ->setConpherence($conpherence) | ||||
| ->setUpdateURI($this->getWidgetURI())); | ->setUpdateURI($this->getWidgetURI())); | ||||
| $widgets[] = phutil_tag( | $widgets[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'widgets-body', | 'class' => 'widgets-body', | ||||
| 'id' => 'widgets-calendar', | 'id' => 'widgets-calendar', | ||||
| 'style' => 'display: none;' | 'style' => 'display: none;', | ||||
| ), | ), | ||||
| $this->renderCalendarWidgetPaneContent()); | $this->renderCalendarWidgetPaneContent()); | ||||
| $widgets[] = phutil_tag( | $widgets[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'widgets-body', | 'class' => 'widgets-body', | ||||
| 'id' => 'widgets-settings', | 'id' => 'widgets-settings', | ||||
| 'style' => 'display: none' | 'style' => 'display: none', | ||||
| ), | ), | ||||
| $this->renderSettingsWidgetPaneContent()); | $this->renderSettingsWidgetPaneContent()); | ||||
| // without this implosion we get "," between each element in our widgets | // without this implosion we get "," between each element in our widgets | ||||
| // array | // array | ||||
| return array('widgets' => phutil_implode_html('', $widgets)); | return array('widgets' => phutil_implode_html('', $widgets)); | ||||
| } | } | ||||
| Show All 30 Lines | private function renderSettingsWidgetPaneContent() { | ||||
| $layout = array( | $layout = array( | ||||
| $options, | $options, | ||||
| phutil_tag( | phutil_tag( | ||||
| 'input', | 'input', | ||||
| array( | array( | ||||
| 'type' => 'hidden', | 'type' => 'hidden', | ||||
| 'name' => 'action', | 'name' => 'action', | ||||
| 'value' => 'notifications' | 'value' => 'notifications', | ||||
| )), | )), | ||||
| phutil_tag( | phutil_tag( | ||||
| 'button', | 'button', | ||||
| array( | array( | ||||
| 'type' => 'submit', | 'type' => 'submit', | ||||
| 'class' => 'notifications-update', | 'class' => 'notifications-update', | ||||
| ), | ), | ||||
| pht('Save')) | pht('Save')), | ||||
| ); | ); | ||||
| return phabricator_form( | return phabricator_form( | ||||
| $user, | $user, | ||||
| array( | array( | ||||
| 'method' => 'POST', | 'method' => 'POST', | ||||
| 'action' => $this->getWidgetURI(), | 'action' => $this->getWidgetURI(), | ||||
| 'sigil' => 'notifications-update', | 'sigil' => 'notifications-update', | ||||
| Show All 31 Lines | foreach ($epoch_stamps as $day) { | ||||
| $should_draw_list = $list_days < 7; | $should_draw_list = $list_days < 7; | ||||
| $list_days++; | $list_days++; | ||||
| if ($should_draw_list) { | if ($should_draw_list) { | ||||
| $content[] = phutil_tag( | $content[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'day-header '.$active_class | 'class' => 'day-header '.$active_class, | ||||
| ), | ), | ||||
| array( | array( | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'day-name' | 'class' => 'day-name', | ||||
| ), | ), | ||||
| $day->format('l')), | $day->format('l')), | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'day-date' | 'class' => 'day-date', | ||||
| ), | ), | ||||
| $day->format('m/d/y')))); | $day->format('m/d/y')), | ||||
| )); | |||||
| } | } | ||||
| $week_day_number = $day->format('w'); | $week_day_number = $day->format('w'); | ||||
| $epoch_start = $day->format('U'); | $epoch_start = $day->format('U'); | ||||
| $next_day = clone $day; | $next_day = clone $day; | ||||
| $next_day->modify('+1 day'); | $next_day->modify('+1 day'); | ||||
| $epoch_end = $next_day->format('U'); | $epoch_end = $next_day->format('U'); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | foreach ($epoch_stamps as $day) { | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'icon', | 'class' => 'icon', | ||||
| ), | ), | ||||
| ''), | ''), | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'description' | 'class' => 'description', | ||||
| ), | ), | ||||
| array( | array( | ||||
| $status->getTerseSummary($user), | $status->getTerseSummary($user), | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'participant' | 'class' => 'participant', | ||||
| ), | ), | ||||
| $secondary_info))))); | $secondary_info), | ||||
| )), | |||||
| )); | |||||
| } | } | ||||
| $first_status_of_the_day = false; | $first_status_of_the_day = false; | ||||
| } | } | ||||
| } | } | ||||
| // we didn't get a status on this day so add a spacer | // we didn't get a status on this day so add a spacer | ||||
| if ($first_status_of_the_day && $should_draw_list) { | if ($first_status_of_the_day && $should_draw_list) { | ||||
| $content[] = phutil_tag( | $content[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array('class' => 'no-events pm'), | array('class' => 'no-events pm'), | ||||
| pht('No Events Scheduled.')); | pht('No Events Scheduled.')); | ||||
| } | } | ||||
| if ($is_today || ($calendar_columns && $calendar_columns < 3)) { | if ($is_today || ($calendar_columns && $calendar_columns < 3)) { | ||||
| $active_class = ''; | $active_class = ''; | ||||
| if ($is_today) { | if ($is_today) { | ||||
| $active_class = '-active'; | $active_class = '-active'; | ||||
| } | } | ||||
| $inner_layout = array(); | $inner_layout = array(); | ||||
| foreach ($participants as $phid => $participant) { | foreach ($participants as $phid => $participant) { | ||||
| $status = idx($statuses_of_the_day, $phid, false); | $status = idx($statuses_of_the_day, $phid, false); | ||||
| if ($status) { | if ($status) { | ||||
| $inner_layout[] = phutil_tag( | $inner_layout[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => $status->getTextStatus() | 'class' => $status->getTextStatus(), | ||||
| ), | ), | ||||
| ''); | ''); | ||||
| } else { | } else { | ||||
| $inner_layout[] = phutil_tag( | $inner_layout[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'present' | 'class' => 'present', | ||||
| ), | ), | ||||
| ''); | ''); | ||||
| } | } | ||||
| } | } | ||||
| $layout->addColumn( | $layout->addColumn( | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'day-column'.$active_class | 'class' => 'day-column'.$active_class, | ||||
| ), | ), | ||||
| array( | array( | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'day-name' | 'class' => 'day-name', | ||||
| ), | ), | ||||
| $day->format('D')), | $day->format('D')), | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'day-number', | 'class' => 'day-number', | ||||
| ), | ), | ||||
| $day->format('j')), | $day->format('j')), | ||||
| $inner_layout | $inner_layout, | ||||
| ))); | ))); | ||||
| $calendar_columns++; | $calendar_columns++; | ||||
| } | } | ||||
| } | } | ||||
| return | return array( | ||||
| array( | |||||
| $layout, | $layout, | ||||
| $content | $content, | ||||
| ); | ); | ||||
| } | } | ||||
| private function getWidgetURI() { | private function getWidgetURI() { | ||||
| $conpherence = $this->getConpherence(); | $conpherence = $this->getConpherence(); | ||||
| return $this->getApplicationURI('update/'.$conpherence->getID().'/'); | return $this->getApplicationURI('update/'.$conpherence->getID().'/'); | ||||
| } | } | ||||
| } | } | ||||