Пример #1
0
 /**
  *
  * @param CHttpRequest $request        	
  * @param User $model        	
  */
 private function respondIfAjaxRequest($request, $model)
 {
     $ajaxRequest = $request->getPost('ajax', false);
     if (!$ajaxRequest or $ajaxRequest !== 'signup-form') {
         return;
     }
     echo CActiveForm::validate($model, array('email', 'password', 'verifyCode'));
     Yii::app()->end();
 }
Пример #2
0
 /**
  * @param Payment $payment
  * @param CHttpRequest $request
  * @return bool|static
  */
 public function processCheckout(Payment $payment, CHttpRequest $request)
 {
     $orderId = (int) $request->getPost('order');
     if (!$orderId) {
         return false;
     }
     $order = Order::model()->findByPk($orderId);
     if (null === $order) {
         return false;
     }
     if ($order->pay($payment, Order::PAID_STATUS_NOT_PAID)) {
         return $order;
     }
     return false;
 }
Пример #3
0
 public function actionRating()
 {
     if (!($rating = MovieRating::model()->find('movie_id=:movie_id AND user_id=:user_id', array(':movie_id' => CHttpRequest::getPost('id'), ':user_id' => Yii::app()->user->id)))) {
         $rating = new MovieRating();
         $rating->movie_id = CHttpRequest::getPost('id');
         $rating->user_id = Yii::app()->user->id;
     }
     $rating->value = CHttpRequest::getPost('rate');
     $rating->save();
     var_dump($rating);
 }
 /**
  * Returns the named POST parameter value, or the entire POST array if no name is specified.
  * If $name is specified and the POST parameter does not exist, $defaultValue will be returned.
  *
  * @param null $name The POST parameter name or null.  If $name is null, it will return the entire POST array.
  * @param null   $defaultValue The default parameter value is $name is not null and the POST parameter does not exist.
  * @return mixed|null
  */
 public function getPost($name = null, $defaultValue = null)
 {
     if (!$name) {
         return $_POST;
     } else {
         return parent::getPost($name, $defaultValue);
     }
 }