Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/view/PhabricatorUserLogView.php
| <?php | <?php | ||||
| final class PhabricatorUserLogView extends AphrontView { | final class PhabricatorUserLogView extends AphrontView { | ||||
| private $logs; | private $logs; | ||||
| private $handles; | |||||
| private $searchBaseURI; | private $searchBaseURI; | ||||
| public function setSearchBaseURI($search_base_uri) { | public function setSearchBaseURI($search_base_uri) { | ||||
| $this->searchBaseURI = $search_base_uri; | $this->searchBaseURI = $search_base_uri; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setLogs(array $logs) { | public function setLogs(array $logs) { | ||||
| assert_instances_of($logs, 'PhabricatorUserLog'); | assert_instances_of($logs, 'PhabricatorUserLog'); | ||||
| $this->logs = $logs; | $this->logs = $logs; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setHandles(array $handles) { | |||||
| assert_instances_of($handles, 'PhabricatorObjectHandle'); | |||||
| $this->handles = $handles; | |||||
| return $this; | |||||
| } | |||||
| public function render() { | public function render() { | ||||
| $logs = $this->logs; | $logs = $this->logs; | ||||
| $handles = $this->handles; | |||||
| $viewer = $this->getUser(); | $viewer = $this->getUser(); | ||||
| $phids = array(); | |||||
| foreach ($logs as $log) { | |||||
| $phids[] = $log->getActorPHID(); | |||||
| $phids[] = $log->getUserPHID(); | |||||
| } | |||||
| $handles = $viewer->loadHandles($phids); | |||||
| $action_map = PhabricatorUserLog::getActionTypeMap(); | $action_map = PhabricatorUserLog::getActionTypeMap(); | ||||
| $base_uri = $this->searchBaseURI; | $base_uri = $this->searchBaseURI; | ||||
| $rows = array(); | $rows = array(); | ||||
| foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
| $ip = $log->getRemoteAddr(); | $ip = $log->getRemoteAddr(); | ||||
| $session = substr($log->getSession(), 0, 6); | $session = substr($log->getSession(), 0, 6); | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||