当前位置: 首页>>代码示例>>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;未经允许,请勿转载。