当前位置: 首页>>代码示例>>PHP>>正文


PHP Photo::model方法代码示例

本文整理汇总了PHP中Photo::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::model方法的具体用法?PHP Photo::model怎么用?PHP Photo::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photo的用法示例。


在下文中一共展示了Photo::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionPhoto

 public function actionPhoto()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 25;
     $model = Photo::model()->is_publish()->findAll($criteria);
     $this->setRss($model, 'photo', 'Photo', 'Rss Feed Photo', $this->createUrl('photo'));
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:7,代码来源:RssController.php

示例2: actionList

 public function actionList()
 {
     $request = Yii::app()->getRequest();
     $page = $request->getParam("page");
     if (!$page) {
         $page = 1;
     }
     $pagenum = $request->getParam("pagenum");
     if (!$pagenum) {
         $pagenum = 12;
     }
     $winner = new Winner();
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->limit = $pagenum;
     $criteria->offset = ($page - 1) * $pagenum;
     $criteria->order = 'month DESC';
     $winners = $winner->findAll($criteria);
     $res = array();
     foreach ($winners as $winner) {
         $res[] = $winner->attributes;
     }
     $topPhoto = Photo::model()->findByAttributes(array('weibo_id' => $winners[0]->mid));
     if ($topPhoto) {
         $res[0]['detail'] = $topPhoto->attributes;
     }
     $this->responseJSON($res, "success");
 }
开发者ID:dalinhuang,项目名称:ave_photowall,代码行数:28,代码来源:WinnerController.php

示例3: actionIndex

 public function actionIndex()
 {
     echo "================================================================================\n\r";
     echo "ATMOSPHERA console command: Batch resizing of uploaded photos\n\r";
     echo "================================================================================\n\r";
     $fileform = new PhotoFileForm();
     //get instance of model
     $fileform->setImageSize();
     //set sizes from params-local
     $path = UrlHelper::getImageDir();
     //get dir for upload
     $criteia = new CDbCriteria();
     $countTotal = Photo::model()->count($criteia);
     echo "total count of photo: " . $countTotal . "\n\r";
     echo "start process... please wait\n\r";
     $offset = 0;
     //DebugBreak();
     $step = floor($countTotal / 10);
     $criteia->limit = $step;
     $criteia->offset = $offset;
     $countTotal = 0;
     while (($count = count($aPhotos = Photo::model()->findAll($criteia))) > 0) {
         foreach ($aPhotos as $oPhoto) {
             $fileform->createImages($path, $oPhoto->filename, $oPhoto->thumb_filename);
         }
         $offset += $step;
         $criteia = new CDbCriteria();
         $criteia->limit = $step;
         $criteia->offset = $offset;
         $countTotal += $count;
         echo ".";
     }
     echo "\n\r";
     echo "total count of processed files: " . $countTotal . "\n\r";
 }
开发者ID:andreyantonov78,项目名称:atmosphera,代码行数:35,代码来源:GenImageCommand.php

