Path: blob/master/src/applications/conpherence/view/ConpherenceParticipantView.php
12256 views
<?php12final class ConpherenceParticipantView extends AphrontView {34private $conpherence;5private $updateURI;67public function setConpherence(ConpherenceThread $conpherence) {8$this->conpherence = $conpherence;9return $this;10}1112public function setUpdateURI($uri) {13$this->updateURI = $uri;14return $this;15}1617public function render() {18$conpherence = $this->conpherence;19$viewer = $this->getViewer();2021$participants = $conpherence->getParticipants();22$count = new PhutilNumber(count($participants));23$handles = $conpherence->getHandles();24$handles = array_intersect_key($handles, $participants);25$head_handles = array_select_keys($handles, array($viewer->getPHID()));26$handle_list = mpull($handles, 'getName');27natcasesort($handle_list);28$handles = mpull($handles, null, 'getName');29$handles = array_select_keys($handles, $handle_list);3031$head_handles = mpull($head_handles, null, 'getName');32$handles = $head_handles + $handles;3334$can_edit = PhabricatorPolicyFilter::hasCapability(35$viewer,36$conpherence,37PhabricatorPolicyCapability::CAN_EDIT);3839$body = array();40foreach ($handles as $handle) {41$user_phid = $handle->getPHID();4243if (($user_phid == $viewer->getPHID()) || $can_edit) {44$icon = id(new PHUIIconView())45->setIcon('fa-times')46->addClass('lightbluetext');47$remove_html = javelin_tag(48'a',49array(50'class' => 'remove',51'sigil' => 'remove-person',52'meta' => array(53'remove_person' => $user_phid,54'action' => 'remove_person',55),56),57$icon);58} else {59$remove_html = null;60}6162$body[] = phutil_tag(63'div',64array(65'class' => 'person-entry grouped',66),67array(68phutil_tag(69'a',70array(71'class' => 'pic',72'href' => $handle->getURI(),73),74phutil_tag(75'img',76array(77'src' => $handle->getImageURI(),78),79'')),80$handle->renderLink(),81$remove_html,82));83}8485$new_icon = id(new PHUIIconView())86->setIcon('fa-plus-square')87->setHref($this->updateURI)88->setMetadata(array('widget' => null))89->addSigil('conpherence-widget-adder');9091$header = id(new PHUIHeaderView())92->setHeader(pht('Participants (%d)', $count))93->addClass('widgets-header')94->addActionItem($new_icon);9596$content = javelin_tag(97'div',98array(99'class' => 'widgets-body',100'id' => 'widgets-people',101'sigil' => 'widgets-people',102),103array(104$header,105$body,106));107108return $content;109}110111}112113114