showForm() public method

Print out an HTML "
" for knowbase item
public showForm ( $ID, $options = [] ) : nothing
$ID
$options array - target for the Form
return nothing (display the form)
Esempio n. 1
0
             $item->add($_POST);
             Event::log($_POST["knowbaseitems_id"], "knowbaseitem", 4, "tools", sprintf(__('%s adds a target'), $_SESSION["glpiname"]));
         }
     }
     Html::back();
 } else {
     if (isset($_GET["id"])) {
         if (isset($_GET["_in_modal"])) {
             Html::popHeader(__('Knowledge base'), $_SERVER['PHP_SELF']);
             $kb = new KnowbaseItem();
             if ($_GET['id']) {
                 $kb->check($_GET["id"], READ);
                 $kb->showFull();
             } else {
                 // New item
                 $kb->showForm($_GET["id"], $_GET);
             }
             Html::popFooter();
         } else {
             // modifier un item dans la base de connaissance
             $kb->check($_GET["id"], READ);
             if (Session::getLoginUserID()) {
                 if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
                     Html::header(KnowbaseItem::getTypeName(1), $_SERVER['PHP_SELF'], "tools", "knowbaseitem");
                 } else {
                     Html::helpHeader(__('FAQ'), $_SERVER['PHP_SELF']);
                 }
                 Html::helpHeader(__('FAQ'), $_SERVER['PHP_SELF'], $_SESSION["glpiname"]);
             } else {
                 $_SESSION["glpilanguage"] = $CFG_GLPI['language'];
                 // Anonymous FAQ
if (!isset($_GET["removefromfaq"])) {
    $_GET["removefromfaq"] = "";
}
$kb = new KnowbaseItem();
if ($_GET["id"] == "new") {
    // on affiche le formulaire de saisie de l'item
    $kb->check(-1, 'w');
    commonHeader($LANG['title'][5], $_SERVER['PHP_SELF'], "utils", "knowbase");
    $available_options = array('tickets_id');
    $options = array();
    foreach ($available_options as $key) {
        if (isset($_GET[$key])) {
            $options[$key] = $_GET[$key];
        }
    }
    $kb->showForm("", $options);
    commonFooter();
} else {
    if (isset($_POST["add"])) {
        // ajoute un item dans la base de connaisssances
        $kb->check(-1, 'w', $_POST);
        $newID = $kb->add($_POST);
        Event::log($newID, "knowbaseitem", 5, "tools", $_SESSION["glpiname"] . " " . $LANG['log'][20]);
        glpi_header($CFG_GLPI["root_doc"] . "/front/knowbaseitem.php");
    } else {
        if (isset($_POST["update"])) {
            // actualiser  un item dans la base de connaissances
            $kb->check($_POST["id"], 'w');
            $kb->update($_POST);
            Event::log($_POST["id"], "knowbaseitem", 5, "tools", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
            glpi_header($CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=" . $_POST['id']);