当前位置: 首页>>代码示例>>PHP>>正文


PHP Currency::find方法代码示例

本文整理汇总了PHP中app\models\Currency::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Currency::find方法的具体用法?PHP Currency::find怎么用?PHP Currency::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Currency的用法示例。


在下文中一共展示了Currency::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionGetCurrencies

 public function actionGetCurrencies()
 {
     $billing_id = Yii::$app->request->post('billing_id');
     $currencies = ArrayHelper::map(Currency::find()->where("billing_id = :billing_id", [':billing_id' => $billing_id])->with('billing')->asArray()->all(), 'id', 'name');
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     return $currencies;
 }
开发者ID:zinchenkomax,项目名称:moneychanger,代码行数:7,代码来源:RateController.php

示例2: getActiveCurrency

 public static function getActiveCurrency($chCode = false)
 {
     $attr = 'name';
     $query = Currency::find()->andWhere(['active' => true])->all();
     if ($chCode) {
         $attr = 'chCode';
     }
     return ArrayHelper::map($query, 'id', $attr);
 }
开发者ID:alexus007,项目名称:budget,代码行数:9,代码来源:Currency.php

示例3: actionCreate

 /**
  * Creates a new Account model.
  * If creation is successful, the browser will be redirected to the 'index' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Account();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash("Account-success", Yii::t("app", "Account successfully created"));
         return $this->redirect(['index']);
     } else {
         $currencyItems = Currency::find()->select(['id', 'name'])->where(['user_id' => Yii::$app->user->id])->asArray()->all();
         $currencyItems = ArrayHelper::map($currencyItems, 'id', 'name');
         return $this->render('create', ['model' => $model, 'currencyItems' => $currencyItems]);
     }
 }
开发者ID:ercling,项目名称:economizzer,代码行数:17,代码来源:AccountController.php

示例4: postSetActive

 public function postSetActive()
 {
     $id = Input::get('id');
     Currency::where('active', 1)->update(['active' => 0]);
     $currency = Currency::find($id);
     if ($currency) {
         $currency->active = 1;
         $currency->save();
         return Redirect::back()->with('message', "Курс валюты '{$currency->title}' обновлён");
     }
     return Redirect::back()->with('message', 'Ошибка обновления');
 }
开发者ID:venomir,项目名称:tc,代码行数:12,代码来源:CurrencyController.php

示例5: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Currency::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'iso', $this->iso])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
开发者ID:Nhassa,项目名称:budget,代码行数:21,代码来源:CurrencySearch.php

示例6: array

 */
$items = [['label' => BackLink::widget(['title' => Yii::t('app', 'Orders'), 'textOnly' => true]), 'url' => Url::to(['/admin/order/list'])]];
if (!$model->isNewRecord) {
    $items[] = ['label' => Yii::t('app', 'View items'), 'url' => Url::to(['/admin/order-items/list', 'node' => $model->id])];
}
$items[count($items) - 1]['active'] = true;
echo Nav::widget(['encodeLabels' => false, 'items' => $items, 'options' => ['class' => 'nav-pills']]);
?>

<div class="order-form">
    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'currency_code')->widget(EntityDropDown::className(), ['items' => ArrayHelper::map(Currency::find()->all(), 'code', 'name')]);
?>

    <?php 
echo $form->field($model, 'country_id')->widget(EntityDropDown::className(), array('items' => ArrayHelper::map(Country::find()->all(), 'id', 'name')));
?>

    <?php 
echo $form->field($model, 'user_id')->widget(EntityDropDown::className(), ['items' => ArrayHelper::map(User::find()->all(), 'id', 'name')]);
?>

    <?php 
echo $form->field($model, 'status')->widget(EntityDropDown::className(), ['items' => [Yii::t('app', 'New'), Yii::t('app', 'Closed'), Yii::t('app', 'Canceled')]]);
?>

    <?php 
开发者ID:vetoni,项目名称:toko,代码行数:31,代码来源:_form.php

示例7:

?>
<div class="operation-update">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <div class="operation-form">

    <?php 
