Esempio n. 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(getAllLocationsPowered($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('Location name', 'glpi'), '');
$n->first_elt_padding = '0';
$n->addExtraInfo($cols['comment'], _T("Comment", "glpi"));
$n->addActionItem(new ActionItem(_T("Edit location", "glpi"), "addLocation", "edit", "location", "base", "computers"));
//$n->addActionItem(new ActionPopupItem(_T("Delete", "glpi"), "deleteLocation", "delete", "id", "base", "computers"));
Esempio n. 2
0
    $params = array();
    $params['filters']['id'] = $_GET["id"];
    $result = getAllLocationsPowered($params);
    if ($result['count'] != 1) {
        die('Unexpected error');
    }
    $location = $result['data'][0];
    $location_name = $location['name'];
    $parent = $location['locations_id'];
    $description = $location['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" => $location_name, "required" => True));
// Location list
$locations_select = new SelectItem("parent");
$locations = getAllLocationsPowered(array());
$location_list = array();
foreach ($locations['data'] as $location) {
    $location_list[$location['id']] = $location['completename'];
}
$locations_select->setElements(array_values($location_list));
$locations_select->setElementsVal(array_keys($location_list));
$f->add(new TrFormElement(_T('Parent location', 'glpi'), $locations_select), array("value" => $parent, "required" => True));
$f->add(new TrFormElement(_T('Description', 'glpi'), new InputTpl('description')), array("value" => $description, "required" => True));
$f->pop();
$f->addValidateButton("bconfirm");
$f->display();