public function actionIndex() { $model = new CommentSpec('search'); $model->unsetAttributes(); if(!empty($_GET['CommentSpec'])) $model->attributes = $_GET['CommentSpec']; $criteria = new CDbCriteria; $criteria->condition = 'id_parent is null'; $dataProvider = $model->search($criteria); $dataProvider->pagination->pageSize = 25; $this->render('index', array( 'model'=>$model, 'dataProvider'=>$dataProvider )); }
<div class="vote text-right c9 active" style="margin-top:10px;" id="vote<?php echo $model->id; ?>"> <span class="c-gray f-11" style="margin-right:5px;">Полезен ли отзыв?</span> <span class="user_votes"><span onclick="toVoteSpec(<?php echo $model->id; ?>, 1);" class="user_pro"><i class="md md-thumb-up"></i></span> <span class="user_num"><?php echo $model->yes?$model->yes:' '; ?></span> <span class="user_contra" onclick="toVoteSpec(<?php echo $model->id; ?>, 0);"><i class="md md-thumb-down"></i></span> <span class="user_contra-num"><?php echo $model->no?$model->no:' '; ?></span></span></div> <?php } ?> </div> </div> <div class="row"> <div class="col-xs-12"> <?php if($showcommenttext == true){ $comments = new CommentSpec('search'); $comments->unsetAttributes(); if(!empty($model->user_id)){ $user_name = $model->user->fullname; } else { $user_name = $model->name; } if(!empty($_GET['CommentSpec'])) $comments->attributes = $_GET['CommentSpec']; $criteria = new CDbCriteria; $criteria->limit = 3; $criteria->with = array('user'); $criteria->condition = 't.object_pk='.$org_id.' and t.id_parent='.$model->id.' and t.status='.CommentSpec::STATUS_APPROVED; $dataProviderComments = new CActiveDataProvider('CommentSpec', array( 'criteria' => $criteria,