Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/query/PhabricatorPeopleLogSearchEngine.php
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | final class PhabricatorPeopleLogSearchEngine | ||||
public function buildSearchForm( | public function buildSearchForm( | ||||
AphrontFormView $form, | AphrontFormView $form, | ||||
PhabricatorSavedQuery $saved) { | PhabricatorSavedQuery $saved) { | ||||
$actor_phids = $saved->getParameter('actorPHIDs', array()); | $actor_phids = $saved->getParameter('actorPHIDs', array()); | ||||
$user_phids = $saved->getParameter('userPHIDs', array()); | $user_phids = $saved->getParameter('userPHIDs', array()); | ||||
$all_phids = array_merge( | |||||
$actor_phids, | |||||
$user_phids); | |||||
if ($all_phids) { | |||||
$handles = id(new PhabricatorHandleQuery()) | |||||
->setViewer($this->requireViewer()) | |||||
->withPHIDs($all_phids) | |||||
->execute(); | |||||
} else { | |||||
$handles = array(); | |||||
} | |||||
$actor_handles = array_select_keys($handles, $actor_phids); | |||||
$user_handles = array_select_keys($handles, $user_phids); | |||||
$actions = $saved->getParameter('actions', array()); | $actions = $saved->getParameter('actions', array()); | ||||
$remote_prefix = $saved->getParameter('ip'); | $remote_prefix = $saved->getParameter('ip'); | ||||
$sessions = $saved->getParameter('sessions', array()); | $sessions = $saved->getParameter('sessions', array()); | ||||
$actions = array_fuse($actions); | $actions = array_fuse($actions); | ||||
$action_control = id(new AphrontFormCheckboxControl()) | $action_control = id(new AphrontFormCheckboxControl()) | ||||
->setLabel(pht('Actions')); | ->setLabel(pht('Actions')); | ||||
$action_types = PhabricatorUserLog::getActionTypeMap(); | $action_types = PhabricatorUserLog::getActionTypeMap(); | ||||
foreach ($action_types as $type => $label) { | foreach ($action_types as $type => $label) { | ||||
$action_control->addCheckbox( | $action_control->addCheckbox( | ||||
'actions[]', | 'actions[]', | ||||
$type, | $type, | ||||
$label, | $label, | ||||
isset($actions[$label])); | isset($actions[$label])); | ||||
} | } | ||||
$form | $form | ||||
->appendChild( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setDatasource(new PhabricatorPeopleDatasource()) | ->setDatasource(new PhabricatorPeopleDatasource()) | ||||
->setName('actors') | ->setName('actors') | ||||
->setLabel(pht('Actors')) | ->setLabel(pht('Actors')) | ||||
->setValue($actor_handles)) | ->setValue($actor_phids)) | ||||
->appendChild( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setDatasource(new PhabricatorPeopleDatasource()) | ->setDatasource(new PhabricatorPeopleDatasource()) | ||||
->setName('users') | ->setName('users') | ||||
->setLabel(pht('Users')) | ->setLabel(pht('Users')) | ||||
->setValue($user_handles)) | ->setValue($user_phids)) | ||||
->appendChild($action_control) | ->appendChild($action_control) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
->setLabel(pht('Filter IP')) | ->setLabel(pht('Filter IP')) | ||||
->setName('ip') | ->setName('ip') | ||||
->setValue($remote_prefix)) | ->setValue($remote_prefix)) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |