public static function checkLimitFileUpload($id) { $totalImgupload = ProListingUploadCea::model()->countByAttributes(array('listing_id' => $id)); if ($totalImgupload >= LIMIT_DOC_UPLOAD) { return false; } return true; }
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(); }
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); } } }