示例#1
0
 public function beforeDelete()
 {
     //delete all photo
     $allphoto = ProListingPhotos::model()->findAllByAttributes(array('listing_id' => $this->id));
     if ($allphoto) {
         foreach ($allphoto as $photo) {
             if ($photo->delete()) {
                 ProListingPhotos::removePhoto($photo);
             }
         }
     }
     //delete all doc
     $allDoc = ProListingUploadCea::model()->findAllByAttributes(array('listing_id' => $this->id));
     if ($allDoc) {
         foreach ($allDoc as $doc) {
             if ($doc->delete()) {
                 ProListingUploadCea::removefileDoc($doc);
             }
         }
     }
     return parent::beforeDelete();
 }
示例#2
0
 public function actionAjaxdelete_doc($listing, $doc)
 {
     if (Listing::model()->findByAttributes(array('id' => $listing, 'user_id' => $this->userID))) {
         $model = ProListingUploadCea::model()->findByPk($doc);
         if ($model->delete()) {
             ProListingUploadCea::removefileDoc($model);
         }
     }
 }