public function actionStep2() {
     if (isFrontUserLoggedIn()) {
         $visit_code = Yii::app()->session['visit_code'];
         $visit_model = Visits::model()->find(array('condition' => 'visit_code = "' . $visit_code . '" '));
         // finding out all the previous donations
         $user_id = Yii::app()->session['user_id'];
         $solicitor_id = $visit_model->solicitor->id;
         $prev_don_model = Donation::model()->findAll(array('order'=>'date_entered DESC','condition' => 'user_id = "' . $user_id . '" and solicitor_id = "' . $solicitor_id . '" '));
         $this->render('step2', array('visit_model' => $visit_model, 'prev_don_model' => $prev_don_model));
     } else {
         $this->redirect(array("/user"));
     }
 }
 public function actionProcessPending($id)
 {
     $visit_model = Visits::model()->findByPk($id);
     $attributes = array('payment_status' => 'transferred');
     //Donation::model()->updateAll($attributes, 'payment_status=:payment_status', array(':payment_status' => 'pending'));
     Donation::model()->updateAll($attributes, array('condition' => "payment_status = 'pending' AND visit_id = '{$id}' "));
     $this->redirect(array('donations', 'id' => $visit_model->solicitor_id));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Donation the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Donation::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }