public function actionIndex() { $personData = new Employee(); $currency = new Currency(); $country = new Country(); return $this->render('index', ['personData' => $personData, 'currencyList' => $currency->getCurrencyList(), 'countryList' => $country->getCountryList()]); }
public function actionConsortium() { try { $companyConsortium = new CompanyConsortium(); $currency = new Currency(); $country = new Country(); $companyGround = new CompanyGround(); $countryList = $country->getCountryList(); $currencyList = $currency->getCurrencyList(); $companyGroundList = $companyGround->getCompanyGroundList(); //var_dump($countryList); exit(); // if(Yii::$app->request->post()) if ($companyConsortium->load(Yii::$app->request->post())) { $post = Yii::$app->request->post(); // $transaction = Yii::$app->db->beginTransaction(); var_dump($post); exit; // var_dump($post['CompanyConsortium']['name']); } else { echo "error"; } } catch (CException $ex) { var_dump($ex); Yii::app()->end(); } return $this->render('consortium', ['companyConsortium' => $companyConsortium, 'currencyList' => $currencyList, 'country' => $country, 'countryList' => $countryList, 'companyGroundList' => $companyGroundList]); }
public function actionIndex() { try { $personData = new Person(); $currency = new Currency(); $country = new Country(); $profession = new Professions(); $bloodGroup = new BloodGroup(); if ($personData->load(Yii::$app->request->post())) { $post = Yii::$app->request->post(); $jsonValue = $personData->genJsonPerson(); $jsonValue['profile_data']['first_name'] = $post['Person']['first_name']; $jsonValue['profile_data']['second_name'] = $post['Person']['second_name']; $jsonValue['profile_data']['first_surname'] = $post['Person']['first_surname']; $jsonValue['profile_data']['second_surname'] = $post['Person']['second_surname']; $jsonValue['profile_data']['date_born'] = $post['Person']['date_born']; $jsonValue['profile_data']['gender'] = $post['Person']['gender']; $jsonValue['profile_data']['marital_status_id'] = $post['Person']['marital_status_id']; $jsonValue['profile_data']['nationality_country_id'] = $post['Person']['nationality_country_id']; $jsonValue['profile_data']['blood_group_id'] = $post['Person']['blood_group_id']; $jsonValue['profile_data']['dni_type_id'] = $post['Person']['dni_type_id']; $jsonValue['profile_data']['dni'] = $post['Person']['dni']; /***********************************/ $jsonValue['geograhpic_data']['address']['country_id'] = $post['Person']['country_id']; $jsonValue['geograhpic_data']['address']['state_id'] = $post['Person']['state_id']; $jsonValue['geograhpic_data']['address']['city_id'] = $post['Person']['city_id']; $jsonValue['geograhpic_data']['address']['address'] = $post['Person']['address']; /***********************************/ $jsonValue['technical_data']['education_level_id'] = $post['Person']['education_level_id']; /***********************************/ $jsonValue['contact_data']['phone']['mobile'] = $post['Person']['phone_number_personal']; /************* Arreglos dentro de otros *********/ array_push($jsonValue['technical_data']['profession_id'], $post['Person']['profession_id']); array_push($jsonValue['contact_data']['email'], $post['Person']['email'], $post['Person']['email_2']); /* BVariables de Entorno Modelo*/ $personData->person_data = json_encode($jsonValue); $personData->date_reg = date('Y-m-d h:m:s'); if ($personData->validate()) { if ($personData->save(false)) { echo $personData->id; } else { echo date('Y-m-d'); } } else { // validation failed: $errors is an array containing error messages $errors = $personData->errors; } } } catch (CException $ex) { var_dump($ex); Yii::app()->end(); } return $this->render('index', ['personData' => $personData, 'currencyList' => $currency->getCurrencyList(), 'countryList' => $country->getCountryList(), 'professionList' => $profession->getProfessionList(), 'bloodGroup' => $bloodGroup->getBloodGroupList()]); }
/** * 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, 'surface_area' => $this->surface_area, 'indep_year' => $this->indep_year, 'population' => $this->population, 'life_expectancy' => $this->life_expectancy, 'gnp' => $this->gnp, 'gnpold' => $this->gnpold, 'capital' => $this->capital, 'numeric_code' => $this->numeric_code, 'phone_code' => $this->phone_code]); $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'continent', $this->continent])->andFilterWhere(['like', 'region', $this->region])->andFilterWhere(['like', 'local_name', $this->local_name])->andFilterWhere(['like', 'goverment_form', $this->goverment_form])->andFilterWhere(['like', 'head_state', $this->head_state])->andFilterWhere(['like', 'iso_code', $this->iso_code])->andFilterWhere(['like', 'currency_data', $this->currency_data]); return $dataProvider; }
/** * Finds the Country model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Country the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Country::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }