Exemple #1
0
 /**
  * Returns a DSCParameter Formatted string representing the currency
  *
  * @param $currency_id currency_id
  * @return $string DSCParameter formatted string
  */
 public static function currencyToParameters($currency_id)
 {
     if (!is_numeric($currency_id)) {
         return false;
     }
     JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/models');
     $model = JModel::getInstance('Currencies', 'TiendaModel');
     $table = $model->getTable();
     // Load the currency
     if (!$table->load($currency_id)) {
         return false;
     }
     // Convert this into a DSCParameter formatted string
     // a bit rough, but works smoothly and is extensible (works even if you add another parameter to the curremcy table
     $currency_parameters = $table;
     unset($table);
     unset($currency_parameters->currency_id);
     unset($currency_parameters->created_date);
     unset($currency_parameters->modified_date);
     unset($currency_parameters->currency_enabled);
     $param = new DSCParameter('');
     $param->loadObject($currency_parameters);
     return $param->toString();
 }