Differential D8871 Diff 21064 src/applications/people/controller/PhabricatorPeopleLogsController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/controller/PhabricatorPeopleLogsController.php
Show All 29 Lines | public function renderResultsList( | ||||
$phids = array(); | $phids = array(); | ||||
foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
$phids[$log->getActorPHID()] = true; | $phids[$log->getActorPHID()] = true; | ||||
$phids[$log->getUserPHID()] = true; | $phids[$log->getUserPHID()] = true; | ||||
} | } | ||||
$phids = array_keys($phids); | $phids = array_keys($phids); | ||||
$handles = $this->loadViewerHandles($phids); | $handles = $this->loadViewerHandles($phids); | ||||
$action_map = PhabricatorUserLog::getActionTypeMap(); | $table = id(new PhabricatorUserLogView()) | ||||
->setUser($viewer) | |||||
$rows = array(); | ->setLogs($logs) | ||||
foreach ($logs as $log) { | ->setSearchBaseURI($this->getApplicationURI('logs/')) | ||||
->setHandles($handles); | |||||
$ip_href = $this->getApplicationURI( | |||||
'logs/?ip='.$log->getRemoteAddr()); | |||||
$session_href = $this->getApplicationURI( | |||||
'logs/?sessions='.$log->getSession()); | |||||
$action = $log->getAction(); | |||||
$action_name = idx($action_map, $action, $action); | |||||
$rows[] = array( | |||||
phabricator_date($log->getDateCreated(), $viewer), | |||||
phabricator_time($log->getDateCreated(), $viewer), | |||||
$action_name, | |||||
$log->getActorPHID() | |||||
? $handles[$log->getActorPHID()]->getName() | |||||
: null, | |||||
$handles[$log->getUserPHID()]->getName(), | |||||
phutil_tag( | |||||
'a', | |||||
array( | |||||
'href' => $ip_href, | |||||
), | |||||
$log->getRemoteAddr()), | |||||
phutil_tag( | |||||
'a', | |||||
array( | |||||
'href' => $session_href, | |||||
), | |||||
substr($log->getSession(), 0, 6)), | |||||
); | |||||
} | |||||
$table = new AphrontTableView($rows); | |||||
$table->setHeaders( | |||||
array( | |||||
pht('Date'), | |||||
pht('Time'), | |||||
pht('Action'), | |||||
pht('Actor'), | |||||
pht('User'), | |||||
pht('IP'), | |||||
pht('Session'), | |||||
)); | |||||
$table->setColumnClasses( | |||||
array( | |||||
'', | |||||
'right', | |||||
'wide', | |||||
'', | |||||
'', | |||||
'', | |||||
'n', | |||||
)); | |||||
return id(new PHUIObjectBoxView()) | return id(new PHUIObjectBoxView()) | ||||
->setHeaderText(pht('User Activity Logs')) | ->setHeaderText(pht('User Activity Logs')) | ||||
->appendChild($table); | ->appendChild($table); | ||||
} | } | ||||
public function buildSideNavView() { | public function buildSideNavView() { | ||||
Show All 13 Lines |