예제 #1
0
         }
     } else {
         $this->redirect(Yii::app()->createAbsoluteUrl('/'));
     }
 }
 public function actionAddPropertyItem()
 {
     if (isset($_GET['id'])) {
         $model = new ProEnquiryProperty();
         if (isset($_POST['ProEnquiryProperty'])) {
             $model->attributes = $_POST['ProEnquiryProperty'];
             if ($model->validate()) {
                 $model->property_id = $_GET['id'];
                 if ($model->save()) {
                     $thankYouEnquiry = Pages::getPageById(PAGE_THANK_ENQUIRY_PROPERTY);
                     Yii::app()->user->setFlash('success', $thankYouEnquiry->content);
                     //insert Subscriber
                     if (!empty($_POST['ProEnquiryProperty']['get_update'])) {
                         Subscriber::saveSubscriberPublic($model->email, 2, $model->name);
                     }
                     /*
                          * -----------------
                          * dtoan : send mail
                          * -----------------
                          */
                     SendEmail::sendEmailEnquiryForAgent($model);
                     SendEmail::sendEmailEnquiryForSender($model);
                     Yii::app()->session['propertyId'] = $model->property_id;
                     $this->redirect(Yii::app()->createAbsoluteUrl('page/index', array('slug' => $thankYouEnquiry->slug)));
                     //                        $this->redirect(Yii::app()->createAbsoluteUrl('site/thankyou'));