Esempio n. 1
0
    $params['filters'] = $_GET["filter"];
}
// Receiving form data
if (isset($_POST['bconfirm'])) {
    if (!isset($_GET['numRule'])) {
        addEntityRule($_POST);
        if (!isXMLRPCError()) {
            new NotifyWidgetSuccess(_T("The entity rule has been added successfully.", "inventory"));
        }
    } else {
        addEntityRule($_POST);
        header('location: main.php?module=base&submod=computers&action=entityRules');
    }
}
$rule = array();
$datarule = parse_file_rule($params);
if (isset($_GET['numRule'])) {
    $regle = $_GET['numRule'];
    //edition rule mode
    foreach ($datarule['data'] as $val) {
        //echo $val['numRule'];
        if ($val['numRule'] == $regle) {
            $rule[] = $val;
            $exitrule = True;
        }
    }
} else {
    // add rule mode
    $rule[] = array("operand1" => "Network/IP", "operand2" => "/.*/", "entitie" => $entityroot, "aggregator" => "", "operator" => "match", "actif" => 1, "numRule" => $datarule['nb_regle'] + 1);
}
if (!isset($regle)) {
Esempio n. 2
0
require_once "modules/inventory/includes/xmlrpc.php";
require_once "modules/update/includes/utils.inc.php";
echo "<br/><br/>";
global $conf;
$maxperpage = $conf["global"]["maxperpage"];
$params = array('min' => $start, 'max' => $start + $maxperpage, 'filters' => array());
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
$params = array('min' => $start, 'max' => $start + $maxperpage, 'filters' => '');
if (isset($_GET["filter"]) && $_GET["filter"]) {
    $params['filters'] = $_GET["filter"];
}
extract(parse_file_rule($params));
if (!$count) {
    print _T('No entry found', 'inventory');
    return;
}
//  Listinfo params
$listinfoParams = array();
foreach ($data as $row) {
    $listinfoParams[] = array('numRule' => $row['numRule'], 'entitie' => $row['entitie']);
}
$cols = listInfoFriendly($data);
$n = new OptimizedListInfos($cols['numRule'], _T('Rule', 'inventory'), '', '10px');
$n->addExtraInfo($cols['actif'], _T('actif', 'inventory'));
$n->addExtraInfo($cols['entitie'], _T('entitie', 'inventory'));
$n->addExtraInfo($cols['aggregator'], _T('aggregator', 'inventory'));
$n->addExtraInfo($cols['operand1'], _T('lvalue', 'inventory'));