Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / plugins / pdf / inc / plugin_pdf.config.function.php @ 7b214c36

Historique | Voir | Annoter | Télécharger (2,81 ko)

1
<?php
2
/*
3
  ----------------------------------------------------------------------
4
  GLPI - Gestionnaire Libre de Parc Informatique
5
  Copyright (C) 2003-2008 by the INDEPNET Development Team.
6
  
7
  http://indepnet.net/   http://glpi-project.org/
8
  ----------------------------------------------------------------------
9
  
10
  LICENSE
11
  
12
  This file is part of GLPI.
13
  
14
  GLPI is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
16
  the Free Software Foundation; either version 2 of the License, or
17
  (at your option) any later version.
18
  
19
  GLPI is distributed in the hope that it will be useful,
20
  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
  GNU General Public License for more details.
23
  
24
  You should have received a copy of the GNU General Public License
25
  along with GLPI; if not, write to the Free Software
26
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
  ------------------------------------------------------------------------
28
 */
29

    
30
// ----------------------------------------------------------------------
31
// Original Author of file: Balpe Dévi
32
// Purpose of file:
33
// ----------------------------------------------------------------------
34

    
35
if (!defined('GLPI_ROOT')){
36
        die("Sorry. You can't access directly to this file");
37
        }
38

    
39
include_once (GLPI_ROOT . "/inc/includes.php");
40
        
41
function plugin_pdf_Install() {
42
        $DB = new DB;
43
                        
44
        $query= "CREATE TABLE IF NOT EXISTS `glpi_plugin_pdf_profiles` (
45
          `ID` int(11),
46
          `profile` varchar(255) default 0,
47
          `use` tinyint(1) default 0,
48
          PRIMARY KEY  (`ID`)
49
        ) ENGINE=MyISAM;";
50
                        
51
        $DB->query($query) or die($DB->error());        
52

    
53
        $query= "CREATE TABLE IF NOT EXISTS `glpi_plugin_pdf_preference` (
54
          `id` int(11) NOT NULL auto_increment,
55
          `user_id` int(11) NOT NULL,
56
          `cat` varchar(255) NOT NULL,
57
          `table_num` int(11) NOT NULL default -1,
58
          PRIMARY KEY  (`id`)
59
        ) ENGINE=MyISAM;";
60
                        
61
        $DB->query($query) or die($DB->error());
62
}
63

    
64
function plugin_pdf_uninstall() {
65
        $DB = new DB;
66
                
67
        $query = "DROP TABLE `glpi_plugin_pdf_preference`;";
68
        $DB->query($query) or die($DB->error());
69

    
70
        $query = "DROP TABLE `glpi_plugin_pdf_profiles`;";
71
        $DB->query($query) or die($DB->error());
72
}
73

    
74
function plugin_pdf_initSession()
75
{
76
        if (TableExists("glpi_plugin_pdf_profiles"))
77
                $_SESSION["glpi_plugin_pdf_installed"]=1;        
78
}
79
function plugin_pdf_changeprofile()
80
{
81
        if(isset($_SESSION["glpi_plugin_pdf_installed"]) && $_SESSION["glpi_plugin_pdf_installed"]==1){
82
                $prof=new PluginPdfProfile();
83
                if($prof->getFromDB($_SESSION['glpiactiveprofile']['ID']))
84
                        $_SESSION["glpi_plugin_pdf_profile"]=$prof->fields;
85
                else
86
                        unset($_SESSION["glpi_plugin_pdf_profile"]);
87
        }
88
}
89
?>
Redmine Appliance - Powered by TurnKey Linux