示例#1
0
 /**
  * Updates an existing Brands model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $countries = Countries::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'countries' => $countries]);
     }
 }
示例#2
0
文件: Countries.php 项目: dosh93/shop
 static function loadCountries()
 {
     $countries = \app\models\Countries::find()->asArray()->all();
     /*for($i=0;$i<=count($categories)-1;$i++){
           if($categories[$i]['parent']!=0){
               $categories[$i]['name']=$categories[$i]['name']."(".\app\models\Category::findOne(['id'=>$categories[$i]['parent']])->name.")";
           }
       }*/
     $countries = ArrayHelper::map($countries, 'country_id', 'name');
     return $countries;
 }
示例#3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Countries::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', 'name', $this->name]);
     return $dataProvider;
 }
示例#4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Countries::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['defaultOrder' => ['name' => SORT_ASC]]);
     $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, 'area' => $this->area, 'population' => $this->population]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'capital', $this->capital]);
     return $dataProvider;
 }
 public function search($input)
 {
     $query = Countries::query();
     $columns = Schema::getColumnListing('countries');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
示例#6
0
 public function getCountries()
 {
     return $this->hasMany(Countries::className(), ['continent_code' => 'code']);
 }
示例#7
0
 public function getCountries()
 {
     return $this->hasOne(Countries::className(), ['code' => 'countryid']);
 }
示例#8
0
<?php

use yii\helpers\Html;
use app\models\Countries;
use yii\widgets\Pjax;
/* @var $id_country integer */
/* @var $state app\models\States */
/* @var $this \yii\web\View */
$countries = Countries::getList();
?>

<div class="row">

    <div class="col-xs-5">

       <?php 
echo Html::beginForm(['ajax/pjax'], 'get');
?>
       <?php 
echo Html::label('Select country to edit states/regions', 'country');
?>

       <?php 
echo Html::dropDownList('id_country', $id_country, $countries, ['prompt' => 'select country', 'id' => 'country', 'class' => 'form-control', 'onchange' => 'this.form.submit()']);
?>
       <?php 
echo Html::endForm();
?>
    </div>

    <div class="col-xs-5 col-xs-offset-2">
示例#9
0
 public function getCountries()
 {
     return $this->hasMany(Countries::className(), ['code' => jackpotDetails::className() . 'countryid']);
 }
示例#10
0
<?php

use app\models\Countries;
//	print_r($detail['lastconnected']['ISO']);
$response = file_get_contents("http://ip-api.com/json/{$_SERVER['REMOTE_ADDR']}", false, $context);
//	$response = file_get_contents("http://ip-api.com/json/14.192.159.252",false, $context);
$IPResponse = json_decode($response);
//	print_r($IPResponse);
global $cannotRegister, $userCountry, $userState;
$GLOBALS['cannotRegister'] = "false";
$GLOBALS['userCountry'] = $IPResponse->countryCode;
//	var_dump($cannotRegister,$userCountry,$userState);
$banned = Countries::find('first', array('conditions' => array('ISO2' => $GLOBALS['userCountry'])));
//	print_r($GLOBALS['userCountry']);
//	print_r($banned['Country']);
//	var_dump($banned['ISO2']);
if ($banned['banned'] == true) {
    $GLOBALS['cannotRegister'] = "true";
}
示例#11
0
</div>





    <div class="row">
    <div class="col-sm-4 col-md-4">
        <?php 
echo $form->field($model, 'zip_code')->widget(\yii\widgets\MaskedInput::classname(), ['mask' => '99999']);
?>
    </div>

    <div class="col-sm-4 col-md-4">
  <?php 
echo $form->field($model, 'countries')->widget(Select2::classname(), ['language' => 'de', 'data' => ArrayHelper::map(Countries::find()->all(), 'country_code', 'country_name'), 'options' => ['placeholder' => 'เลือกประเทศ ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
    </div>

    <div class="col-sm-4 col-md-4">
       <?php 
echo $form->field($model, 'mobile_phone')->widget(\yii\widgets\MaskedInput::classname(), ['mask' => '99-9999-9999']);
?>
    </div>

</div>

<div class="row">
    <div class="col-sm-6 col-md-6">
       <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => 150]);
示例#12
0
 public function actionContinent_country($param = '')
 {
     $countries = Countries::find()->filterWhere(['countries.continent_code' => $_REQUEST["code"]])->asArray()->all();
     if (count($countries) > 0) {
         foreach ($countries as $country) {
             echo "<option value='" . $country['code'] . "'>" . $country['name'] . "</option>";
         }
     } else {
         echo "<option>-</option>";
     }
 }
 public function actionCountry_currency($param = '')
 {
     if ($_REQUEST["code"] != "") {
         $countries = Countries::find()->filterWhere(['countries.code' => $_REQUEST["code"]])->asArray()->all();
         return $countries[0]['currency_code'];
     } else {
         return '';
     }
 }
示例#14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCountry()
 {
     return $this->hasOne(Countries::className(), ['id' => 'id_country']);
 }
示例#15
0
文件: Brands.php 项目: Robot72/task1
 public function getNameCountry()
 {
     return $this->hasOne(Countries::className(), ['id' => 'id_country'])->one()->name;
 }
 /**
  * Finds the Countries model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Countries the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Countries::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#17
0
<div class="jackpot-details-form<?php 
echo $model->continent;
?>
">

<?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
    <?php 
$continentData = ArrayHelper::map($continents, 'code', 'name');
$countryData = Countries::find()->select('countries.name as name, countries.code as code, countries.currency_code as currency')->innerJoinWith('countryListCode', false)->filterWhere(['continent_code' => $model->continent == '' ? '-' : $model->continent])->asArray()->all();
$currency = Countries::find()->select('countries.currency_code as currency')->filterWhere(['code' => $model->countryid == '' ? '-' : $model->countryid])->asArray()->all();
$currency[0]["currency"] = empty($currency) ? "" : $currency[0]["currency"];
//  echo Yii::$app->customFun->prx($currency);
$countryData = ArrayHelper::map($countryData, 'code', 'name');
echo $form->field($model, 'continent')->dropDownList($continentData, ['code' => 'name', 'prompt' => 'Select Continent', 'onchange' => '$.post("' . Yii::$app->urlManager->createUrl(["jackpot-section/continent_country"]) . '&code="+$(this).val(), function( data ) {
            var json = $.parseJSON(data);
             $( "#jackpotdetails-countryid" ).html( json.country );
             $( ".currency_code" ).html( json.currency );
           });
      '])->label('Continent');
?>
    
   

    <?php 
echo $form->field($model, 'countryid')->dropDownList($countryData, ['prompt' => 'Select Country', 'onchange' => '$.post("' . Yii::$app->urlManager->createUrl(["jackpot-section/country_currency"]) . '&code="+$(this).val(), function( data ) {
示例#18
0
 public function companyid($id = null)
 {
     $function = new Functions();
     $company = Companies::find('first', array('conditions' => array('hash' => $id)));
     if (count($company) == 0) {
         return $this->redirect('kyc::index');
     }
     if ($this->request->data) {
         //				if(stristr( $_SERVER['HTTP_REFERER'],COMPANY_URL)===FALSE){return $this->redirect('/kyc');exit;}
         $conditions = array('email' => $company['email'], 'kyc_id' => $company['kyc_id']);
         $save = Companies::update($this->request->data, $conditions);
     }
     $company = Companies::find('first', array('conditions' => array('hash' => $id)));
     $countries = Countries::find('all', array('order' => array('order' => 1)));
     return compact('company', 'countries');
 }