| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- // This file is part of the Sloodle project (www.sloodle.org)
-
- /**
- * @package sloodle
- * @copyright Copyright (c) 2008 Sloodle (various contributors)
- * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
- *
- * @contributor Peter R. Bloomfield
- * @contributor Edmund Edgar
- * @contributor Fire Centaur
- */
-
- /** Include the general Sloodle library. */
- require_once(SLOODLE_LIBROOT.'/general.php');
-
- /**
- * The Sloodle course data class
- * @package sloodle
- */
- class SloodleCurrency
- {
- // DATA //
-
-
- // FUNCTIONS //
-
- /**
- * Constructor
- */
- function SloodleCurrency()
- {
-
- }
- function loadFromRecord($rec) {
- $this->id = $rec->id;
- $this->name = $rec->name;
- $this->timemodified = $rec->timemodified;
- $this->imageurl = $rec->imageurl;
- $this->displayorder = $rec->displayorder;
- }
- function FetchAll() {
- $recs = sloodle_get_records('sloodle_currency_types', null, null, 'displayorder asc, name asc');
- if (!$recs) {
- return false;
- }
- $currencies = array();
- foreach($recs as $rec) {
- $c = new SloodleCurrency();
- $c->loadFromRecord($rec);
- $currencies[] = $c;
- }
- return $currencies;
- }
- function FetchIDNameHash() {
- if (!$currencies = SloodleCurrency::FetchAll()) {
- return false;
- }
- $curbyid = array();
- foreach($currencies as $cur) {
- $id = $cur->id;
- $name = $cur->name;
- $curbyid[ $id ] = $name;
- }
- return $curbyid;
- }
- function ForID($id) {
- $rec = sloodle_get_record( 'sloodle_currency_types', 'id', $id );
- if (!$rec) {
- return null;
- }
- $curr = new SloodleCurrency();
- $curr->loadFromRecord( $rec );
- return $curr;
- }
- }
- ?>
|