Software::showForm PHP Method

showForm() public method

Print the Software form
public showForm ( $ID, $options = [] ) : boolean
$ID integer ID of the item
$options array of possible options: - target filename : where to go when done. - withtemplate boolean : template or basic item
return boolean item found
    function showForm($ID, $options = array())
    {
        $this->initForm($ID, $options);
        $this->showFormHeader($options);
        $canedit = $this->canEdit($ID);
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Name') . "</td>";
        echo "<td>";
        Html::autocompletionTextField($this, "name");
        echo "</td>";
        echo "<td>" . __('Publisher') . "</td><td>";
        Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Location') . "</td><td>";
        Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
        echo "</td>";
        echo "<td>" . __('Category') . "</td><td>";
        SoftwareCategory::dropdown(array('value' => $this->fields["softwarecategories_id"]));
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Technician in charge of the hardware') . "</td><td>";
        User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
        echo "</td>";
        echo "<td>" . __('Associable to a ticket') . "</td><td>";
        Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Group in charge of the hardware') . "</td>";
        echo "<td>";
        Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
        echo "</td>";
        echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
        echo "<td class='center middle' rowspan='4'>";
        echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_1'>";
        echo "<td >" . __('User') . "</td>";
        echo "<td >";
        User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Group') . "</td><td>";
        Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
        echo "</td></tr>\n";
        // UPDATE
        echo "<tr class='tab_bg_1'>";
        //TRANS: a noun, (ex : this software is an upgrade of..)
        echo "<td>" . __('Upgrade') . "</td><td>";
        Dropdown::showYesNo("is_update", $this->fields['is_update']);
        echo "&nbsp;" . __('from') . "&nbsp;";
        Software::dropdown(array('value' => $this->fields["softwares_id"]));
        echo "</td></tr>\n";
        $this->showFormButtons($options);
        return true;
    }

Usage Example

Esempio n. 1
0
            $soft->redirectToList();
        } else {
            if (isset($_REQUEST["purge"])) {
                $soft->check($_REQUEST["id"], 'd');
                $soft->delete($_REQUEST, 1);
                Event::log($_REQUEST["id"], "software", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][24]);
                $soft->redirectToList();
            } else {
                if (isset($_POST["update"])) {
                    $soft->check($_POST["id"], 'w');
                    $soft->update($_POST);
                    Event::log($_POST["id"], "software", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
                    glpi_header($_SERVER['HTTP_REFERER']);
                } else {
                    if (isset($_POST["mergesoftware"])) {
                        popHeader($LANG['Menu'][4]);
                        if (isset($_POST["id"]) && isset($_POST["item"]) && is_array($_POST["item"]) && count($_POST["item"])) {
                            $soft->check($_POST["id"], 'w');
                            $soft->merge($_POST["item"]);
                        }
                        glpi_header($_SERVER['HTTP_REFERER']);
                    } else {
                        commonHeader($LANG['Menu'][4], $_SERVER['PHP_SELF'], "inventory", "software");
                        $soft->showForm($_GET["id"], array('withtemplate' => $_GET["withtemplate"]));
                        commonFooter();
                    }
                }
            }
        }
    }
}