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


PHP pht函数代码示例

本文整理汇总了PHP中pht函数的典型用法代码示例。如果您正苦于以下问题:PHP pht函数的具体用法?PHP pht怎么用?PHP pht使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: execute

 public function execute(PhutilArgumentParser $args)
 {
     $console = PhutilConsole::getConsole();
     $ids = $args->getArg('id');
     if (!$ids) {
         throw new PhutilArgumentUsageException(pht("Use the '%s' flag to specify one or more SMS messages to show.", '--id'));
     }
     $messages = id(new PhabricatorSMS())->loadAllWhere('id IN (%Ld)', $ids);
     if ($ids) {
         $ids = array_fuse($ids);
         $missing = array_diff_key($ids, $messages);
         if ($missing) {
             throw new PhutilArgumentUsageException(pht('Some specified SMS messages do not exist: %s', implode(', ', array_keys($missing))));
         }
     }
     $last_key = last_key($messages);
     foreach ($messages as $message_key => $message) {
         $info = array();
         $info[] = pht('PROPERTIES');
         $info[] = pht('ID: %d', $message->getID());
         $info[] = pht('Status: %s', $message->getSendStatus());
         $info[] = pht('To: %s', $message->getToNumber());
         $info[] = pht('From: %s', $message->getFromNumber());
         $info[] = null;
         $info[] = pht('BODY');
         $info[] = $message->getBody();
         $info[] = null;
         $console->writeOut('%s', implode("\n", $info));
         if ($message_key != $last_key) {
             $console->writeOut("\n%s\n\n", str_repeat('-', 80));
         }
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:PhabricatorSMSManagementShowOutboundWorkflow.php

示例2: doWork

 protected function doWork()
 {
     $data = $this->getTaskData();
     $viewer = PhabricatorUser::getOmnipotentUser();
     $address = idx($data, 'address');
     $author_phid = idx($data, 'authorPHID');
     $author = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withPHIDs(array($author_phid))->executeOne();
     if (!$author) {
         throw new PhabricatorWorkerPermanentFailureException(pht('Invite has invalid author PHID ("%s").', $author_phid));
     }
     $invite = id(new PhabricatorAuthInviteQuery())->setViewer($viewer)->withEmailAddresses(array($address))->executeOne();
     if ($invite) {
         // If we're inviting a user who has already been invited, we just
         // regenerate their invite code.
         $invite->regenerateVerificationCode();
     } else {
         // Otherwise, we're creating a new invite.
         $invite = id(new PhabricatorAuthInvite())->setEmailAddress($address);
     }
     // Whether this is a new invite or not, tag this most recent author as
     // the invite author.
     $invite->setAuthorPHID($author_phid);
     $code = $invite->getVerificationCode();
     $invite_uri = '/auth/invite/' . $code . '/';
     $invite_uri = PhabricatorEnv::getProductionURI($invite_uri);
     $template = idx($data, 'template');
     $template = str_replace('{$INVITE_URI}', $invite_uri, $template);
     $invite->save();
     $mail = id(new PhabricatorMetaMTAMail())->addRawTos(array($invite->getEmailAddress()))->setForceDelivery(true)->setSubject(pht('[Phabricator] %s has invited you to join Phabricator', $author->getFullName()))->setBody($template)->saveAndSend();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:30,代码来源:PhabricatorAuthInviteWorker.php

示例3: buildApplicationCrumbs

 protected function buildApplicationCrumbs()
 {
     $crumbs = parent::buildApplicationCrumbs();
     $can_create = $this->hasApplicationCapability(HarbormasterManagePlansCapability::CAPABILITY);
     $crumbs->addAction(id(new PHUIListItemView())->setName(pht('New Build Plan'))->setHref($this->getApplicationURI('plan/edit/'))->setDisabled(!$can_create)->setWorkflow(!$can_create)->setIcon('fa-plus-square'));
     return $crumbs;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:7,代码来源:HarbormasterPlanListController.php

示例4: buildChartForm

 private function buildChartForm()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $table = new PhabricatorFactRaw();
     $conn_r = $table->establishConnection('r');
     $table_name = $table->getTableName();
     $facts = queryfx_all($conn_r, 'SELECT DISTINCT factType from %T', $table_name);
     $specs = PhabricatorFactSpec::newSpecsForFactTypes(PhabricatorFactEngine::loadAllEngines(), ipull($facts, 'factType'));
     $options = array();
     foreach ($specs as $spec) {
         if ($spec->getUnit() == PhabricatorFactSpec::UNIT_COUNT) {
             $options[$spec->getType()] = $spec->getName();
         }
     }
     if (!$options) {
         return id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NOTICE)->setTitle(pht('No Chartable Facts'))->appendChild('<p>' . pht('There are no facts that can be plotted yet.') . '</p>');
     }
     $form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormSelectControl())->setLabel('Y-Axis')->setName('y1')->setOptions($options))->appendChild(id(new AphrontFormSubmitControl())->setValue('Plot Chart'));
     $panel = new AphrontPanelView();
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     $panel->setHeader('Plot Chart');
     return $panel;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:25,代码来源:PhabricatorFactHomeController.php

示例5: renderItemCommonProperties

 private function renderItemCommonProperties(PhabricatorUser $viewer, NuanceItem $item, PHUIPropertyListView $view)
 {
     $complaint = $item->getNuanceProperty('complaint');
     $complaint = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($complaint), 'default', $viewer);
     $view->addSectionHeader(pht('Complaint'), 'fa-exclamation-circle');
     $view->addTextContent($complaint);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:NuancePhabricatorFormSourceDefinition.php

示例6: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getUser();
     $file = PhabricatorFile::initializeNewFile();
     $e_file = true;
     $errors = array();
     if ($request->isFormPost()) {
         $view_policy = $request->getStr('viewPolicy');
         if (!$request->getFileExists('file')) {
             $e_file = pht('Required');
             $errors[] = pht('You must select a file to upload.');
         } else {
             $file = PhabricatorFile::newFromPHPUpload(idx($_FILES, 'file'), array('name' => $request->getStr('name'), 'authorPHID' => $viewer->getPHID(), 'viewPolicy' => $view_policy, 'isExplicitUpload' => true));
         }
         if (!$errors) {
             return id(new AphrontRedirectResponse())->setURI($file->getInfoURI());
         }
         $file->setViewPolicy($view_policy);
     }
     $support_id = celerity_generate_unique_node_id();
     $instructions = id(new AphrontFormMarkupControl())->setControlID($support_id)->setControlStyle('display: none')->setValue(hsprintf('<br /><br /><strong>%s</strong> %s<br /><br />', pht('Drag and Drop:'), pht('You can also upload files by dragging and dropping them from your ' . 'desktop onto this page or the Phabricator home page.')));
     $policies = id(new PhabricatorPolicyQuery())->setViewer($viewer)->setObject($file)->execute();
     $form = id(new AphrontFormView())->setUser($viewer)->setEncType('multipart/form-data')->appendChild(id(new AphrontFormFileControl())->setLabel(pht('File'))->setName('file')->setError($e_file))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Name'))->setName('name')->setValue($request->getStr('name')))->appendChild(id(new AphrontFormPolicyControl())->setUser($viewer)->setCapability(PhabricatorPolicyCapability::CAN_VIEW)->setPolicyObject($file)->setPolicies($policies)->setName('viewPolicy'))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Upload'))->addCancelButton('/file/'))->appendChild($instructions);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Upload'), $request->getRequestURI());
     $crumbs->setBorder(true);
     $title = pht('Upload File');
     $global_upload = id(new PhabricatorGlobalUploadTargetView())->setUser($viewer)->setShowIfSupportedID($support_id);
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('File'))->setFormErrors($errors)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setForm($form);
     $header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-upload');
     $view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($form_box, $global_upload));
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:33,代码来源:PhabricatorFileUploadController.php

