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


PHP PHUIInfoView::setErrors方法代码示例

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


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

示例1: processImportRequest

 private function processImportRequest($request)
 {
     $admin = $request->getUser();
     $usernames = $request->getArr('usernames');
     $emails = $request->getArr('email');
     $names = $request->getArr('name');
     $notice_view = new PHUIInfoView();
     $notice_view->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
     $notice_view->setTitle(pht('Import Successful'));
     $notice_view->setErrors(array(pht('Successfully imported users from LDAP')));
     $list = new PHUIObjectItemListView();
     $list->setNoDataString(pht('No users imported?'));
     foreach ($usernames as $username) {
         $user = new PhabricatorUser();
         $user->setUsername($username);
         $user->setRealname($names[$username]);
         $email_obj = id(new PhabricatorUserEmail())->setAddress($emails[$username])->setIsVerified(1);
         try {
             id(new PhabricatorUserEditor())->setActor($admin)->createNewUser($user, $email_obj);
             id(new PhabricatorExternalAccount())->setUserPHID($user->getPHID())->setAccountType('ldap')->setAccountDomain('self')->setAccountID($username)->save();
             $header = pht('Successfully added %s', $username);
             $attribute = null;
             $color = 'fa-check green';
         } catch (Exception $ex) {
             $header = pht('Failed to add %s', $username);
             $attribute = $ex->getMessage();
             $color = 'fa-times red';
         }
         $item = id(new PHUIObjectItemView())->setHeader($header)->addAttribute($attribute)->setStatusIcon($color);
         $list->addItem($item);
     }
     return array($notice_view, $list);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:PhabricatorPeopleLdapController.php

示例2: renderErrorPage

 protected function renderErrorPage($title, array $messages)
 {
     $view = new PHUIInfoView();
     $view->setTitle($title);
     $view->setErrors($messages);
     return $this->buildApplicationPage($view, array('title' => $title));
 }
开发者ID:nilsdornblut,项目名称:phabricator,代码行数:7,代码来源:PhabricatorAuthController.php

示例3: renderErrorPage

 protected function renderErrorPage($title, array $messages)
 {
     $view = new PHUIInfoView();
     $view->setTitle($title);
     $view->setErrors($messages);
     return $this->newPage()->setTitle($title)->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:7,代码来源:PhabricatorAuthController.php

示例4: renderExample

 public function renderExample()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $sevs = array(PHUIInfoView::SEVERITY_ERROR => pht('Error'), PHUIInfoView::SEVERITY_WARNING => pht('Warning'), PHUIInfoView::SEVERITY_NODATA => pht('No Data'), PHUIInfoView::SEVERITY_NOTICE => pht('Notice'), PHUIInfoView::SEVERITY_SUCCESS => pht('Success'));
     $button = id(new PHUIButtonView())->setTag('a')->setText(pht('Resolve Issue'))->setHref('#');
     $views = array();
     // Only Title
     foreach ($sevs as $sev => $title) {
         $view = new PHUIInfoView();
         $view->setSeverity($sev);
         $view->setTitle($title);
         $views[] = $view;
     }
     $views[] = phutil_tag('br', array(), null);
     // Only Body
     foreach ($sevs as $sev => $title) {
         $view = new PHUIInfoView();
         $view->setSeverity($sev);
         $view->appendChild(pht('Several issues were encountered.'));
         $view->addButton($button);
         $views[] = $view;
     }
     $views[] = phutil_tag('br', array(), null);
     // Only Errors
     foreach ($sevs as $sev => $title) {
         $view = new PHUIInfoView();
         $view->setSeverity($sev);
         $view->setErrors(array(pht('Overcooked.'), pht('Too much salt.'), pht('Full of sand.')));
         $views[] = $view;
     }
     $views[] = phutil_tag('br', array(), null);
     // All
     foreach ($sevs as $sev => $title) {
         $view = new PHUIInfoView();
         $view->setSeverity($sev);
         $view->setTitle($title);
         $view->appendChild(pht('Several issues were encountered.'));
         $view->setErrors(array(pht('Overcooked.'), pht('Too much salt.'), pht('Full of sand.')));
         $views[] = $view;
     }
     return $views;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:43,代码来源:PHUIInfoExample.php

示例5: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) {
         return new Aphront400Response();
     }
     $e_email = true;
     $e_captcha = true;
     $errors = array();
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     if ($request->isFormPost()) {
         $e_email = null;
         $e_captcha = pht('Again');
         $captcha_ok = AphrontFormRecaptchaControl::processCaptcha($request);
         if (!$captcha_ok) {
             $errors[] = pht('Captcha response is incorrect, try again.');
             $e_captcha = pht('Invalid');
         }
         $email = $request->getStr('email');
         if (!strlen($email)) {
             $errors[] = pht('You must provide an email address.');
             $e_email = pht('Required');
         }
         if (!$errors) {
             // NOTE: Don't validate the email unless the captcha is good; this makes
             // it expensive to fish for valid email addresses while giving the user
             // a better error if they goof their email.
             $target_email = id(new PhabricatorUserEmail())->loadOneWhere('address = %s', $email);
             $target_user = null;
             if ($target_email) {
                 $target_user = id(new PhabricatorUser())->loadOneWhere('phid = %s', $target_email->getUserPHID());
             }
             if (!$target_user) {
                 $errors[] = pht('There is no account associated with that email address.');
                 $e_email = pht('Invalid');
             }
             // If this address is unverified, only send a reset link to it if
             // the account has no verified addresses. This prevents an opportunistic
             // attacker from compromising an account if a user adds an email
             // address but mistypes it and doesn't notice.
             // (For a newly created account, all the addresses may be unverified,
             // which is why we'll send to an unverified address in that case.)
             if ($target_email && !$target_email->getIsVerified()) {
                 $verified_addresses = id(new PhabricatorUserEmail())->loadAllWhere('userPHID = %s AND isVerified = 1', $target_email->getUserPHID());
                 if ($verified_addresses) {
                     $errors[] = pht('That email address is not verified. You can only send ' . 'password reset links to a verified address.');
                     $e_email = pht('Unverified');
                 }
             }
             if (!$errors) {
                 $engine = new PhabricatorAuthSessionEngine();
                 $uri = $engine->getOneTimeLoginURI($target_user, null, PhabricatorAuthSessionEngine::ONETIME_RESET);
                 if ($is_serious) {
                     $body = pht("You can use this link to reset your Phabricator password:" . "\n\n  %s\n", $uri);
                 } else {
                     $body = pht("Condolences on forgetting your password. You can use this " . "link to reset it:\n\n" . "  %s\n\n" . "After you set a new password, consider writing it down on a " . "sticky note and attaching it to your monitor so you don't " . "forget again! Choosing a very short, easy-to-remember password " . "like \"cat\" or \"1234\" might also help.\n\n" . "Best Wishes,\nPhabricator\n", $uri);
                 }
                 $mail = id(new PhabricatorMetaMTAMail())->setSubject(pht('[Phabricator] Password Reset'))->setForceDelivery(true)->addRawTos(array($target_email->getAddress()))->setBody($body)->saveAndSend();
                 return $this->newDialog()->setTitle(pht('Check Your Email'))->setShortTitle(pht('Email Sent'))->appendParagraph(pht('An email has been sent with a link you can use to login.'))->addCancelButton('/', pht('Done'));
             }
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = new PHUIInfoView();
         $error_view->setErrors($errors);
     }
     $email_auth = new PHUIFormLayoutView();
     $email_auth->appendChild($error_view);
     $email_auth->setUser($request->getUser())->setFullWidth(true)->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Email'))->setName('email')->setValue($request->getStr('email'))->setError($e_email))->appendChild(id(new AphrontFormRecaptchaControl())->setLabel(pht('Captcha'))->setError($e_captcha));
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Reset Password'));
     $dialog = new AphrontDialogView();
     $dialog->setUser($request->getUser());
     $dialog->setTitle(pht('Forgot Password / Email Login'));
     $dialog->appendChild($email_auth);
     $dialog->addSubmitButton(pht('Send Email'));
     $dialog->setSubmitURI('/login/email/');
     return $this->buildApplicationPage(array($crumbs, $dialog), array('title' => pht('Forgot Password')));
 }
开发者ID:truSense,项目名称:phabricator,代码行数:79,代码来源:PhabricatorEmailLoginController.php

示例6: handleRequest


//.........这里部分代码省略.........
                 $template_task = id(new ManiphestTaskQuery())->setViewer($viewer)->withIDs(array($template_id))->needSubscriberPHIDs(true)->needProjectPHIDs(true)->executeOne();
                 if ($template_task) {
                     $cc_phids = array_unique(array_merge($template_task->getSubscriberPHIDs(), array($viewer->getPHID())));
                     $task->attachSubscriberPHIDs($cc_phids);
                     $task->attachProjectPHIDs($template_task->getProjectPHIDs());
                     $task->setOwnerPHID($template_task->getOwnerPHID());
                     $task->setPriority($template_task->getPriority());
                     $task->setViewPolicy($template_task->getViewPolicy());
                     $task->setEditPolicy($template_task->getEditPolicy());
                     $v_space = $template_task->getSpacePHID();
                     $template_fields = PhabricatorCustomField::getObjectFields($template_task, PhabricatorCustomField::ROLE_EDIT);
                     $fields = $template_fields->getFields();
                     foreach ($fields as $key => $field) {
                         if (!$field->shouldCopyWhenCreatingSimilarTask()) {
                             unset($fields[$key]);
                         }
                         if (empty($aux_fields[$key])) {
                             unset($fields[$key]);
                         }
                     }
                     if ($fields) {
                         id(new PhabricatorCustomFieldList($fields))->setViewer($viewer)->readFieldsFromStorage($template_task);
                         foreach ($fields as $key => $field) {
                             $aux_fields[$key]->setValueFromStorage($field->getValueForStorage());
                         }
                     }
                 }
             }
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = new PHUIInfoView();
         $error_view->setErrors($errors);
     }
     $priority_map = ManiphestTaskPriority::getTaskPriorityMap();
     if ($task->getOwnerPHID()) {
         $assigned_value = array($task->getOwnerPHID());
     } else {
         $assigned_value = array();
     }
     if ($task->getSubscriberPHIDs()) {
         $cc_value = $task->getSubscriberPHIDs();
     } else {
         $cc_value = array();
     }
     if ($task->getProjectPHIDs()) {
         $projects_value = $task->getProjectPHIDs();
     } else {
         $projects_value = array();
     }
     $cancel_id = nonempty($task->getID(), $template_id);
     if ($cancel_id) {
         $cancel_uri = '/T' . $cancel_id;
     } else {
         $cancel_uri = '/maniphest/';
     }
     if ($task->getID()) {
         $button_name = pht('Save Task');
         $header_name = pht('Edit Task');
     } else {
         if ($parent_task) {
             $cancel_uri = '/T' . $parent_task->getID();
             $button_name = pht('Create Task');
             $header_name = pht('Create New Subtask');
         } else {
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:67,代码来源:SprintBoardTaskEditController.php


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