rootpackage
[ class tree: rootpackage ] [ index: rootpackage ] [ all elements ]

Class: Exchange_Rates

Source Location: /Exchange_Rates.php

Class Overview


Created on 05 sep 06


Author(s):

Version:

  • 2.0

Variables

Methods



Class Details

[line 17]
Created on 05 sep 06

This class manages Exchange Rates objects.

Changes: 2.0 -> 2.1: 27 jul 09 updated: renamed Dates class to STRdates 1.0 to 2.0: phpdoc compatible in the way to generate documentation




Tags:

author:  Pierre-Dominique Vienne <pvienne@me.com>
version:  2.0
license:  GNU Public License


[ Top ]


Class Variables

$average =

[line 86]

Variable that contains average rate.



Tags:

access:  public

Type:   float


[ Top ]

$database =  "currencies"

[line 23]

Variable that contains database name.



Tags:

access:  public

Type:   string


[ Top ]

$date_ts =

[line 40]

Variable that contains date (UNIX timestamp) of the exchange rate.



Tags:

access:  public

Type:   int


[ Top ]

$debug =  false

[line 108]

Variable that contains debug switch.



Tags:

access:  public

Type:   array


[ Top ]

$exch_ID =

[line 35]

Variable that contains ID of the exchange rate.



Tags:

access:  public

Type:   int


[ Top ]

$fromcurr_ID =

[line 45]

Variable that contains currency ID from which to convert.



Tags:

access:  public

Type:   int


[ Top ]

$oFromCurr =

[line 74]

Variable that contains currencies object (From currency).



Tags:

access:  public
uses:  GEOcurrencies

Type:   object


[ Top ]

$oFromDate =

[line 62]

Variable that contains From date object.



Tags:

access:  public
uses:  STRdates

Type:   object


[ Top ]

$oToCurr =

[line 80]

Variable that contains currencies object (To currency).



Tags:

access:  public
uses:  GEOcurrencies

Type:   object


[ Top ]

$oToDate =

[line 68]

Variable that contains To date object.



Tags:

access:  public
uses:  STRdates

Type:   object


[ Top ]

$rate =

[line 55]

Variable that contains exchange rate.



Tags:

access:  public

Type:   float


[ Top ]

$ratemax =

[line 96]

Variable that contains maximal rate.



Tags:

access:  public

Type:   float


[ Top ]

$ratemin =

[line 91]

Variable that contains minimal rate.



Tags:

access:  public

Type:   float


[ Top ]

$result =

[line 102]

Variable that contains Select results.



Tags:

access:  public

Type:   array


[ Top ]

$table =  "exchangerates"

[line 28]

Variable that contains table name.



Tags:

access:  public

Type:   string


[ Top ]

$tocurr_ID =

[line 50]

Variable that contains currency ID to which to convert.



Tags:

access:  public

Type:   int


[ Top ]



Class Methods


constructor __construct [line 133]

Exchange_Rates __construct( [array $aParams = null], [string $sAction = null])

Construction function