示例7: getCustomFieldList

 public function getCustomFieldList($role)
 {
     if (empty($this->lists[$role])) {
         throw new PhabricatorCustomFieldNotAttachedException(pht("Role list '%s' is not available!", $role));
     }
     return $this->lists[$role];
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:PhabricatorCustomFieldAttachment.php

示例8: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $response = $this->loadDiffusionContextForEdit();
     if ($response) {
         return $response;
     }
     $viewer = $this->getViewer();
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     if (!$repository->supportsStaging()) {
         return new Aphront404Response();
     }
     $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
     $v_area = $repository->getHumanReadableDetail('staging-uri');
     if ($request->isFormPost()) {
         $v_area = $request->getStr('area');
         $xactions = array();
         $template = id(new PhabricatorRepositoryTransaction());
         $type_encoding = PhabricatorRepositoryTransaction::TYPE_STAGING_URI;
         $xactions[] = id(clone $template)->setTransactionType($type_encoding)->setNewValue($v_area);
         id(new PhabricatorRepositoryEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($viewer)->applyTransactions($repository, $xactions);
         return id(new AphrontRedirectResponse())->setURI($edit_uri);
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Edit Staging'));
     $title = pht('Edit %s', $repository->getName());
     $form = id(new AphrontFormView())->setUser($viewer)->appendRemarkupInstructions(pht("To make it easier to run integration tests and builds on code " . "under review, you can configure a **Staging Area**. When `arc` " . "creates a diff, it will push a copy of the changes to the " . "configured staging area with a corresponding tag." . "\n\n" . "IMPORTANT: This feature is new, experimental, and not supported. " . "Use it at your own risk."))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Staging Area URI'))->setName('area')->setValue($v_area))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton($edit_uri));
     $object_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($object_box);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:30,代码来源:DiffusionRepositoryEditStagingController.php

示例9: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $dashboard = id(new PhabricatorDashboardQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
     if (!$dashboard) {
         return new Aphront404Response();
     }
     $view_uri = $this->getApplicationURI('manage/' . $dashboard->getID() . '/');
     if ($request->isFormPost()) {
         if ($dashboard->isArchived()) {
             $new_status = PhabricatorDashboard::STATUS_ACTIVE;
         } else {
             $new_status = PhabricatorDashboard::STATUS_ARCHIVED;
         }
         $xactions = array();
         $xactions[] = id(new PhabricatorDashboardTransaction())->setTransactionType(PhabricatorDashboardTransaction::TYPE_STATUS)->setNewValue($new_status);
         id(new PhabricatorDashboardTransactionEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true)->applyTransactions($dashboard, $xactions);
         return id(new AphrontRedirectResponse())->setURI($view_uri);
     }
     if ($dashboard->isArchived()) {
         $title = pht('Activate Dashboard');
         $body = pht('This dashboard will become active again.');
         $button = pht('Activate Dashboard');
     } else {
         $title = pht('Archive Dashboard');
         $body = pht('This dashboard will be marked as archived.');
         $button = pht('Archive Dashboard');
     }
     return $this->newDialog()->setTitle($title)->appendChild($body)->addCancelButton($view_uri)->addSubmitButton($button);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:31,代码来源:PhabricatorDashboardArchiveController.php

示例10: getQuickCreateItems

 public function getQuickCreateItems(PhabricatorUser $viewer)
 {
     $items = array();
     $item = id(new PHUIListItemView())->setName(pht('Conpherence Room'))->setIcon('fa-comments')->setWorkflow(true)->setHref($this->getBaseURI() . 'new/');
     $items[] = $item;
     return $items;
 }
开发者ID:phpengineer,项目名称:phabricator,代码行数:7,代码来源:PhabricatorConpherenceApplication.php

示例11: attemptLand

 private function attemptLand($revision, $request)
 {
     $status = $revision->getStatus();
     if ($status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
         throw new Exception(pht('Only Accepted revisions can be landed.'));
     }
     $repository = $revision->getRepository();
     if ($repository === null) {
         throw new Exception(pht('Revision is not attached to a repository.'));
     }
     $can_push = PhabricatorPolicyFilter::hasCapability($request->getUser(), $repository, DiffusionPushCapability::CAPABILITY);
     if (!$can_push) {
         throw new Exception(pht('You do not have permission to push to this repository.'));
     }
     $lock = $this->lockRepository($repository);
     try {
         $response = $this->pushStrategy->processLandRequest($request, $revision, $repository);
     } catch (Exception $e) {
         $lock->unlock();
         throw $e;
     }
     $lock->unlock();
     $looksoon = new ConduitCall('diffusion.looksoon', array('callsigns' => array($repository->getCallsign())));
     $looksoon->setUser($request->getUser());
     $looksoon->execute();
     return $response;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:27,代码来源:DifferentialRevisionLandController.php

示例12: buildCustomEditFields

 public function buildCustomEditFields(PhabricatorEditEngine $engine, PhabricatorApplicationTransactionInterface $object)
 {
     $viewer = $engine->getViewer();
     $editor = $object->getApplicationTransactionEditor();
     $types = $editor->getTransactionTypesForObject($object);
     $types = array_fuse($types);
     $policies = id(new PhabricatorPolicyQuery())->setViewer($viewer)->setObject($object)->execute();
     $map = array(PhabricatorTransactions::TYPE_VIEW_POLICY => array('key' => 'policy.view', 'aliases' => array('view'), 'capability' => PhabricatorPolicyCapability::CAN_VIEW, 'label' => pht('View Policy'), 'description' => pht('Controls who can view the object.'), 'edit' => 'view'), PhabricatorTransactions::TYPE_EDIT_POLICY => array('key' => 'policy.edit', 'aliases' => array('edit'), 'capability' => PhabricatorPolicyCapability::CAN_EDIT, 'label' => pht('Edit Policy'), 'description' => pht('Controls who can edit the object.'), 'edit' => 'edit'), PhabricatorTransactions::TYPE_JOIN_POLICY => array('key' => 'policy.join', 'aliases' => array('join'), 'capability' => PhabricatorPolicyCapability::CAN_JOIN, 'label' => pht('Join Policy'), 'description' => pht('Controls who can join the object.'), 'edit' => 'join'));
     $fields = array();
     foreach ($map as $type => $spec) {
         if (empty($types[$type])) {
             continue;
         }
         $capability = $spec['capability'];
         $key = $spec['key'];
         $aliases = $spec['aliases'];
         $label = $spec['label'];
         $description = $spec['description'];
         $edit = $spec['edit'];
         $policy_field = id(new PhabricatorPolicyEditField())->setKey($key)->setLabel($label)->setDescription($description)->setAliases($aliases)->setIsCopyable(true)->setCapability($capability)->setPolicies($policies)->setTransactionType($type)->setEditTypeKey($edit)->setValue($object->getPolicy($capability));
         $fields[] = $policy_field;
         if (!$object instanceof PhabricatorSpacesInterface) {
             if ($capability == PhabricatorPolicyCapability::CAN_VIEW) {
                 $type_space = PhabricatorTransactions::TYPE_SPACE;
                 if (isset($types[$type_space])) {
                     $space_field = id(new PhabricatorSpaceEditField())->setKey('spacePHID')->setLabel(pht('Space'))->setEditTypeKey('space')->setDescription(pht('Shifts the object in the Spaces application.'))->setIsCopyable(true)->setIsReorderable(false)->setAliases(array('space', 'policy.space'))->setTransactionType($type_space)->setValue($object->getSpacePHID());
                     $fields[] = $space_field;
                     $policy_field->setSpaceField($space_field);
                 }
             }
         }
     }
     return $fields;
 }
开发者ID:fuding,项目名称:phabricator,代码行数:34,代码来源:PhabricatorPolicyEditEngineExtension.php

示例13: buildActionList

 private function buildActionList(PhabricatorUser $user)
 {
     $viewer = $this->getViewer();
     $actions = id(new PhabricatorActionListView())->setUser($viewer);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $user, PhabricatorPolicyCapability::CAN_EDIT);
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Profile'))->setHref($this->getApplicationURI('editprofile/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-picture-o')->setName(pht('Edit Profile Picture'))->setHref($this->getApplicationURI('picture/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-wrench')->setName(pht('Edit Settings'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref('/settings/' . $user->getID() . '/'));
     if ($user->getIsAdmin()) {
         $empower_icon = 'fa-arrow-circle-o-down';
         $empower_name = pht('Remove Administrator');
     } else {
         $empower_icon = 'fa-arrow-circle-o-up';
         $empower_name = pht('Make Administrator');
     }
     $is_admin = $viewer->getIsAdmin();
     $is_self = $user->getPHID() === $viewer->getPHID();
     $can_admin = $is_admin && !$is_self;
     $actions->addAction(id(new PhabricatorActionView())->setIcon($empower_icon)->setName($empower_name)->setDisabled(!$can_admin)->setWorkflow(true)->setHref($this->getApplicationURI('empower/' . $user->getID() . '/')));
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-tag')->setName(pht('Change Username'))->setDisabled(!$is_admin)->setWorkflow(true)->setHref($this->getApplicationURI('rename/' . $user->getID() . '/')));
     if ($user->getIsDisabled()) {
         $disable_icon = 'fa-check-circle-o';
         $disable_name = pht('Enable User');
     } else {
         $disable_icon = 'fa-ban';
         $disable_name = pht('Disable User');
     }
     $actions->addAction(id(new PhabricatorActionView())->setIcon($disable_icon)->setName($disable_name)->setDisabled(!$can_admin)->setWorkflow(true)->setHref($this->getApplicationURI('disable/' . $user->getID() . '/')));
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-times')->setName(pht('Delete User'))->setDisabled(!$can_admin)->setWorkflow(true)->setHref($this->getApplicationURI('delete/' . $user->getID() . '/')));
     $can_welcome = $is_admin && $user->canEstablishWebSessions();
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-envelope')->setName(pht('Send Welcome Email'))->setWorkflow(true)->setDisabled(!$can_welcome)->setHref($this->getApplicationURI('welcome/' . $user->getID() . '/')));
     return $actions;
 }
开发者ID:billtt,项目名称:phabricator,代码行数:33,代码来源:PhabricatorPeopleProfileManageController.php

示例14: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($this->id) {
         $question = id(new PonderQuestionQuery())->setViewer($user)->withIDs(array($this->id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
         if (!$question) {
             return new Aphront404Response();
         }
         $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs($question->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
         $v_projects = array_reverse($v_projects);
     } else {
         $question = id(new PonderQuestion())->setStatus(PonderQuestionStatus::STATUS_OPEN)->setAuthorPHID($user->getPHID())->setVoteCount(0)->setAnswerCount(0)->setHeat(0.0);
         $v_projects = array();
     }
     $v_title = $question->getTitle();
     $v_content = $question->getContent();
     $errors = array();
     $e_title = true;
     if ($request->isFormPost()) {
         $v_title = $request->getStr('title');
         $v_content = $request->getStr('content');
         $v_projects = $request->getArr('projects');
         $len = phutil_utf8_strlen($v_title);
         if ($len < 1) {
             $errors[] = pht('Title must not be empty.');
             $e_title = pht('Required');
         } else {
             if ($len > 255) {
                 $errors[] = pht('Title is too long.');
                 $e_title = pht('Too Long');
             }
         }
         if (!$errors) {
             $template = id(new PonderQuestionTransaction());
             $xactions = array();
             $xactions[] = id(clone $template)->setTransactionType(PonderQuestionTransaction::TYPE_TITLE)->setNewValue($v_title);
             $xactions[] = id(clone $template)->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT)->setNewValue($v_content);
             $proj_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
             $xactions[] = id(new PonderQuestionTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $proj_edge_type)->setNewValue(array('=' => array_fuse($v_projects)));
             $editor = id(new PonderQuestionEditor())->setActor($user)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true);
             $editor->applyTransactions($question, $xactions);
             return id(new AphrontRedirectResponse())->setURI('/Q' . $question->getID());
         }
     }
     $form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Question'))->setName('title')->setValue($v_title)->setError($e_title))->appendChild(id(new PhabricatorRemarkupControl())->setUser($user)->setName('content')->setID('content')->setValue($v_content)->setLabel(pht('Description'))->setUser($user));
     $form->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($v_projects)->setDatasource(new PhabricatorProjectDatasource()));
     $form->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($this->getApplicationURI())->setValue(pht('Ask Away!')));
     $preview = id(new PHUIRemarkupPreviewPanel())->setHeader(pht('Question Preview'))->setControlID('content')->setPreviewURI($this->getApplicationURI('preview/'));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Ask New Question'))->setFormErrors($errors)->setForm($form);
     $crumbs = $this->buildApplicationCrumbs();
     $id = $question->getID();
     if ($id) {
         $crumbs->addTextCrumb("Q{$id}", "/Q{$id}");
         $crumbs->addTextCrumb(pht('Edit'));
     } else {
         $crumbs->addTextCrumb(pht('Ask Question'));
     }
     return $this->buildApplicationPage(array($crumbs, $form_box, $preview), array('title' => pht('Ask New Question')));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:60,代码来源:PonderQuestionEditController.php

示例15: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $provider_config = id(new PhortunePaymentProviderConfigQuery())->setViewer($viewer)->withIDs(array($this->id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
     if (!$provider_config) {
         return new Aphront404Response();
     }
     $merchant = $provider_config->getMerchant();
     $merchant_id = $merchant->getID();
     $cancel_uri = $this->getApplicationURI("merchant/{$merchant_id}/");
     $provider = $provider_config->buildProvider();
     if ($request->isFormPost()) {
         $new_status = !$provider_config->getIsEnabled();
         $xactions = array();
         $xactions[] = id(new PhortunePaymentProviderConfigTransaction())->setTransactionType(PhortunePaymentProviderConfigTransaction::TYPE_ENABLE)->setNewValue($new_status);
         $editor = id(new PhortunePaymentProviderConfigEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true)->setContinueOnMissingFields(true);
         $editor->applyTransactions($provider_config, $xactions);
         return id(new AphrontRedirectResponse())->setURI($cancel_uri);
     }
     if ($provider_config->getIsEnabled()) {
         $title = pht('Disable Provider?');
         $body = pht('If you disable this payment provider, users will no longer be able ' . 'to use it to make new payments.');
         $button = pht('Disable Provider');
     } else {
         $title = pht('Enable Provider?');
         $body = pht('If you enable this payment provider, users will be able to use it to ' . 'make new payments.');
         $button = pht('Enable Provider');
     }
     return $this->newDialog()->setTitle($title)->appendParagraph($body)->addSubmitButton($button)->addCancelButton($cancel_uri);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:31,代码来源:PhortuneProviderDisableController.php


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