ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPaymentCurrency.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
32 {
34  {
35  global $ilDB;
36 
37  $res = $ilDB->query('SELECT * FROM payment_currencies');
38 
39 
40  while($row = $ilDB->fetchObject($res))
41  {
42  $currencies[$row->currency_id]['currency_id'] = $row->currency_id;
43  $currencies[$row->currency_id]['unit'] = $row->unit;
44  $currencies[$row->currency_id]['subunit'] = $row->subunit;
45  }
46  return $currencies ? $currencies : array();
47  }
48  function _getCurrency($a_currency_id)
49  {
50  global $ilDB;
51 
52  $res = $ilDB->queryf('
53  SELECT * FROM payment_currencies WHERE currency_id = %s',
54  array('integer'), array($a_currency_id));
55 
56 
57  while($row = $ilDB->fetchObject($res))
58  {
59  $currencies['currency_id'] = $row->currency_id;
60  $currencies['unit'] = $row->unit;
61  $currencies['sub_unit'] = $row->subunit;
62  }
63  return $currencies;
64  }
65  function _getUnit($a_currency_id)
66  {
67  global $ilDB;
68 
69  $res = $ilDB->queryf('
70  SELECT unit FROM payment_currencies WHERE currency_id = %s',
71  array('integer'), array($a_currency_id));
72 
73  while($row = $ilDB->fetchObject($res))
74  {
75  return $row->unit;
76  }
77  return false;
78  }
79  function _getSubUnit($a_currency_id)
80  {
81  global $ilDB;
82 
83  $statement = $ilDB->queryf('
84  SELECT subunit FROM payment_currencies WHERE currency_id = %s',
85  array('integer'), array($a_currency_id));
86 
87  while($row = $ilDB->fetchObject($res))
88  {
89  return $row->subunit;
90  }
91  return false;
92  }
93 }
94 
95 ?>