Esempio n. 1
0
function plugin_itilcategorygroups_uninstall()
{
    include_once GLPI_ROOT . "/plugins/itilcategorygroups/inc/category_group.class.php";
    include_once GLPI_ROOT . "/plugins/itilcategorygroups/inc/category.class.php";
    include_once GLPI_ROOT . "/plugins/itilcategorygroups/inc/group_level.class.php";
    PluginItilcategorygroupsCategory_Group::uninstall();
    PluginItilcategorygroupsCategory::uninstall();
    PluginItilcategorygroupsGroup_Level::uninstall();
    return true;
}
 function post_updateItem($history = 1)
 {
     // quick fix :
     if (isset($_REQUEST['massiveaction'])) {
         return;
     }
     $cat_group = new PluginItilcategorygroupsCategory_Group();
     for ($lvl = 1; $lvl <= 4; $lvl++) {
         if ($this->input["view_all_lvl{$lvl}"] != 1) {
             //delete old groups values
             $found_cat_groups = $cat_group->find("itilcategories_id = " . $this->input["itilcategories_id"] . " AND level = {$lvl}");
             foreach ($found_cat_groups as $id => $current_cat_group) {
                 $cat_group->delete(array('id' => $current_cat_group['id']));
             }
             //insert new saved
             if (isset($this->input["groups_id_level{$lvl}"])) {
                 foreach ($this->input["groups_id_level{$lvl}"] as $groups_id) {
                     $cat_group->add(array('plugin_itilcategorygroups_categories_id' => $this->input["id"], 'level' => $lvl, 'itilcategories_id' => $this->input["itilcategories_id"], 'groups_id' => $groups_id));
                 }
             }
         }
     }
 }