ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilBMFSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
15 include_once './Services/Payment/classes/class.ilPaymentSettings.php';
17 {
18  private $db;
19  public $pSettings;
20 
21  private $settings_id;
22 
23  private $client_id;
26  private $object_id;
31  private $ca_certificate;
32  private $timeout;
33 
34  static private $instance = null;
35 
42  static public function getInstance()
43  {
44  if (!self::$instance)
45  {
46  self::$instance = new ilBMFSettings();
47  }
48 
49  return self::$instance;
50  }
51 
57  private function ilBMFSettings()
58  {
59  global $ilDB;
60 
61  $this->db = $ilDB;
62  $this->pSettings = ilPaymentSettings::_getInstance();
63  $this->getSettings();
64  }
65 
71  private function getSettings()
72  {
73  $result_bmf = NULL;
74  $result_bmf = $this->pSettings->get('bmf');
75  $data = array();
76 
77  if ($result_bmf != "" && $result_bmf != NULL)
78  {
79  $data = unserialize($result_bmf);
80  }
81 
82  $this->setClientId($data["mandantNr"]);
83  $this->setBewirtschafterNr($data["bewirtschafterNr"]);
84  $this->setHaushaltsstelle($data["haushaltsstelle"]);
85  $this->setObjectId($data["objektNr"]);
86  $this->setKennzeichenMahnverfahren($data["kennzeichenMahnverfahren"]);
87  $this->setWaehrungsKennzeichen($data["waehrungskennzeichen"]);
88  $this->setEpaymentServer($data["ePaymentServer"]);
89  $this->setClientCertificate($data["clientCertificate"]);
90  $this->setCaCertificate($data["caCertificate"]);
91  $this->setTimeout($data["timeOut"]);
92  }
93 
99  private function fetchSettingsId()
100  {
101 // $result = $this->db->query('SELECT settings_id FROM payment_settings');
102 //
103 // while($row = $this->db->fetchObject($result))
104 // {
105 // $this->setSettingsId($row->settings_id);
106 // }
107  }
108 
109  public function setSettingsId($a_settings_id = 0)
110  {
111 // $this->settings_id = $a_settings_id;
112  }
113  public function getSettingsId()
114  {
115 // return $this->settings_id;
116  }
117  public function setClientId($a_client_id)
118  {
119  $this->client_id = $a_client_id;
120  }
121  public function getClientId()
122  {
123  return $this->client_id;
124  }
125  public function setBewirtschafterNr($a_bewirtschafter_nr)
126  {
127  $this->bewirtschafter_nr = $a_bewirtschafter_nr;
128  }
129  public function getBewirtschafterNr()
130  {
132  }
133  public function setHaushaltsstelle($a_haushaltsstelle)
134  {
135  $this->haushaltsstelle = $a_haushaltsstelle;
136  }
137  public function getHaushaltsstelle()
138  {
139  return $this->haushaltsstelle;
140  }
141  public function setObjectId($a_object_id)
142  {
143  $this->object_id = $a_object_id;
144  }
145  public function getObjectId()
146  {
147  return $this->object_id;
148  }
149  public function setKennzeichenMahnverfahren($a_kennzeichen_mahnverfahren)
150  {
151  $this->kennzeichen_mahnverfahren = $a_kennzeichen_mahnverfahren;
152  }
153  public function getKennzeichenMahnverfahren()
154  {
156  }
157  public function setWaehrungsKennzeichen($a_waehrungs_kennzeichen)
158  {
159  $this->waehrungs_kennzeichen = $a_waehrungs_kennzeichen;
160  }
161  public function getWaehrungsKennzeichen()
162  {
164  }
165  public function setEpaymentServer($a_epayment_server)
166  {
167  $this->epayment_server = $a_epayment_server;
168  }
169  public function getEpaymentServer()
170  {
171  return $this->epayment_server;
172  }
173  public function setClientCertificate($a_client_certificate)
174  {
175  $this->client_certificate = $a_client_certificate;
176  }
177  public function getClientCertificate()
178  {
180  }
181  public function setCaCertificate($a_ca_certificate)
182  {
183  $this->ca_certificate = $a_ca_certificate;
184  }
185  public function getCaCertificate()
186  {
187  return $this->ca_certificate;
188  }
189  public function setTimeout($a_timeout)
190  {
191  $this->timeout = $a_timeout;
192  }
193  public function getTimeout()
194  {
195  return $this->timeout;
196  }
197 
204  function getAll()
205  {
206  $values = array(
207  "mandantNr" => $this->getClientId(),
208  "bewirtschafterNr" => $this->getBewirtschafterNr(),
209  "haushaltsstelle" => $this->getHaushaltsstelle(),
210  "objektNr" => $this->getObjectId(),
211  "kennzeichenMahnverfahren" => $this->getKennzeichenMahnverfahren(),
212  "waehrungskennzeichen" => $this->getWaehrungsKennzeichen(),
213  "ePaymentServer" => $this->getEpaymentServer(),
214  "clientCertificate" => $this->getClientCertificate(),
215  "caCertificate" => $this->getCaCertificate(),
216  "timeOut" => $this->getTimeOut()
217  );
218 
219  return $values;
220  }
221 
227  public function clearAll()
228  {
229 
230  $this->pSettings->set('bmf', NULL, 'bmf');
231 // $statement = $this->db->manipulateF('
232 // UPDATE payment_settings
233 // SET bmf = %s
234 // WHERE settings_id = %s',
235 // array('text', 'integer'),
236 // array('NULL', $this->getSettingsId())
237 // );
238  }
239 
245  public function save()
246  {
247 
248  global $ilDB;
249 
250  $values = array(
251  "mandantNr" => $this->getClientId(),
252  "bewirtschafterNr" => $this->getBewirtschafterNr(),
253  "haushaltsstelle" => $this->getHaushaltsstelle(),
254  "objektNr" => $this->getObjectId(),
255  "kennzeichenMahnverfahren" => $this->getKennzeichenMahnverfahren(),
256  "waehrungskennzeichen" => $this->getWaehrungsKennzeichen(),
257  "ePaymentServer" => $this->getEpaymentServer(),
258  "clientCertificate" => $this->getClientCertificate(),
259  "caCertificate" => $this->getCaCertificate(),
260  "timeOut" => $this->getTimeOut()
261  );
262 
263 
264  $this->pSettings->set('bmf',serialize($values), 'bmf');
265 
266 // if ($this->getSettingsId())
267 // {
268 //
269 // $statement = $this->db->manipulateF('
270 // UPDATE payment_settings
271 // SET bmf = %s
272 // WHERE settings_id = %s',
273 // array('text', 'integer'),
274 // array(serialize($values), $this->getSettingsId())
275 // );
276 // }
277 // else
278 // {
279 // $next_id = $ilDB->nextId('payment_settings');
280 // $statement = $this->db->manipulateF('
281 // INSERT into payment_settings
282 // ( settings_id,
283 // bmf)
284 // VALUES (%s, %s)',
285 // array('integer','text'),
286 // array($next_id, serialize($values))
287 // );
288 //
289 // $this->setSettingsId($next_id);
290 //
291 // }
292 
293  }
294 }
295 ?>