当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer方法代码示例

本文整理汇总了PHP中PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer方法的具体用法?PHP PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer怎么用?PHP PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorSpacesNamespaceQuery的用法示例。


在下文中一共展示了PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: returnSaveAddressResponse

 private function returnSaveAddressResponse(AphrontRequest $request, PhutilURI $uri, PhabricatorMetaMTAApplicationEmail $email_object, $is_new)
 {
     $viewer = $request->getUser();
     $config_default = PhabricatorMetaMTAApplicationEmail::CONFIG_DEFAULT_AUTHOR;
     $e_email = true;
     $v_email = $email_object->getAddress();
     $e_space = null;
     $v_space = $email_object->getSpacePHID();
     $v_default = $email_object->getConfigValue($config_default);
     $validation_exception = null;
     if ($request->isDialogFormPost()) {
         $e_email = null;
         $v_email = trim($request->getStr('email'));
         $v_space = $request->getStr('spacePHID');
         $v_default = $request->getArr($config_default);
         $v_default = nonempty(head($v_default), null);
         $type_address = PhabricatorMetaMTAApplicationEmailTransaction::TYPE_ADDRESS;
         $type_space = PhabricatorTransactions::TYPE_SPACE;
         $type_config = PhabricatorMetaMTAApplicationEmailTransaction::TYPE_CONFIG;
         $key_config = PhabricatorMetaMTAApplicationEmailTransaction::KEY_CONFIG;
         $xactions = array();
         $xactions[] = id(new PhabricatorMetaMTAApplicationEmailTransaction())->setTransactionType($type_address)->setNewValue($v_email);
         $xactions[] = id(new PhabricatorMetaMTAApplicationEmailTransaction())->setTransactionType($type_space)->setNewValue($v_space);
         $xactions[] = id(new PhabricatorMetaMTAApplicationEmailTransaction())->setTransactionType($type_config)->setMetadataValue($key_config, $config_default)->setNewValue($v_default);
         $editor = id(new PhabricatorMetaMTAApplicationEmailEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true);
         try {
             $editor->applyTransactions($email_object, $xactions);
             return id(new AphrontRedirectResponse())->setURI($uri->alter('highlight', $email_object->getID()));
         } catch (PhabricatorApplicationTransactionValidationException $ex) {
             $validation_exception = $ex;
             $e_email = $ex->getShortMessage($type_address);
             $e_space = $ex->getShortMessage($type_space);
         }
     }
     if ($v_default) {
         $v_default = array($v_default);
     } else {
         $v_default = array();
     }
     $form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Email'))->setName('email')->setValue($v_email)->setError($e_email));
     if (PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
         $form->appendControl(id(new AphrontFormSelectControl())->setLabel(pht('Space'))->setName('spacePHID')->setValue($v_space)->setError($e_space)->setOptions(PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer($viewer, $v_space)));
     }
     $form->appendControl(id(new AphrontFormTokenizerControl())->setDatasource(new PhabricatorPeopleDatasource())->setLabel(pht('Default Author'))->setName($config_default)->setLimit(1)->setValue($v_default)->setCaption(pht('Used if the "From:" address does not map to a known account.')));
     if ($is_new) {
         $title = pht('New Address');
     } else {
         $title = pht('Edit Address');
     }
     $dialog = id(new AphrontDialogView())->setUser($viewer)->setWidth(AphrontDialogView::WIDTH_FORM)->setTitle($title)->setValidationException($validation_exception)->appendForm($form)->addSubmitButton(pht('Save'))->addCancelButton($uri);
     if ($is_new) {
         $dialog->addHiddenInput('new', 'true');
     }
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:55,代码来源:PhabricatorMetaMTAApplicationEmailPanel.php

示例2: buildSpacesControl

 private function buildSpacesControl()
 {
     if ($this->capability != PhabricatorPolicyCapability::CAN_VIEW) {
         return null;
     }
     if (!$this->object instanceof PhabricatorSpacesInterface) {
         return null;
     }
     $viewer = $this->getUser();
     if (!PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
         return null;
     }
     $space_phid = $this->getSpacePHID();
     if ($space_phid === null) {
         $space_phid = $viewer->getDefaultSpacePHID();
     }
     $select = AphrontFormSelectControl::renderSelectTag($space_phid, PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer($viewer, $space_phid), array('disabled' => $this->getDisabled(), 'name' => 'spacePHID', 'class' => 'aphront-space-select-control-knob'));
     return $select;
 }
开发者ID:mduan,项目名称:phabricator,代码行数:19,代码来源:AphrontFormPolicyControl.php


注:本文中的PhabricatorSpacesNamespaceQuery::getSpaceOptionsForViewer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。