grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026. -------------------------------------------------------------------------- */ /** @file * @brief */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } /** * Knowbase Class * * @since version 0.84 **/ class Knowbase extends CommonGLPI { static function getTypeName($nb=0) { // No plural return __('Knowledge base'); } function defineTabs($options=array()) { $ong = array(); $this->addStandardTab(__CLASS__, $ong, $options); $ong['no_all_tab'] = true; return $ong; } function getTabNameForItem(CommonGLPI $item, $withtemplate=0) { if ($item->getType() == __CLASS__) { $tabs[1] = _x('button', 'Search'); $tabs[2] = _x('button', 'Browse'); if (KnowbaseItem::canUpdate()) { $tabs[3] = _x('button', 'Manage'); } return $tabs; } return ''; } static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { if ($item->getType() == __CLASS__) { switch ($tabnum) { case 1 : // all $item->showSearchView(); break; case 2 : $item->showBrowseView(); break; case 3 : $item->showManageView(); break; } } return true; } /** * Show the knowbase search view **/ static function showSearchView() { // Search a solution if (!isset($_GET["contains"]) && isset($_GET["itemtype"]) && isset($_GET["items_id"])) { if ($item = getItemForItemtype($_GET["itemtype"])) { if ($item->getFromDB($_GET["items_id"])) { $_GET["contains"] = addslashes($item->getField('name')); } } } if (isset($_GET["contains"])) { $_SESSION['kbcontains'] = $_GET["contains"]; } else if (isset($_SESSION['kbcontains'])) { $_GET['contains'] = $_SESSION["kbcontains"]; } $ki = new KnowbaseItem(); $ki->searchForm($_GET); if (!isset($_GET['contains']) || empty($_GET['contains'])) { echo "
| "; KnowbaseItem::showRecentPopular("recent"); echo " | "; KnowbaseItem::showRecentPopular("lastupdate"); echo " | "; KnowbaseItem::showRecentPopular("popular"); echo " |