Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00035 class ilBMFSettings
00036 {
00037 private $db;
00038
00039 private $settings_id;
00040
00041 private $client_id;
00042 private $bewirtschafter_nr;
00043 private $haushaltsstelle;
00044 private $object_id;
00045 private $kennzeichen_mahnverfahren;
00046 private $waehrungs_kennzeichen;
00047 private $epayment_server;
00048 private $client_certificate;
00049 private $ca_certificate;
00050 private $timeout;
00051
00052 static private $instance = null;
00053
00060 static public function getInstance()
00061 {
00062 if (!self::$instance)
00063 {
00064 self::$instance = new ilBMFSettings();
00065 }
00066
00067 return self::$instance;
00068 }
00069
00075 private function ilBMFSettings()
00076 {
00077 global $ilDB;
00078
00079 $this->db =& $ilDB;
00080
00081 $this->getSettings();
00082 }
00083
00089 private function getSettings()
00090 {
00091 $this->fetchSettingsId();
00092
00093 $query = "SELECT bmf FROM payment_settings WHERE settings_id = '" . $this->getSettingsId() . "'";
00094 $result = $this->db->getrow($query);
00095
00096 $data = array();
00097 if (is_object($result))
00098 {
00099 if ($result->bmf != "") $data = unserialize($result->bmf);
00100 else $data = array();
00101 }
00102
00103 $this->setClientId($data["mandantNr"]);
00104 $this->setBewirtschafterNr($data["bewirtschafterNr"]);
00105 $this->setHaushaltsstelle($data["haushaltsstelle"]);
00106 $this->setObjectId($data["objektNr"]);
00107 $this->setKennzeichenMahnverfahren($data["kennzeichenMahnverfahren"]);
00108 $this->setWaehrungsKennzeichen($data["waehrungskennzeichen"]);
00109 $this->setEpaymentServer($data["ePaymentServer"]);
00110 $this->setClientCertificate($data["clientCertificate"]);
00111 $this->setCaCertificate($data["caCertificate"]);
00112 $this->setTimeout($data["timeOut"]);
00113 }
00114
00120 private function fetchSettingsId()
00121 {
00122 $query = "SELECT * FROM payment_settings";
00123 $result = $this->db->getrow($query);
00124
00125 $this->setSettingsId($result->settings_id);
00126 }
00127
00128 public function setSettingsId($a_settings_id = 0)
00129 {
00130 $this->settings_id = $a_settings_id;
00131 }
00132 public function getSettingsId()
00133 {
00134 return $this->settings_id;
00135 }
00136 public function setClientId($a_client_id)
00137 {
00138 $this->client_id = $a_client_id;
00139 }
00140 public function getClientId()
00141 {
00142 return $this->client_id;
00143 }
00144 public function setBewirtschafterNr($a_bewirtschafter_nr)
00145 {
00146 $this->bewirtschafter_nr = $a_bewirtschafter_nr;
00147 }
00148 public function getBewirtschafterNr()
00149 {
00150 return $this->bewirtschafter_nr;
00151 }
00152 public function setHaushaltsstelle($a_haushaltsstelle)
00153 {
00154 $this->haushaltsstelle = $a_haushaltsstelle;
00155 }
00156 public function getHaushaltsstelle()
00157 {
00158 return $this->haushaltsstelle;
00159 }
00160 public function setObjectId($a_object_id)
00161 {
00162 $this->object_id = $a_object_id;
00163 }
00164 public function getObjectId()
00165 {
00166 return $this->object_id;
00167 }
00168 public function setKennzeichenMahnverfahren($a_kennzeichen_mahnverfahren)
00169 {
00170 $this->kennzeichen_mahnverfahren = $a_kennzeichen_mahnverfahren;
00171 }
00172 public function getKennzeichenMahnverfahren()
00173 {
00174 return $this->kennzeichen_mahnverfahren;
00175 }
00176 public function setWaehrungsKennzeichen($a_waehrungs_kennzeichen)
00177 {
00178 $this->waehrungs_kennzeichen = $a_waehrungs_kennzeichen;
00179 }
00180 public function getWaehrungsKennzeichen()
00181 {
00182 return $this->waehrungs_kennzeichen;
00183 }
00184 public function setEpaymentServer($a_epayment_server)
00185 {
00186 $this->epayment_server = $a_epayment_server;
00187 }
00188 public function getEpaymentServer()
00189 {
00190 return $this->epayment_server;
00191 }
00192 public function setClientCertificate($a_client_certificate)
00193 {
00194 $this->client_certificate = $a_client_certificate;
00195 }
00196 public function getClientCertificate()
00197 {
00198 return $this->client_certificate;
00199 }
00200 public function setCaCertificate($a_ca_certificate)
00201 {
00202 $this->ca_certificate = $a_ca_certificate;
00203 }
00204 public function getCaCertificate()
00205 {
00206 return $this->ca_certificate;
00207 }
00208 public function setTimeout($a_timeout)
00209 {
00210 $this->timeout = $a_timeout;
00211 }
00212 public function getTimeout()
00213 {
00214 return $this->timeout;
00215 }
00216
00223 function getAll()
00224 {
00225 $values = array(
00226 "mandantNr" => $this->getClientId(),
00227 "bewirtschafterNr" => $this->getBewirtschafterNr(),
00228 "haushaltsstelle" => $this->getHaushaltsstelle(),
00229 "objektNr" => $this->getObjectId(),
00230 "kennzeichenMahnverfahren" => $this->getKennzeichenMahnverfahren(),
00231 "waehrungskennzeichen" => $this->getWaehrungsKennzeichen(),
00232 "ePaymentServer" => $this->getEpaymentServer(),
00233 "clientCertificate" => $this->getClientCertificate(),
00234 "caCertificate" => $this->getCaCertificate(),
00235 "timeOut" => $this->getTimeOut()
00236 );
00237
00238 return $values;
00239 }
00240
00246 public function clearAll()
00247 {
00248 $query = "UPDATE payment_settings "
00249 ."SET bmf = '' "
00250 ."WHERE settings_id = '" . $this->getSettingsId() . "'";
00251 $this->db->query($query);
00252 }
00253
00259 public function save()
00260 {
00261 global $ilDB;
00262
00263 $values = array(
00264 "mandantNr" => $this->getClientId(),
00265 "bewirtschafterNr" => $this->getBewirtschafterNr(),
00266 "haushaltsstelle" => $this->getHaushaltsstelle(),
00267 "objektNr" => $this->getObjectId(),
00268 "kennzeichenMahnverfahren" => $this->getKennzeichenMahnverfahren(),
00269 "waehrungskennzeichen" => $this->getWaehrungsKennzeichen(),
00270 "ePaymentServer" => $this->getEpaymentServer(),
00271 "clientCertificate" => $this->getClientCertificate(),
00272 "caCertificate" => $this->getCaCertificate(),
00273 "timeOut" => $this->getTimeOut()
00274 );
00275
00276 if ($this->getSettingsId())
00277 {
00278 $query = "UPDATE payment_settings "
00279 ."SET bmf = " . $ilDB->quote(serialize($values)). " "
00280 ."WHERE settings_id = '" . $this->getSettingsId() . "'";
00281 $this->db->query($query);
00282 }
00283 else
00284 {
00285 $query = "INSERT INTO payment_settings (bmf) VALUES (" . $ilDB->quote(serialize($values)). ") ";
00286
00287 $this->db->query($query);
00288
00289 $this->setSettingsId($this->db->getLastInsertId());
00290 }
00291 }
00292 }
00293 ?>