예제 #1
0
function plugin_monitoring_MassiveActionsDisplay($options = array())
{
    global $LANG, $CFG_GLPI;
    switch ($options['itemtype']) {
        case "Computer":
            switch ($options['action']) {
                case "plugin_monitoring_activatehosts":
                    $pmHost = new PluginMonitoringHost();
                    $a_list = $pmHost->find("`is_template`='1'");
                    $a_elements = array();
                    foreach ($a_list as $data) {
                        $a_elements[$data['id']] = $data['template_name'];
                    }
                    $rand = Dropdown::showFromArray("template_id", $a_elements);
                    echo "<img alt='' title=\"" . $LANG['buttons'][8] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'\n                     onClick=\"var w = window.open('" . $pmHost->getFormURL() . "?withtemplate=1&popup=1&amp;rand=" . $rand . "' ,'glpipopup', 'height=400, " . "width=1000, top=100, left=100, scrollbars=yes' );w.focus();\">";
                    echo "<input name='add' value='Post' class='submit' type='submit'>";
                    break;
            }
            break;
    }
    return "";
}
예제 #2
0
if ($_POST["idtable"] && class_exists($_POST["idtable"])) {
    $table = getTableForItemType($_POST["idtable"]);
    // Link to user for search only > normal users
    $link = "dropdownValue.php";
    $rand = mt_rand();
    $use_ajax = false;
    if ($CFG_GLPI["use_ajax"] && countElementsInTable($table) > $CFG_GLPI["ajax_limit_count"]) {
        $use_ajax = true;
    }
    $paramsallitems = array('searchText' => '__VALUE__', 'table' => $table, 'itemtype' => $_POST["idtable"], 'rand' => $rand, 'myname' => $_POST["myname"], 'displaywith' => array('otherserial', 'serial'), 'display_emptychoice' => true);
    if (isset($_POST['value'])) {
        $paramsallitems['value'] = $_POST['value'];
    }
    if (isset($_POST['entity_restrict'])) {
        $paramsallitems['entity_restrict'] = $_POST['entity_restrict'];
    }
    if (isset($_POST['condition'])) {
        $paramsallitems['condition'] = stripslashes($_POST['condition']);
    }
    $pmHost = new PluginMonitoringHost();
    $classname = $_POST['idtable'];
    $class = new $classname();
    $a_list = $pmHost->find("`itemtype`='" . $classname . "'");
    $a_elements = array();
    foreach ($a_list as $data) {
        $class->getFromDB($data['items_id']);
        $a_elements[$data['id']] = $class->getName();
    }
    asort($a_elements);
    Dropdown::showFromArray($_POST['myname'], $a_elements);
}