Example #1
0
 public static function saveListingReleatedWithListingid($model)
 {
     //delete old listing
     ProListingReleated::model()->deleteAllByAttributes(array('listing_id' => $model->id));
     //save listing
     if (!empty($model->listing_releated)) {
         $dataJson = json_decode($model->listing_releated, true);
         if (is_array($dataJson) && count($dataJson) > 0) {
             foreach ($dataJson as $k => $v) {
                 $releated = new ProListingReleated();
                 $releated->listing_id = $model->id;
                 $releated->listing_releated = $v;
                 $releated->save();
             }
         }
     }
 }
Example #2
0
 /**
  * step 3
  */
 public function actionManagephotos($id)
 {
     $this->pageTitle = 'Create New Listing' . ' - ' . Yii::app()->params['title'];
     $model = $this->loadModel($id);
     $messagePhoto = NULL;
     $this->HandleSortPhoto($model);
     if (empty($model)) {
         $this->redirect(Yii::app()->createAbsoluteUrl('member/dashboard'));
     }
     if (isset($_POST) && count($_POST) > 0) {
         //chekcPhoto
         $totalImgupload = ProListingPhotos::model()->countByAttributes(array('listing_id' => $id));
         //            if ($totalImgupload > 0) { // ANH DUNG CLOSE AUG 28, 2014
         if (isset($_POST['releated'])) {
             $model->listing_releated = json_encode($_POST['releated']);
         }
         //back
         if (isset($_POST['back'])) {
             $this->redirect(Yii::app()->createAbsoluteUrl('member/listing/extradetail', array('id' => $model->id)));
         }
         if (isset($_POST['save_exit']) || isset($_POST['next']) && $model->status_listing != STATUS_LISTING_ACTIVE) {
             if ($model->current_step_next == 2) {
                 $model->current_step_next = 3;
             } else {
                 if ($model->current_step_next == 3) {
                     $model->current_step_next = 4;
                 }
             }
             if ($model->save()) {
                 ProListingReleated::saveListingReleatedWithListingid($model);
             }
         }
         //save & exit
         if (isset($_POST['save_exit'])) {
             $this->redirect(Yii::app()->createAbsoluteUrl('member/listing', array('status' => $model->status_listing)));
         }
         //next
         if (isset($_POST['next'])) {
             if ($model->save()) {
                 ProListingReleated::saveListingReleatedWithListingid($model);
             }
             $this->redirect(Yii::app()->createAbsoluteUrl('member/listing/confrimations', array('id' => $model->id)));
         }
         //            }else{ // ANH DUNG CLOSE AUG 28, 2014
         ////                 $messagePhoto= 'Please upload photos';
         //            }
     }
     Listing::getCurrentStep($model, 'member', 3);
     //photo
     $photo = new ProListingPhotos();
     $photo->listing_id = $model->id;
     //cea form
     $cea = new ProListingUploadCea();
     $cea->listing_id = $model->id;
     $this->render('create', array('model' => $model, 'view' => 'manage_photos', 'arrOrther' => array('photo' => $photo->search(), 'cea' => $cea->search(), 'messagePhoto' => $messagePhoto)));
 }
Example #3
0
                     $ImageProcessing->createSingleDirectoryByPath("/upload/listing/{$id}/appeal");
                     $file->saveAs(YII_UPLOAD_DIR . "/listing/{$id}/appeal/" . $appeal->file);
                 }
             }
         }
         $model->status_listing = STATUS_LISTING_PENDING;
         $model->is_rejected = 0;
         if ($model->save()) {
             die('<script type="text/javascript">parent.$.fancybox.close();parent.$.fn.yiiGridView.update("sr-resume-request-grid");  </script>');
         }
     }
 }