function GetNation($nationId) { $sql = "select * from t_Nation where nationId={$nationId}"; $sqlHelper = new SqlHelper(); $arr = $sqlHelper->execute_dql2($sql); $sqlHelper->close_connect(); // 二次封装,$arr=>Nation对象实例 $nation = new Nation(); if (count($arr) > 0) { $nation->setNationId($arr[0]['nationId']); $nation->setNationName($arr[0]['nationName']); } return $nation; }
public function actionEditmoreinfo($user_id) { $user_more_info = UserInfoAR::model()->findByPk($user_id); $this->assign('user_more', $user_more_info); $maritalStatus = MaritalStatus::model()->findAll(); // 'MaritalStatus', 'marital_status_id'), $hometown = Hometown::model()->findAll(); // 'Province', 'hometown_id'), $nation = Nation::model()->findAll(); // 'Nation', 'nation_id'), $bodyType = BodyType::model()->findAll(); // 'BodyType', 'body_type_id'), $education = Education::model()->findAll(); // 'Education', 'education_id'), $school = School::model()->findAll(); // 'School', 'school_id'), $province = Province::model()->findAll(); // 'Province', 'province_id'), $job = Job::model()->findAll(); // '$maritalSta, $this->assign('maritalStatus', $maritalStatus); $this->assign('hometown', $hometown); $this->assign('nation', $nation); $this->assign('bodyType', $bodyType); $this->assign('education', $education); $this->assign('school', $school); $this->assign('province', $province); $this->assign('job', $job); }
public static function select($id) { $connection = Flight::dbMain(); try { $sql = "SELECT * FROM e_sim_vendor WHERE id = :id;"; $query = $connection->prepare($sql); $query->bindParam(':id', $id, PDO::PARAM_INT); $query->execute(); if ($query->rowCount() < 1) { return null; } $row = $query->fetch(PDO::FETCH_ASSOC); $simVendor = new SimVendor(); $simVendor->Id = (int) $row['id']; $simVendor->Name = $row['sim_vendor_name']; $simVendor->Desc = $row['sim_vendor_desc']; $simVendor->Nation = Nation::select($row['e_nation_id']); return $simVendor; } catch (PDOException $pdoException) { throw $pdoException; } catch (Exception $exception) { throw $exception; } finally { $connection = null; } }
public static function select($id) { $connection = Flight::dbMain(); try { $sql = "SELECT * FROM company_address WHERE id = :id;"; $query = $connection->prepare($sql); $query->bindParam(':id', $id, PDO::PARAM_INT); $query->execute(); if ($query->rowCount() < 1) { return null; } $row = $query->fetch(PDO::FETCH_ASSOC); $address = new Address(); $address->Id = (int) $row['id']; $address->Name = $row['address_name']; $address->Full = $row['address_full']; $address->Coordinate = new Coordinate((double) $row['address_latitude'], (double) $row['address_longitude']); $address->Country = $row['address_country']; $address->City = $row['address_city']; $address->Area = $row['address_area']; $address->Nation = Nation::select($row['e_nation_id']); return $address; } catch (PDOException $pdoException) { throw $pdoException; } catch (Exception $exception) { throw $exception; } finally { $connection = null; } }
/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); // Nation DB::table('nations')->delete(); Nation::create(array('libelle' => '---', 'code' => 'xxx')); Nation::create(array('libelle' => 'Belgique', 'code' => 'be')); Nation::create(array('libelle' => 'France', 'code' => 'fr')); Nation::create(array('libelle' => 'Luxembourg', 'code' => 'lu')); // Region DB::table('regions')->delete(); // Belgique Region::create(array('nation_id' => 1, 'libelle' => '---')); Region::create(array('nation_id' => 2, 'libelle' => 'Anvers')); Region::create(array('nation_id' => 2, 'libelle' => 'Brabant Flamand')); Region::create(array('nation_id' => 2, 'libelle' => 'Brabant Wallon')); Region::create(array('nation_id' => 2, 'libelle' => 'Bruxelles')); Region::create(array('nation_id' => 2, 'libelle' => 'Flandre Occidentale')); Region::create(array('nation_id' => 2, 'libelle' => 'Flandre Orientale')); Region::create(array('nation_id' => 2, 'libelle' => 'Limbourg')); Region::create(array('nation_id' => 2, 'libelle' => 'Hainaut')); Region::create(array('nation_id' => 2, 'libelle' => 'Liège')); Region::create(array('nation_id' => 2, 'libelle' => 'Luxembourg')); Region::create(array('nation_id' => 2, 'libelle' => 'Namur')); // France Region::create(array('nation_id' => 3, 'libelle' => 'Alsace')); Region::create(array('nation_id' => 3, 'libelle' => 'Aquitaine')); Region::create(array('nation_id' => 3, 'libelle' => 'Auvergne')); Region::create(array('nation_id' => 3, 'libelle' => 'Basse Normandie')); Region::create(array('nation_id' => 3, 'libelle' => 'Bourgogne')); Region::create(array('nation_id' => 3, 'libelle' => 'Bretagne')); Region::create(array('nation_id' => 3, 'libelle' => 'Centre')); Region::create(array('nation_id' => 3, 'libelle' => 'Champagne Ardennes')); Region::create(array('nation_id' => 3, 'libelle' => 'Corse')); Region::create(array('nation_id' => 3, 'libelle' => 'Franche Comte')); Region::create(array('nation_id' => 3, 'libelle' => 'Guadeloupe')); Region::create(array('nation_id' => 3, 'libelle' => 'Guyanne')); Region::create(array('nation_id' => 3, 'libelle' => 'Normandie')); Region::create(array('nation_id' => 3, 'libelle' => 'Ile de France')); Region::create(array('nation_id' => 3, 'libelle' => 'La Réunion')); Region::create(array('nation_id' => 3, 'libelle' => 'Languedoc Roussillon')); Region::create(array('nation_id' => 3, 'libelle' => 'Limousin')); Region::create(array('nation_id' => 3, 'libelle' => 'Lorraine')); Region::create(array('nation_id' => 3, 'libelle' => 'Martinique')); Region::create(array('nation_id' => 3, 'libelle' => 'Midi Pyrennées')); Region::create(array('nation_id' => 3, 'libelle' => 'Nord Pas-de-Calais')); Region::create(array('nation_id' => 3, 'libelle' => 'Nouvelle Calédonie')); Region::create(array('nation_id' => 3, 'libelle' => 'Paca')); Region::create(array('nation_id' => 3, 'libelle' => 'Pays de Loire')); Region::create(array('nation_id' => 3, 'libelle' => 'Picardie')); Region::create(array('nation_id' => 3, 'libelle' => 'Poitoi Charentes')); Region::create(array('nation_id' => 3, 'libelle' => 'Rhones Alpes')); Region::create(array('nation_id' => 3, 'libelle' => 'Territoire Outre Mer')); // Luxembourg Region::create(array('nation_id' => 4, 'libelle' => 'Luxembourg')); }
Xform::addText('backUrl', '', $param['backUrl']); Xform::addText('user_id', 'USER_ID', Auth::user()->id, 1); Xform::endRow(); // Get Fields Xform::startRow(); Xform::addText('nom', 'Nom', $datas->nom, 4); Xform::addText('prenom', 'Prénom', $datas->prenom, 4); Xform::addDate('naissance', 'Date de naissance', $datas->naissance, 4); Xform::endRow(); Xform::startRow(); Xform::addSelect('nation_id', Nation::lists('libelle', 'id'), 'Nationalité', $datas->nation_id, 3); Xform::addSelect('langue_id', Langue::lists('libelle', 'id'), 'Langue', $datas->langue_id, 3); Xform::addText('Tel1', 'Téléphone', $datas->tel1, 3); Xform::endRow(); Xform::startRow(); Xform::addSelect('selectNation_id', Nation::lists('libelle', 'id'), 'Pays', $datas->club->region->nation->id, 3); Xform::addSelect('region_id', Region::listRegionsOneNation($datas->club->region->nation->id), 'Region', $datas->club->region->id, 3); Xform::addSelect('club_id', Club::listClubsOneRegion($datas->club->region->id), 'Club', $datas->club_id, 4); Xform::endRow(); Xform::startRow(); Xform::addText('licence', 'N° licence', $datas->licence, 3); Xform::addSelect('statusplayer_id', Statusplayer::lists('libelle', 'id'), 'Status', $datas->statusplayer_id, 2); Xform::addText('hcp', 'Hcp (index)', $datas->hcp, 2); Xform::addSelect('sexe_id', Sexe::lists('libelle', 'id'), 'Cat', $datas->sexe_id, 2); Xform::endRow(); // Buttons Xform::addSubmit(); Xform::addCancel($param['backUrl']); // Message bottom //Xform::addMessage('Ceci est un message'); ?>
Xform::addSelect('statussocial_id', Statussocial::lists('libelle', 'id'), 'Status', $datas->statussocial_id, 3); Xform::addSelect('langue_id', Langue::lists('libelle', 'id'), 'Langue', $datas->langue_id, 2); Xform::endRow(); Xform::startRow(); Xform::addText('societe', 'Société', $datas->societe, 4); Xform::addText('numtva', 'N° de TVA', $datas->numtva, 3); Xform::endRow(); Xform::startRow(); Xform::addText('adr1', 'Adresse', $datas->adr1, 4); Xform::addText('adr2', 'Adresse 2', $datas->adr2, 4); Xform::endRow(); Xform::startRow(); Xform::addText('Tel1', 'Téléphone 1', $datas->tel1, 3); Xform::addText('Tel2', 'Téléphone 2', $datas->tel2, 3); Xform::endRow(); Xform::startRow(); Xform::addText('cpost', 'Code postal', $datas->cpost, 2); Xform::addText('ville', 'Ville', $datas->ville, 4); Xform::addSelect('nation_id', Nation::lists('libelle', 'id'), 'Pays', $datas->nation_id, 2); Xform::endRow(); // Buttons Xform::addSubmit(); Xform::addCancel($param['backUrl']); // Message bottom //Xform::addMessage('Ceci est un message'); ?> <!-- Close Form --> {{ Xform::show($errors,'left') }} {{ closeContent() }}
<?php Route::group(['prefix' => 'ajax'], function () { # SelectBox Nations Route::post('sbNations', function () { $results = Nation::all(); $code = ''; foreach ($results as $result) { $code .= '<option value="' . $result->id . '">' . $result->libelle . '</option>'; } return $code; }); # SelectBox Regions Route::post('sbRegions/{nation_id}', function ($nation_id) { $results = Region::where('nation_id', '=', $nation_id)->get(); $code = ''; foreach ($results as $result) { $code .= '<option value="' . $result->id . '">' . $result->libelle . '</option>'; } return $code; }); # SelectBox Clubs Route::post('sbClubs/{region_id}', function ($region_id) { $results = Club::where('region_id', '=', $region_id)->get(); $code = ''; foreach ($results as $result) { $code .= '<option value="' . $result->id . '">' . $result->nom . '</option>'; } return $code; }); # LoadPage
<?php require_once '../phpbean/Nation.class.php'; require_once '../service/NationService.class.php'; //创建了NationService实例 $nationService = new NationService(); //根据action参数决定用户要执行什么样的操作 if (!empty($_REQUEST['action'])) { //接收action值 $action = $_REQUEST['action']; if ($action == "add") { //说明用户希望执行添加民族信息信息 $nation = new Nation(); $array_nation = $_POST["nation"]; $nation->setNationId($array_nation['nationId']); $nation->setNationName($array_nation['nationName']); //完成添加->数据库 $res = $nationService->AddNation($nation); if ($res == 1) { header("Location: /ok.php"); exit; } else { //失败 header("Location: /error.php"); exit; } } else { if ($action == "query") { //查询民族信息信息 require_once '../service/NationService.class.php'; require_once '../service/FenyePage.class.php'; //获取查询参数
# List Route::get('/list', ['as' => 'test.list', 'uses' => 'TestsController@liste']); # Home Route::get('/home', ['as' => 'test.home', 'uses' => 'TestsController@home']); # ScoreCard Angular Route::get('/scorecard', ['as' => 'test.scorecard', 'uses' => 'TestsController@scorecard']); # Divers test Route::get('/divers', ['as' => 'test.divers', 'uses' => 'TestsController@divers']); # Show Session Route::get('/showSession', ['as' => 'test.showSession', 'uses' => 'TestsController@showSession']); # Show Ajax Route::get('/showAjax', ['as' => 'test.showAjax', 'uses' => 'TestsController@showAjax']); # Test Ajax Route::get('/getAjax/{model}/{id?}', function ($model, $id = 0) { if ($id == 0) { return $model::all(); } return $model::find($id); }); Route::get('/getNation', function () { return Nation::all(); }); Route::get('/getRegion/{nation_id}', function ($nation_id) { $result = DB::table('regions')->select('regions.id', 'regions.libelle', 'nation_id')->join('nations', 'regions.nation_id', '=', 'nations.id')->where('regions.nation_id', '=', $nation_id)->get(); return $result; }); Route::get('/getClub/{region_id}', function ($region_id) { $result = DB::table('clubs')->select('clubs.id', 'clubs.nom', 'region_id', 'regions.libelle')->join('regions', 'clubs.region_id', '=', 'regions.id')->where('clubs.region_id', '=', $region_id)->get(); return $result; }); });
Flight::ok($object); } catch (Exception $exception) { Flight::error($exception); } }); Flight::route('PUT /v1/main/nation/@id', function ($id) { try { $object = Nation::update($id); Flight::ok($object); } catch (Exception $exception) { Flight::error($exception); } }); Flight::route('DELETE /v1/main/nation/@id', function ($id) { try { $object = Nation::delete($id); Flight::ok($object); } catch (Exception $exception) { Flight::error($exception); } }); //============================================================================= //Poi //============================================================================= Flight::route('GET /v1/main/poi', function () { try { $array = Poi::selectAll(); Flight::ok($array); } catch (Exception $exception) { Flight::error($exception); }