本文整理汇总了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");
}
示例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);
}
示例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);
}