ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilGeneralSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once '.Services/Payment/classes/class.ilPaymentSettings.php';
5 
6 // !!! USE ilPaymentSettings instead !!!
8 {
9  private static $_instance;
10 
11  public $db;
12  public $settings;
13 
14  public static function _getInstance()
15  {
16  if(!isset(self::$_instance))
17  {
18  self::$_instance = new ilGeneralSettings();
19  }
20 
21  return self::$_instance;
22  }
23 
24  public function ilGeneralSettings()
25  {
26  $pSettings = ilPaymentSettings::_getInstance();
27  $this->settings = $pSettings->getAll();
28 
29 // global $ilDB;
30 //
31 // $this->db = $ilDB;
32 //
33 // $this->__getSettings();
34  }
35 //
36 // /**
37 // * Fetches and sets the primary key of the payment settings
38 // *
39 // * @access private
40 // */
41 // private function fetchSettingsId()
42 // {
43 // $result = $this->db->query('SELECT settings_id FROM payment_settings');
44 // while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
45 // {
46 // $this->setSettingsId($row->settings_id);
47 // }
48 // }
49 //
50 // public function setSettingsId($a_settings_id = 0)
51 // {
52 // $this->settings_id = $a_settings_id;
53 //
54 // }
55 // public function getSettingsId()
56 // {
57 // return $this->settings_id;
58 // }
59 //
60 // public function get($a_type)
61 // {
62 // return $this->settings[$a_type];
63 // }
64 //
65 // public function getAll()
66 // {
67 // return $this->settings;
68 // }
69 //
70 // public function clearAll()
71 // {
72 // $statement = $this->db->manipulateF('
73 // UPDATE payment_settings
74 // SET currency_unit = %s,
75 // currency_subunit = %s,
76 // address = %s,
77 // bank_data = %s,
78 // add_info = %s,
79 // pdf_path = %s,
80 // topics_sorting_type = %s,
81 // topics_sorting_direction = %s,
82 // topics_allow_custom_sorting = %s,
83 // max_hits = %s,
84 // shop_enabled = %s,
85 // hide_advanced_search = %s,
86 // objects_allow_custom_sorting = %s,
87 // hide_coupons = %s,
88 // hide_news = %s,
89 // hide_shop_info = %s,
90 // use_shop_specials = %s
91 // WHERE settings_id = %s',
92 // array( 'text',
93 // 'text',
94 // 'text',
95 // 'text',
96 // 'text',
97 // 'text',
98 // 'integer',
99 // 'integer',
100 // 'text',
101 // 'integer',
102 // 'integer',
103 // 'integer',
104 // 'integer',
105 // 'integer',
106 // 'integer',
107 // 'integer',
108 // 'integer',
109 // 'integer'),
110 // array( NULL,
111 // NULL,
112 // NULL,
113 // NULL,
114 // NULL,
115 // NULL,
116 // '1',
117 // 'asc',
118 // '0',
119 // '20',
120 // '0',
121 // '0',
122 // '0',
123 // '0',
124 // '0',
125 // '0',
126 // '0',
127 // $this->getSettingsId())
128 // );
129 //
130 // return true;
131 // }
132 //
133 // public function setAll($a_values)
134 // {
135 // global $ilDB;
136 //
137 // if(!$a_values['currency_unit']) $a_values['currency_unit'] = NULL;
138 // if(!$a_values['currency_subunit']) $a_values['currency_subunit'] = NULL;
139 // if(!$a_values['address']) $a_values['address'] = NULL;
140 // if(!$a_values['bank_data']) $a_values['bank_data'] = NULL;
141 // if(!$a_values['add_info']) $a_values['add_info'] = NULL;
142 // if(!$a_values['pdf_path']) $a_values['pdf_path'] = NULL;
143 //
144 // if(!$a_values['topics_allow_custom_sorting']) $a_values['topics_allow_custom_sorting'] = 0;
145 // if(!$a_values['topics_sorting_type']) $a_values['topics_sorting_type'] = 0;
146 // if(!$a_values['topics_sorting_direction']) $a_values['topics_sorting_direction'] = NULL;
147 // if(!$a_values['shop_enabled']) $a_values['shop_enabled'] = 0;
148 // if(!$a_values['max_hits']) $a_values['max_hits'] = 0;
149 // if(!$a_values['hide_advanced_search']) $a_values['hide_advanced_search'] = 0;
150 // if(!$a_values['objects_allow_custom_sorting']) $a_values['objects_allow_custom_sorting'] = 0;
151 // if(!$a_values['hide_coupons']) $a_values['hide_coupons'] = 0;
152 // if(!$a_values['hide_news']) $a_values['hide_news'] = 0;
153 // if(!$a_values['hide_shop_info']) $a_values['hide_shop_info'] = 0;
154 // if(!$a_values['use_shop_specials']) $a_values['use_shop_specials'] = 0;
155 // if(!$a_values['show_general_filter']) $a_values['show_general_filter'] = 0;
156 // if(!$a_values['show_topics_filter']) $a_values['show_topics_filter'] = 0;
157 // if(!$a_values['show_shop_explorer']) $a_values['show_shop_explorer'] = 0;
158 //
159 // if ($this->getSettingsId())
160 // {
161 //
162 // $statement = $this->db->manipulateF('
163 // UPDATE payment_settings
164 // SET currency_unit = %s,
165 // currency_subunit = %s,
166 // address = %s,
167 // bank_data = %s,
168 // add_info = %s,
169 // pdf_path = %s,
170 // topics_sorting_type = %s,
171 // topics_sorting_direction = %s,
172 // topics_allow_custom_sorting = %s,
173 // max_hits = %s,
174 // shop_enabled = %s,
175 // hide_advanced_search = %s,
176 // objects_allow_custom_sorting = %s,
177 // hide_coupons = %s,
178 // hide_news = %s,
179 // hide_shop_info = %s,
180 // use_shop_specials = %s,
181 // show_general_filter = %s,
182 // show_topics_filter = %s,
183 // show_shop_explorer = %s
184 // WHERE settings_id = %s',
185 // array( 'text',
186 // 'text',
187 // 'text',
188 // 'text',
189 // 'text',
190 // 'text',
191 // 'integer',
192 // 'text',
193 // 'integer',
194 // 'integer',
195 // 'integer',
196 // 'integer',
197 // 'integer',
198 // 'integer',
199 // 'integer',
200 // 'integer',
201 // 'integer',
202 // 'integer',
203 // 'integer',
204 // 'integer',
205 // 'integer'),
206 // array(
207 // $a_values['currency_unit'],
208 // $a_values['currency_subunit'],
209 // $a_values['address'],
210 // $a_values['bank_data'],
211 // $a_values['add_info'],
212 // $a_values['pdf_path'],
213 // $a_values['topics_sorting_type'],
214 // $a_values['topics_sorting_direction'],
215 // $a_values['topics_allow_custom_sorting'],
216 // $a_values['max_hits'],
217 // $a_values['shop_enabled'],
218 // $a_values['hide_advanced_search'],
219 // $a_values['objects_allow_custom_sorting'],
220 // $a_values['hide_coupons'],
221 // $a_values['hide_news'],
222 // $a_values['hide_shop_info'],
223 // $a_values['use_shop_specials'],
224 // $a_values['show_general_filter'],
225 // $a_values['show_topics_filter'],
226 // $a_values['show_shop_explorer'],
227 // $this->getSettingsId())
228 // );
229 // }
230 // else
231 // {
232 //
233 // $next_id = $ilDB->nextId('payment_settings');
234 // $statement = $this->db->manipulateF('
235 // INSERT INTO payment_settings
236 // ( settings_id,
237 // currency_unit,
238 // currency_subunit,
239 // address,
240 // bank_data,
241 // add_info,
242 // pdf_path,
243 // topics_allow_custom_sorting,
244 // topics_sorting_type,
245 // topics_sorting_direction,
246 // shop_enabled,
247 // max_hits,
248 // hide_advanced_search,
249 // objects_allow_custom_sorting,
250 // hide_coupons,
251 // hide_news,
252 // hide_shop_info,
253 // use_shop_specials,
254 // show_general_filter,
255 // show_topics_filter,
256 // show_shop_explorer
257 // )
258 // VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
259 // array( 'integer',
260 // 'text',
261 // 'text',
262 // 'text',
263 // 'text',
264 // 'text',
265 // 'text',
266 // 'integer',
267 // 'integer',
268 // 'text',
269 // 'integer',
270 // 'integer',
271 // 'integer',
272 // 'integer',
273 // 'integer',
274 // 'integer',
275 // 'integer',
276 // 'integer',
277 // 'integer',
278 // 'integer',
279 // 'integer'
280 // ),
281 // array(
282 // $next_id,
283 // $a_values['currency_unit'],
284 // $a_values['currency_subunit'],
285 // $a_values['address'],
286 // $a_values['bank_data'],
287 // $a_values['add_info'],
288 // $a_values['pdf_path'],
289 // $a_values['topics_allow_custom_sorting'],
290 // $a_values['topics_sorting_type'],
291 // $a_values['topics_sorting_direction'],
292 // $a_values['shop_enabled'],
293 // $a_values['max_hits'],
294 // $a_values['hide_advanced_search'],
295 // $a_values['objects_allow_custom_sorting'],
296 // $a_values['hide_coupons'],
297 // $a_values['hide_news'],
298 // $a_values['hide_shop_info'],
299 // $a_values['use_shop_specials'],
300 // $a_values['show_general_filter'],
301 // $a_values['show_topics_filter'],
302 // $a_values['show_shop_explorer']
303 //
304 // )
305 // );
306 // }
307 //
308 // $this->__getSettings();
309 //
310 // return true;
311 // }
312 //
313 // private function __getSettings()
314 // {
315 // $this->fetchSettingsId();
316 //
317 // $result = $this->db->query('SELECT * FROM payment_settings');
318 //
319 // $data = array();
320 // while($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
321 // {
322 // $data['currency_unit'] = $row->currency_unit;
323 // $data['currency_subunit'] = $row->currency_subunit;
324 // $data['address'] = $row->address;
325 // $data['bank_data'] = $row->bank_data;
326 // $data['add_info'] = $row->add_info;
327 // $data['pdf_path'] = $row->pdf_path;
328 // $data['topics_allow_custom_sorting'] = $row->topics_allow_custom_sorting;
329 // $data['topics_sorting_type'] = $row->topics_sorting_type;
330 // $data['topics_sorting_direction'] = $row->topics_sorting_direction;
331 // $data['max_hits'] = $row->max_hits;
332 // $data['shop_enabled'] = $row->shop_enabled;
333 // $data['hide_advanced_search'] = $row->hide_advanced_search;
334 // $data['objects_allow_custom_sorting'] = $row->objects_allow_custom_sorting;
335 // $data['hide_coupons'] = $row->hide_coupons;
336 // $data['hide_news'] = $row->hide_news;
337 // $data['hide_shop_info'] = $row->hide_shop_info;
338 // $data['use_shop_specials'] = $row->use_shop_specials;
339 // $data['show_general_filter'] = $row->show_general_filter;
340 // $data['show_topics_filter'] = $row->show_topics_filter;
341 // $data['show_shop_explorer'] = $row->show_shop_explorer;
342 // }
343 // $this->settings = $data;
344 //
345 // }
346 //
347 // public static function _isPaymentEnabled()
348 // {
349 // global $ilDB;
350 //
351 // $res = $ilDB->query('SELECT shop_enabled FROM payment_settings');
352 // $row = $ilDB->fetchAssoc($res);
353 //
354 // return $row['shop_enabled'];
355 // }
356 // public static function setMailUsePlaceholders($a_mail_use_placeholders)
357 // {
358 // global $ilDB;
359 //
360 // $res = $ilDB->manipulateF('UPDATE payment_settings
361 // SET mail_use_placeholders = %s',
362 // array('integer'), array($a_mail_use_placeholders));
363 //}
364 //
365 // public static function getMailUsePlaceholders()
366 // {
367 // global $ilDB;
368 //
369 // $res = $ilDB->query('SELECT mail_use_placeholders FROM payment_settings');
370 // $row = $ilDB->fetchAssoc($res);
371 //
372 // return $row['mail_use_placeholders'];
373 // }
374 //
375 // public static function setMailBillingText($a_mail_billing_text)
376 // {
377 // global $ilDB;
378 //
379 // $ilDB->update('payment_settings',
380 // array('mail_billing_text' => array('clob', $a_mail_billing_text)),
381 // array('settings_id' => array('integer',1)));
382 //
383 // }
384 //
385 // public static function getMailBillingText()
386 // {
387 // global $ilDB;
388 //
389 // $res = $ilDB->query('SELECT mail_billing_text FROM payment_settings');
390 // $row = $ilDB->fetchAssoc($res);
391 //
392 // return $row['mail_billing_text'];
393 // }
394 //
395 // public static function useShopSpecials()
396 // {
397 // global $ilDB;
398 //
399 // $res = $ilDB->query('SELECT use_shop_specials FROM payment_settings');
400 // $row = $ilDB->fetchAssoc($res);
401 //
402 // return $row['use_shop_specials'];
403 // }
404 
405 }
406 ?>