Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/view/ConpherencePeopleWidgetView.php
| <?php | <?php | ||||
| final class ConpherencePeopleWidgetView extends ConpherenceWidgetView { | final class ConpherencePeopleWidgetView extends ConpherenceWidgetView { | ||||
| public function render() { | public function render() { | ||||
| $conpherence = $this->getConpherence(); | $conpherence = $this->getConpherence(); | ||||
| $widget_data = $conpherence->getWidgetData(); | $widget_data = $conpherence->getWidgetData(); | ||||
| $user = $this->getUser(); | $viewer = $this->getUser(); | ||||
| $conpherence = $this->getConpherence(); | |||||
| $participants = $conpherence->getParticipants(); | $participants = $conpherence->getParticipants(); | ||||
| $handles = $conpherence->getHandles(); | $handles = $conpherence->getHandles(); | ||||
| $head_handles = array_select_keys($handles, array($user->getPHID())); | $head_handles = array_select_keys($handles, array($viewer->getPHID())); | ||||
| $handle_list = mpull($handles, 'getName'); | $handle_list = mpull($handles, 'getName'); | ||||
| natcasesort($handle_list); | natcasesort($handle_list); | ||||
| $handles = mpull($handles, null, 'getName'); | $handles = mpull($handles, null, 'getName'); | ||||
| $handles = array_select_keys($handles, $handle_list); | $handles = array_select_keys($handles, $handle_list); | ||||
| $head_handles = mpull($head_handles, null, 'getName'); | $head_handles = mpull($head_handles, null, 'getName'); | ||||
| $handles = $head_handles + $handles; | $handles = $head_handles + $handles; | ||||
| $can_edit = PhabricatorPolicyFilter::hasCapability( | |||||
| $viewer, | |||||
| $conpherence, | |||||
| PhabricatorPolicyCapability::CAN_EDIT); | |||||
| $body = array(); | $body = array(); | ||||
| foreach ($handles as $handle) { | foreach ($handles as $handle) { | ||||
| $user_phid = $handle->getPHID(); | $user_phid = $handle->getPHID(); | ||||
| $remove_html = ''; | |||||
| if ($user_phid == $user->getPHID()) { | if (($user_phid == $viewer->getPHID()) || $can_edit) { | ||||
| $icon = id(new PHUIIconView()) | $icon = id(new PHUIIconView()) | ||||
| ->setIcon('fa-times lightbluetext'); | ->setIcon('fa-times lightbluetext'); | ||||
| $remove_html = javelin_tag( | $remove_html = javelin_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'class' => 'remove', | 'class' => 'remove', | ||||
| 'sigil' => 'remove-person', | 'sigil' => 'remove-person', | ||||
| 'meta' => array( | 'meta' => array( | ||||
| 'remove_person' => $user_phid, | 'remove_person' => $user_phid, | ||||
| 'action' => 'remove_person', | 'action' => 'remove_person', | ||||
| ), | ), | ||||
| ), | ), | ||||
| $icon); | $icon); | ||||
| } else { | |||||
| $remove_html = null; | |||||
| } | } | ||||
| $body[] = phutil_tag( | $body[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'person-entry grouped', | 'class' => 'person-entry grouped', | ||||
| ), | ), | ||||
| array( | array( | ||||
| phutil_tag( | phutil_tag( | ||||
| 'a', | 'a', | ||||
| Show All 19 Lines | |||||