Пример #1
0
 public function actionAjaxListForRelatedModel($uniquePageId = null)
 {
     $getData = GetUtil::getData();
     $relatedModelId = ArrayUtil::getArrayValue($getData, 'relatedModelId');
     $relatedModelClassName = ArrayUtil::getArrayValue($getData, 'relatedModelClassName');
     $relatedModelRelationName = ArrayUtil::getArrayValue($getData, 'relatedModelRelationName');
     if (ArrayUtil::getArrayValue($getData, 'noPaging')) {
         $pageSize = null;
         $retrievalPageSize = null;
     } else {
         $pageSize = 5;
         $retrievalPageSize = $pageSize + 1;
     }
     $commentsData = Comment::getCommentsByRelatedModelTypeIdAndPageSize($relatedModelClassName, (int) $relatedModelId, $retrievalPageSize);
     $getParams = array('uniquePageId' => $uniquePageId, 'relatedModelId' => $relatedModelId, 'relatedModelClassName' => $relatedModelClassName, 'relatedModelRelationName' => $relatedModelRelationName);
     $relatedModel = $relatedModelClassName::getById((int) $relatedModelId);
     $view = new CommentsForRelatedModelView('default', 'comments', $commentsData, $relatedModel, $pageSize, $getParams, $uniquePageId);
     $content = $view->render();
     Yii::app()->getClientScript()->setToAjaxMode();
     Yii::app()->getClientScript()->render($content);
     echo $content;
 }
Пример #2
0
 protected function renderMissionCommentsContent()
 {
     $getParams = array('relatedModelId' => $this->model->id, 'relatedModelClassName' => get_class($this->model), 'relatedModelRelationName' => 'comments');
     $pageSize = 5;
     $commentsData = Comment::getCommentsByRelatedModelTypeIdAndPageSize(get_class($this->model), $this->modelId, $pageSize + 1);
     $view = new CommentsForRelatedModelView('default', 'comments', $commentsData, $this->model, $pageSize, $getParams);
     $content = $view->render();
     return $content;
 }
Пример #3
0
 private static function renderCommentsContent(SocialItem $model)
 {
     $getParams = array('uniquePageId' => self::makeUniquePageIdByModel($model), 'relatedModelId' => $model->id, 'relatedModelClassName' => 'SocialItem', 'relatedModelRelationName' => 'comments');
     $pageSize = 5;
     $commentsData = Comment::getCommentsByRelatedModelTypeIdAndPageSize('SocialItem', $model->id, $pageSize + 1);
     $view = new CommentsForRelatedModelView('default', 'comments', $commentsData, $model, $pageSize, $getParams, self::makeUniquePageIdByModel($model));
     $content = $view->render();
     return $content;
 }