public function templateNested(GWF_Guestbook $gb) { $gbid = $gb->getID(); $ipp = $this->module->cfgItemsPerPage(); $user = GWF_Session::getUser(); $can_moderate = $gb->canModerate($user); $mod = GWF_GuestbookMSG::IN_MODERATION; $msgs = GDO::table('GWF_GuestbookMSG'); $conditions = "gbm_gbid={$gbid} AND gbm_replyto=0"; $conditions .= $can_moderate ? '' : " AND gbm_options&{$mod}=0"; $nItems = $msgs->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(intval(Common::getGet('page', $nPages)), 1, $nPages); $gbid_app = $gbid === 1 ? '' : '/' . $gbid; # append $orderby = 'gbm_date ASC'; $from = GWF_PageMenu::getFrom($page, $ipp); $tVars = array('gb' => $gb, 'entries' => $this->getNestedEntries($gb, $msgs, $conditions, $ipp, $from), 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . 'guestbook/show' . $gbid_app . '/page-%PAGE%'), 'href_sign' => GWF_WEB_ROOT . 'guestbook/sign/' . $gbid, 'href_moderate' => GWF_WEB_ROOT . 'guestbook/edit/' . $gbid, 'can_moderate' => $can_moderate); return $this->module->templatePHP('show_nested.php', $tVars); }