ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPaypalSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 include_once './Services/Payment/classes/class.ilPaymentSettings.php';
13 
15 {
16  private $db;
17  public $pSettings;
18 
19  private $settings;
20  #private $settings_id;
21 
22  private $server_host;
23  private $server_path;
24  private $vendor;
25  private $auth_token;
26  private $page_style;
27  private $ssl;
28 
29  static private $instance = null;
30 
37  static public function getInstance()
38  {
39  if (!self::$instance)
40  {
41  self::$instance = new ilPaypalSettings();
42  }
43 
44  return self::$instance;
45  }
46 
52  private function ilPaypalSettings()
53  {
54  $this->pSettings = ilPaymentSettings::_getInstance();
55 
56  $this->getSettings();
57  }
58 
64  private function getSettings()
65  {
66  $result_paypal = $this->pSettings->get('paypal');
67  $data = array();
68 
69  if ($result_paypal != "" && $result_paypal != NULL)
70  {
71  $data = unserialize($result_paypal);
72  }
73 
74  $this->setServerHost($data["server_host"]);
75  $this->setServerPath($data["server_path"]);
76  $this->setVendor($data["vendor"]);
77  $this->setAuthToken($data["auth_token"]);
78  $this->setPageStyle($data["page_style"]);
79  $this->setSsl($data["ssl"]);
80  }
81 
87  private function fetchSettingsId()
88  {
89 
90  }
91 
92  public function setSettingsId($a_settings_id = 0)
93  {
94  # $this->settings_id = $a_settings_id;
95  }
96 
97  public function getSettingsId()
98  {
99  # return $this->settings_id;
100  }
101 
102  public function setServerHost($a_server_host)
103  {
104  $this->server_host = $a_server_host;
105  }
106 
107  public function getServerHost()
108  {
109  return $this->server_host;
110  }
111 
112  public function setServerPath($a_server_path)
113  {
114  $this->server_path = $a_server_path;
115  }
116 
117  public function getServerPath()
118  {
119  return $this->server_path;
120  }
121 
122  public function setVendor($a_vendor)
123  {
124  $this->vendor = $a_vendor;
125  }
126 
127  public function getVendor()
128  {
129  return $this->vendor;
130  }
131 
132  public function setAuthToken($a_auth_token)
133  {
134  $this->auth_token = $a_auth_token;
135  }
136 
137  public function getAuthToken()
138  {
139  return $this->auth_token;
140  }
141 
142  public function setPageStyle($a_page_style)
143  {
144  $this->page_style = $a_page_style;
145  }
146 
147  public function getPageStyle()
148  {
149  return $this->page_style;
150  }
151 
152  public function setSsl($a_ssl)
153  {
154  $this->ssl = $a_ssl;
155  }
156 
157  public function getSsl()
158  {
159  return $this->ssl;
160  }
161 
168  function getAll()
169  {
170  $values = array(
171  "server_host" => $this->getServerHost(),
172  "server_path" => $this->getServerPath(),
173  "vendor" => $this->getVendor(),
174  "auth_token" => $this->getAuthToken(),
175  "page_style" => $this->getPageStyle(),
176  "ssl" => $this->getSsl()
177  );
178 
179  return $values;
180  }
181 
187  function clearAll()
188  {
189  $this->pSettings->set('paypal', NULL, 'paypal');
190  $this->settings = array();
191  }
192 
198  public function save()
199  {
200  $values = array(
201  "server_host" => $this->getServerHost(),
202  "server_path" => $this->getServerPath(),
203  "vendor" => $this->getVendor(),
204  "auth_token" => $this->getAuthToken(),
205  "page_style" => $this->getPageStyle(),
206  "ssl" => $this->getSsl()
207  );
208 
209  $this->pSettings->set('paypal', serialize($values), 'paypal');
210  }
211 }
212 ?>