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


PHP Photo::findAll方法代码示例

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


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

示例1: actionList

 public function actionList()
 {
     $request = Yii::app()->getRequest();
     $page = $request->getParam("page");
     if (!$page) {
         $page = 1;
     }
     $pagenum = $request->getParam("pagenum");
     if (!$pagenum) {
         $pagenum = 10;
     }
     $status = $request->getParam("status");
     if (!isset($status)) {
         $status = 1;
     }
     $photo = new Photo();
     $criteria = new CDbCriteria();
     if ($this->getRole() == 2) {
         $criteria->select = '*';
     } else {
         $criteria->select = 'pid,weibo_id,url,sns_uid,image,content,datetime';
     }
     if ($status != 'all' && $this->getRole() == 2) {
         $criteria->condition = 'status=:status';
         $criteria->params = array(':status' => $status);
     } else {
         $criteria->condition = 'status=:status';
         $criteria->params = array(':status' => 1);
     }
     $criteria->limit = $pagenum;
     $criteria->offset = ($page - 1) * $pagenum;
     $criteria->order = 'datetime DESC';
     $photos = $photo->findAll($criteria);
     $retdata = array();
     foreach ($photos as $photo) {
         $data = $photo->attributes;
         $data['link'] = $data['sns_uid'] . '/' . $data['url'];
         unset($data['avatar']);
         unset($data['sns_uid']);
         if ($this->getRole() != 2) {
             unset($data['status']);
             unset($data['screen_name']);
         }
         unset($data['url']);
         $retdata[] = $data;
     }
     $this->responseJSON($retdata, "success");
 }
开发者ID:dalinhuang,项目名称:ave_photowall,代码行数:48,代码来源:PhotoController.php

示例2: actionPhoto

 public function actionPhoto()
 {
     $criteria = new CDbCriteria();
     //AR的另一种写法
     $criteria->condition = "userid=" . Yii::app()->session['uid'];
     $photoModel = new Photo();
     $total = $photoModel->count('userid=:uid', array('uid' => Yii::app()->session['uid']), $criteria);
     //count
     $pager = new CPagination($total);
     $pager->pageSize = 27;
     $pager->applyLimit($criteria);
     $photos = $photoModel->findAll($criteria);
     //$url = "http://".Yii::app()->params['bucket'].".".Yii::app()->params['domain']."/";
     $url = Yii::app()->params['resurl'];
     $data = array('photos' => $photos, 'pages' => $pager, 'url' => $url, 'ajaxurl' => "admin/Ajaxdelimage", 'ajaxset' => "admin/Ajaxsetimage");
     $this->render("iphoto", $data);
 }
开发者ID:returncn,项目名称:chen-xia-cms,代码行数:17,代码来源:AdminController.php

示例3: actionJustlook

 public function actionJustlook($uid)
 {
     $this->Myaccess($uid);
     $photoModel = new Photo();
     $data['photoInfo'] = $photoModel->findAll('userid=:uid', array(':uid' => $uid));
     if (empty($data['photoInfo'])) {
         $data = array('backup' => 'index/m', 'params' => array('who' => $uid), 'message' => '~啊哟,相册里是空的,主人家没有上传过,回去看看别的吧~');
         $this->renderPartial('error', $data);
         die;
     }
     $data['uid'] = $uid;
     $data['url'] = "http://" . Yii::app()->params['bucket'] . "." . Yii::app()->params['domain'] . "/";
     $this->layout = "//layouts/illokit";
     $this->render('picture', $data);
 }
开发者ID:biggtfish,项目名称:A-Simple-CMS,代码行数:15,代码来源:IndexController.php


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