本文整理汇总了PHP中Country::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::get方法的具体用法?PHP Country::get怎么用?PHP Country::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Country
的用法示例。
在下文中一共展示了Country::get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParent
/**
* @return Region
*/
public function getParent()
{
if ($this->parent_id) {
//for now "parents" are always a country
return Country::get($this->parent_id);
}
}
示例2: assignResult
/**
* {@inheritDoc}
*/
protected function assignResult($server)
{
$this->name = $server['name'];
$this->address = $server['address'];
$this->country = Country::get($server['country']);
$this->owner = $server['owner'];
$this->online = $server['online'];
$this->info = unserialize($server['info']);
$this->updated = TimeDate::fromMysql($server['updated']);
$this->status = $server['status'];
}
示例3: index
public function index()
{
$post = array('alert' => '');
Model::load('admincp/taxrate');
$curPage = 0;
if ($match = Uri::match('\\/page\\/(\\d+)')) {
$curPage = $match[1];
}
if (Request::has('btnAction')) {
actionProcess();
}
if (Request::has('btnAdd')) {
try {
insertProcess();
$post['alert'] = '<div class="alert alert-success">Add new category success.</div>';
} catch (Exception $e) {
$post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
}
}
if (Request::has('btnSave')) {
$match = Uri::match('\\/edit\\/(\\d+)');
try {
updateProcess($match[1]);
$post['alert'] = '<div class="alert alert-success">Update category success.</div>';
} catch (Exception $e) {
$post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
}
}
if (Request::has('btnSearch')) {
filterProcess();
} else {
$post['pages'] = Misc::genPage('admincp/taxrate', $curPage);
$post['theList'] = Taxrates::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by taxid desc', 'cacheTime' => 1));
}
if ($match = Uri::match('\\/edit\\/(\\d+)')) {
$loadData = Taxrates::get(array('where' => "where taxid='" . $match[1] . "'"));
$post['edit'] = $loadData[0];
if (strlen($loadData[0]['country_short']) > 0) {
$post['edit']['countries'] = explode(',', $loadData[0]['country_short']);
}
// print_r($post['countries']);die();
}
$post['listCountries'] = Country::get();
System::setTitle('Taxrate list - ' . ADMINCP_TITLE);
View::make('admincp/head');
self::makeContents('taxrateList', $post);
View::make('admincp/footer');
}
示例4: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$eventTypeSource = EventType::get()->map()->toArray();
$countrySource = Country::get()->map()->toArray();
$fields->addFieldsToTab('Root.Main', array(TextField::create('LocationName', 'Location Name'), TextareaField::create('LocationAddress', 'Location Address'), $startDate = DatetimeField::create('StartTime', 'Start'), $endDate = DatetimeField::create('EndTime', 'End'), TextareaField::create('Price', 'Price'), DropdownField::create('EventTypeID', 'Type', $eventTypeSource), DropdownField::create('CountryID', 'Country', $countrySource), UploadField::create('Image', 'Image')));
$date = Date('Y-m-d', time());
$time = Date('H:i:s', time());
$startDate->getDateField()->setConfig('showcalendar', true);
$startDate->getDateField()->setValue($date);
$startDate->getTimeField()->setValue($time);
$endDate->getDateField()->setConfig('showcalendar', true);
$endDate->getDateField()->setValue($date);
$endDate->getTimeField()->setValue($time);
return $fields;
}
示例5: buildView
/**
* Render a list of comma-separated usernames for the user to see
*
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
if ($this->type === 'Role') {
foreach ($view->vars['choices'] as $choice) {
$role = \Role::get($choice->value);
$icon = $role->getDisplayIcon();
if ($icon !== null) {
$choice->attr['data-icon'] = $icon;
}
}
} elseif ($this->type === 'Country') {
foreach ($view->vars['choices'] as $choice) {
$country = \Country::get($choice->value);
$choice->attr['data-iso'] = $country->getISO();
}
}
}
示例6: index
/**
* Display a listing of the resource.
* GET /countries
*
* @return Response
*/
public function index()
{
return Response::json(Country::get());
}
示例7: run
public function run()
{
DB::table('wines')->truncate();
DB::table('wineries')->truncate();
DB::connection()->disableQueryLog();
set_time_limit(3600);
$c = 0;
$i = 1;
$count = 1;
$winery_id = 1;
try {
$file = app_path() . '/rakuten_wine_data_20140905.csv';
//$file = app_path() . '/testcsv.csv';
$i = 1;
$country_name_on_wines = Wine::take(300)->get(array('country_name'));
$country_name_ja_list = Country::get(array('country_name_ja'));
foreach ($country_name_ja_list as $country_name) {
if ($country_name->country_name_ja != null) {
if ($i == 1) {
$re = $country_name->country_name_ja;
$i++;
} else {
$re = $re . "|" . $country_name->country_name_ja;
}
}
}
$re_country_name = "'/" . $re . "/'";
$parser = \KzykHys\CsvParser\CsvParser::fromFile($file, array("encoding" => "UTF-8"));
foreach ($parser as $column_wine) {
echo $c++ . "\n";
if (count($column_wine) == 33) {
$validator = Validator::make(array('rakuten_id' => $column_wine[0]), array('rakuten_id' => 'exists:wines2,rakuten_id'));
if ($validator->passes()) {
if ($column_wine[13] == 'NA' && $column_wine[14] !== 'NA') {
$column_wine[13] = $column_wine[14];
}
if ($column_wine[9] == 'NA' && $column_wine[10] !== 'NA') {
$column_wine[9] = $column_wine[10];
}
for ($j = 0; $j < 33; $j++) {
if ($column_wine[$j] == 'NA') {
$column_wine[$j] = '';
}
}
if ($column_wine[3] == '') {
$column_wine[3] = $column_wine[1];
}
if ($column_wine[9] != null) {
$in_string = preg_match($re_country_name, $column_wine[9], $matches);
if ($in_string == true) {
//$country = explode('・', $country_name->country_name, -1);
$country = Country::where('country_name_ja', $matches[0])->first();
if ($country) {
$flag = $country->flag_url;
} else {
$flag = null;
}
}
}
$winery = Winery::where('brand_name', $column_wine[16])->first();
if ($winery == null) {
$winery_data = array('id' => $winery_id, 'brand_name' => $column_wine[16], 'country_id' => '', 'country_name' => $column_wine[10], 'year' => $column_wine[14], 'winery_url' => $column_wine[18], 'region' => $column_wine[11], 'description' => '');
Winery::create($winery_data);
$winery = $winery_id;
$winery_id++;
} else {
$winery = $winery->id;
}
$wine = array('name' => $column_wine[3], 'name_en' => $column_wine[4], 'sub_name' => $column_wine[5], 'sub_name_en' => $column_wine[6], 'year' => $column_wine[13], 'winery_id' => $winery, 'rakuten_id' => $column_wine[0], 'original_name' => $column_wine[1], 'original_name_2' => $column_wine[2], 'country_name' => $column_wine[9], 'image_url' => $column_wine[27], 'wine_flag' => $flag, 'imformation_image' => $column_wine[21] . ',' . $column_wine[22] . ',' . $column_wine[23] . ',' . $column_wine[24] . ',' . $column_wine[25] . ',' . $column_wine[26], 'rakuten_url' => $column_wine[17], 'wine_unique_id' => $i . '_' . $column_wine[13], 'color' => $column_wine[12], 'average_price' => $column_wine[15], 'average_rate' => 0, 'rate_count' => 0, 'wine_type' => $column_wine[7], 'folder_code' => $column_wine[20]);
if ($wine['year'] == '' || $wine['year'] == 0) {
$wine['wine_unique_id'] = $i . '_' . $i;
}
Wine::create($wine);
$i++;
}
} else {
$error = implode(",", $column_wine);
$file_error = app_path() . "/error.txt";
file_put_contents($file_error, $error . "\n", FILE_APPEND | LOCK_EX);
}
}
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
示例8: getCountry
/**
* Returns a Country object for the user's specified country. Legacy Support: Note that some users may not have country_id specified and rely on older country names. In those cases a new object is returned and can be operated in the same manner as newer country data
* @return Country
*/
public function getCountry()
{
if (is_null($this->cached_country)) {
if ($this->country_id && ($country = Country::get($this->country_id))) {
$this->cached_country = $country;
} else {
$this->cached_country = new Country($this->country);
}
}
return $this->cached_country;
}
示例9: getCountry
/**
* Get the country the server is in
* @return Country The country the server is located in
*/
public function getCountry()
{
return Country::get($this->country);
}
示例10: manage
function manage()
{
$data['message'] = null;
$countries = new Country();
$user_profile = new userProfile();
$countries->get();
foreach ($countries->all as $country) {
$data['countries'][$country->id] = $country->name;
}
$data['user_profile'] = $user_profile->get_by_id($this->dx_auth->get_user_id());
if ($this->dx_auth->is_logged_in()) {
$data['email'] = $this->dx_auth->get_user_email();
if ($this->form_validation->run() == false) {
$this->load->view('account/manage', $data);
} else {
$user_profile->country_id = $this->input->post('country');
$user_profile->website = $this->input->post('website');
$user_profile->name = $this->input->post('name');
$user_profile->save();
$data['message'] = '<p class="notice fade">Profile Details saved</p>';
$this->load->view('account/manage', $data);
}
} else {
redirect('session/login');
}
}
示例11: europe
function europe()
{
return $this->sendData(Country::get()->filter([]));
// define some filters for european countries ;)
}