Computer_Item::dropdownAllConnect PHP Method

dropdownAllConnect() static public method

Make a select box for connections
static public dropdownAllConnect ( $fromtype, $myname, $entity_restrict, $onlyglobal, $used = [] ) : nothing
$fromtype from where the connection is
$myname select name
$entity_restrict Restrict to a defined entity (default = -1)
$onlyglobal display only global devices (used for templates) (default 0)
$used array Already used items ID: not to display in dropdown
return nothing (print out an HTML select box)
    static function dropdownAllConnect($fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = array())
    {
        global $CFG_GLPI;
        $rand = mt_rand();
        $options = array();
        $options['checkright'] = true;
        $options['name'] = 'itemtype';
        $rand = Dropdown::showItemType($CFG_GLPI['directconnect_types'], $options);
        if ($rand) {
            $params = array('itemtype' => '__VALUE__', 'fromtype' => $fromtype, 'value' => 0, 'myname' => $myname, 'onlyglobal' => $onlyglobal, 'entity_restrict' => $entity_restrict, 'used' => $used);
            if ($onlyglobal) {
                $params['condition'] = "`is_global` = '1'";
            }
            Ajax::updateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_{$myname}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/dropdownConnect.php", $params);
            echo "<br><div id='show_{$myname}{$rand}'>&nbsp;</div>\n";
        }
        return $rand;
    }