/**
  * @param array $input
  * @param Affiliate $affiliate
  *
  * @return array
  */
 private function getLicensePaymentDetails(array $input, Affiliate $affiliate)
 {
     $country = Country::find($input['country_id']);
     $data = ['firstName' => $input['first_name'], 'lastName' => $input['last_name'], 'email' => $input['email'], 'number' => $input['card_number'], 'expiryMonth' => $input['expiration_month'], 'expiryYear' => $input['expiration_year'], 'cvv' => $input['cvv'], 'billingAddress1' => $input['address1'], 'billingAddress2' => $input['address2'], 'billingCity' => $input['city'], 'billingState' => $input['state'], 'billingPostcode' => $input['postal_code'], 'billingCountry' => $country->iso_3166_2, 'shippingAddress1' => $input['address1'], 'shippingAddress2' => $input['address2'], 'shippingCity' => $input['city'], 'shippingState' => $input['state'], 'shippingPostcode' => $input['postal_code'], 'shippingCountry' => $country->iso_3166_2];
     $card = new CreditCard($data);
     return ['amount' => $affiliate->price, 'card' => $card, 'currency' => 'USD', 'returnUrl' => URL::to('license_complete'), 'cancelUrl' => URL::to('/')];
 }
示例#2
0
 public function actionIndex()
 {
     $query = Country::find();
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $countries = $query->orderBy('name')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['countries' => $countries, 'pagination' => $pagination]);
 }
示例#3
0
 public function actionTest()
 {
     $result = Country::find()->orderBy('population DESC')->all();
     //获取全部
     //var_dump($result);exit();
     return $this->render('test', ['result' => $result]);
 }
 public function getCountries()
 {
     $ret = [];
     foreach (Country::find()->all() as $cc) {
         $ret[$cc->key] = $cc->id;
     }
     return $ret;
 }
 public function actionIndex()
 {
     $country = new Country();
     echo PRE;
     $query = Country::find();
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $countries = $query->orderBy('name')->offset($pagination->offset)->limit($pagination->limit)->all();
 }
示例#6
0
 public function actionIndex()
 {
     $query = Country::find();
     //$query = Country::find()->andWhere(['code'=>'AU']);
     //初始化分页
     $pagination = new Pagination(['pageSize' => 2, 'totalCount' => $query->count()]);
     $countries = $query->orderBy('name')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['countries' => $countries, 'pagination' => $pagination]);
 }
示例#7
0
 public function convertInputForOmnipay($input)
 {
     $data = ['firstName' => $input['first_name'], 'lastName' => $input['last_name'], 'number' => $input['card_number'], 'expiryMonth' => $input['expiration_month'], 'expiryYear' => $input['expiration_year'], 'cvv' => $input['cvv']];
     if (isset($input['country_id'])) {
         $country = Country::find($input['country_id']);
         $data = array_merge($data, ['billingAddress1' => $input['address1'], 'billingAddress2' => $input['address2'], 'billingCity' => $input['city'], 'billingState' => $input['state'], 'billingPostcode' => $input['postal_code'], 'billingCountry' => $country->iso_3166_2, 'shippingAddress1' => $input['address1'], 'shippingAddress2' => $input['address2'], 'shippingCity' => $input['city'], 'shippingState' => $input['state'], 'shippingPostcode' => $input['postal_code'], 'shippingCountry' => $country->iso_3166_2]);
     }
     return $data;
 }
示例#8
0
 public function actionCountry()
 {
     $countries = Country::find()->orderBy('name desc')->all();
     echo \yii\helpers\Json::encode($countries);
     $countryUs = Country::findOne('US');
     echo '<br />' . \yii\helpers\Json::encode($countryUs);
     $countryUs->name = 'U.S.A.';
     echo $countryUs->save() ? '  OK' : '  False';
 }
示例#9
0
 public function getState(Request $req)
 {
     $country = Country::find($req->id);
     $state = state::where('country_code', $country->code)->get();
     $html = '<option value="" selected>Choose Option</option>';
     foreach ($state as $states) {
         $html .= '<option value="' . $states->id . '">' . $states->name . '</option>';
     }
     echo $html;
 }
示例#10
0
 public function getAttack($playerHash, $countryIdFrom, $countryIdTo)
 {
     $from = Country::find($countryIdFrom);
     /** @var $from Country */
     $to = Country::find($countryIdTo);
     $player = Player::getByHash($playerHash);
     if ($from->isOwnedBy($player)) {
         Action::attack($from, $to);
     }
 }
