Example #1
0
 public static function currency_select($currencies = null, $item = null)
 {
     if ($currencies == null) {
         $currencies = osc_get_currencies();
     }
     if ($item == null) {
         $item = osc_item();
     }
     if (Session::newInstance()->_getForm('currency') != '') {
         $item['fk_c_currency_code'] = Session::newInstance()->_getForm('currency');
     }
     if (count($currencies) > 1) {
         $default_key = null;
         $currency = osc_get_preference('currency');
         if (isset($item['fk_c_currency_code'])) {
             $default_key = $item['fk_c_currency_code'];
         } elseif (isset($currency)) {
             $default_key = $currency;
         }
         parent::generic_select('currency', $currencies, 'pk_c_code', 's_description', null, $default_key);
     } else {
         if (count($currencies) == 1) {
             parent::generic_input_hidden("currency", $currencies[0]["pk_c_code"]);
             echo $currencies[0]['s_description'];
         }
     }
 }
Example #2
0
function item_currency_select()
{
    ?>
        <?php 
    $aCurrencies = osc_get_currencies();
    ?>
        <select class="medium" id="currency" name="currency">
            <?php 
    foreach ($aCurrencies as $currency) {
        ?>
                <option value="<?php 
        echo $currency['pk_c_code'];
        ?>
"><?php 
        echo $currency['s_description'];
        ?>
</option>
            <?php 
    }
    ?>
        </select>
        <?php 
}
Example #3
0
function item_currency_select()
{
    $item = osc_item() != null ? osc_item() : array();
    $aCurrencies = osc_get_currencies();
    $currencySelected = get_item_currency($item);
    ?>
        <select class="medium" id="currency" name="currency">
            <?php 
    foreach ($aCurrencies as $currency) {
        ?>
                <option value="<?php 
        echo $currency['pk_c_code'];
        ?>
" <?php 
        echo $currencySelected == $currency['pk_c_code'] ? 'selected="selected"' : '';
        ?>
><?php 
        echo $currency['s_description'];
        ?>
</option>
            <?php 
    }
    ?>
        </select>
        <?php 
}
Example #4
0
 public static function currency_select($currencies = null, $item = null)
 {
     if ($currencies == null) {
         $currencies = osc_get_currencies();
     }
     if ($item == null) {
         $item = osc_item();
     }
     if (Session::newInstance()->_getForm('currency') != "") {
         $item['fk_c_currency_code'] = Session::newInstance()->_getForm('currency');
     }
     if (count($currencies) > 1) {
         $default_key = null;
         $currency = Preference::newInstance()->findByConditions(array('s_section' => 'osclass', 's_name' => 'currency'));
         if (isset($item['fk_c_currency_code'])) {
             $default_key = $item['fk_c_currency_code'];
         } elseif (is_array($currency)) {
             if (isset($currency['s_value'])) {
                 $default_key = $currency['s_value'];
             }
         }
         parent::generic_select('currency', $currencies, 'pk_c_code', 's_description', null, $default_key);
     } else {
         if (count($currencies) == 1) {
             parent::generic_input_hidden("currency", $currencies[0]["pk_c_code"]);
             echo $currencies[0]['s_description'];
         }
     }
 }