/** * Intercept the usual page display and replace it with a * blog template controlled one. * * @param Doku_Event $event event object by reference * @param array $param empty array as passed to register_hook() * @return void|bool */ function handle_tpl_act_render(Doku_Event $event, $param) { global $ID; if ($event->data != 'show') { return false; } $pid = md5($ID); $this->entryhelper->load_by_pid($pid); if ($this->entryhelper->get_blog() == '') { return true; } // we can handle it $event->preventDefault(); $this->commenthelper->setPid($pid); $this->entryhelper->tpl_content($this->entryhelper->entry['blog'], 'entry'); return true; }
/** * Returns a reference to the comment helper plugin preloaded with * the current entry */ public function &getCommentHelper() { if (!$this->commenthelper) { $this->commenthelper = plugin_load('helper', 'blogtng_comments'); $this->commenthelper->setPid($this->entry['pid']); } return $this->commenthelper; }
/** * Displays a single entry and related actions * * @author Michael Klier <*****@*****.**> * * @param $entry * @param $query */ private function xhtml_entry_item($entry, $query) { global $lang; global $ID; static $class = 'odd'; ptln('<tr class="' . $class . '">'); $class = $class == 'odd' ? 'even' : 'odd'; ptln('<td class="entry_created">' . dformat($entry['created']) . '</td>'); ptln('<td class="entry_author">' . hsc($entry['author']) . '</td>'); ptln('<td class="entry_title">' . html_wikilink(':' . $entry['page'], $entry['title']) . '</td>'); ptln('<td class="entry_set_blog">' . $this->xhtml_entry_edit_form($entry, $query, 'blog') . '</th>'); ptln('<td class="entry_set_commentstatus">' . $this->xhtml_entry_edit_form($entry, $query, 'commentstatus') . '</th>'); $this->commenthelper->setPid($entry['pid']); // search comments of this entry link ptln('<td class="entry_comments">'); $count = $this->commenthelper->get_count(null, true); if ($count > 0) { $params = array('do' => 'admin', 'page' => 'blogtng', 'btng[admin]' => 'search', 'btng[query][filter]' => 'comment', 'btng[query][pid]' => $entry['pid']); ptln('<a href="' . wl($ID, $params) . '" title="' . $this->getLang('comments') . '">' . $count . '</a>'); } else { ptln($count); } ptln('</td>'); // tags filter links ptln('<td class="entry_tags">'); $this->taghelper->load($entry['pid']); $tags = $this->taghelper->getTags(); $count = count($tags); for ($i = 0; $i < $count; $i++) { $params = array('do' => 'admin', 'page' => 'blogtng', 'btng[admin]' => 'search', 'btng[query][filter]' => 'tags', 'btng[query][string]' => $tags[$i]); $link = '<a href="' . wl($ID, $params) . '" title="' . $tags[$i] . '">' . $tags[$i] . '</a>'; if ($i < $count - 1) { $link .= ', '; } ptln($link); } ptln('</td>'); // edit links ptln('<td class="entry_edit">'); $params = array('id' => $entry['page'], 'do' => 'edit'); ptln('<a href="' . wl($ID, $params) . '" class="blogtng_btn_edit" title="' . $lang['btn_secedit'] . '">' . $lang['btn_secedit'] . '</a>'); ptln('</td>'); ptln('</tr>'); }