コード例 #1
0
 public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         return PluginConsumablesMenu::getMenuName(2);
     }
     return '';
 }
コード例 #2
0
ファイル: hook.php プロジェクト: AircraftRu/consumables
function plugin_consumables_uninstall()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/consumables/inc/profile.class.php";
    include_once GLPI_ROOT . "/plugins/consumables/inc/menu.class.php";
    $tables = array("glpi_plugin_consumables_profiles", "glpi_plugin_consumables_requests");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $options = array('itemtype' => 'PluginConsumablesRequest', 'event' => 'ConsumableRequest', 'FIELDS' => 'id');
    $notif = new Notification();
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginConsumablesRequest', 'event' => 'ConsumableResponse', 'FIELDS' => 'id');
    $notif = new Notification();
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
    $options = array('itemtype' => 'PluginConsumablesRequest', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notificationtemplates', $options) as $data) {
        $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id');
        foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) {
            $translation->delete($data_template);
        }
        $template->delete($data);
    }
    // Delete rights associated with the plugin
    $profileRight = new ProfileRight();
    foreach (PluginConsumablesProfile::getAllRights() as $right) {
        $profileRight->deleteByCriteria(array('name' => $right['field']));
    }
    PluginConsumablesMenu::removeRightsFromSession();
    PluginConsumablesProfile::removeRightsFromSession();
    return true;
}