コード例 #1
0
 public static function checkLimitFileUpload($id)
 {
     $totalImgupload = ProListingUploadCea::model()->countByAttributes(array('listing_id' => $id));
     if ($totalImgupload >= LIMIT_DOC_UPLOAD) {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: Listing.php プロジェクト: jasonhai/onehome
 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();
 }
コード例 #3
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);
         }
     }
 }