Exemplo n.º 1
0
 static function getSelectedCurrency($db)
 {
     if (!isset(Currency::$selected_currency_cache)) {
         $currencies = Currency::all($db);
         if (isset($_COOKIE['currency'])) {
             $selected_currency_id = $_COOKIE['currency'];
             $selected_currency = Currency::find($currencies, 'currency_id', $selected_currency_id);
         }
         if (!isset($selected_currency)) {
             $selected_currency = Currency::find($currencies, 'currency_value', 1);
         }
         Currency::$selected_currency_cache = $selected_currency;
     }
     return Currency::$selected_currency_cache;
 }
 public function update_user_form($user_id, $form_id)
 {
     $user = $this->user->find($user_id);
     $form = $this->form->find($form_id);
     $currencies = Currency::all();
     $cargo_types = CargoType::all();
     $contract_types = ContractType::all();
     $data = Input::except('_token', 'tax_content');
     if ($form->is_valid($data)) {
         $form->fill($data);
         if (Input::get('insurance') == 'on') {
             $form->insurance = 1;
         } else {
             $form->insurance = 0;
         }
         if (Input::get('admin_confirmed') == 'on') {
             $form->admin_confirmed = 1;
         } else {
             $form->admin_confirmed = 0;
         }
         if (null !== Input::get('tax_content')) {
             if (!$form->tax) {
                 $tax = new Tax(['content' => Input::get('tax_content')]);
                 $tax = $form->tax()->save($tax);
             } else {
                 $form->tax->content = Input::get('tax_content');
                 $form->tax->save();
             }
         }
         $form->save();
         return View::make('admin.form.show')->withForm($form)->withUser($user)->withErrors(['msg' => ['Сохранено!']])->withCurrencies($currencies)->withCargotypes($cargo_types)->with('contract_types', $contract_types);
     }
     return Redirect::back()->withInput()->withErrors(DeliveryForm::$errors);
 }
Exemplo n.º 3
0
 /**
  * Show the form for editing the specified loanproduct.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $loanproduct = Loanproduct::find($id);
     $currencies = Currency::all();
     return View::make('loanproducts.edit', compact('loanproduct', 'currencies'));
 }
Exemplo n.º 4
0
<?php

global $db, $raw_path, $messages, $home_dir, $custAuth;
require_once $home_dir . 'models/currency.m.php';
$currencies = Currency::all($db);
$selected_currency = Currency::getSelectedCurrency($db);
$is_logged_in = $custAuth->isAuth() && !$custAuth->customer->val('customer_anonymous');
?>
<div class="btn-group" role="group" aria-label="...">
	<div class="language dropdown btn btn-default">
		<span class="dropdown-toggle " data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
			<img src="/images/<?php 
echo t('language_code');
?>
.jpg" alt="<?php 
echo t('language_name');
?>
" title="<?php 
echo t('language_name');
?>
" />
			<?php 
echo t('language_name');
?>
			<span class="caret"></span>
		</span>
		<ul class="dropdown-menu">
			<li class="<?php 
echo t('cs_css');
?>
"><a href="#" onclick="javascript:setLang('cs');return false" ><img src="/images/cs.jpg" alt="<?php 
Exemplo n.º 5
0
 /**
  * Display a listing of currencies
  *
  * @return Response
  */
 public function index()
 {
     $currencies = Currency::all();
     return View::make('currencies.index', compact('currencies'));
 }
Exemplo n.º 6
0
 public function getCurrencies()
 {
     return Currency::all();
 }
Exemplo n.º 7
0
 private function currencies()
 {
     $class = get_class(new Currency());
     $this->log($this->verb . ' Currencies');
     $url = $this->baseUrl . "currency?c:limit=100";
     $data = $this->getCensusData($url);
     if (!$data) {
         return false;
     }
     // Collection of Eloquent objects from API
     $apiCollection = new Collection();
     foreach ($data->currency_list as $currency) {
         $values = [];
         $values['id'] = isset($currency->currency_id) ? $currency->currency_id : null;
         $values['name'] = isset($currency->name->en) ? $currency->name->en : null;
         $apiCollection->add(new Currency($values));
     }
     $currencies = Currency::all();
     $this->addModels($class, $currencies, $apiCollection);
     $this->deleteModels($class, $currencies, $apiCollection);
     $this->updateModels($class, Currency::all(), $apiCollection, ['name']);
 }