示例#11
0
 public static function sender()
 {
     //todo: move to database
     switch (Auth::user()->user_id) {
         default:
         case 4916903:
             return new self(['first_name' => 'osu!store', 'last_name' => '', 'street' => 'Room 304, Build 700 Nishijin 7-7-1', 'city' => 'Sawara', 'state' => 'Fukuoka', 'zip' => '814-0002', 'country' => Country::find('JP'), 'phone' => '+819064201305']);
         case 2:
             return new self(['first_name' => 'osu!store', 'last_name' => '', 'street' => 'Nishi-Ooi 4-21-3 Birdie House A', 'city' => 'Shinagawa', 'state' => 'Tokyo', 'zip' => '140-0015', 'country' => Country::find('JP'), 'phone' => '+818013811430']);
     }
 }
示例#12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['population' => $this->population]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#13
0
 /**
  * Updates an existing Address 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 = ArrayHelper::map(Country::find()->all(), 'country_id', 'country');
     $cities = ArrayHelper::map(City::find()->all(), 'city_id', 'city');
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->address_id]);
     } else {
         return $this->render('update', ['model' => $model, 'countries' => $countries, 'cities' => $cities]);
     }
 }
示例#14
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSizeLimit' => [10, 100]], 'sort' => ['defaultOrder' => ['name' => SORT_ASC]]]);
     $params = $this->processParams($params);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'code', $this->code]);
     return $dataProvider;
 }
 /**
  * Lists all CountryData models.
  * @return mixed
  */
 public function actionIndex()
 {
     $model = Country::find()->all();
     $file = Yii::$app->basePath . '/data/BP-各国能源具体数据-20151206.xlsx';
     $PHPExcel = \PHPExcel_IOFactory::load($file);
     $sheet = $PHPExcel->getSheet(5);
     // 读取第一個工作表(编号从 0 开始)
     $highestRow = $sheet->getHighestRow();
     // 取得总行数
     $highestColumm = $sheet->getHighestColumn();
     // 取得总列数
     // $years = 2014-1965+1;
     // for($row = 4; $row <= $highestRow; $row++){
     //   $org = array();
     //   $country = null;
     //   $data_key = null;
     //   $data_value = null;
     //   $flag = true;
     // // $row = 5;
     //   for ($column = 0; $column <= $years; $column++) {
     //     $column_name = \PHPExcel_Cell::stringFromColumnIndex($column);
     //     $val = (string)$sheet->getCell($column_name.$row)->getValue();
     //     if($column == 0){
     //       if($val == "US"){
     //         $val = "United States";
     //       }
     //       if($val == "Trinidad & Tobago"){
     //         $val = "Trinidad and Tobago";
     //       }
     //       $country_model = Country::find()->where([
     //           'name_english' => $val,
     //       ])->one();
     //       if(!isset($country_model->id)){
     //         $country = null;
     //         continue;
     //       }else{
     //         $country = $country_model->id;
     //       }
     //     }
     //     if($column >=1 && trim($val)!="" && $country){
     //       $model = new CountryData();
     //       $model->country_id = $country;
     //       $model->data_key = "oil_consumption_barrels";
     //       $model->data_value = $val;
     //       $y = 1965 + $column - 1;
     //       $model->data_version = (string)$y;
     //       $model->save();
     //     }
     //   }
     // }
     return $this->render('index', ['model' => $model]);
 }
示例#16
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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(['like', 'CODE', $this->CODE])->andFilterWhere(['like', 'NAME', $this->NAME])->andFilterWhere(['like', 'POPULATION', $this->POPULATION]);
     return $dataProvider;
 }
 public function convertInputForOmnipay($input)
 {
     $data = ['firstName' => $input['first_name'], 'lastName' => $input['last_name'], 'email' => $input['email'], 'number' => isset($input['card_number']) ? $input['card_number'] : null, 'expiryMonth' => isset($input['expiration_month']) ? $input['expiration_month'] : null, 'expiryYear' => isset($input['expiration_year']) ? $input['expiration_year'] : null];
     // allow space until there's a setting to disable
     if (isset($input['cvv']) && $input['cvv'] != ' ') {
         $data['cvv'] = $input['cvv'];
     }
     if (isset($input['country_id'])) {
         $country = Country::find($input['country_id']);
         $data = array_merge($data, ['billingAddress1' => $input['address1'], 'billingAddress2' => $input['address2'], 'billingCity' => $input['city'], 'billingState' => $input['state'], 'billingPostcode' => $input['postal_code'], 'billingCountry' => $country->iso_3166_2, 'shippingAddress1' => $input['address1'], 'shippingAddress2' => $input['address2'], 'shippingCity' => $input['city'], 'shippingState' => $input['state'], 'shippingPostcode' => $input['postal_code'], 'shippingCountry' => $country->iso_3166_2]);
     }
     return $data;
 }