$form = ActiveForm::begin(['id' => 'operation-form', 'options' => ['class' => 'form-horizontal col-lg-5'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-8\">{input}</div>\n<div class=\"col-lg-1\"></div><div class=\"col-lg-12\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-4 control-label']]]);
?>
	
	<?php 
$currencies = Currency::find()->all();
$currency_items = ArrayHelper::map($currencies, 'id', 'iso');
$operation_type = $t === 'income' ? 0 : 1;
$categories = Category::findAll(['type' => $operation_type]);
$category_items = ArrayHelper::map($categories, 'id', 'name');
$category_label = $t === 'income' ? 'Статья доходов' : 'Статья расходов';
?>
	
	<?php 
echo $form->field($model, 'currency_id')->dropDownList($currency_items)->label('Валюта');
?>
	<?php 
echo $form->field($model, 'summ');
?>
	<?php 
echo $form->field($model, 'category_id')->dropDownList($category_items)->label($category_label);
开发者ID:Nhassa,项目名称:budget,代码行数:31,代码来源:update.php

示例8: function

<?php

use app\models\Advert;
use app\models\AdvertSearch;
use app\models\Bookmark;
use app\models\Currency;
use yii\data\ActiveDataProvider;
use yii\helpers\Html;
use yii\helpers\Url;
$columns = [['attribute' => 'price', 'format' => 'html', 'value' => function ($searchModel) {
    $currency = Currency::find()->where(['>', 'date', time()])->asArray()->one();
    $dropDownItems = ['uan' => 'грн.', 'rur' => 'руб.', 'usd' => 'USD', 'eur' => 'EURO'];
    if (isset($_GET['currency']) && $_GET['currency'] !== 'default') {
        $cur = $_GET['currency'];
    } else {
        $cur = $searchModel->currency;
    }
    $price = round($searchModel->price * ($currency[$searchModel->currency] / $currency[$cur]), 2);
    return '<h4><strong>' . $price . ' ' . $dropDownItems[$cur] . '</strong></h4>';
}, 'options' => ['style' => 'width: 130px; max-width: 130px;']], ['attribute' => 'price', 'format' => 'html', 'value' => function ($searchModel) {
    $span = '<span class="glyphicon glyphicon-trash"></span>';
    $url = Url::toRoute(['bookmark/delete-bm', 'advert_id' => $searchModel->id]);
    return Html::a($span, [$url]);
}]];
$searchModel = new AdvertSearch();
$book = Bookmark::find()->where(['user_id' => Yii::$app->user->identity->getId()])->asArray()->all();
$n = count($book);
$arr = [0];
for ($i = 0; $i < $n; $i++) {
    $arr[$i] = $book[$i]['advert_id'];
}
开发者ID:aiskimzhi,项目名称:advert,代码行数:31,代码来源:try.php

示例9: get

 public function get($id, $elequent)
 {
     $cacheKey = self::CACHE . $id;
     if ($elequent) {
         return Currency::find($id);
     }
     $cachedData = \Cache::has($cacheKey);
     if (empty($cachedData)) {
         $currency = Currency::find($id);
         if (!empty($currency)) {
             $currency = $currency->toArray();
             // if(!empty($country['pic_path']))
             //     $country['profile_pic'] = env('STORAGE_URL').'app/user_images/'.$country['pic_path'];
             // else
             //     $country['profile_pic'] = '';
             $currency['updated_at'] = date('Y-m-d', strtotime($currency['updated_at']));
             $currency['created_at_formatted'] = date('Y-m-d', strtotime($currency['created_at']));
             $currency['updated_at_formatted'] = date('Y-m-d', strtotime($currency['updated_at']));
             // unset($country['password']);
             //unset($country['code']);
             // Set data in cache
             \Cache::forever($cacheKey, $currency);
             return $currency;
         } else {
             return false;
         }
     } else {
         return \Cache::get($cacheKey);
     }
 }
开发者ID:iqbalmalik89,项目名称:carpool,代码行数:30,代码来源:CurrencyRepository.php

示例10: actionMyAdverts

 public function actionMyAdverts()
 {
     if (Currency::find()->where(['>', 'date', time()])->orderBy(['date' => SORT_DESC])->asArray()->one() == null) {
         $currency = new Currency();
         if ($currency->exchangeRates()) {
             Yii::$app->session->setFlash('warning', 'Exchange rates might differ from actual ones');
         }
     }
     $searchModel = new AdvertSearch();
     $dataProvider = $searchModel->getMyAdverts();
     return $this->render('my-adverts', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:aiskimzhi,项目名称:advert,代码行数:12,代码来源:AdvertController.php

示例11: createAdvert

 /**
  * creates an advert
  */
 public function createAdvert()
 {
     $currency = Currency::find()->where(['date' => 0])->asArray()->one();
     if ($this->validate()) {
         $advert = new Advert();
         $advert->user_id = Yii::$app->user->identity->getId();
         $advert->category_id = $this->category_id;
         $advert->subcategory_id = $this->subcategory_id;
         $advert->region_id = $this->region_id;
         $advert->city_id = $this->city_id;
         $advert->title = $this->title;
         $advert->text = $this->text;
         $advert->price = $this->price;
         $advert->currency = $this->currency;
         $advert->u_price = $this->price * $currency[$this->currency];
         $advert->created_at = time();
         $advert->updated_at = time();
         $advert->views = 0;
         if ($advert->save()) {
             return $advert;
         }
     }
     return null;
 }
开发者ID:aiskimzhi,项目名称:advert,代码行数:27,代码来源:Advert.php

示例12: getListView

 /**
  * @return string
  */
 protected function getListView()
 {
     $dataProvider = new ActiveDataProvider(['query' => Currency::find()]);
     return $this->render('list', ['dataProvider' => $dataProvider]);
 }
开发者ID:vetoni,项目名称:toko,代码行数:8,代码来源:CurrencyController.php

示例13: destroy

 /**
  * Delete a currency.
  *
  * @param string $id
  *
  * @return Redirect
  */
 public function destroy($id)
 {
     // delete
     $currency = Currency::find($id);
     $currency->delete();
     // redirect
     $request->session()->flash('success', trans('currencies.currency') . ' ' . trans('crud.deleted'));
     return redirect('admin/currencies');
 }
开发者ID:kudosagency,项目名称:kudos-php,代码行数:16,代码来源:CurrenciesController.php

示例14: actionIndex

 /**
  * Lists all Currency models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new Currency();
     $dataProvider = new ActiveDataProvider(['query' => $searchModel->find()->where(['user_id' => Yii::$app->user->id])]);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
开发者ID:ercling,项目名称:economizzer,代码行数:10,代码来源:CurrencyController.php

示例15: actionMyBookmarks

 public function actionMyBookmarks()
 {
     if (Currency::find()->where(['>', 'date', time()])->orderBy(['date' => SORT_DESC])->asArray()->one() == null) {
         $currency = new Currency();
         if ($currency->exchangeRates()) {
             Yii::$app->session->setFlash('warning', 'Exchange rates might differ from actual ones');
         }
     }
     $disabled_subcat = 'disabled';
     $disabled_city = 'disabled';
     $catList = ArrayHelper::map(Category::find()->asArray()->all(), 'id', 'name');
     $regionList = ArrayHelper::map(Region::find()->asArray()->all(), 'id', 'name');
     $subcatList = [];
     $cityList = [];
     $searchModel = new BookmarkSearch();
     $dataProvider = $searchModel->getMyBookmarks();
     $advert = new Advert();
     return $this->render('my-bookmarks', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'catList' => $catList, 'subcatList' => $subcatList, 'regionList' => $regionList, 'cityList' => $cityList, 'disabled_subcat' => $disabled_subcat, 'disabled_city' => $disabled_city, 'advert' => $advert]);
 }
开发者ID:aiskimzhi,项目名称:advert,代码行数:19,代码来源:BookmarkController.php


注:本文中的app\models\Currency::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。