public function render() { $view = new AphrontNullView(); $view->appendChild($this->buttons); require_celerity_resource('aphront-contextbar-view-css'); return phutil_tag_div('aphront-contextbar-view', array(phutil_tag_div('aphront-contextbar-core', array(phutil_tag_div('aphront-contextbar-buttons', $view->render()), phutil_tag_div('aphront-contextbar-content', $this->renderChildren()))), phutil_tag('div', array('style' => 'clear: both;')))); }
public function render() { $view = new AphrontNullView(); $view->appendChild($this->items); require_celerity_resource('aphront-side-nav-view-css'); return '<table class="aphront-side-nav-view">' . '<tr>' . '<th class="aphront-side-nav-navigation">' . $view->render() . '</th>' . '<td class="aphront-side-nav-content">' . $this->renderChildren() . '</td>' . '</tr>' . '</table>'; }
public function buildView() { if (!$this->user) { throw new Exception('Call setUser() before buildView()!'); } $user = $this->user; $stories = $this->stories; $handles = array(); if ($stories) { $handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs')); $object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs')); $handles = id(new PhabricatorObjectHandleData($handle_phids))->loadHandles(); } $null_view = new AphrontNullView(); require_celerity_resource('phabricator-feed-css'); $last_date = null; foreach ($stories as $story) { $story->setHandles($handles); $story->setFramed($this->framed); $date = ucfirst(phabricator_relative_date($story->getEpoch(), $user)); if ($date !== $last_date) { if ($last_date !== null) { $null_view->appendChild('<div class="phabricator-feed-story-date-separator"></div>'); } $last_date = $date; $null_view->appendChild(phutil_render_tag('div', array('class' => 'phabricator-feed-story-date'), phutil_escape_html($date))); } $view = $story->renderView(); $view->setViewer($user); $null_view->appendChild($view); } return id(new AphrontNullView())->appendChild('<div class="phabricator-feed-frame">' . $null_view->render() . '</div>'); }
public function render() { $view = new AphrontNullView(); $view->appendChild($this->buttons); require_celerity_resource('aphront-contextbar-view-css'); return '<div class="aphront-contextbar-view">' . '<div class="aphront-contextbar-core">' . '<div class="aphront-contextbar-buttons">' . $view->render() . '</div>' . '<div class="aphront-contextbar-content">' . $this->renderChildren() . '</div>' . '</div>' . '<div style="clear: both;"></div>' . '</div>'; }
public function render() { $view = new AphrontNullView(); $view->appendChild($this->items); if ($this->flexNav) { require_celerity_resource('phabricator-nav-view-css'); $nav_id = celerity_generate_unique_node_id(); $drag_id = celerity_generate_unique_node_id(); $content_id = celerity_generate_unique_node_id(); if ($this->flexible) { Javelin::initBehavior('phabricator-nav', array('navID' => $nav_id, 'dragID' => $drag_id, 'contentID' => $content_id)); $flex_bar = phutil_render_tag('div', array('class' => 'phabricator-nav-drag', 'id' => $drag_id), ''); } else { $flex_bar = null; } return '<div class="phabricator-nav">' . phutil_render_tag('div', array('class' => 'phabricator-nav-col', 'id' => $nav_id), $view->render()) . $flex_bar . phutil_render_tag('div', array('class' => 'phabricator-nav-content', 'id' => $content_id), $this->renderChildren()) . '</div>'; } else { require_celerity_resource('aphront-side-nav-view-css'); return '<table class="aphront-side-nav-view">' . '<tr>' . '<th class="aphront-side-nav-navigation">' . $view->render() . '</th>' . '<td class="aphront-side-nav-content">' . $this->renderChildren() . '</td>' . '</tr>' . '</table>'; } }
public function buildView() { if (!$this->user) { throw new PhutilInvalidStateException('setUser'); } $user = $this->user; $stories = $this->stories; $null_view = new AphrontNullView(); require_celerity_resource('phabricator-feed-css'); $last_date = null; foreach ($stories as $story) { $story->setFramed($this->framed); $story->setHovercard($this->hovercards); $date = ucfirst(phabricator_relative_date($story->getEpoch(), $user)); if ($date !== $last_date) { if ($last_date !== null) { $null_view->appendChild(phutil_tag_div('phabricator-feed-story-date-separator')); } $last_date = $date; $header = new PHUIActionHeaderView(); $header->setHeaderTitle($date); $null_view->appendChild($header); } try { $view = $story->renderView(); $view->setUser($user); $view = $view->render(); } catch (Exception $ex) { // If rendering failed for any reason, don't fail the entire feed, // just this one story. $view = id(new PHUIFeedStoryView())->setUser($user)->setChronologicalKey($story->getChronologicalKey())->setEpoch($story->getEpoch())->setTitle(pht('Feed Story Failed to Render (%s)', get_class($story)))->appendChild(pht('%s: %s', get_class($ex), $ex->getMessage())); } $null_view->appendChild($view); } if (empty($stories)) { $nodatastring = pht('No Stories.'); if ($this->noDataString) { $nodatastring = $this->noDataString; } $view = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($nodatastring); $null_view->appendChild($view); } return id(new AphrontNullView())->appendChild($null_view->render()); }
public function render() { $view = new AphrontNullView(); $view->appendChild($this->items); $side_links = null; $realname = null; $title = null; if (!empty($this->profileRealname)) { $realname = '<h2 class="phabricator-profile-realname">' . phutil_escape_html($this->profileRealname) . '</h2>'; } if (!empty($this->profileTitle)) { $title = '<h2>' . phutil_escape_html($this->profileTitle) . '</h2>'; } if (!empty($this->items)) { $side_links = $view->render() . '<hr />'; } require_celerity_resource('phabricator-profile-css'); return '<table class="phabricator-profile-master-layout">' . '<tr>' . '<td class="phabricator-profile-navigation">' . '<h1>' . phutil_escape_html($this->profileName) . '</h1>' . $realname . $title . '<hr />' . '<img class="phabricator-profile-image" src="' . $this->profilePicture . '"/>' . '<hr />' . $side_links . '</td>' . '<td class="phabricator-profile-content">' . $this->renderChildren() . '</td>' . '</tr>' . '</table>'; }
public function handleRequest(AphrontRequest $request) { $user = $request->getUser(); $conpherences = array(); require_celerity_resource('conpherence-notification-css'); $unread_status = ConpherenceParticipationStatus::BEHIND; $participant_data = id(new ConpherenceParticipantQuery())->withParticipantPHIDs(array($user->getPHID()))->setLimit(5)->execute(); if ($participant_data) { $conpherences = id(new ConpherenceThreadQuery())->setViewer($user)->withPHIDs(array_keys($participant_data))->needProfileImage(true)->needTransactions(true)->setTransactionLimit(50)->needParticipantCache(true)->execute(); } if ($conpherences) { // re-order the conpherences based on participation data $conpherences = array_select_keys($conpherences, array_keys($participant_data)); $view = new AphrontNullView(); foreach ($conpherences as $conpherence) { $p_data = $participant_data[$conpherence->getPHID()]; $d_data = $conpherence->getDisplayData($user); $classes = array('phabricator-notification', 'conpherence-notification'); if ($p_data->getParticipationStatus() == $unread_status) { $classes[] = 'phabricator-notification-unread'; } $uri = $this->getApplicationURI($conpherence->getID() . '/'); $title = $d_data['title']; $subtitle = $d_data['subtitle']; $unread_count = $d_data['unread_count']; $epoch = $d_data['epoch']; $image = $d_data['image']; $msg_view = id(new ConpherenceMenuItemView())->setUser($user)->setTitle($title)->setSubtitle($subtitle)->setHref($uri)->setEpoch($epoch)->setImageURI($image)->setUnreadCount($unread_count); $view->appendChild(javelin_tag('div', array('class' => implode(' ', $classes), 'sigil' => 'notification', 'meta' => array('href' => $uri)), $msg_view)); } $content = $view->render(); } else { $rooms_uri = phutil_tag('a', array('href' => '/conpherence/', 'class' => 'no-room-notification'), pht('You have joined no rooms.')); $content = phutil_tag_div('phabricator-notification no-notifications', $rooms_uri); } $content = hsprintf('<div class="phabricator-notification-header grouped">%s%s</div>' . '%s', phutil_tag('a', array('href' => '/conpherence/'), pht('Rooms')), $this->renderPersistentOption(), $content); $unread = id(new ConpherenceParticipantCountQuery())->withParticipantPHIDs(array($user->getPHID()))->withParticipationStatus($unread_status)->execute(); $unread_count = idx($unread, $user->getPHID(), 0); $json = array('content' => $content, 'number' => (int) $unread_count); return id(new AphrontAjaxResponse())->setContent($json); }
public function render() { $view = new AphrontNullView(); $view->appendChild($this->items); if ($this->flexNav) { $user = $this->user; require_celerity_resource('phabricator-nav-view-css'); $nav_classes = array(); $nav_classes[] = 'phabricator-nav'; $app_id = celerity_generate_unique_node_id(); $nav_id = null; $drag_id = null; $content_id = celerity_generate_unique_node_id(); $local_id = null; $local_menu = null; $main_id = celerity_generate_unique_node_id(); $apps = $this->renderApplications(); $app_menu = phutil_render_tag('div', array('class' => 'phabricator-nav-col phabricator-nav-app', 'id' => $app_id), $apps->render()); if ($this->isFlexible) { $drag_id = celerity_generate_unique_node_id(); $flex_bar = phutil_render_tag('div', array('class' => 'phabricator-nav-drag', 'id' => $drag_id), ''); } else { $flex_bar = null; } $nav_menu = null; if ($this->items) { $local_id = celerity_generate_unique_node_id(); $nav_classes[] = 'has-local-nav'; $local_menu = phutil_render_tag('div', array('class' => 'phabricator-nav-col phabricator-nav-local', 'id' => $local_id), $view->render()); } Javelin::initBehavior('phabricator-nav', array('mainID' => $main_id, 'appID' => $app_id, 'localID' => $local_id, 'dragID' => $drag_id, 'contentID' => $content_id)); if ($this->active && $local_id) { Javelin::initBehavior('phabricator-active-nav', array('localID' => $local_id)); } $header_part = '<div class="phabricator-nav-head">' . '<div class="phabricator-nav-head-tablet">' . '<a href="#" class="nav-button nav-button-w nav-button-menu" ' . 'id="tablet-menu1"></a>' . '<a href="#" class="nav-button nav-button-e nav-button-content ' . 'nav-button-selected" id="tablet-menu2"></a>' . '</div>' . '<div class="phabricator-nav-head-phone">' . '<a href="#" class="nav-button nav-button-w nav-button-apps" ' . 'id="phone-menu1"></button>' . '<a href="#" class="nav-button nav-button-menu" ' . 'id="phone-menu2"></button>' . '<a href="#" class="nav-button nav-button-e nav-button-content ' . 'nav-button-selected" id="phone-menu3"></button>' . '</div>' . '</div>'; return $header_part . phutil_render_tag('div', array('class' => implode(' ', $nav_classes), 'id' => $main_id), $app_menu . $local_menu . $flex_bar . phutil_render_tag('div', array('class' => 'phabricator-nav-content', 'id' => $content_id), $this->renderChildren())); } else { require_celerity_resource('aphront-side-nav-view-css'); return '<table class="aphront-side-nav-view">' . '<tr>' . '<th class="aphront-side-nav-navigation">' . $view->render() . '</th>' . '<td class="aphront-side-nav-content">' . $this->renderChildren() . '</td>' . '</tr>' . '</table>'; } }