本文整理汇总了PHP中AphrontRequest::getURIData方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::getURIData方法的具体用法?PHP AphrontRequest::getURIData怎么用?PHP AphrontRequest::getURIData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontRequest
的用法示例。
在下文中一共展示了AphrontRequest::getURIData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
public function handleRequest(AphrontRequest $request)
{
$user = $request->getUser();
$query = id(new PhabricatorProjectQuery())->setViewer($user)->needMembers(true)->needWatchers(true)->needImages(true)->needSlugs(true);
$id = $request->getURIData('id');
$slug = $request->getURIData('slug');
if ($slug) {
$query->withSlugs(array($slug));
} else {
$query->withIDs(array($id));
}
$project = $query->executeOne();
if (!$project) {
return new Aphront404Response();
}
if ($slug && $slug != $project->getPrimarySlug()) {
return id(new AphrontRedirectResponse())->setURI('/tag/' . $project->getPrimarySlug() . '/');
}
$query = new PhabricatorFeedQuery();
$query->setFilterPHIDs(array($project->getPHID()));
$query->setLimit(50);
$query->setViewer($request->getUser());
$stories = $query->execute();
$feed = $this->renderStories($stories);
$box = id(new PHUIObjectBoxView())->setHeaderText(pht('Project Activity'))->appendChild($feed);
$nav = $this->buildIconNavView($project);
$nav->selectFilter("feed/{$id}/");
$nav->appendChild($box);
return $this->buildApplicationPage($nav, array('title' => $project->getName()));
}
示例2: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$querykey = $request->getURIData('queryKey');
$merchant_id = $request->getURIData('merchantID');
$account_id = $request->getURIData('accountID');
$engine = new PhortuneSubscriptionSearchEngine();
if ($merchant_id) {
$merchant = id(new PhortuneMerchantQuery())->setViewer($viewer)->withIDs(array($merchant_id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$merchant) {
return new Aphront404Response();
}
$this->merchant = $merchant;
$viewer->grantAuthority($merchant);
$engine->setMerchant($merchant);
} else {
if ($account_id) {
$account = id(new PhortuneAccountQuery())->setViewer($viewer)->withIDs(array($account_id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$account) {
return new Aphront404Response();
}
$this->account = $account;
$engine->setAccount($account);
} else {
return new Aphront404Response();
}
}
$controller = id(new PhabricatorApplicationSearchController())->setQueryKey($querykey)->setSearchEngine($engine)->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
示例3: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$space = id(new PhabricatorSpacesNamespaceQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$space) {
return new Aphront404Response();
}
$is_archive = $request->getURIData('action') == 'archive';
$cancel_uri = '/' . $space->getMonogram();
if ($request->isFormPost()) {
$type_archive = PhabricatorSpacesNamespaceTransaction::TYPE_ARCHIVE;
$xactions = array();
$xactions[] = id(new PhabricatorSpacesNamespaceTransaction())->setTransactionType($type_archive)->setNewValue($is_archive ? 1 : 0);
$editor = id(new PhabricatorSpacesNamespaceEditor())->setActor($viewer)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->setContentSourceFromRequest($request);
$editor->applyTransactions($space, $xactions);
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
}
$body = array();
if ($is_archive) {
$title = pht('Archive Space: %s', $space->getNamespaceName());
$body[] = pht('If you archive this Space, you will no longer be able to create ' . 'new objects inside it.');
$body[] = pht('Existing objects in this Space will be hidden from query results ' . 'by default.');
$button = pht('Archive Space');
} else {
$title = pht('Activate Space: %s', $space->getNamespaceName());
$body[] = pht('If you activate this space, you will be able to create objects ' . 'inside it again.');
$body[] = pht('Existing objects will no longer be hidden from query results.');
$button = pht('Activate Space');
}
$dialog = $this->newDialog()->setTitle($title)->addCancelButton($cancel_uri)->addSubmitButton($button);
foreach ($body as $paragraph) {
$dialog->appendParagraph($paragraph);
}
return $dialog;
}
示例4: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$id = $request->getURIData('id');
$event = id(new PhabricatorCalendarEventQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
if (!$event) {
return new Aphront404Response();
}
$response = $this->newImportedEventResponse($event);
if ($response) {
return $response;
}
$cancel_uri = $event->getURI();
if (!$event->getIsUserAttending($viewer->getPHID())) {
return $this->newDialog()->setTitle(pht('Not Attending Event'))->appendParagraph(pht('You can not change your display availability for events you ' . 'are not attending.'))->addCancelButton($cancel_uri);
}
// TODO: This endpoint currently only works via AJAX. It would be vaguely
// nice to provide a plain HTML version of the workflow where we return
// a dialog with a vanilla <select /> in it for cases where all the JS
// breaks.
$request->validateCSRF();
$invitee = $event->getInviteeForPHID($viewer->getPHID());
$map = PhabricatorCalendarEventInvitee::getAvailabilityMap();
$new_availability = $request->getURIData('availability');
if (isset($map[$new_availability])) {
$invitee->setAvailability($new_availability)->save();
// Invalidate the availability cache.
$viewer->writeAvailabilityCache(array(), null);
}
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
}
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:31,代码来源:PhabricatorCalendarEventAvailabilityController.php
示例5: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$status = $request->getURIData('status');
$question = id(new PonderQuestionQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$question) {
return new Aphront404Response();
}
switch ($status) {
case 'open':
$status = PonderQuestionStatus::STATUS_OPEN;
break;
case 'close':
$status = PonderQuestionStatus::STATUS_CLOSED;
break;
default:
return new Aphront400Response();
}
$xactions = array();
$xactions[] = id(new PonderQuestionTransaction())->setTransactionType(PonderQuestionTransaction::TYPE_STATUS)->setNewValue($status);
$editor = id(new PonderQuestionEditor())->setActor($viewer)->setContentSourceFromRequest($request);
$editor->applyTransactions($question, $xactions);
return id(new AphrontRedirectResponse())->setURI('/Q' . $question->getID());
}
示例6: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$phid = $request->getURIData('phid');
$capability = $request->getURIData('capability');
$object = id(new PhabricatorObjectQuery())->setViewer($viewer)->withPHIDs(array($phid))->executeOne();
if (!$object) {
return new Aphront404Response();
}
$policies = PhabricatorPolicyQuery::loadPolicies($viewer, $object);
$policy = idx($policies, $capability);
if (!$policy) {
return new Aphront404Response();
}
$handle = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs(array($phid))->executeOne();
$object_name = $handle->getName();
$object_uri = nonempty($handle->getURI(), '/');
$dialog = id(new AphrontDialogView())->setUser($viewer)->setClass('aphront-access-dialog aphront-policy-explain-dialog')->setTitle(pht('Policy Details: %s', $object_name))->addCancelButton($object_uri, pht('Done'));
$space_section = $this->buildSpaceSection($object, $policy, $capability);
$extended_section = $this->buildExtendedSection($object, $capability);
$exceptions_section = $this->buildExceptionsSection($object, $capability);
$object_section = $this->buildObjectSection($object, $policy, $capability, $handle);
$dialog->appendChild(array($space_section, $extended_section, $exceptions_section, $object_section));
return $dialog;
}
示例7: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$blueprint = id(new DrydockBlueprintQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$blueprint) {
return new Aphront404Response();
}
$is_disable = $request->getURIData('action') == 'disable';
$id = $blueprint->getID();
$cancel_uri = $this->getApplicationURI("blueprint/{$id}/");
if ($request->isFormPost()) {
$xactions = array();
$xactions[] = id(new DrydockBlueprintTransaction())->setTransactionType(DrydockBlueprintTransaction::TYPE_DISABLED)->setNewValue($is_disable ? 1 : 0);
$editor = id(new DrydockBlueprintEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($blueprint, $xactions);
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
}
if ($is_disable) {
$title = pht('Disable Blueprint');
$body = pht('If you disable this blueprint, Drydock will no longer use it to ' . 'allocate new resources. Existing resources will not be affected.');
$button = pht('Disable Blueprint');
} else {
$title = pht('Enable Blueprint');
$body = pht('If you enable this blueprint, Drydock will start using it to ' . 'allocate new resources.');
$button = pht('Enable Blueprint');
}
return $this->newDialog()->setTitle($title)->appendParagraph($body)->addCancelButton($cancel_uri)->addSubmitButton($button);
}
示例8: handleRequest
public function handleRequest(AphrontRequest $request)
{
$engine_key = $request->getURIData('engineKey');
$this->setEngineKey($engine_key);
$key = $request->getURIData('key');
$viewer = $this->getViewer();
$config = id(new PhabricatorEditEngineConfigurationQuery())->setViewer($viewer)->withEngineKeys(array($engine_key))->withIdentifiers(array($key))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$config) {
return id(new Aphront404Response());
}
$cancel_uri = "/transactions/editengine/{$engine_key}/view/{$key}/";
if ($request->isFormPost()) {
$xactions = array();
$locks = $request->getArr('locks');
$type_locks = PhabricatorEditEngineConfigurationTransaction::TYPE_LOCKS;
$xactions[] = id(new PhabricatorEditEngineConfigurationTransaction())->setTransactionType($type_locks)->setNewValue($locks);
$editor = id(new PhabricatorEditEngineConfigurationEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnMissingFields(true)->setContinueOnNoEffect(true);
$editor->applyTransactions($config, $xactions);
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
}
$engine = $config->getEngine();
$fields = $engine->getFieldsForConfig($config);
$help = pht(<<<EOTEXT
**Locked** fields are visible in the form, but their values can not be changed
by the user.
**Hidden** fields are not visible in the form.
Any assigned default values are still respected, even if the field is locked
or hidden.
EOTEXT
);
$form = id(new AphrontFormView())->setUser($viewer)->appendRemarkupInstructions($help);
$locks = $config->getFieldLocks();
$lock_visible = PhabricatorEditEngineConfiguration::LOCK_VISIBLE;
$lock_locked = PhabricatorEditEngineConfiguration::LOCK_LOCKED;
$lock_hidden = PhabricatorEditEngineConfiguration::LOCK_HIDDEN;
$map = array($lock_visible => pht('Visible'), $lock_locked => pht("🔒 Locked"), $lock_hidden => pht("✘ Hidden"));
foreach ($fields as $field) {
if (!$field->getIsLockable()) {
continue;
}
$key = $field->getKey();
$label = $field->getLabel();
if (!strlen($label)) {
$label = $key;
}
if ($field->getIsHidden()) {
$value = $lock_hidden;
} else {
if ($field->getIsLocked()) {
$value = $lock_locked;
} else {
$value = $lock_visible;
}
}
$form->appendControl(id(new AphrontFormSelectControl())->setName('locks[' . $key . ']')->setLabel($label)->setValue($value)->setOptions($map));
}
return $this->newDialog()->setTitle(pht('Lock / Hide Fields'))->setWidth(AphrontDialogView::WIDTH_FORM)->appendForm($form)->addSubmitButton(pht('Save Changes'))->addCancelButton($cancel_uri);
}
示例9: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dblob = $request->getURIData('dblob');
$fragment = id(new PhragmentFragmentQuery())->setViewer($viewer)->withPaths(array($dblob))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if ($fragment === null) {
return new Aphront404Response();
}
$version = id(new PhragmentFragmentVersionQuery())->setViewer($viewer)->withFragmentPHIDs(array($fragment->getPHID()))->withIDs(array($id))->executeOne();
if ($version === null) {
return new Aphront404Response();
}
if ($request->isDialogFormPost()) {
$file_phid = $version->getFilePHID();
$file = null;
if ($file_phid !== null) {
$file = id(new PhabricatorFileQuery())->setViewer($viewer)->withPHIDs(array($file_phid))->executeOne();
if ($file === null) {
throw new Exception(pht('The file associated with this version was not found.'));
}
}
if ($file === null) {
$fragment->deleteFile($viewer);
} else {
$fragment->updateFromFile($viewer, $file);
}
return id(new AphrontRedirectResponse())->setURI($this->getApplicationURI('/history/' . $dblob));
}
return $this->createDialog($fragment, $version);
}
示例10: handleRequest
public function handleRequest(AphrontRequest $request)
{
$user = $request->getUser();
$query = id(new PhabricatorProjectQuery())->setViewer($user)->needMembers(true)->needWatchers(true)->needImages(true)->needSlugs(true);
$id = $request->getURIData('id');
$slug = $request->getURIData('slug');
if ($slug) {
$query->withSlugs(array($slug));
} else {
$query->withIDs(array($id));
}
$project = $query->executeOne();
if (!$project) {
return new Aphront404Response();
}
if ($slug && $slug != $project->getPrimarySlug()) {
return id(new AphrontRedirectResponse())->setURI('/tag/' . $project->getPrimarySlug() . '/');
}
require_celerity_resource('phabricator-profile-css');
$query = new PhabricatorFeedQuery();
$query->setFilterPHIDs(array($project->getPHID()));
$query->setLimit(50);
$query->setViewer($request->getUser());
$stories = $query->execute();
$feed = $this->renderStories($stories);
$content = phutil_tag_div('phabricator-project-feed', $feed);
$nav = $this->buildIconNavView($project);
$nav->selectFilter("feed/{$id}/");
$nav->appendChild($content);
return $this->buildApplicationPage($nav, array('title' => $project->getName()));
}
示例11: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$this->database = $request->getURIData('database');
$this->table = $request->getURIData('table');
$this->column = $request->getURIData('column');
$this->key = $request->getURIData('key');
$query = $this->buildSchemaQuery();
$actual = $query->loadActualSchema();
$expect = $query->loadExpectedSchema();
$comp = $query->buildComparisonSchema($expect, $actual);
if ($this->column) {
return $this->renderColumn($comp, $expect, $actual, $this->database, $this->table, $this->column);
} else {
if ($this->key) {
return $this->renderKey($comp, $expect, $actual, $this->database, $this->table, $this->key);
} else {
if ($this->table) {
return $this->renderTable($comp, $expect, $actual, $this->database, $this->table);
} else {
if ($this->database) {
return $this->renderDatabase($comp, $expect, $actual, $this->database);
} else {
return $this->renderServer($comp, $expect, $actual);
}
}
}
}
}
示例12: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$id = $request->getURIData('id');
$key = $request->getURIData('key');
if ($id) {
$user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$user) {
return new Aphront404Response();
}
$this->user = $user;
} else {
$this->user = $viewer;
}
$panels = $this->buildPanels();
$nav = $this->renderSideNav($panels);
$key = $nav->selectFilter($key, head($panels)->getPanelKey());
$panel = $panels[$key];
$panel->setUser($this->getUser());
$panel->setViewer($viewer);
$response = $panel->processRequest($request);
if ($response instanceof AphrontResponse) {
return $response;
}
$crumbs = $this->buildApplicationCrumbs();
if (!$this->isSelf()) {
$crumbs->addTextCrumb($this->getUser()->getUsername(), '/p/' . $this->getUser()->getUsername() . '/');
}
$crumbs->addTextCrumb($panel->getPanelName());
$nav->appendChild(array($crumbs, $response));
return $this->buildApplicationPage($nav, array('title' => $panel->getPanelName()));
}
示例13: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$project_id = $request->getURIData('projectID');
$project = id(new PhabricatorProjectQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW))->withIDs(array($project_id))->needImages(true)->executeOne();
if (!$project) {
return new Aphront404Response();
}
$this->setProject($project);
$column = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW))->executeOne();
if (!$column) {
return new Aphront404Response();
}
$timeline = $this->buildTransactionTimeline($column, new PhabricatorProjectColumnTransactionQuery());
$timeline->setShouldTerminate(true);
$title = pht('%s', $column->getDisplayName());
$header = $this->buildHeaderView($column);
$actions = $this->buildActionView($column);
$properties = $this->buildPropertyView($column, $actions);
$box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$nav = $this->buildIconNavView($project);
$nav->appendChild($box);
$nav->appendChild($timeline);
return $this->buildApplicationPage($nav, array('title' => $title));
}
示例14: handleRequest
public function handleRequest(AphrontRequest $request)
{
$engine_key = $request->getURIData('engineKey');
$this->setEngineKey($engine_key);
$key = $request->getURIData('key');
$viewer = $this->getViewer();
$config = id(new PhabricatorEditEngineConfigurationQuery())->setViewer($viewer)->withEngineKeys(array($engine_key))->withIdentifiers(array($key))->executeOne();
if (!$config) {
return id(new Aphront404Response());
}
$is_concrete = (bool) $config->getID();
$actions = $this->buildActionView($config);
$properties = $this->buildPropertyView($config)->setActionList($actions);
$header = id(new PHUIHeaderView())->setUser($viewer)->setPolicyObject($config)->setHeader(pht('Edit Form: %s', $config->getDisplayName()));
$box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$crumbs = $this->buildApplicationCrumbs();
if ($is_concrete) {
$crumbs->addTextCrumb(pht('Form %d', $config->getID()));
} else {
$crumbs->addTextCrumb(pht('Builtin'));
}
if ($is_concrete) {
$timeline = $this->buildTransactionTimeline($config, new PhabricatorEditEngineConfigurationTransactionQuery());
$timeline->setShouldTerminate(true);
} else {
$timeline = null;
}
return $this->newPage()->setCrumbs($crumbs)->appendChild(array($box, $timeline));
}
示例15: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$post = id(new PhamePostQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$post) {
return new Aphront404Response();
}
$cancel_uri = $post->getViewURI();
$action = $request->getURIData('action');
$is_publish = $action == 'publish';
if ($request->isFormPost()) {
$xactions = array();
if ($is_publish) {
$new_value = PhameConstants::VISIBILITY_PUBLISHED;
} else {
$new_value = PhameConstants::VISIBILITY_DRAFT;
}
$xactions[] = id(new PhamePostTransaction())->setTransactionType(PhamePostTransaction::TYPE_VISIBILITY)->setNewValue($new_value);
id(new PhamePostEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($post, $xactions);
return id(new AphrontRedirectResponse())->setURI($cancel_uri);
}
if ($is_publish) {
$title = pht('Publish Post');
$body = pht('This post will go live once you publish it.');
$button = pht('Publish');
} else {
$title = pht('Unpublish Post');
$body = pht('This post will revert to draft status and no longer be visible ' . 'to other users.');
$button = pht('Unpublish');
}
return $this->newDialog()->setTitle($title)->appendParagraph($body)->addSubmitButton($button)->addCancelButton($cancel_uri);
}