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


PHP Reply::model方法代碼示例

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


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

示例1: run

 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //刪除
             Reply::model()->deleteAll($criteria);
             break;
         case 'show':
             //顯示
             Reply::model()->updateAll(['status' => Reply::STATUS_SHOW], $criteria);
             break;
         case 'hide':
             //隱藏
             Reply::model()->updateAll(['status' => Reply::STATUS_HIDE], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:28,代碼來源:BatchAction.php

示例2: actionIndex

 public function actionIndex()
 {
     $shop_id = Yii::app()->request->getParam('shop_id');
     if (!$shop_id) {
         Error::output(Error::ERR_NO_SHOPID);
     }
     //獲取該店的留言
     $criteria = new CDbCriteria();
     $criteria->order = 't.order_id DESC';
     $criteria->condition = 't.shop_id=:shop_id AND t.status=:status';
     $criteria->params = array(':shop_id' => $shop_id, ':status' => 1);
     $messageMode = Message::model()->with('members', 'shops', 'replys')->findAll($criteria);
     $message = array();
     foreach ($messageMode as $k => $v) {
         $message[$k] = $v->attributes;
         $message[$k]['shop_name'] = $v->shops->name;
         $message[$k]['user_name'] = $v->members->name;
         $message[$k]['create_time'] = date('Y-m-d H:i:s', $v->create_time);
         $message[$k]['status_text'] = Yii::app()->params['message_status'][$v->status];
         $message[$k]['status_color'] = Yii::app()->params['status_color'][$v->status];
         $_replys = Reply::model()->with('members')->findAll(array('condition' => 'message_id=:message_id', 'params' => array(':message_id' => $v->id)));
         if (!empty($_replys)) {
             foreach ($_replys as $kk => $vv) {
                 $message[$k]['replys'][$kk] = $vv->attributes;
                 $message[$k]['replys'][$kk]['create_time'] = date('Y-m-d H:i:s', $vv->create_time);
                 $message[$k]['replys'][$kk]['user_name'] = $vv->user_id == -1 ? '前台妹子說' : $vv->members->name;
             }
         }
     }
     Out::jsonOutput($message);
 }
開發者ID:RoyZeng,項目名稱:dinner,代碼行數:31,代碼來源:MessageController.php

示例3: loadModel

 /**
  * 判斷數據是否存在
  * 
  * return \$this->model
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (isset($_GET['id'])) {
             $this->model = Reply::model()->findbyPk($_GET['id']);
         }
         if ($this->model === null) {
             throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
         }
     }
     return $this->model;
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:17,代碼來源:ReplyController.php

示例4: run

 public function run()
 {
     $this->controller->layout = false;
     if (Yii::app()->request->isPostRequest) {
         //當前登錄用戶id
         $uid = Yii::app()->user->id;
         if (!$uid) {
             exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'You Need Login'))));
         }
         $cid = intval($_POST['cid']);
         $reply_id = intval($_POST['reply_id']);
         $content = $_POST['content'];
         $comment = Comment::model()->findByPk($cid);
         $reply = Reply::model()->findByPk($reply_id);
         if ($comment) {
             //不能對自己的評論和回複而回複
             if ($comment->user_id == $uid && !$reply || $reply && $reply->user_id == $uid) {
                 exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'You Can not Rely Yourself'))));
             }
             if (!$content || strlen($content) < 10) {
                 exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Content Is Too Small'))));
             }
             $model = new Reply('create');
             $model->cid = $cid;
             $model->user_id = $uid;
             $model->reply_id = $reply_id;
             $model->content = $content;
             $model->status = 'Y';
             $model->create_time = time();
             if ($model->save()) {
                 exit(CJSON::encode(array('status' => 'success', 'message' => Yii::t('common', 'Reply Success'))));
             } else {
                 exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Failed'))));
             }
         } else {
             exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Failed'))));
         }
     } else {
         exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Failed'))));
     }
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:41,代碼來源:ReplyAction.php

示例5: run

 public function run()
 {
     $this->controller->layout = false;
     $view_url = Yii::app()->request->getParam('view_url');
     $content_id = Yii::app()->request->getParam('content_id');
     $topic_type = Yii::app()->request->getParam('topic_type');
     $cur_url = Yii::app()->request->hostinfo . Yii::app()->request->getUrl();
     $post = false;
     //評論類型
     switch ($topic_type) {
         case 'post':
             $post = Post::model()->findByPk($content_id);
             break;
         case 'image':
             $post = Image::model()->findByPk($content_id);
             break;
         case 'soft':
             $post = Soft::model()->findByPk($content_id);
             break;
         case 'video':
             $post = Video::model()->findByPk($content_id);
             break;
     }
     if (!$post) {
         throw new CHttpException(404, Yii::t('admin', 'Loading Error'));
     }
     //評論內容
     $model = new Comment('create');
     $criteria = new CDbCriteria();
     $criteria->with = array('user');
     $criteria->addColumnCondition(array('content_id' => $content_id));
     $criteria->addColumnCondition(array('t.status' => Comment::STATUS_SHOW));
     $criteria->addColumnCondition(array('type' => $this->controller->_type_ids[$topic_type]));
     $criteria->addCondition('u.uid > 0');
     $criteria->order = 't.id DESC';
     $criteria->select = 't.id, user_id, content_id, content, t.create_time ';
     //分頁
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $comments = $model->findAll($criteria);
     //回複
     if ($comments) {
         foreach ($comments as $c) {
             $replies[$c->id] = Reply::model()->with('user')->findAll(array('condition' => 'cid = ' . $c->id . ' AND t.status = "' . Reply::STATUS_SHOW . '" AND u.uid > 0', 'order' => 'id'));
         }
     } else {
         $comments = array();
         $replies = array();
     }
     if (Yii::app()->request->isPostRequest) {
         $uid = Yii::app()->user->id;
         if (!$uid) {
             $this->message('script', Yii::t('common', 'You Need Login'));
         }
         $model->attributes = $_POST['Comment'];
         $model->content_id = $content_id;
         $model->type = $this->controller->_type_ids[$topic_type];
         $model->user_id = $uid;
         $model->status = 'N';
         $model->client_ip = Yii::app()->request->userHostAddress;
         $model->create_time = time();
         $ret_url = $_POST['ret_url'];
         if ($model->save()) {
             $this->controller->message('script', Yii::t('common', 'Submit Success, Waiting Pass'), $ret_url);
         }
     }
     $data = array('model' => $model, 'view_url' => $view_url, 'cur_url' => $cur_url, 'comments' => $comments, 'pagebar' => $pages, 'replies' => $replies);
     $this->controller->render('create', $data);
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:72,代碼來源:CreateAction.php

示例6: actionLookMenu

 public function actionLookMenu()
 {
     $shop_id = Yii::app()->request->getParam('shop_id');
     if (!isset($shop_id)) {
         throw new CHttpException(404, Yii::t('yii', '請選擇就餐類別'));
     }
     $resident_flag = Yii::app()->request->getParam('resident_flag');
     if (isset($resident_flag)) {
         throw new CHttpException(404, Yii::t('yii', '常駐員工每天每餐僅每次僅允許訂購一份!!'));
     }
     //查詢出改商店的一些詳細信息
     $shopData = Shops::model()->findByPk($shop_id);
     if (!$shopData) {
         throw new CHttpException(404, Yii::t('yii', '您選擇的餐類不存在!'));
     }
     $shopData = CJSON::decode(CJSON::encode($shopData));
     //判斷改商家有沒有下市場
     if (intval($shopData['status']) != 2) {
         throw new CHttpException(404, Yii::t('yii', '您選擇的餐類已經下市!'));
     }
     //根據訂單曆史紀錄查詢當天是否已經存在同樣的中餐、晚餐訂單記錄
     //店鋪->中餐、晚餐
     //菜單->地點
     //LCF
     $member_id = Yii::app()->user->member_userinfo['id'];
     $criteria = new CDbCriteria();
     $today = strtotime(date('Y-m-d'));
     $criteria->order = 't.create_time DESC';
     $criteria->select = '*';
     $criteria->condition = 'food_user_id=:food_user_id AND shop_id = :shop_id AND create_time > :create_time AND status < :status';
     $criteria->params = array(':food_user_id' => $member_id, ':shop_id' => $shop_id, ':create_time' => $today, ':status' => 3);
     //查詢結果
     $todayOrderCount = FoodOrder::model()->count($criteria);
     $memberInfo = Members::model()->find('id=:id', array(':id' => Yii::app()->user->member_userinfo['id']));
     if ($memberInfo->resident == 1 && $todayOrderCount >= 1) {
         throw new CHttpException(404, Yii::t('yii', '你今天已經訂過該餐了!!常駐員工每天每餐僅每次僅允許訂購一份!!'));
     }
     //根據店鋪id查詢出該店鋪的菜單
     $menuData = Menus::model()->with('food_sort', 'image', 'shops')->findAll(array('condition' => 't.shop_id=:shop_id AND t.status=:status', 'params' => array(':shop_id' => $shop_id, ':status' => 2)));
     $data = array();
     foreach ($menuData as $k => $v) {
         $data[$k] = $v->attributes;
         $data[$k]['index_pic'] = $v->index_pic ? Yii::app()->params['img_url'] . $v->image->filepath . $v->image->filename : '';
         $data[$k]['sort_name'] = $v->food_sort->name;
         $data[$k]['shop_name'] = $v->shops->name;
         $data[$k]['create_time'] = Yii::app()->format->formatDate($v->create_time);
         $data[$k]['status'] = Yii::app()->params['menu_status'][$v->status];
         $data[$k]['price'] = $v->price;
     }
     //獲取該店的留言
     $criteria = new CDbCriteria();
     $criteria->order = 't.order_id DESC';
     $criteria->condition = 't.shop_id=:shop_id AND t.status=:status';
     $criteria->params = array(':shop_id' => $shop_id, ':status' => 1);
     $count = Message::model()->count($criteria);
     //構建分頁
     $pages = new CPagination($count);
     $pages->pageSize = Yii::app()->params['pagesize'];
     $pages->applyLimit($criteria);
     $messageMode = Message::model()->with('members', 'shops', 'replys')->findAll($criteria);
     $message = array();
     foreach ($messageMode as $k => $v) {
         $message[$k] = $v->attributes;
         $message[$k]['shop_name'] = $v->shops->name;
         $message[$k]['user_name'] = $v->members->name;
         $message[$k]['create_time'] = date('Y-m-d H:i:s', $v->create_time);
         $message[$k]['status_text'] = Yii::app()->params['message_status'][$v->status];
         $message[$k]['status_color'] = Yii::app()->params['status_color'][$v->status];
         $_replys = Reply::model()->with('members')->findAll(array('condition' => 'message_id=:message_id', 'params' => array(':message_id' => $v->id)));
         if (!empty($_replys)) {
             foreach ($_replys as $kk => $vv) {
                 $message[$k]['replys'][$kk] = $vv->attributes;
                 $message[$k]['replys'][$kk]['create_time'] = date('Y-m-d H:i:s', $vv->create_time);
                 $message[$k]['replys'][$kk]['user_name'] = $vv->user_id == -1 ? '行政MM說' : $vv->members->name;
             }
         }
     }
     $this->render('lookmenu', array('menus' => $data, 'shop' => $shopData, 'pages' => $pages, 'message' => $message));
 }
開發者ID:elite-lcf,項目名稱:mictfood,代碼行數:79,代碼來源:SiteController.php

示例7: array

?>
</span></p>
        <p>Posted: <span><?php 
echo CHtml::encode($data['date_created']);
?>
</span></p>
    </div>

    <div class="media-body well">
        <div class="forum-text-area">

            <?php 
if ($data['child_reply']) {
    ?>
                <?php 
    $childReply = Reply::model()->getChildReplyPosting($data['child_reply']);
    $this->widget('bootstrap.widgets.TbBox', array('title' => "In reply to <a href='#'>" . PostHelper::PrintPosterName($childReply['username'], $childReply['user_group_id']) . "</a>", 'headerIcon' => 'icon-arrow-left', 'content' => $childReply['is_active'] ? CHtml::decode($childReply['message']) : PostHelper::PrintDisabledMessage()));
    ?>
            <?php 
}
?>

            <?php 
echo $data['is_active'] ? CHtml::decode($data['message']) : PostHelper::PrintDisabledMessage();
?>
        </div>
        
        <?php 
if ($data['is_active']) {
    ?>
           
開發者ID:aakbar24,項目名稱:CollegeCorner_Ver_2.0,代碼行數:30,代碼來源:_post.php

示例8: foreach

        ?>
				<ul class="reply_list clear">					
					<?php 
        $position = 1;
        ?>
					<?php 
        foreach ((array) $replies[$comment->id] as $reply) {
            ?>
								
					<li class="clear">
						<?php 
            $user = User::model()->findByPk($reply->user_id);
            ?>
	
						<?php 
            $rto = Reply::model()->findByPk($reply->reply_id);
            ?>
						<?php 
            $ruser = User::model()->findByPk($rto->user_id);
            ?>
	
						<div class="comment_desc">							
							<p class="desc_head">
								<img width="20" <?php 
            if ($user && $user->avatar) {
                ?>
 src="<?php 
                echo $user->avatar;
                ?>
" <?php 
            } else {
開發者ID:redtreelchao,項目名稱:wander-moon,代碼行數:31,代碼來源:create.php

示例9: actionBatch

 /**
  * 批量操作
  *
  */
 public function actionBatch()
 {
     if ($this->method() == 'GET') {
         $command = trim($_GET['command']);
         $ids = intval($_GET['id']);
     } else {
         if ($this->method() == 'POST') {
             $command = trim($_POST['command']);
             $ids = $_POST['id'];
         } else {
             $this->message('errorBack', Yii::t('admin', 'Only POST Or GET'));
         }
     }
     empty($ids) && $this->message('error', Yii::t('admin', 'No Select'));
     switch ($command) {
         case 'delete':
             //刪除回複
             foreach ((array) $ids as $id) {
                 $replyModel = Reply::model()->findByPk($id);
                 if ($replyModel) {
                     $replyModel->delete();
                 }
             }
             break;
         case 'verify':
             //回複審核通過
             foreach ((array) $ids as $id) {
                 $replyModel = Reply::model()->findByPk($id);
                 if ($replyModel) {
                     $replyModel->status = 'Y';
                     $replyModel->save();
                 }
             }
             break;
         case 'unVerify':
             //回複取消審核
             foreach ((array) $ids as $id) {
                 $replyModel = Reply::model()->findByPk($id);
                 if ($replyModel) {
                     $replyModel->status = 'N';
                     $replyModel->save();
                 }
             }
             break;
         default:
             throw new CHttpException(404, Yii::t('admin', 'Error Operation'));
             break;
     }
     $this->message('success', Yii::t('admin', 'Batch Operate Success'), $this->createUrl('index'));
 }
開發者ID:redtreelchao,項目名稱:wander-moon,代碼行數:54,代碼來源:ReplyController.php

示例10: actionDisableReply

 public function actionDisableReply($reply_id, $complaint_id)
 {
     if ($reply_id) {
         $reply = Reply::model()->findByPk($reply_id);
         $reply->is_active = 0;
         $reply->save();
         Complaint::model()->deleteByPk($complaint_id);
     } else {
         $thread = PostItem::model()->findByPk(Complaint::model()->findByPk($complaint_id)->post_item_id);
         $thread->is_active = $thread->is_active ? 0 : 1;
         $thread->save(false);
     }
     if (!Yii::app()->request->isAjaxRequest) {
         $this->redirect(array('admin'));
     }
 }
開發者ID:aakbar24,項目名稱:CollegeCorner_Ver_2.0,代碼行數:16,代碼來源:ComplaintController.php

示例11: getReplyid

 public function getReplyid($mid)
 {
     $next = Reply::model()->findAll(array('order' => 'rid DESC', 'condition' => '(uid=:x or sid=:y) and mid=:z', 'params' => array(':x' => Yii::app()->user->id, ':y' => Yii::app()->user->id, ':z' => $mid)));
     if ($next != NULL) {
         return $next[0]['rid'];
     } else {
         return $mid;
     }
 }
開發者ID:SoftScape,項目名稱:open-school-CE,代碼行數:9,代碼來源:Message1.php

示例12: actionLookMenu

 public function actionLookMenu()
 {
     $shop_id = Yii::app()->request->getParam('shop_id');
     if (!isset($shop_id)) {
         throw new CHttpException(404, Yii::t('yii', '請選擇一家餐廳'));
     }
     //查詢出改商店的一些詳細信息
     $shopData = Shops::model()->findByPk($shop_id);
     if (!$shopData) {
         throw new CHttpException(404, Yii::t('yii', '您選擇的這家餐廳不存在'));
     }
     $shopData = CJSON::decode(CJSON::encode($shopData));
     //判斷改商家有沒有下市場
     if (intval($shopData['status']) != 2) {
         throw new CHttpException(404, Yii::t('yii', '您選擇的這家餐廳不存在或者已經倒閉了!'));
     }
     //根據店鋪id查詢出該店鋪的菜單
     $menuData = Menus::model()->with('food_sort', 'image', 'shops')->findAll(array('condition' => 't.shop_id=:shop_id AND t.status=:status', 'params' => array(':shop_id' => $shop_id, ':status' => 2)));
     $data = array();
     foreach ($menuData as $k => $v) {
         $data[$k] = $v->attributes;
         $data[$k]['index_pic'] = $v->index_pic ? Yii::app()->params['img_url'] . $v->image->filepath . $v->image->filename : '';
         $data[$k]['sort_name'] = $v->food_sort->name;
         $data[$k]['shop_name'] = $v->shops->name;
         $data[$k]['create_time'] = Yii::app()->format->formatDate($v->create_time);
         $data[$k]['status'] = Yii::app()->params['menu_status'][$v->status];
         $data[$k]['price'] = $v->price;
     }
     //獲取該店的留言
     $criteria = new CDbCriteria();
     $criteria->order = 't.order_id DESC';
     $criteria->condition = 't.shop_id=:shop_id AND t.status=:status';
     $criteria->params = array(':shop_id' => $shop_id, ':status' => 1);
     $count = Message::model()->count($criteria);
     //構建分頁
     $pages = new CPagination($count);
     $pages->pageSize = Yii::app()->params['pagesize'];
     $pages->applyLimit($criteria);
     $messageMode = Message::model()->with('members', 'shops', 'replys')->findAll($criteria);
     $message = array();
     foreach ($messageMode as $k => $v) {
         $message[$k] = $v->attributes;
         $message[$k]['shop_name'] = $v->shops->name;
         $message[$k]['user_name'] = $v->members->name;
         $message[$k]['create_time'] = date('Y-m-d H:i:s', $v->create_time);
         $message[$k]['status_text'] = Yii::app()->params['message_status'][$v->status];
         $message[$k]['status_color'] = Yii::app()->params['status_color'][$v->status];
         $_replys = Reply::model()->with('members')->findAll(array('condition' => 'message_id=:message_id', 'params' => array(':message_id' => $v->id)));
         if (!empty($_replys)) {
             foreach ($_replys as $kk => $vv) {
                 $message[$k]['replys'][$kk] = $vv->attributes;
                 $message[$k]['replys'][$kk]['create_time'] = date('Y-m-d H:i:s', $vv->create_time);
                 $message[$k]['replys'][$kk]['user_name'] = $vv->user_id == -1 ? '前台妹子說' : $vv->members->name;
             }
         }
     }
     $this->render('lookmenu', array('menus' => $data, 'shop' => $shopData, 'pages' => $pages, 'message' => $message));
 }
開發者ID:RoyZeng,項目名稱:dinner,代碼行數:58,代碼來源:SiteController.php


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