當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Listing::AutoSetCoverPhotoListing方法代碼示例

本文整理匯總了PHP中Listing::AutoSetCoverPhotoListing方法的典型用法代碼示例。如果您正苦於以下問題:PHP Listing::AutoSetCoverPhotoListing方法的具體用法?PHP Listing::AutoSetCoverPhotoListing怎麽用?PHP Listing::AutoSetCoverPhotoListing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Listing的用法示例。


在下文中一共展示了Listing::AutoSetCoverPhotoListing方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SavePhotoListing

 /**
  * @Author: ANH DUNG Aug 12, 2014
  * @Todo: save photo listing upload 
  * @Param: $model model 
  */
 public static function SavePhotoListing($model)
 {
     $uid = Yii::app()->user->id;
     if (isset($_FILES['Listing']['name']['photo_listing_anhdung']) && count($_FILES['Listing']['name']['photo_listing_anhdung'])) {
         $cMaxDisplay = ProListingPhotos::GetMaxDisplayOrder($model->id);
         foreach ($_FILES['Listing']['name']['photo_listing_anhdung'] as $key => $item) {
             if (Listing::CountPhotoListing($model->id) >= Listing::GetLimitPhotoUpload()) {
                 return;
             }
             $mFile = new ProListingPhotos();
             $mFile->FileValidate = CUploadedFile::getInstanceByName('Listing[photo_listing_anhdung][' . $key . ']');
             $mFile->validate();
             if (!$mFile->hasErrors()) {
                 $ext = $mFile->FileValidate->getExtensionName();
                 $mFile->image = $uid . "-" . time() . ActiveRecord::randString() . $key . '.' . $ext;
                 // file name
                 $mFile->listing_id = $model->id;
                 $mFile->default = 0;
                 $mFile->display_order = ++$cMaxDisplay;
                 $mFile->save();
                 Listing::saveFile($mFile, 'FileValidate', $mFile->image);
                 Listing::ResizePhotoListing($mFile);
                 Listing::PutWarterMarkPhotoListing($mFile);
                 Listing::ResizePhotoListingSmall($mFile);
             }
         }
         Listing::AutoSetCoverPhotoListing($model->id);
     }
 }
開發者ID:jasonhai,項目名稱:onehome,代碼行數:34,代碼來源:Listing.php

示例2: actionAjaxdelete_photo

 public function actionAjaxdelete_photo($listing, $photo)
 {
     if (Listing::model()->findByAttributes(array('id' => $listing, 'user_id' => $this->userID))) {
         $model = ProListingPhotos::model()->findByPk($photo);
         if ($model->delete()) {
             ProListingPhotos::removePhoto($model);
             Listing::AutoSetCoverPhotoListing($listing);
         }
     }
 }
開發者ID:jasonhai,項目名稱:onehome,代碼行數:10,代碼來源:ListingController.php


注:本文中的Listing::AutoSetCoverPhotoListing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。