Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / plugins / pdf / setup.php @ 7b214c36

Historique | Voir | Annoter | Télécharger (5,44 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
// Original Author of file: BALPE Dévi
31
// Purpose of file:
32
// ----------------------------------------------------------------------
33

    
34
include_once ("plugin_pdf.includes.php");
35

    
36
function plugin_init_pdf() {
37
        global $PLUGIN_HOOKS;
38
        
39
        $PLUGIN_HOOKS['init_session']['pdf'] = 'plugin_pdf_initSession';
40
        $PLUGIN_HOOKS['change_profile']['pdf'] = 'plugin_pdf_changeprofile';
41
        
42
        if (isset($_SESSION["glpi_plugin_pdf_installed"]) && $_SESSION["glpi_plugin_pdf_installed"]==1)
43
        {
44
                if (isset($_SESSION["glpi_plugin_pdf_profile"]) && $_SESSION["glpi_plugin_pdf_profile"]["use"])
45
                {
46
                        $PLUGIN_HOOKS['use_massive_action']['pdf']=1;
47
                        $PLUGIN_HOOKS['headings']['pdf'] = 'plugin_get_headings_pdf';
48
                        $PLUGIN_HOOKS['headings_action']['pdf'] = 'plugin_headings_actions_pdf';
49
                        $PLUGIN_HOOKS['pre_item_delete']['pdf'] = 'plugin_pre_item_delete_pdf';
50
                        $PLUGIN_HOOKS['user_preferences']['pdf'] = 'plugin_user_preferences_pdf';
51
                }
52
                if (haveRight("config","w") || haveRight("profile","r"))
53
                        $PLUGIN_HOOKS['config_page']['pdf'] = 'front/plugin_pdf.config.form.php';
54
        }
55
        else if (haveRight("config","w")) {
56
                $PLUGIN_HOOKS['config_page']['pdf'] = 'front/plugin_pdf.config.form.php';
57
        }
58
        
59
}
60

    
61
        
62
function plugin_version_pdf() {
63
        global $LANGPDF;
64

    
65
                return array ('name' => $LANGPDF["title"][1],'minGlpiVersion' => '0.71', 'version' => '0.5');
66
}
67

    
68
// Hook done on delete item case
69

    
70
function plugin_pre_item_delete_pdf($input){
71
        if (isset($input["_item_type_"]))
72
                switch ($input["_item_type_"]){
73
                        case PROFILE_TYPE :
74
                                // Manipulate data if needed 
75
                                $PluginPdfProfile=new PluginPdfProfile;
76
                                $PluginPdfProfile->cleanProfiles($input["ID"]);
77
                                break;
78
                }
79
        return $input;
80
}
81

    
82
function plugin_get_headings_pdf($type,$withtemplate){        
83

    
84
        global $LANGPDF;
85

    
86
        switch ($type){
87
                case COMPUTER_TYPE :
88
                        if ($withtemplate)
89
                                return array();
90
                        else 
91
                                return array(1 => $LANGPDF["title"][1]);
92
                break;
93

    
94
                case SOFTWARE_TYPE :
95
                        if ($withtemplate)
96
                                return array();
97
                        else 
98
                                return array(1 => $LANGPDF["title"][1]);
99
                break;
100
        }
101
        return false;        
102
}
103
         
104
function plugin_headings_actions_pdf($type){
105

    
106
        switch ($type){
107
                case COMPUTER_TYPE :
108
                        return array(
109
                                        1 => "plugin_headings_pdf_computer",
110
                                    );
111
                        break;
112

    
113
                case SOFTWARE_TYPE :
114
                        return array(
115
                                        1 => "plugin_headings_pdf_software",
116
                                    );
117
                        break;
118
        }
119
        return false;
120
}
121

    
122
function plugin_headings_pdf_computer($type,$ID,$withtemplate=0){
123

    
124
        echo "<div align='center'>";
125
        echo "<table class='tab_cadre_fixe'>";
126
        echo plugin_pdf_menu_computer("../plugins/pdf/front/plugin_pdf.export.php",$ID);
127
        echo "</table>";
128
        echo "</div>";
129
}
130

    
131
function plugin_headings_pdf_software($type,$ID,$withtemplate=0){
132

    
133
        echo "<div align='center'>";
134
        echo "<table class='tab_cadre_fixe'>";
135
        echo plugin_pdf_menu_software("../plugins/pdf/front/plugin_pdf.export.php",$ID);
136
        echo "</table>";
137
        echo "</div>";
138
}
139

    
140
function plugin_pdf_MassiveActions($type){
141
        global $LANGPDF;
142
        switch ($type){
143
                case COMPUTER_TYPE :
144
                        return array(
145
                                "plugin_pdf_DoIt"=>$LANGPDF["title"][1],
146
                        );
147
                        break;
148
                case SOFTWARE_TYPE:
149
                        return array(
150
                                "plugin_pdf_DoIt"=>$LANGPDF["title"][1],
151
                                );
152
                break;
153
        }
154
        return array();
155
}
156

    
157
function plugin_pdf_MassiveActionsDisplay($type,$action){
158
        global $LANG;
159
        switch ($type){
160
                case COMPUTER_TYPE:
161
                        switch ($action){
162
                                case "plugin_pdf_DoIt":
163
                                        echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"".$LANG["buttons"][2]."\" >";
164
                                break;
165
                        }
166
                        break;
167
                case SOFTWARE_TYPE:
168
                        switch ($action){
169
                                case "plugin_pdf_DoIt":
170
                                        echo "<input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"".$LANG["buttons"][2]."\" >";
171
                                break;
172
                        }
173
                break;
174
        }
175
        return "";
176
}
177

    
178
function plugin_pdf_MassiveActionsProcess($data){
179

    
180
        switch ($data["action"]){
181
                case "plugin_pdf_DoIt":
182
                        foreach ($data['item'] as $key => $val)
183
                                $tab_id[]=$key;
184
                                        
185
                        $_SESSION["plugin_pdf"]["type"] = $data["device_type"];
186
                        $_SESSION["plugin_pdf"]["tab_id"] = serialize($tab_id);
187
                        
188
                        echo "<script type='text/javascript'>location.href='../plugins/pdf/front/plugin_pdf.export.massive.php'</script>)";
189
                break;
190
                }
191
}
192

    
193
function plugin_user_preferences_pdf($post){
194
        global $DB;
195

    
196
        $pref = new PluginPdfPreferences;
197
        $pref->showForm($_SERVER["PHP_SELF"],$_POST);
198
}
199
?>
Redmine Appliance - Powered by TurnKey Linux