[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class ConpherenceNotificationPanelController 4 extends ConpherenceController { 5 6 public function processRequest() { 7 $request = $this->getRequest(); 8 $user = $request->getUser(); 9 $conpherences = array(); 10 $unread_status = ConpherenceParticipationStatus::BEHIND; 11 12 $participant_data = id(new ConpherenceParticipantQuery()) 13 ->withParticipantPHIDs(array($user->getPHID())) 14 ->setLimit(5) 15 ->execute(); 16 17 if ($participant_data) { 18 $conpherences = id(new ConpherenceThreadQuery()) 19 ->setViewer($user) 20 ->withPHIDs(array_keys($participant_data)) 21 ->needParticipantCache(true) 22 ->execute(); 23 } 24 25 if ($conpherences) { 26 require_celerity_resource('conpherence-notification-css'); 27 // re-order the conpherences based on participation data 28 $conpherences = array_select_keys( 29 $conpherences, array_keys($participant_data)); 30 $view = new AphrontNullView(); 31 foreach ($conpherences as $conpherence) { 32 $p_data = $participant_data[$conpherence->getPHID()]; 33 $d_data = $conpherence->getDisplayData($user); 34 $classes = array( 35 'phabricator-notification', 36 'conpherence-notification', 37 ); 38 39 if ($p_data->getParticipationStatus() == $unread_status) { 40 $classes[] = 'phabricator-notification-unread'; 41 } 42 $uri = $this->getApplicationURI($conpherence->getID().'/'); 43 $title = $d_data['title']; 44 $subtitle = $d_data['subtitle']; 45 $unread_count = $d_data['unread_count']; 46 $epoch = $d_data['epoch']; 47 $image = $d_data['image']; 48 49 $msg_view = id(new ConpherenceMenuItemView()) 50 ->setUser($user) 51 ->setTitle($title) 52 ->setSubtitle($subtitle) 53 ->setHref($uri) 54 ->setEpoch($epoch) 55 ->setImageURI($image) 56 ->setUnreadCount($unread_count); 57 58 $view->appendChild(javelin_tag( 59 'div', 60 array( 61 'class' => implode(' ', $classes), 62 'sigil' => 'notification', 63 'meta' => array( 64 'href' => $uri, 65 ), 66 ), 67 $msg_view)); 68 } 69 $content = $view->render(); 70 } else { 71 $content = phutil_tag_div( 72 'phabricator-notification no-notifications', 73 pht('You have no messages.')); 74 } 75 76 $content = hsprintf( 77 '<div class="phabricator-notification-header">%s</div>'. 78 '%s', 79 phutil_tag( 80 'a', 81 array( 82 'href' => '/conpherence/', 83 ), 84 pht('Messages')), 85 $content); 86 87 $unread = id(new ConpherenceParticipantCountQuery()) 88 ->withParticipantPHIDs(array($user->getPHID())) 89 ->withParticipationStatus($unread_status) 90 ->execute(); 91 $unread_count = idx($unread, $user->getPHID(), 0); 92 93 $json = array( 94 'content' => $content, 95 'number' => (int)$unread_count, 96 ); 97 98 return id(new AphrontAjaxResponse())->setContent($json); 99 } 100 101 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |