public function listen_quicksearchDropdownFoundItems(TBGEvent $event) { $searchterm = $event->getSubject(); list($resultcount, $articles) = TBGWikiArticle::findByArticleNameAndProject($searchterm, TBGContext::getCurrentProject()); TBGActionComponent::includeTemplate('publish/quicksearch_dropdown_founditems', array('searchterm' => $searchterm, 'articles' => $articles, 'resultcount' => $resultcount)); }
/** * Returns the HTML output from a template, but doesn't render it * * @param string $template the template name * @param array $params template parameters * * @return boolean */ public static function returnTemplateHTML($template, $params = array()) { $current_content = ob_get_clean(); ob_start(); echo TBGActionComponent::includeTemplate($template, $params); $template_content = ob_get_clean(); ob_start(); echo $current_content; return $template_content; }
/** * Includes a template with specified parameters * * @param string $template name of template to load, or module/template to load * @param array $params key => value pairs of parameters for the template */ function include_template($template, $params = array()) { return TBGActionComponent::includeTemplate($template, $params); }
public function listen_viewissue_panel(TBGEvent $event) { if (TBGContext::getModule('vcs_integration')->getSetting('vcs_mode_' . TBGContext::getCurrentProject()->getID()) == TBGVCSIntegration::MODE_DISABLED) { return; } $links = TBGVCSIntegrationIssueLink::getCommitsByIssue($event->getSubject()); TBGActionComponent::includeTemplate('vcs_integration/viewissue_commits', array('links' => $links, 'projectId' => $event->getSubject()->getProject()->getID())); }
public function listen_viewissue_panel(TBGEvent $event) { $web_path = $this->getSetting('web_path_' . $event->getSubject()->getProject()->getID()); $web_repo = $this->getSetting('web_repo_' . $event->getSubject()->getProject()->getID()); if (empty($web_repo) || empty($web_path)) { return; } $data = TBGVCSIntegrationTable::getTable()->getCommitsByIssue($event->getSubject()->getId()); if (!is_array($data)) { TBGActionComponent::includeTemplate('vcs_integration/viewissue_commits_top', array('items' => false)); } else { TBGActionComponent::includeTemplate('vcs_integration/viewissue_commits_top', array('items' => true)); /* Now produce each box */ foreach ($data as $revno => $entry) { $revision = $revno; /* Build correct URLs */ switch ($this->getSetting('web_type_' . $event->getSubject()->getProject()->getID())) { case 'viewvc': $link_rev = $web_path . '/' . '?root=' . $web_repo . '&view=rev&revision=' . $revision; break; case 'viewvc_repo': $link_rev = $web_path . '/' . '?view=rev&revision=' . $revision; break; case 'websvn': $link_rev = $web_path . '/revision.php?repname=' . $web_repo . '&isdir=1&rev=' . $revision; break; case 'websvn_mv': $link_rev = $web_path . '/' . '?repname=' . $web_repo . '&op=log&isdir=1&rev=' . $revision; break; case 'loggerhead': $link_rev = $web_path . '/' . $web_repo . '/revision/' . $revision; break; case 'gitweb': $link_rev = $web_path . '/' . '?p=' . $web_repo . ';a=commitdiff;h=' . $revision; break; case 'cgit': $link_rev = $web_path . '/' . $web_repo . '/commit/?id=' . $revision; break; case 'hgweb': $link_rev = $web_path . '/' . $web_repo . '/rev/' . $revision; break; case 'github': $link_rev = 'http://github.com/' . $web_repo . '/commit/' . $revision; break; case 'gitorious': $link_rev = $web_path . '/' . $web_repo . '/commit/' . $revision; break; } /* Now we have everything, render the template */ include_template('vcs_integration/commitbox', array("projectId" => $event->getSubject()->getProject()->getID(), "id" => $entry[0][0], "revision" => $revision, "author" => $entry[0][1], "date" => $entry[0][2], "log" => $entry[0][3], "files" => $entry[1])); } TBGActionComponent::includeTemplate('vcs_integration/viewissue_commits_bottom'); } }
public function listen_projectconfig_panel(TBGEvent $event) { TBGActionComponent::includeTemplate('mailing/projectconfig_panel', array('selected_tab' => $event->getParameter('selected_tab'), 'access_level' => $event->getParameter('access_level'), 'project' => $event->getParameter('project'))); }
/** * Returns the HTML output from a template, but doesn't render it * * @param string $template the template name * @param array $params template parameters * * @return boolean */ public static function returnTemplateHTML($template, $params = array()) { $current_content = ob_get_clean(); TBGContext::isCLI() ? ob_start() : ob_start('mb_output_handler'); echo TBGActionComponent::includeTemplate($template, $params); $template_content = ob_get_clean(); TBGContext::isCLI() ? ob_start() : ob_start('mb_output_handler'); echo $current_content; return $template_content; }