本文整理汇总了PHP中Notify::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Notify::count方法的具体用法?PHP Notify::count怎么用?PHP Notify::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notify
的用法示例。
在下文中一共展示了Notify::count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$this->setPageTitle('通知');
$type = Yii::app()->request->getQuery('type');
$type_arr = Notify::model()->type_arr;
$user = new User();
$notifys = array();
$uid = Yii::app()->user->id;
$model = new Notify();
//初始化
$criteria = new CDbCriteria();
$criteria->order = 'ctime';
$criteria->condition = "t.uid=:uid";
$criteria->params = array(':uid' => $uid);
if (!array_key_exists($type, $type_arr)) {
$type = 'all';
}
if ($type != 'all') {
$condition = "cate = '{$cate}'";
$criteria->addCondition($condition);
}
//取得数据总数,分页显示
$total = $model->count($criteria);
$pages = new CPagination($total);
$pages->pageSize = 20;
$pages->applyLimit($criteria);
//获取数据集
$notifys = $model->findAll($criteria);
$data = array('type' => $type, 'type_arr' => $type_arr, 'notifys' => $notifys, 'user' => $user, 'pages' => $pages);
$this->render('index', $data);
}