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


PHP Reply::findAll方法代碼示例

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


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

示例1: run

 public function run()
 {
     $controller = $this->getController();
     $controller->_seoTitle = Yii::t('common', 'User Center') . ' - ' . Yii::t('common', 'My Replys') . ' - ' . $controller->_setting['site_name'];
     //我的回複
     $uid = Yii::app()->user->id;
     $comment_mod = new Comment();
     $reply_mod = new Reply();
     $criteria = new CDbCriteria();
     $criteria->addColumnCondition(array('t.user_id' => $uid));
     $criteria->order = 't.id DESC';
     //分頁
     $count = $reply_mod->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $pages->applyLimit($criteria);
     $datalist = $reply_mod->findAll($criteria);
     foreach ((array) $datalist as $k => $v) {
         $reply = $comment_mod->findByPk($v->cid);
         if ($reply) {
             $c_mod_class = $controller->_content_models[$reply->type];
             $c_mod_name = strtolower($c_mod_class);
             $content_mod = new $c_mod_class();
             $content = $content_mod->findByPk($reply->content_id);
             $datalist[$k]['title'] = $content->title;
             $datalist[$k]['url'] = $controller->createUrl($c_mod_name . '/view', array('id' => $reply->content_id));
         }
     }
     $controller->render('my_replys', array('datalist' => $datalist, 'pages' => $pages));
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:30,代碼來源:MyreplysAction.php

示例2: actionIndex

 /**
  * 回複管理
  *
  */
 public function actionIndex()
 {
     $model = new Reply();
     $criteria = new CDbCriteria();
     $condition = '1';
     $status = $this->_request->getParam('status');
     $status && ($condition .= " AND t.status='{$status}'");
     $criteria->condition = $condition;
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $pageParams = $this->buildCondition($_GET, array('status'));
     $pages->params = is_array($pageParams) ? $pageParams : array();
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     Yii::app()->clientScript->registerCssFile($this->_static_public . "/js/kindeditor/code/prettify.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/kindeditor/code/prettify.js", CClientScript::POS_END);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages));
 }
開發者ID:redtreelchao,項目名稱:wander-moon,代碼行數:25,代碼來源:ReplyController.php

示例3: run

 public function run()
 {
     $model = new Reply();
     //條件
     $criteria = new CDbCriteria();
     $status = trim(Yii::app()->request->getParam('status'));
     $status && $criteria->addColumnCondition(array('status' => $status));
     $title = trim(Yii::app()->request->getParam('content'));
     $title && $criteria->addSearchCondition('content', $title);
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     //分頁
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     //查詢
     $result = $model->findAll($criteria);
     Yii::app()->clientScript->registerCssFile($this->controller->_static_public . "/js/kindeditor/code/prettify.css");
     Yii::app()->clientScript->registerScriptFile($this->controller->_static_public . "/js/kindeditor/code/prettify.js", CClientScript::POS_END);
     $this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:21,代碼來源:IndexAction.php

示例4: run

 public function run()
 {
     $controller = $this->getController();
     $this->_setting = $controller->_setting;
     $this->_stylePath = $controller->_stylePath;
     $this->_static_public = $controller->_static_public;
     $controller->_seoTitle = Yii::t('common', 'User Center') . ' - ' . Yii::t('common', 'My Replys') . ' - ' . $this->_setting['site_name'];
     //加載css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/user.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     //我的回複
     $uid = Yii::app()->user->id;
     $comment_mod = new Comment();
     $reply_mod = new Reply();
     $model_type = new ModelType();
     $uid = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->condition = 't.user_id=' . $uid;
     $criteria->order = 't.id DESC';
     //分頁
     $count = $reply_mod->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 15;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $datalist = $reply_mod->findAll($criteria);
     foreach ((array) $datalist as $k => $v) {
         $reply = $comment_mod->findByPk($v->cid);
         if ($reply) {
             $c_mod_class = $controller->_content_models[$reply->type];
             $c_mod_name = strtolower($c_mod_class);
             $content_mod = new $c_mod_class();
             $content = $content_mod->findByPk($reply->topic_id);
             $datalist[$k]['title'] = $content->title;
             $datalist[$k]['url'] = $controller->createUrl($c_mod_name . '/view', array('id' => $reply->topic_id));
         }
     }
     $controller->render('my_replys', array('datalist' => $datalist));
 }
開發者ID:redtreelchao,項目名稱:wander-moon,代碼行數:39,代碼來源:MyreplysAction.php


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