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


PHP sfRequest::getPostParameters方法代码示例

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


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

示例1: executeCitiCashBackApplication

 /**
  * Приём анкеты Сити банка
  */
 public function executeCitiCashBackApplication(sfRequest $request)
 {
     $form = new CitiBankApplicationForm();
     $form->bind($request->getPostParameters());
     if ($form->isValid()) {
         $this->_sendEmail($form->getValues());
         return $this->renderJsonSuccess('Анкета успешно отправлена');
     }
     $errors = $form->getErrorSchema()->getErrors();
     $errorMessages = array();
     //TODO: refactor: все сообщения русским языком должны создаваться на клиенте,
     //сервер должен слать только код поля (например, "email") и сообщение валидатора
     $humanFieldNames = array("email" => "Email", "birthday" => "Дата рождения", "name" => "Имя", "patronymic" => "Отчество", "surname" => "Фамилия", "mobile_phone" => "Мобильный телефон");
     foreach ($errors as $fieldName => $error) {
         $errorMessages[] = sprintf("%s", $humanFieldNames[$fieldName]);
     }
     return $this->renderJsonError("Пожалуйста, исправьте заполнение полей: \n" . implode(', ', $errorMessages));
 }
开发者ID:ru-easyfinance,项目名称:EasyFinance,代码行数:21,代码来源:actions.class.php

示例2: executeSave

 /**
  * Сохранить профиль пользователя
  */
 public function executeSave(sfRequest $request)
 {
     $user = $this->getUser()->getUserRecord();
     $this->form = new UserProfileForm($user);
     $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
     $postParameters = $request->getPostParameters();
     $formParameters = array();
     // default fields
     $fields = array('mailIntegration' => 'user_service_mail', 'nickname' => 'name');
     // грязный хак для (от) Рамблёра
     if (strpos($_SERVER['HTTP_HOST'], 'rambler') === false) {
         $fields = array_merge(array('login' => 'user_login', 'mail' => 'user_mail', 'pass' => 'password', 'newpass' => 'password_new', 'getNotify' => 'notify'), $fields);
     }
     foreach ($fields as $parameter => $field) {
         if (array_key_exists($parameter, $postParameters)) {
             $formParameters[$field] = $postParameters[$parameter];
         }
     }
     $this->form->bind($formParameters, array());
     if ($this->form->isValid()) {
         $this->form->save();
         return $this->renderText(json_encode(array('result' => array('text' => 'Данные успешно сохранены'))));
     }
     $err = $this->form->getErrorSchema();
     $string = '';
     foreach ($err as $errors) {
         if ($errors instanceof sfValidatorErrorSchema) {
             foreach ($errors as $code => $message) {
                 $string .= $message->getMessage() . "<br /><br />\n";
             }
         } elseif ($errors instanceof sfValidatorError) {
             $string .= $errors->getMessage() . "<br /><br />\n";
         } else {
             $string .= $errors . "<br /><br />\n";
         }
     }
     return $this->renderText(json_encode(array('error' => array('text' => $string))));
 }
开发者ID:ru-easyfinance,项目名称:EasyFinance,代码行数:41,代码来源:actions.class.php

示例3: executeLogin

 /**
  * Авторизация пользователя
  */
 public function executeLogin(sfRequest $request)
 {
     $this->setLayout("layout");
     $user = $this->getUser();
     if ($user->isAuthenticated()) {
         return $this->redirect('@homepage');
     }
     // Запрос на авторизацию
     if ($request->isMethod('post')) {
         $this->form = new myAuthForm();
         $params = $request->getPostParameters();
         $this->form->bind($params['auth']);
         if ($this->form->isValid()) {
             $values = $this->form->getValues();
             $remember = array_key_exists('remember', $values) ? $values['remember'] : false;
             $user->signIn($this->form->getUser(), $remember);
             return $this->redirect('@homepage');
         }
         // Форвард из других контроллеров
     } else {
         $this->form = new myAuthForm();
     }
     return sfView::SUCCESS;
 }
开发者ID:EasyFinance,项目名称:myAuthPlugin,代码行数:27,代码来源:BasemyAuthActions.class.php

示例4: executeLogin

 /**
  * Авторизация пользователя / сообщение о неавторизованности
  */
 public function executeLogin(sfRequest $request)
 {
     $this->setLayout("layout");
     $user = $this->getUser();
     if (!$user->isAuthenticated()) {
         if ($request->isMethod('post')) {
             $form = new myAuthForm();
             $form->bind($request->getPostParameters());
             if ($form->isValid()) {
                 $userRecord = $form->getUser();
             } else {
                 return $this->raiseError($form->getErrorSchema());
             }
         } else {
             return $this->raiseError('Authentification required');
         }
         $user->signIn($userRecord);
     }
     if (!$this->checkSubscription()) {
         $user->signOut();
         return $this->raiseError('Payment required', 402);
     }
     return sfView::SUCCESS;
 }
开发者ID:ru-easyfinance,项目名称:EasyFinance,代码行数:27,代码来源:actions.class.php


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