Exemple #1
0
 public function templateComments(Module_Comments $mod_c, GWF_News $news, GWF_Comments $comments)
 {
     $ipp = 10;
     $cid = $comments->getID();
     $nItems = $comments->getVar('cmts_count');
     $nPages = GWF_PageMenu::getPagecount($ipp, $nItems);
     $page = Common::clamp(Common::getGetInt('cpage'), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     // Method
     $me = $mod_c->getMethod('Reply');
     $me instanceof Comments_Reply;
     $where = "cmt_cid={$cid}";
     $with_perms = !GWF_User::isInGroupS('moderator');
     if ($with_perms) {
         $visible = GWF_Comment::VISIBLE;
         $deleted = GWF_Comment::DELETED;
         $flags = $visible | $deleted;
         $where .= " cmt_options & {$flags} = {$visible}";
     }
     $c = GDO::table('GWF_Comment')->selectObjects('*', 'cmt_cid=' . $comments->getID(), 'cmt_date ASC', $ipp, $from);
     $href = GWF_WEB_ROOT . 'news-comments-' . $news->getID() . '-' . $news->displayTitle() . '-page-' . $page . '.html';
     $hrefp = GWF_WEB_ROOT . 'news-comments-' . $news->getID() . '-' . $news->displayTitle() . '-page-%PAGE%.html';
     $tVars = array('news' => $news, 'newsitem' => Module_News::displayBoxB(array($news)), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $hrefp), 'comments' => $comments->displayComments($c, $href), 'form' => $me->templateReply($href));
     return $this->module->template('comments.tpl', $tVars);
 }