/**
  * @param CurrencyBase $currencyBase
  * @param integer $userId
  */
 protected static function saveCurrencyByCurrencyBase($currencyBase, $userId)
 {
     $currency = new Currency();
     $currency->title = $currencyBase->name;
     $currency->user_id = $userId;
     $currency->base_currency_id = $currencyBase->id;
     $currency->save();
 }
 /**
  * Get List Currency for Current User
  *
  * @return array
  */
 public static function getCurrentListCurrency()
 {
     $result = [];
     $currencies = Currency::findActual()->all();
     if (isset($currencies)) {
         foreach ($currencies as $currency) {
             /** @var $currency Currency */
             $result[$currency->id] = $currency->title;
         }
     }
     return $result;
 }
 /**
 * 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 any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'symbol', $this->symbol])->andFilterWhere(['like', 'iso_name', $this->iso_name]);
     return $dataProvider;
 }
Exemple #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCurrencies()
 {
     return $this->hasMany(Currency::className(), ['billing_id' => 'id']);
 }
 /**
  * Finds the Currency model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Currency the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Currency::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCurrency()
 {
     return $this->hasOne(\common\models\Currency::className(), ['id' => 'currency_id']);
 }
Exemple #7
0
?>
</label>
                <br>
                <?php 
Spaceless::begin();
?>
                    <?php 
echo $form->field($model, 'min_price', ['template' => "{input}"])->textInput(['name' => $directPopulating ? 'min_price' : null, 'placeholder' => Yii::t('app', 'Price from')]);
?>

                    <?php 
echo $form->field($model, 'max_price', ['template' => "{input}"])->textInput(['name' => $directPopulating ? 'max_price' : null, 'class' => 'without-left-border', 'placeholder' => Yii::t('app', 'Price to')]);
?>

                    <?php 
echo $form->field($model, 'currency', ['options' => ['tag' => false], 'template' => "{input}"])->dropDownList(Currency::getDropDownList(), ['name' => $directPopulating ? 'currency' : null]);
?>
                <?php 
Spaceless::end();
?>
            </div>
        </div>

        <div class="right">
            <?php 
echo $form->field($model, 'content', ['template' => "{input}"])->textarea(['name' => $directPopulating ? 'content' : null]);
?>
            
            <div class="button-container">
                <?php 
if ($model->isNewRecord || $model->templet) {
Exemple #8
0
 /**
  * function ->delete ()
  */
 public function delete()
 {
     $now = strtotime('now');
     $username = Yii::$app->user->identity->username;
     $model = $this;
     if ($log = new UserLog()) {
         $log->username = $username;
         $log->action = "Delete";
         $log->object_class = "Currency";
         $log->object_pk = $model->id;
         $log->created_at = $now;
         $log->is_success = 0;
         $log->save();
     }
     if (parent::delete()) {
         if ($log) {
             $log->is_success = 1;
             $log->save();
         }
         return true;
     }
     return false;
 }
Exemple #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCurrency()
 {
     return $this->hasOne(Currency::className(), ['id' => 'currencyId']);
 }
    ?>
</label>
                <br>
                <?php 
    Spaceless::begin();
    ?>
                    <?php 
    echo $form->field($searchModel, 'min_price', ['template' => "{input}"])->textInput(['name' => $directPopulating ? 'min_price' : null, 'placeholder' => $searchModel->getAttributeLabel('min_price')]);
    ?>

                    <?php 
    echo $form->field($searchModel, 'max_price', ['template' => "{input}"])->textInput(['name' => $directPopulating ? 'max_price' : null, 'class' => 'without-left-border', 'placeholder' => $searchModel->getAttributeLabel('max_price')]);
    ?>

                    <?php 
    echo $form->field($searchModel, 'currency', ['template' => "{input}{error}", 'options' => ['tag' => false]])->dropDownList(Currency::getDropDownList(), ['name' => $directPopulating ? 'currency' : null, 'emptyItem' => Yii::t('app', 'Currency')]);
    ?>
                <?php 
    Spaceless::end();
    ?>
                <div class="clear"></div>
            </div>
            
            <div class="button-container">
                <?php 
    echo Html::submitInput('Искать', ['class' => 'clear']);
    ?>
                    
                <?php 
    $js = <<<JS
\$('#detaile-search-panel .button-container input').hide();
 public function getAllCurrenciesAsMappedArray()
 {
     $models = Currency::find()->all();
     return ArrayHelper::map($models, 'id', 'symbol');
 }
Exemple #12
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFromCurrency()
 {
     return $this->hasOne(Currency::className(), ['id' => 'from_currency_id']);
 }
Exemple #13
0
 public function getDefaultCurrencyParams()
 {
     if (!($currency = Currency::find()->where(['id' => $this->default_currency_id])->andWhere(['is_active' => 1])->asArray()->one())) {
         $currency = [];
     }
     return $currency;
 }
Exemple #14
0
 public function getCurrencyname()
 {
     return $this->hasOne(\common\models\Currency::className(), ['recid' => 'invcurrency']);
 }