1 |
fraynaud |
3 |
<?php |
2 |
|
|
/** |
3 |
|
|
* |
4 |
|
|
* |
5 |
|
|
* @package openmairie_exemple |
6 |
|
|
* @version SVN : $Id: utils.class.php 318 2010-12-06 12:16:35Z fmichon $ |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
/** |
10 |
|
|
* |
11 |
|
|
*/ |
12 |
|
|
require_once "../dyn/locales.inc.php"; |
13 |
|
|
|
14 |
|
|
/** |
15 |
|
|
* |
16 |
|
|
*/ |
17 |
|
|
require_once "../dyn/include.inc.php"; |
18 |
|
|
|
19 |
|
|
/** |
20 |
|
|
* |
21 |
|
|
*/ |
22 |
|
|
require_once "../dyn/debug.inc.php"; |
23 |
|
|
|
24 |
|
|
/** |
25 |
|
|
* |
26 |
|
|
*/ |
27 |
|
|
(defined("PATH_OPENMAIRIE") ? "" : define("PATH_OPENMAIRIE", "")); |
28 |
|
|
|
29 |
|
|
/** |
30 |
|
|
* |
31 |
|
|
*/ |
32 |
|
|
require_once PATH_OPENMAIRIE."om_application.class.php"; |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
* |
36 |
|
|
*/ |
37 |
|
|
class utils extends application { |
38 |
|
|
|
39 |
|
|
var $schema; //*** |
40 |
|
|
|
41 |
|
|
|
42 |
|
|
/** |
43 |
|
|
* Cette methode permet de charger les differents fichiers de configs dans |
44 |
|
|
* des attributs de la classe |
45 |
|
|
* |
46 |
|
|
* @return void |
47 |
|
|
*/ |
48 |
|
|
function setParamsFromFiles() { |
49 |
|
|
|
50 |
|
|
// |
51 |
|
|
if (file_exists("../dyn/config.inc.php")) { |
52 |
|
|
include_once("../dyn/config.inc.php"); |
53 |
|
|
} |
54 |
|
|
if (isset($config)) { |
55 |
|
|
$this->config = $config; |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
// |
59 |
|
|
if (file_exists("../dyn/database.inc.php")) { |
60 |
|
|
include_once("../dyn/database.inc.php"); |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
if (isset($conn)) { |
64 |
|
|
$this->conn = $conn; |
65 |
|
|
// |
66 |
|
|
foreach($this->conn as $key => $conn) { |
67 |
|
|
$this->database[$key] = array( |
68 |
|
|
'title' => $conn[0], |
69 |
|
|
'phptype' => $conn[1], |
70 |
|
|
'dbsyntax' => $conn[2], |
71 |
|
|
'username' => $conn[3], |
72 |
|
|
'password' => $conn[4], |
73 |
|
|
'protocol' => $conn[5], |
74 |
|
|
'hostspec' => $conn[6], |
75 |
|
|
'port' => $conn[7], |
76 |
|
|
'socket' => $conn[8], |
77 |
|
|
'database' => $conn[9], |
78 |
|
|
'formatdate' => $conn[10], |
79 |
|
|
'schema' => $conn[11], //**** |
80 |
|
|
'prefixe' => $conn[12], //**** |
81 |
|
|
); |
82 |
|
|
} |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
// |
86 |
|
|
if (file_exists("../dyn/menu.inc.php")) { |
87 |
|
|
include_once("../dyn/menu.inc.php"); |
88 |
|
|
} |
89 |
|
|
if (isset($menu)) { |
90 |
|
|
$this->menu = $menu; |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
// |
94 |
|
|
if (file_exists("../dyn/actions.inc.php")) { |
95 |
|
|
include_once("../dyn/actions.inc.php"); |
96 |
|
|
} |
97 |
|
|
if (isset($actions)) { |
98 |
|
|
$this->actions = $actions; |
99 |
|
|
} |
100 |
|
|
|
101 |
|
|
// |
102 |
|
|
if (file_exists("../dyn/shortlinks.inc.php")) { |
103 |
|
|
include_once("../dyn/shortlinks.inc.php"); |
104 |
|
|
} |
105 |
|
|
if (isset($shortlinks)) { |
106 |
|
|
$this->shortlinks = $shortlinks; |
107 |
|
|
} |
108 |
|
|
|
109 |
|
|
// |
110 |
|
|
if (file_exists("../dyn/footer.inc.php")) { |
111 |
|
|
include_once("../dyn/footer.inc.php"); |
112 |
|
|
} |
113 |
|
|
if (isset($footer)) { |
114 |
|
|
$this->footer = $footer; |
115 |
|
|
} |
116 |
|
|
|
117 |
|
|
// |
118 |
|
|
if (file_exists("../dyn/version.inc.php")) { |
119 |
|
|
include_once("../dyn/version.inc.php"); |
120 |
|
|
} |
121 |
|
|
if (isset($version)) { |
122 |
|
|
$this->version = $version; |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
} |
126 |
|
|
|
127 |
|
|
/** |
128 |
|
|
* Cette methode permet de parametrer les valeurs par defaut pour les |
129 |
|
|
* fichiers css et javascript a appeler sur toutes les pages |
130 |
|
|
* |
131 |
|
|
* @return void |
132 |
|
|
*/ |
133 |
|
|
function setDefaultValues() { |
134 |
|
|
|
135 |
|
|
$js = array( |
136 |
|
|
"../js/iepngfix_tilebg.js", |
137 |
|
|
"../lib/jquery-ui/js/jquery-1.4.2.min.js", |
138 |
|
|
"../lib/jquery-ui/js/jquery.ui.datepicker-fr.js", |
139 |
|
|
"../lib/jquery-ui/js/jquery-ui-1.8.6.custom.min.js", |
140 |
|
|
"../lib/jquery-misc/jquery.collapsible-v.2.1.3.js", |
141 |
|
|
"../js/script.js", |
142 |
|
|
); |
143 |
|
|
$this->setHTMLHeadJs($js); |
144 |
|
|
|
145 |
|
|
|
146 |
|
|
$css = array( |
147 |
|
|
"../css/main.css", |
148 |
|
|
"../lib/jquery-ui/css/".$this->config['theme']."/jquery-ui-1.8.6.custom.css", |
149 |
|
|
"../css/specific.css", |
150 |
|
|
); |
151 |
|
|
if (file_exists("../css/specific_".$this->config['theme'].".css")) { |
152 |
|
|
array_push($css, "../css/specific_".$this->config['theme'].".css"); |
153 |
|
|
} |
154 |
|
|
$this->setHTMLHeadCss($css); |
155 |
|
|
|
156 |
|
|
$extras = "\t<link rel=\"stylesheet\" type=\"text/css\" media=\"print\" href=\"../css/print.css\" />\n"; |
157 |
|
|
$this->setHTMLHeadExtras($extras); |
158 |
|
|
// $this->setStyleForHeader("ui-widget-header ui-state-active"); // essai jquery |
159 |
|
|
|
160 |
|
|
} |
161 |
|
|
|
162 |
|
|
/** |
163 |
|
|
* Cette methode permet d'affecter des parametres dans un attribut de |
164 |
|
|
* l'objet. |
165 |
|
|
* |
166 |
|
|
* @return void |
167 |
|
|
*/ |
168 |
|
|
function setMoreParams() { |
169 |
|
|
|
170 |
|
|
// |
171 |
|
|
if (file_exists("../dyn/var.inc")) { |
172 |
|
|
include_once("../dyn/var.inc"); |
173 |
|
|
} |
174 |
|
|
|
175 |
|
|
// |
176 |
|
|
if (isset($chemin_plan)) { |
177 |
|
|
$this->config['chemin_plan'] = $chemin_plan; |
178 |
|
|
} else { |
179 |
|
|
$this->config['chemin_plan'] = "../trs/"; |
180 |
|
|
} |
181 |
|
|
|
182 |
|
|
} |
183 |
|
|
|
184 |
|
|
|
185 |
|
|
} //fin class |
186 |
|
|
?> |