public static function getComments(BaseObject $commentableObject, sfWebRequest $request) { $page = null; $comments = array(); if (sfNestedCommentConfig::isPagingEnabled()) { $page = $request->getParameter('comment-page', 1); } if (sfNestedCommentConfig::isNestedEnabled()) { $comments = $commentableObject->getApprovedCommentsLevel1(sfNestedCommentConfig::getMaxPerPageComment(), $page); } else { $comments = $commentableObject->getApprovedComments(sfNestedCommentConfig::getMaxPerPageComment(), $page); } return $comments; }
<?php use_stylesheet('/sfNestedCommentPlugin/css/commentPreview.css', 'last') ?> <?php use_stylesheet('/sfNestedCommentPlugin/css/jquery.textarearesizer.css', 'last') ?> <?php use_javascript('/sfNestedCommentPlugin/js/commentPreview.js', 'last') ?> <?php use_javascript('/sfNestedCommentPlugin/js/jquery.textarearesizer.compressed.js', 'last') ?> <?php endif; ?> <div id="respond"> <h3 id="replay-title"><?php echo __('Leave a reply') ?> <small><a href="#respond" id="cancel-comment-reply-link">Cancel Reply</a></small></h3> <form action="<?php echo url_for('@sf_nested_commend_add') ?>" name='add_comment' class='add_comment' id='sfNestedComment_add_comment_form' method="post"> <?php echo $commentForm ?> <div class="form-submit"> <input type="submit" value="<?php echo (__('Submit comment')) ?>" id="sumbit-comment" /> <?php if($use_ajax): ?> <input type="button" value="Preview" id="preview-comment-button" /> <span id="add-comment-loader" style="display:none;"><?php echo image_tag('/sfNestedCommentPlugin/images/loading.gif') ?></span> <?php endif; ?> </div> </form> <?php if($use_ajax): ?> <div class="lp-block" id="live-preview-display"> <div id="lp-comment"></div> </div> <?php endif; ?> </div> <?php if($use_ajax): ?> <?php use_javascript('/sfNestedCommentPlugin/js/commentForm.js') ?> <script type="text/javascript"> setupAjaxCommentForm(<?php echo sfNestedCommentConfig::isNestedEnabled() ?>); </script> <?php endif; ?>
<?php $use_ajax = sfNestedCommentConfig::isAjaxEnabled() ?> <?php $enable_nested = sfNestedCommentConfig::isNestedEnabled() ?> <?php if (sfNestedCommentConfig::isNestedEnabled()): ?> <?php use_helper('sfNestedCommentPagination') ?> <?php $url = $use_ajax ? '@sf_nested_comment_commenting' : $sf_request->getPathInfoPrefix().$sf_request->getPathInfo() ?> <?php echo comment_pagination($comments, $url, $sf_request->getParameterHolder(), 'Earlier Comments', 'Older Comments') ?> <?php $comments = $comments->getResults() ?> <?php endif; ?> <?php $renderer = sfNestedCommentTools::createCommentsRenderer($comments, $enable_nested) ?> <?php echo $renderer->render() ?>
<?php if (sfNestedCommentConfig::isUsePluginStylesheet()): ?> <?php use_stylesheet('/sfNestedCommentPlugin/css/sfNestedComment.css') ?> <?php endif; ?> <?php use_javascript('/sfNestedCommentPlugin/js/sfNestedComment.reply.js') ?> <?php $use_ajax = sfNestedCommentConfig::isAjaxEnabled() ?> <?php $enable_nested = sfNestedCommentConfig::isNestedEnabled() ?> <?php if($use_ajax): ?> <?php if($enable_nested): ?> <?php use_javascript('/sfNestedCommentPlugin/js/jCollapsible.js') ?> <?php endif; ?> <?php endif; ?> <div id="comments"> <div id="sfNestedComments"> <?php include_partial('sfNestedComment/comments', array('object' => $object, 'comments' => $comments, 'commentForm' => $commentForm)) ?> </div> </div> <?php if($use_ajax): ?> <?php use_javascript('/sfNestedCommentPlugin/js/listComments.js') ?> <?php if ($object instanceof sfOutputEscaper): ?> <?php $model = get_class($object->getRawValue()) ?> <?php else: ?> <?php $model = get_class($object) ?> <?php endif; ?> <script type="text/javascript"> setupAjaxListComments('<?php echo $model ?>', '<?php echo $object->getPrimaryKey() ?>', <?php echo sfNestedCommentConfig::isNestedEnabled() ?>); </script> <?php endif; ?>