• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

payment/classes/class.ilPaymentCurrency.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00031 class ilPaymentCurrency
00032 {
00033         function _getAvailableCurrencies()
00034         {
00035                 global $ilDB;
00036                 
00037                 $query = "SELECT * FROM payment_currencies ";
00038                 $res = $ilDB->query($query);
00039 
00040                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00041                 {
00042                         $currencies[$row->currency_id]['currency_id']           = $row->currency_id;
00043                         $currencies[$row->currency_id]['unit']                          = $row->unit;
00044                         $currencies[$row->currency_id]['subunit']                       = $row->subunit;
00045                 }
00046                 return $currencies ? $currencies : array();
00047         }
00048         function _getCurrency($a_currency_id)
00049         {
00050                 global $ilDB;
00051                 
00052                 $query = "SELECT * FROM payment_currencies ".
00053                         "WHERE currency_id = '".$a_currency_id."'";
00054 
00055                 $res = $ilDB->query($query);
00056                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00057                 {
00058                         $currencies['currency_id']              = $row->currency_id;
00059                         $currencies['unit']                             = $row->unit;
00060                         $currencies['sub_unit']                 = $row->subunit;
00061                 }
00062                 return $currencies;
00063         }
00064         function _getUnit($a_currency_id)
00065         {
00066                 global $ilDB;
00067 
00068                 $query = "SELECT unit FROM payment_currencies ".
00069                         "WHERE currency_id = '".$a_currency_id."'";
00070 
00071                 $res = $ilDB->query($query);
00072                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00073                 {
00074                         return $row->unit;
00075                 }
00076                 return false;
00077         }
00078         function _getSubUnit($a_currency_id)
00079         {
00080                 global $ilDB;
00081 
00082                 $query = "SELECT subunit FROM payment_currencies ".
00083                         "WHERE currency_id = '".$a_currency_id."'";
00084 
00085                 $res = $ilDB->query($query);
00086                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00087                 {
00088                         return $row->subunit;
00089                 }
00090                 return false;
00091         }
00092 }
00093 
00094 ?>

Generated on Fri Dec 13 2013 09:06:37 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1