Example #1
0
 */
require_once "modules/glpi/includes/xmlrpc.php";
require_once "modules/update/includes/utils.inc.php";
echo "<br/><br/>";
global $conf;
$maxperpage = $conf["global"]["maxperpage"];
if (isset($_GET["start"])) {
    $start = $_GET["start"];
} else {
    $start = 0;
}
$params = array('min' => $start, 'max' => $start + $maxperpage, 'filters' => array());
if (isset($_GET["filter"]) && $_GET["filter"]) {
    $params['like_filters']['name'] = $_GET["filter"];
}
extract(getAllEntitiesPowered($params));
if (!$count) {
    print _T('No entry found', 'glpi');
    return;
}
//  Listinfo params
$listinfoParams = array();
foreach ($data as $row) {
    $listinfoParams[] = array('id' => $row['id']);
}
$cols = listInfoFriendly($data);
$n = new OptimizedListInfos($cols['completename'], _T('Entity name', 'glpi'), '');
$n->first_elt_padding = '0';
$n->addExtraInfo($cols['comment'], _T("Comment", "glpi"));
$n->addActionItem(new ActionItem(_T("Edit entity", "glpi"), "addEntity", "edit", "entity", "base", "computers"));
//$n->addActionItem(new ActionPopupItem(_T("Delete", "glpi"), "deleteEntity", "delete", "id", "base", "computers"));
Example #2
0
            new NotifyWidgetSuccess(_T("The entity has been edited successfully.", "glpi"));
        }
    }
}
$page_title = _T("Add entity", 'glpi');
// Init form vars
$entity_name = '';
$parent = 1;
$description = '';
if (isset($_GET['id'])) {
    $page_title = _T("Edit entity", 'glpi');
    // Edition mode : init vars
    // Get the corresponding entity
    $params = array();
    $params['filters']['id'] = $_GET["id"];
    $result = getAllEntitiesPowered($params);
    if ($result['count'] != 1) {
        die('Unexpected error');
    }
    $entity = $result['data'][0];
    $entity_name = $entity['name'];
    $parent = $entity['entities_id'];
    $description = $entity['comment'];
}
$p = new PageGenerator($page_title);
$p->setSideMenu($sidemenu);
$p->display();
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T('Name', 'glpi'), new InputTpl('name')), array("value" => $entity_name, "required" => True));
$entities_select = new SelectItem("parent");