public function render() { require_celerity_resource('conpherence-menu-css'); $menu = id(new PHUIListView())->addClass('conpherence-menu')->setID('conpherence-menu'); $policy_objects = ConpherenceThread::loadPolicyObjects($this->getUser(), $this->threads); $grouped = mgroup($this->threads, 'getIsRoom'); $rooms = idx($grouped, 1, array()); $this->addRoomsToMenu($menu, $rooms, $policy_objects); $messages = idx($grouped, 0, array()); $this->addMessagesToMenu($menu, $messages); return $menu; }
protected function renderResultList(array $conpherences, PhabricatorSavedQuery $query, array $handles) { assert_instances_of($conpherences, 'ConpherenceThread'); $viewer = $this->requireViewer(); $policy_objects = ConpherenceThread::loadPolicyObjects($viewer, $conpherences); $engines = array(); $fulltext = $query->getParameter('fulltext'); if (strlen($fulltext) && $conpherences) { $context = $this->loadContextMessages($conpherences, $fulltext); $author_phids = array(); foreach ($context as $phid => $messages) { $conpherence = $conpherences[$phid]; $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->setContextObject($conpherence); foreach ($messages as $group) { foreach ($group as $message) { $xaction = $message['xaction']; if ($xaction) { $author_phids[] = $xaction->getAuthorPHID(); $engine->addObject($xaction->getComment(), PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); } } } $engine->process(); $engines[$phid] = $engine; } $handles = $viewer->loadHandles($author_phids); $handles = iterator_to_array($handles); } else { $context = array(); } $list = new PHUIObjectItemListView(); $list->setUser($viewer); foreach ($conpherences as $conpherence_phid => $conpherence) { $created = phabricator_date($conpherence->getDateCreated(), $viewer); $title = $conpherence->getDisplayTitle($viewer); $monogram = $conpherence->getMonogram(); if ($conpherence->getIsRoom()) { $icon_name = $conpherence->getPolicyIconName($policy_objects); } else { $icon_name = 'fa-envelope-o'; } $icon = id(new PHUIIconView())->setIconFont($icon_name); $item = id(new PHUIObjectItemView())->setObjectName($conpherence->getMonogram())->setHeader($title)->setHref('/' . $conpherence->getMonogram())->setObject($conpherence)->addIcon('none', $created)->addIcon('none', pht('Messages: %d', $conpherence->getMessageCount()))->addAttribute(array($icon, ' ', pht('Last updated %s', phabricator_datetime($conpherence->getDateModified(), $viewer)))); $messages = idx($context, $conpherence_phid); if ($messages) { foreach ($messages as $group) { $rows = array(); foreach ($group as $message) { $xaction = $message['xaction']; if (!$xaction) { continue; } $view = id(new ConpherenceTransactionView())->setUser($viewer)->setHandles($handles)->setMarkupEngine($engines[$conpherence_phid])->setConpherenceThread($conpherence)->setConpherenceTransaction($xaction)->setFullDisplay(false)->addClass('conpherence-fulltext-result'); if ($message['match']) { $view->addClass('conpherence-fulltext-match'); } $rows[] = $view; } $box = id(new PHUIBoxView())->appendChild($rows)->addClass('conpherence-fulltext-results'); $item->appendChild($box); } } $list->addItem($item); } return $list; }