Path: blob/master/src/applications/people/controller/PhabricatorPeopleLogViewController.php
12256 views
<?php12final class PhabricatorPeopleLogViewController3extends PhabricatorPeopleController {45public function shouldRequireAdmin() {6return false;7}89public function handleRequest(AphrontRequest $request) {10$viewer = $this->getViewer();11$id = $request->getURIData('id');1213$log = id(new PhabricatorPeopleLogQuery())14->setViewer($viewer)15->withIDs(array($id))16->executeOne();17if (!$log) {18return new Aphront404Response();19}2021$logs_uri = $this->getApplicationURI('logs/');2223$crumbs = $this->buildApplicationCrumbs()24->addTextCrumb(pht('Activity Logs'), $logs_uri)25->addTextCrumb($log->getObjectName())26->setBorder(true);2728$header = $this->buildHeaderView($log);29$properties = $this->buildPropertiesView($log);3031$view = id(new PHUITwoColumnView())32->setHeader($header)33->addPropertySection(pht('Details'), $properties);3435return $this->newPage()36->setCrumbs($crumbs)37->setTitle($log->getObjectName())38->appendChild($view);39}4041private function buildHeaderView(PhabricatorUserLog $log) {42$viewer = $this->getViewer();4344$view = id(new PHUIHeaderView())45->setViewer($viewer)46->setHeader($log->getObjectName());4748return $view;49}5051private function buildPropertiesView(PhabricatorUserLog $log) {52$viewer = $this->getViewer();5354$view = id(new PHUIPropertyListView())55->setViewer($viewer);5657$type_map = PhabricatorUserLogType::getAllLogTypes();58$type_map = mpull($type_map, 'getLogTypeName', 'getLogTypeKey');5960$action = $log->getAction();61$type_name = idx($type_map, $action, $action);6263$view->addProperty(pht('Event Type'), $type_name);6465$view->addProperty(66pht('Event Date'),67phabricator_datetime($log->getDateCreated(), $viewer));6869$actor_phid = $log->getActorPHID();70if ($actor_phid) {71$view->addProperty(72pht('Acting User'),73$viewer->renderHandle($actor_phid));74}7576$user_phid = $log->getUserPHID();77if ($user_phid) {78$view->addProperty(79pht('Affected User'),80$viewer->renderHandle($user_phid));81}8283$remote_address = $log->getRemoteAddressForViewer($viewer);84if ($remote_address !== null) {85$view->addProperty(pht('Remote Address'), $remote_address);86}8788return $view;89}9091}929394