示例4: loadPost

 private function loadPost($id, $slug)
 {
     $model = Photo::model()->is_publish()->findByAttributes(array('ID' => (int) $id, 'post_link' => $slug));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:8,代码来源:PhotoController.php

示例5: run

 public function run()
 {
     $criteria = new CdbCriteria();
     $criteria->limit = $this->data('limit');
     $criteria->offset = $this->data('offset');
     $model = Photo::model()->is_publish()->findAll($criteria);
     $this->layout($model);
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:8,代码来源:widget_foto.php

示例6: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Photo the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Photo::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:vlad-doroshchuk,项目名称:testwork1,代码行数:15,代码来源:PhotoController.php

示例7: actionGetImages

 public function actionGetImages()
 {
     set_time_limit(0) or die('1');
     $photos = Photo::model()->findAll(array('limit' => 3500, 'offset' => 10000));
     foreach ($photos as $photo) {
         $this->downloadPhoto($photo->path);
     }
 }
开发者ID:nellka,项目名称:mebel,代码行数:8,代码来源:ToolsController.php

示例8: getPhotoByAlbum

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function getPhotoByAlbum($id)
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $criteria->condition = "album_id = '{$id}'";
     $criteria->order = "id asc";
     $model = Photo::model()->findAll($criteria);
     return $model;
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:14,代码来源:Photo.php

示例9: actionCustomer

 public function actionCustomer()
 {
     $model = new Order();
     $errorMessage = null;
     if (isset($_GET['order_id']) && Order::model()->isValidateOrderId($_GET['order_id'])) {
         $model = $this->loadExistOrder($_GET['order_id']);
         $model->order_info = OrderState::model()->getStateZnByStateId($model->order_state_id) . $model->remark;
         $model->product_name = Product::model()->getProductNameByProductId($model->product_id);
         $model->order_photos = Photo::model()->findAllByAttributes(array('product_id' => $model->product_id));
     } else {
         $model->unsetAttributes();
         $errorMessage = Yii::t('order', 'Order is not exist!');
     }
     $this->layout = false;
     $this->render('_customer', array('model' => $model, 'message' => $errorMessage));
 }
开发者ID:roychen-7,项目名称:Shining-Town,代码行数:16,代码来源:OrderController.php

示例10: actionPhotos

 public function actionPhotos()
 {
     if (!empty($_POST)) {
         if (isset($_POST['deletephotos'])) {
             $anketa = Anketa::model()->findByPk(Yii::app()->user->id);
             if (!$anketa) {
                 throw new CException('Error user');
             }
             if (isset($_POST['delete']) && is_array($_POST['delete'])) {
                 foreach ($_POST['delete'] as $k => $v) {
                     if ($k == $anketa->mainphoto) {
                         $anketa->mainphoto = null;
                         $anketa->saveAttributes(array('mainphoto'));
                     }
                     if ($model = Photo::model()->findByPk(array('id_user' => Yii::app()->user->id, 'id_photo' => $k))) {
                         $model->delete();
                     }
                 }
                 Yii::app()->user->setFlash('profile', 'Информация обновлена');
             } else {
                 Yii::app()->user->setFlash('profile', 'Не выбраны фото для удаления');
             }
             $this->refresh();
         } else {
             if (isset($_POST['mainphoto'])) {
                 $id = array_keys($_POST['mainphoto']);
                 $id = $id[0];
                 $model = Anketa::model()->findByPk(Yii::app()->user->id);
                 if (!$model) {
                     throw new CException('Error user');
                 }
                 $photo = Photo::model()->findByPk(array('id_photo' => $id, 'id_user' => $model->id));
                 if (!$photo) {
                     throw new CException('Error photo');
                 }
                 $model->mainphoto = $id;
                 $model->saveAttributes(array('mainphoto'));
                 Yii::app()->user->setFlash('profile', 'Основная фотография изменена');
                 $this->refresh();
             }
         }
     }
     $models = Photo::model()->findAllByAttributes(array('id_user' => Yii::app()->user->id));
     $user = Anketa::model()->findByPk(Yii::app()->user->id);
     $this->render('photos', compact('models', 'user'));
 }
开发者ID:nellka,项目名称:mebel,代码行数:46,代码来源:ProfileController.php

示例11: actionInside

 public function actionInside()
 {
     if (isset($_GET['id'])) {
         $model = News::model()->findByPk($_GET['id']);
         $model_photo = Photo::model()->getPhotoByAlbum($_GET['id']);
         //print_r($model_photo);
         $this->render('detail', array('model' => $model, 'model_photo' => $model_photo));
     } else {
         $news_criteria = new CDbCriteria();
         $news_criteria->condition = "status = 1 AND news_type_id = 5";
         $news_criteria->order = "create_date desc,news_id desc";
         $news_total = News::model()->count($news_criteria);
         $pages = new CPagination($news_total);
         $pages->setPageSize(10);
         $pages->applyLimit($news_criteria);
         $news = News::model()->findAll($news_criteria);
         $this->render('news', array('news' => $news, 'pages' => $pages));
     }
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:19,代码来源:NewsController.php

示例12: actionDelete

 public function actionDelete($id)
 {
     $service = Service::model()->findAll('contractor_id=' . $id);
     if ($service) {
         foreach ($service as $serv) {
             WrapServTransport::Del($serv->id);
             ServCulture::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             $food = ServFood::model()->findAll('service_id=' . $serv->id);
             if ($food) {
                 foreach ($food as $mFood) {
                     LinkFoodServ::model()->deleteAllByAttributes(array('serv_food_id' => $mFood->id));
                 }
             }
             ServFood::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServIntensiv::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServOther::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             $personal = ServPersonal::model()->findAll('service_id=' . $serv->id);
             if ($personal) {
                 foreach ($personal as $mPers) {
                     LinkPersonalLanguage::model()->deleteAllByAttributes(array('serv_personal_id' => $mPers->id));
                 }
             }
             ServPersonal::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServPlatform::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServProgram::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             ServTicket::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             $live = ServLive::model()->findAll('service_id=' . $serv->id);
             if ($live) {
                 foreach ($live as $mLive) {
                     ServLiveRoom::model()->deleteAllByAttributes(array('serv_live_id' => $mLive->id));
                 }
             }
             ServLive::model()->deleteAllByAttributes(array('service_id' => $serv->id));
             Photo::model()->deleteAllByAttributes(array('service_id' => $serv->id));
         }
     }
     Service::model()->deleteAllByAttributes(array('contractor_id' => $id));
     Comment::model()->deleteAllByAttributes(array('contractor_id' => $id));
     LinkCityContractor::model()->deleteAllByAttributes(array('contractor_id' => $id));
     Contractor::model()->deleteByPk($id);
     echo "ok";
 }
开发者ID:dmitryplus,项目名称:gb,代码行数:42,代码来源:ContractorController.php

示例13: getImageSrc

 public function getImageSrc($imageSize = Photo::SIZE_MEDIUM)
 {
     if (($profile = $this->profile) !== null) {
         if (($photo = Photo::model()->findByPk($profile->photo_id)) !== null) {
             return ($src = $photo->getSrcAsSize($imageSize)) !== null ? $src : self::getDefaultImgSrc($imageSize);
         }
     }
     return self::getDefaultImgSrc($imageSize);
 }
开发者ID:jayrulez,项目名称:yiisns,代码行数:9,代码来源:User.php

示例14: tearDown

 function tearDown()
 {
     if ($this->photo_id) {
         $photo = Photo::model()->findByPk($this->photo_id)->delete();
     }
 }
开发者ID:sgaraba,项目名称:photo_gallery,代码行数:6,代码来源:PhotoTest.php

示例15: actionGetUserAllPhoto

 /**
  *  获取用户得到的所有照片
  *  
  */
 public function actionGetUserAllPhoto()
 {
     // 参数检查
     if (!isset($_REQUEST['user_id']) || !isset($_REQUEST['token']) || !isset($_REQUEST['type'])) {
         $this->_return('MSG_ERR_LESS_PARAM');
     }
     $user_id = trim(Yii::app()->request->getParam('user_id'));
     $token = trim(Yii::app()->request->getParam('token'));
     $type = trim(Yii::app()->request->getParam('type'));
     $timestamp = trim(Yii::app()->request->getParam('timestamp'));
     if (!is_numeric($user_id)) {
         $this->_return('MSG_ERR_FAIL_PARAM');
     }
     //验证token
     if (!Token::model()->verifyToken($user_id, $token, $GLOBALS['__APPID'])) {
         $this->_return('MSG_ERR_TOKEN');
     }
     $timestamp = strtotime($timestamp);
     //用户不存在 返回错误
     if ($user_id < 1) {
         $this->_return('MSG_ERR_NO_USER');
     }
     $image = Photo::model()->getUserAllPhoto($user_id, $type, $timestamp);
     $this->_return('MSG_SUCCESS', $image);
 }
开发者ID:hucongyang,项目名称:goddess,代码行数:29,代码来源:GoddessController.php


注:本文中的Photo::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。