示例#18
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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(['nombres' => $this->nombres, 'apellidos' => $this->apellidos, 'cedula' => $this->cedula, 'cargo' => $this->correo, 'tlf' => $this->tlf, 'username' => $this->username, 'fecha_registro' => $this->username]);
     $query->andFilterWhere(['like', 'nombres', $this->nombres])->andFilterWhere(['like', 'apellidos', $this->apellidos])->andFilterWhere(['like', 'cedula', $this->cedula])->andFilterWhere(['like', 'cargo', $this->cargo])->andFilterWhere(['like', 'tlf', $this->tlf])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'fecha_registro', $this->fecha_registro]);
     return $dataProvider;
 }
示例#19
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = Yii::createObject(['class' => ActiveDataProvider::className(), '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(['population' => $this->population]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#20
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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(['country_id' => $this->country_id, 'flag_active' => 1, 'date_added' => $this->date_added, 'date_update' => $this->date_update]);
     $query->andFilterWhere(['like', 'country_name', $this->country_name]);
     return $dataProvider;
 }
示例#21
0
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     // 加载搜索表单数据并验证
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     // 通过添加过滤器来调整查询语句
     $query->andFilterWhere(['code' => $this->code]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     $query->andFilterWhere(['LIKE', 'country.caption', $this->getAttribute('country.caption')]);
     return $dataProvider;
 }
示例#22
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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, 'created_by' => $this->created_by, 'modified_by' => $this->modified_by, 'created_date' => $this->created_date, 'modified_date' => $this->modified_date]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
示例#23
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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(['countryid' => $this->countryid, 'recordstatus' => $this->recordstatus]);
     $query->andFilterWhere(['like', 'countrycode', $this->countrycode])->andFilterWhere(['like', 'countryname', $this->countryname]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 20], 'sort' => ['defaultOrder' => ['code' => SORT_DESC]]]);
     $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(['population' => $this->population]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#25
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['population' => $this->population]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#26
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     //手动添加的分页
     $dataProvider->getPagination()->pageSize = 5;
     $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(['population' => $this->population]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#27
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find()->where(['is_status' => 0]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['country_id' => SORT_DESC]]]);
     $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(['country_id' => $this->country_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'country_name', $this->country_name]);
     unset($_SESSION['exportData']);
     $_SESSION['exportData'] = $dataProvider;
     return $dataProvider;
 }
 /**
  * Creates a new CountryOrgRel model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($oid)
 {
     $org = Organization::findOne(['id' => $oid]);
     $countries = Country::find()->all();
     $rels = CountryOrgRel::find()->where(['org_id' => $oid])->all();
     $model = new CountryOrgRel();
     if (Yii::$app->request->post()) {
         $model->load(Yii::$app->request->post());
         $count = CountryOrgRel::find()->where(['org_id' => $model->org_id, 'country_id' => $model->country_id])->count();
         if ($count == 0) {
             $model->save();
         }
         return $this->redirect(['create', 'oid' => $model->org_id]);
     } else {
         return $this->render('create', ['model' => $model, 'org' => $org, 'countries' => $countries, 'rels' => $rels]);
     }
 }
 public function actionActiveRecord()
 {
     $countryExists = Country::find()->where(['code' => 'PR'])->exists();
     if (!$countryExists) {
         $model = new Country();
         $model->name = 'Pery';
         $model->code = 'PR';
         if (!$model->save()) {
             var_dump($model->getErrors());
             return "Model not saved";
         }
     }
     $country = Country::findOne('UA');
     $countries = Country::findAll(['UA', 'GB']);
     $searchModel = new CountrySearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 /**
  * Creates a new JackpotDetails model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     die("dsfsad");
     $country = '';
     //Yii::$app->customFun->prx("JackpotDetails");
     $data = Yii::$app->request->post("JackpotDetails");
     if (isset($data)) {
         //Yii::$app->customFun->prx($data);
         $country = \app\models\Country::find()->innerJoinWith('continents', false)->filterWhere(['name' => null, 'continents.id' => $data["continent"]])->all();
     }
     $model = new JackpotDetails();
     $continent = \app\models\Continents::find()->innerJoinWith('country', false)->all();
     //Yii::$app->customFun->prx($continent);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'continents' => $continent, 'country' => $country]);
     }
 }