Exemple #1
0
// Copyleft Erwan GOALOU 2010 (erwan(at)ocsinventory-ng(pt)org)
// Web: http://www.ocsinventory-ng.org
//
// This code is open source and may be copied and modified as long as the source
// code is always made freely available.
// Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
//====================================================================================
/*
 * Page des groupes
 * 
 */
require_once 'require/function_groups.php';
require_once 'require/function_computers.php';
//ADD new static group
if ($protectedPost['Valid_modif_x']) {
    $result = creat_group($protectedPost['NAME'], $protectedPost['DESCR'], '', '', 'STATIC');
    if ($result['RESULT'] == "ERROR") {
        msg_error($result['LBL']);
    } elseif ($result['RESULT'] == "OK") {
        msg_success($result['LBL']);
        unset($protectedPost['add_static_group']);
    }
    $tab_options['CACHE'] = 'RESET';
}
//reset add static group
if ($protectedPost['Reset_modif_x'] or $protectedPost['onglet'] != $protectedPost['old_onglet']) {
    unset($protectedPost['add_static_group']);
}
//view only your computers
if ($_SESSION['OCS']['RESTRICTION']['GUI'] == 'YES') {
    $mycomputers = computer_list_by_tag();
 } else {
     $group_type = "DYNAMIC";
 }
 //ajout a un groupe
 if ($protectedPost['NEW_RAZ'] == "ADD") {
     $nb_mach = add_computers_cache($list_id, $protectedPost['group_list'], 1);
     $msg_success = $l->g(973);
 }
 //suppression des machines du groupe en masse
 if ($protectedPost['NEW_RAZ'] == "DEL") {
     $nb_mach = remove_of_group($protectedPost['group_list'], $list_id);
     $msg_success = $l->g(971) . "<br>" . $l->g(972);
 }
 //Cr�ation d'un nouveau groupe
 if ($protectedPost['NEW_RAZ'] == "NEW") {
     $result = creat_group($protectedPost['NAME_GROUP'], $protectedPost['LBL_GROUP'], $list_id, $_SESSION['OCS']['SEARCH_SQL_GROUP'], $group_type);
     if ($result['RESULT'] == "ERROR") {
         $nb_mach = "ERROR";
     } else {
         $nb_mach = $result['LBL'];
     }
     $msg_success = $l->g(880);
 }
 //ecrasement d'un groupe
 if ($protectedPost['NEW_RAZ'] == "RAZ") {
     $nb_mach = replace_group($protectedPost['group_list'], $list_id, $_SESSION['OCS']['SEARCH_SQL_GROUP'], $group_type);
     $msg_success = $l->g(879);
 }
 if ($nb_mach == "ERROR") {
     $msg_error = $result['LBL'];
 } elseif (isset($nb_mach) and $protectedPost['NEW_RAZ'] != "DEL") {