[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorUserLogView extends AphrontView { 4 5 private $logs; 6 private $handles; 7 private $searchBaseURI; 8 9 public function setSearchBaseURI($search_base_uri) { 10 $this->searchBaseURI = $search_base_uri; 11 return $this; 12 } 13 14 public function setLogs(array $logs) { 15 assert_instances_of($logs, 'PhabricatorUserLog'); 16 $this->logs = $logs; 17 return $this; 18 } 19 20 public function setHandles(array $handles) { 21 assert_instances_of($handles, 'PhabricatorObjectHandle'); 22 $this->handles = $handles; 23 return $this; 24 } 25 26 public function render() { 27 $logs = $this->logs; 28 $handles = $this->handles; 29 $viewer = $this->getUser(); 30 31 $action_map = PhabricatorUserLog::getActionTypeMap(); 32 $base_uri = $this->searchBaseURI; 33 34 $rows = array(); 35 foreach ($logs as $log) { 36 37 $ip = $log->getRemoteAddr(); 38 $session = substr($log->getSession(), 0, 6); 39 40 if ($base_uri) { 41 $ip = phutil_tag( 42 'a', 43 array( 44 'href' => $base_uri.'?ip='.$log->getRemoteAddr().'#R', 45 ), 46 $ip); 47 $session = phutil_tag( 48 'a', 49 array( 50 'href' => $base_uri.'?sessions='.$log->getSession().'#R', 51 ), 52 $session); 53 } 54 55 $action = $log->getAction(); 56 $action_name = idx($action_map, $action, $action); 57 58 $rows[] = array( 59 phabricator_date($log->getDateCreated(), $viewer), 60 phabricator_time($log->getDateCreated(), $viewer), 61 $action_name, 62 $log->getActorPHID() 63 ? $handles[$log->getActorPHID()]->getName() 64 : null, 65 $handles[$log->getUserPHID()]->getName(), 66 $ip, 67 $session, 68 ); 69 } 70 71 $table = new AphrontTableView($rows); 72 $table->setHeaders( 73 array( 74 pht('Date'), 75 pht('Time'), 76 pht('Action'), 77 pht('Actor'), 78 pht('User'), 79 pht('IP'), 80 pht('Session'), 81 )); 82 $table->setColumnClasses( 83 array( 84 '', 85 'right', 86 'wide', 87 '', 88 '', 89 '', 90 'n', 91 )); 92 93 return $table; 94 } 95 }
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 |