This function is used when object is generated. It places variables in "$this" var and can launch function

  1.  <?php
  2.  $aParams            array("oFromDate"=>$oFromDate_object,"oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"getByDateFromCurrToCurr");
  4.  print_r($oExchange_Rates->result);
  5.  // Displays all exchange rates between from date and to date, from 'from currency' to 'to currency'
  6.  ?>




Tags:

since:  Version 1.0
uses:  Strings


Parameters:

array   $aParams   array containing variable names and their value ($variablename => $value)
string   $sAction   string containing action to perform on object creation

[ Top ]

method avgEndLastQuarter [line 278]

float avgEndLastQuarter( object $this->oToDate, object $this->oFromCurr, object $this->oToCurr, string $this->database, string $this->table)

Average 15 last days of quarter obtention function

This function is used to get the average rate between two currencies for the 15 last days of a quarter. Result is stored in $this->average and returned

  1.  <?php
  2.  $aParams            array("oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"avgEndLastQuarter");
  4.  echo $oExchange_Rates->average;
  5.  // averagerate
  6.  ?>




Tags:

return:  average exchange rate
since:  Version 1.0
uses:  STRdates::quarterBeginTS()
uses:  STRdates
uses:  MySQL::SelectRow()
uses:  GEOcurrencies


Parameters:

object   $this->oToDate   to date object (required)
object   $this->oFromCurr   from currency object (required)
object   $this->oToCurr   to currency object (required)
string   $this->database   database name
string   $this->table   table name

[ Top ]

method avgLast2Weeks [line 362]

float avgLast2Weeks( object $this->oToDate, object $this->oFromCurr, object $this->oToCurr, string $this->database, string $this->table)

Average last 15 last days obtention function

This function is used to get the average rate between two currencies for the 15 last passed days. Result is stored in $this->average and returned

  1.  <?php
  2.  $aParams            array("oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"avgLast2Weeks");
  4.  echo $oExchange_Rates->average;
  5.  // averagerate
  6.  ?>




Tags:

return:  average exchange rate
since:  Version 1.0
uses:  STRdates
uses:  GEOcurrencies
uses:  MySQL::SelectRow()


Parameters:

object   $this->oToDate   to date object (required)
object   $this->oFromCurr   from currency object (required)
object   $this->oToCurr   to currency object (required)
string   $this->database   database name
string   $this->table   table name

[ Top ]

method getByDateFromCurrToCurr [line 186]

int getByDateFromCurrToCurr( object $this->oFromDate, object $this->oToDate, object $this->oFromCurr, object $this->oToCurr, string $this->database, string $this->table)

Rate exchange obtention function

This function is used to get an exchange rate by a range of dates, from currency and to currency. Result is stored in $this->result and number of fetched rows is returned

  1.  <?php
  2.  $aParams            array("oFromDate"=>$oFromDate_object,"oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"getByDateFromCurrToCurr");
  4.  print_r($oExchange_Rates->result);
  5.  // Displays all exchange rates between from date and to date, from 'from currency' to 'to currency'
  6.  ?>




Tags:

return:  number of fetched rows
since:  Version 1.0
uses:  STRdates
uses:  GEOcurrencies
uses:  MySQL::SelectRow()


Parameters:

object   $this->oFromDate   from date object (required)
object   $this->oToDate   to date object (required)
object   $this->oFromCurr   from currency object (required)
object   $this->oToCurr   to currency object (required)
string   $this->database   database name
string   $this->table   table name

[ Top ]

method getLastFromCurrToCurr [line 719]

float getLastFromCurrToCurr( object $this->oToDate, object $this->oFromCurr, object $this->oToCurr, string $this->database, string $this->table)

Maximum / minimum exchange rate obtention function

This function is used to get the max rate and the min rate between two currencies. Result is stored in $this->exch_ID, $this->from_currID, $this->to_currID, $this->rate and returned

  1.  <?php
  2.  $aParams            array("oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"getLastFromCurrToCurr");
  4.  echo $oExchange_Rates->rate;
  5.  // lastrate
  6.  ?>




Tags:

return:  last rate of the range
since:  Version 1.0
uses:  STRdates
uses:  GEOcurrencies
uses:  MySQL::SelectRow()


Parameters:

object   $this->oToDate   to date object (required)
object   $this->oFromCurr   from currency object (required)
object   $this->oToCurr   to currency object (required)
string   $this->database   database name
string   $this->table   table name

[ Top ]

method maxmin [line 627]

bool maxmin( object $this->oToDate, object $this->oFromCurr, object $this->oToCurr, string $this->database, string $this->table)

Maximum / minimum exchange rate obtention function

This function is used to get the max rate and the min rate between two currencies. Result is stored in $this->ratemin and $this->ratemax

  1.  <?php
  2.  $aParams            array("oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"maxmin");
  4.  echo $oExchange_Rates->ratemin;
  5.  // ratemin
  6.  echo $oExchange_Rates->ratemax;
  7.  // ratemax
  8.  ?>




Tags:

return:  true if query returned a value
since:  Version 1.0
uses:  STRdates
uses:  GEOurrencies
uses:  MySQL::SelectRow()


Parameters:

object   $this->oToDate   to date object (required)
object   $this->oFromCurr   from currency object (required)
object   $this->oToCurr   to currency object (required)
string   $this->database   database name
string   $this->table   table name

[ Top ]

method maxminLast2Weeks [line 538]

bool maxminLast2Weeks( object $this->oToDate, object $this->oFromCurr, object $this->oToCurr, string $this->database, string $this->table)

Maximum / minimum exchange rate obtention for last two weeks function

This function is used to get the max rate and the min rate for last two weeks between two currencies. Result is stored in $this->ratemin and $this->ratemax

  1.  <?php
  2.  $aParams            array("oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"maxminLast2Weeks");
  4.  echo $oExchange_Rates->ratemin;
  5.  // ratemin
  6.  echo $oExchange_Rates->ratemax;
  7.  // ratemax
  8.  ?>




Tags:

return:  true if query returned a value
since:  Version 1.0
uses:  STRdates
uses:  GEOcurrencies
uses:  MySQL::SelectRow()


Parameters:

object   $this->oToDate   to date object (required)
object   $this->oFromCurr   from currency object (required)
object   $this->oToCurr   to currency object (required)
string   $this->database   database name
string   $this->table   table name

[ Top ]

method maxminLastQuarter [line 449]

bool maxminLastQuarter( object $this->oToDate, object $this->oFromCurr, object $this->oToCurr, string $this->database, string $this->table)

Maximum / minimum exchange rate obtention for last quarter function

This function is used to get the max rate and the min rate for last quarter between two currencies. Result is stored in $this->ratemin and $this->ratemax

  1.  <?php
  2.  $aParams            array("oToDate"=>$oToDate_object,"oFromCurr"=>$oFromCurrency_object,"oToCurr"=>$oToCurrency_object);
  3.  $oExchange_Rates    new Exchange_Rates($aParams,"maxminLastQuarter");
  4.  echo $oExchange_Rates->ratemin;
  5.  // ratemin
  6.  echo $oExchange_Rates->ratemax;
  7.  // ratemax
  8.  ?>




Tags:

return:  true if query returned a value
since:  Version 1.0
uses:  STRdates::quarterBeginTS()
uses:  STRdates
uses:  MySQL::SelectRow()
uses:  GEOcurrencies


Parameters:

object   $this->oToDate   to date object (required)
object   $this->oFromCurr   from currency object (required)
object   $this->oToCurr   to currency object (required)
string   $this->database   database name
string   $this->table   table name

[ Top ]


Documentation generated on Wed, 26 Aug 2009 12:30:12 +0200 by phpDocumentor 1.4.1