KnowbaseItem::searchForm PHP Method

searchForm() public method

Print out an HTML form for Search knowbase item
public searchForm ( $options ) : nothing
$options $_GET
return nothing (display the form)
    function searchForm($options)
    {
        global $CFG_GLPI;
        if (!$CFG_GLPI["use_public_faq"] && !Session::haveRightsOr(self::$rightname, array(READ, self::READFAQ))) {
            return false;
        }
        // Default values of parameters
        $params["contains"] = "";
        $params["target"] = $_SERVER['PHP_SELF'];
        if (is_array($options) && count($options)) {
            foreach ($options as $key => $val) {
                $params[$key] = $val;
            }
        }
        echo "<div>";
        echo "<form method='get' action='" . $this->getSearchURL() . "'>";
        echo "<table class='tab_cadre_fixe'>";
        echo "<tr class='tab_bg_2'><td class='right' width='50%'>";
        echo "<input type='text' size='50' name='contains' value=\"" . Html::cleanInputText(stripslashes($params["contains"])) . "\"></td>";
        echo "<td class='left'>";
        echo "<input type='submit' value=\"" . _sx('button', 'Search') . "\" class='submit'></td></tr>";
        echo "</table>";
        if (isset($options['item_itemtype']) && isset($options['item_items_id'])) {
            echo "<input type='hidden' name='item_itemtype' value='" . $options['item_itemtype'] . "'>";
            echo "<input type='hidden' name='item_items_id' value='" . $options['item_items_id'] . "'>";
        }
        Html::closeForm();
        echo "</div>";
    }

Usage Example

示例#1
0
// Affichage Module FAQ
//******************
$name = "";
checkFaqAccess();
if (getLoginUserID()) {
    helpHeader($LANG['Menu'][20], $_SERVER['PHP_SELF'], $_SESSION["glpiname"]);
} else {
    $_SESSION["glpilanguage"] = $CFG_GLPI['language'];
    // Anonymous FAQ
    simpleHeader($LANG['Menu'][20], array($LANG['Menu'][20] => $_SERVER['PHP_SELF']));
}
if (!isset($_GET["contains"])) {
    $_GET["contains"] = "";
}
if (!isset($_GET["knowbaseitemcategories_id"])) {
    $_GET["knowbaseitemcategories_id"] = 0;
}
if (isset($_GET["id"])) {
    $kb = new KnowbaseItem();
    if ($kb->getFromDB($_GET["id"])) {
        $kb->showFull(false);
    }
} else {
    KnowbaseItem::searchForm($_GET, 1);
    KnowbaseItemCategory::showFirstLevel($_GET, 1);
    KnowbaseItem::showList($_GET, 1);
    if (!$_GET["knowbaseitemcategories_id"] && strlen($_GET["contains"]) == 0) {
        KnowbaseItem::showViewGlobal($_SERVER['PHP_SELF'], 1);
    }
}
helpFooter();
All Usage Examples Of KnowbaseItem::searchForm