ILIAS  Release_4_2_x_branch Revision 61807
 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 = $this->pSettings->get('bmf');
74  $data = array();
75  if ($result_bmf != "" && $result_bmf != NULL)
76  {
77  $data = unserialize($result_bmf);
78  }
79 
80  $this->setClientId($data["mandantNr"]);
81  $this->setBewirtschafterNr($data["bewirtschafterNr"]);
82  $this->setHaushaltsstelle($data["haushaltsstelle"]);
83  $this->setObjectId($data["objektNr"]);
84  $this->setKennzeichenMahnverfahren($data["kennzeichenMahnverfahren"]);
85  $this->setWaehrungsKennzeichen($data["waehrungskennzeichen"]);
86  $this->setEpaymentServer($data["ePaymentServer"]);
87  $this->setClientCertificate($data["clientCertificate"]);
88  $this->setCaCertificate($data["caCertificate"]);
89  $this->setTimeout($data["timeOut"]);
90  }
91 
97  private function fetchSettingsId()
98  {
99 // $result = $this->db->query('SELECT settings_id FROM payment_settings');
100 //
101 // while($row = $this->db->fetchObject($result))
102 // {
103 // $this->setSettingsId($row->settings_id);
104 // }
105  }
106 
107  public function setSettingsId($a_settings_id = 0)
108  {
109 // $this->settings_id = $a_settings_id;
110  }
111  public function getSettingsId()
112  {
113 // return $this->settings_id;
114  }
115  public function setClientId($a_client_id)
116  {
117  $this->client_id = $a_client_id;
118  }
119  public function getClientId()
120  {
121  return $this->client_id;
122  }
123  public function setBewirtschafterNr($a_bewirtschafter_nr)
124  {
125  $this->bewirtschafter_nr = $a_bewirtschafter_nr;
126  }
127  public function getBewirtschafterNr()
128  {
130  }
131  public function setHaushaltsstelle($a_haushaltsstelle)
132  {
133  $this->haushaltsstelle = $a_haushaltsstelle;
134  }
135  public function getHaushaltsstelle()
136  {
137  return $this->haushaltsstelle;
138  }
139  public function setObjectId($a_object_id)
140  {
141  $this->object_id = $a_object_id;
142  }
143  public function getObjectId()
144  {
145  return $this->object_id;
146  }
147  public function setKennzeichenMahnverfahren($a_kennzeichen_mahnverfahren)
148  {
149  $this->kennzeichen_mahnverfahren = $a_kennzeichen_mahnverfahren;
150  }
151  public function getKennzeichenMahnverfahren()
152  {
154  }
155  public function setWaehrungsKennzeichen($a_waehrungs_kennzeichen)
156  {
157  $this->waehrungs_kennzeichen = $a_waehrungs_kennzeichen;
158  }
159  public function getWaehrungsKennzeichen()
160  {
162  }
163  public function setEpaymentServer($a_epayment_server)
164  {
165  $this->epayment_server = $a_epayment_server;
166  }
167  public function getEpaymentServer()
168  {
169  return $this->epayment_server;
170  }
171  public function setClientCertificate($a_client_certificate)
172  {
173  $this->client_certificate = $a_client_certificate;
174  }
175  public function getClientCertificate()
176  {
178  }
179  public function setCaCertificate($a_ca_certificate)
180  {
181  $this->ca_certificate = $a_ca_certificate;
182  }
183  public function getCaCertificate()
184  {
185  return $this->ca_certificate;
186  }
187  public function setTimeout($a_timeout)
188  {
189  $this->timeout = $a_timeout;
190  }
191  public function getTimeout()
192  {
193  return $this->timeout;
194  }
195 
202  function getAll()
203  {
204  $values = array(
205  "mandantNr" => $this->getClientId(),
206  "bewirtschafterNr" => $this->getBewirtschafterNr(),
207  "haushaltsstelle" => $this->getHaushaltsstelle(),
208  "objektNr" => $this->getObjectId(),
209  "kennzeichenMahnverfahren" => $this->getKennzeichenMahnverfahren(),
210  "waehrungskennzeichen" => $this->getWaehrungsKennzeichen(),
211  "ePaymentServer" => $this->getEpaymentServer(),
212  "clientCertificate" => $this->getClientCertificate(),
213  "caCertificate" => $this->getCaCertificate(),
214  "timeOut" => $this->getTimeOut()
215  );
216 
217  return $values;
218  }
219 
225  public function clearAll()
226  {
227 
228  $this->pSettings->set('bmf', NULL, 'bmf');
229 // $statement = $this->db->manipulateF('
230 // UPDATE payment_settings
231 // SET bmf = %s
232 // WHERE settings_id = %s',
233 // array('text', 'integer'),
234 // array('NULL', $this->getSettingsId())
235 // );
236  }
237 
243  public function save()
244  {
245 
246  global $ilDB;
247 
248  $values = array(
249  "mandantNr" => $this->getClientId(),
250  "bewirtschafterNr" => $this->getBewirtschafterNr(),
251  "haushaltsstelle" => $this->getHaushaltsstelle(),
252  "objektNr" => $this->getObjectId(),
253  "kennzeichenMahnverfahren" => $this->getKennzeichenMahnverfahren(),
254  "waehrungskennzeichen" => $this->getWaehrungsKennzeichen(),
255  "ePaymentServer" => $this->getEpaymentServer(),
256  "clientCertificate" => $this->getClientCertificate(),
257  "caCertificate" => $this->getCaCertificate(),
258  "timeOut" => $this->getTimeOut()
259  );
260 
261 
262  $this->pSettings->set('bmf',serialize($values), 'bmf');
263 
264 // if ($this->getSettingsId())
265 // {
266 //
267 // $statement = $this->db->manipulateF('
268 // UPDATE payment_settings
269 // SET bmf = %s
270 // WHERE settings_id = %s',
271 // array('text', 'integer'),
272 // array(serialize($values), $this->getSettingsId())
273 // );
274 // }
275 // else
276 // {
277 // $next_id = $ilDB->nextId('payment_settings');
278 // $statement = $this->db->manipulateF('
279 // INSERT into payment_settings
280 // ( settings_id,
281 // bmf)
282 // VALUES (%s, %s)',
283 // array('integer','text'),
284 // array($next_id, serialize($values))
285 // );
286 //
287 // $this->setSettingsId($next_id);
288 //
289 // }
290 
291  }
292 }
293 ?>