当前位置: 首页>>代码示例>>PHP>>正文


PHP CI::Locations方法代码示例

本文整理汇总了PHP中CI::Locations方法的典型用法代码示例。如果您正苦于以下问题:PHP CI::Locations方法的具体用法?PHP CI::Locations怎么用?PHP CI::Locations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CI的用法示例。


在下文中一共展示了CI::Locations方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: zone_area_form

 public function zone_area_form($zone_id, $area_id = false)
 {
     \CI::load()->helper('form');
     \CI::load()->library('form_validation');
     \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>');
     $zone = \CI::Locations()->get_zone($zone_id);
     $data['zone'] = $zone;
     //default values are empty if the product is new
     $data['id'] = '';
     $data['code'] = '';
     $data['zone_id'] = $zone_id;
     $data['tax'] = 0;
     if ($area_id) {
         $area = (array) \CI::Locations()->get_zone_area($area_id);
         //if the country does not exist, redirect them to the country list with an error
         if (!$area) {
             \CI::session()->set_flashdata('error', lang('error_zone_area_not_found'));
             redirect('admin/locations/zone_areas/' . $zone_id);
         }
         $data = array_merge($data, $area);
     }
     \CI::form_validation()->set_rules('code', 'lang:code', 'trim|required');
     \CI::form_validation()->set_rules('tax', 'lang:tax', 'trim|numeric');
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('country_zone_area_form', $data);
     } else {
         $save['id'] = $area_id;
         $save['zone_id'] = $zone_id;
         $save['code'] = \CI::input()->post('code');
         $save['tax'] = \CI::input()->post('tax');
         \CI::Locations()->save_zone_area($save);
         \CI::session()->set_flashdata('message', lang('message_saved_zone_area'));
         //go back to the product list
         redirect('admin/locations/zone_areas/' . $save['zone_id']);
     }
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:36,代码来源:AdminLocations.php

示例2: index

 public function index()
 {
     \CI::load()->helper('form');
     \CI::load()->library('form_validation');
     //set defaults
     $data = ['company_name' => '', 'theme' => 'default', 'homepage' => '', 'products_per_page' => '24', 'default_meta_keywords' => '', 'default_meta_description' => '', 'sendmail_path' => '/usr/sbin/sendmail -bs', 'email_from' => '', 'email_to' => '', 'email_method' => 'Mail', 'smtp_server' => '', 'smtp_username' => '', 'smtp_password' => '', 'smtp_port' => '25', 'country_id' => '', 'city' => '', 'address1' => '', 'address2' => '', 'zone_id' => '', 'zip' => '', 'locale' => locale_get_default(), 'timezone' => date_default_timezone_get(), 'currency_iso' => 'USD', 'ssl_support' => '', 'stage_username' => '', 'stage_password' => '', 'require_login' => '', 'new_customer_status' => '1', 'weight_unit' => 'LB', 'dimension_unit' => 'IN', 'order_status' => '', 'inventory_enabled' => '', 'allow_os_purchase' => '', 'tax_address' => '', 'tax_shipping' => ''];
     \CI::form_validation()->set_rules('company_name', 'lang:company_name', 'required');
     \CI::form_validation()->set_rules('default_meta_keywords', 'lang:default_meta_keywords', 'trim|strip_tags');
     \CI::form_validation()->set_rules('default_meta_description', 'lang:default_meta_description', 'trim|strip_tags');
     \CI::form_validation()->set_rules('theme', 'lang:theme', 'required');
     \CI::form_validation()->set_rules('homepage', 'lang:select_homepage');
     \CI::form_validation()->set_rules('products_per_page', 'lang:products_per_page');
     \CI::form_validation()->set_rules('email_from', 'lang:email_from', 'required|valid_email');
     \CI::form_validation()->set_rules('email_to', 'lang:email_to', 'required|valid_email');
     \CI::form_validation()->set_rules('email_method', 'lang:email_method', 'required');
     if (\CI::input()->post('email_method') == 'smtp') {
         \CI::form_validation()->set_rules('smtp_server', 'lang:smtp_server', 'required');
         \CI::form_validation()->set_rules('smtp_username', 'lang:smtp_username', 'required');
         \CI::form_validation()->set_rules('smtp_password', 'lang:smtp_password', 'required');
         \CI::form_validation()->set_rules('smtp_port', 'lang:smtp_port', 'required');
     } elseif (\CI::input()->post('email_method') == 'sendmail') {
         \CI::form_validation()->set_rules('sendmail_path', 'lang:sendmail_path', 'required');
     }
     \CI::form_validation()->set_rules('country_id', 'lang:country');
     \CI::form_validation()->set_rules('address1', 'lang:address');
     \CI::form_validation()->set_rules('address2', 'lang:address');
     \CI::form_validation()->set_rules('zone_id', 'lang:state');
     \CI::form_validation()->set_rules('zip', 'lang:zip');
     \CI::form_validation()->set_rules('locale', 'lang:locale', 'required');
     \CI::form_validation()->set_rules('timezone', 'lang:timezone', 'required');
     \CI::form_validation()->set_rules('currency_iso', 'lang:currency', 'required');
     \CI::form_validation()->set_rules('ssl_support', 'lang:ssl_support');
     \CI::form_validation()->set_rules('stage', 'lang:stage');
     \CI::form_validation()->set_rules('stage_username', 'lang:stage_username');
     \CI::form_validation()->set_rules('stage_password', 'lang:stage_password');
     \CI::form_validation()->set_rules('require_login', 'lang:require_login');
     \CI::form_validation()->set_rules('new_customer_status', 'lang:new_customer_status');
     \CI::form_validation()->set_rules('weight_unit', 'lang:weight_unit');
     \CI::form_validation()->set_rules('order_status', 'lang:order_status');
     \CI::form_validation()->set_rules('inventory_enabled', 'lang:inventory_enabled');
     \CI::form_validation()->set_rules('allow_os_purchase', 'lang:allow_os_purchase');
     \CI::form_validation()->set_rules('tax_address', 'lang:tax_address');
     \CI::form_validation()->set_rules('tax_shipping', 'lang:tax_shipping');
     // get the values from the DB
     $data = array_merge($data, \CI::Settings()->get_settings('gocart'));
     $data['config'] = $data;
     //break out order statuses to an array
     //get installed themes
     $data['themes'] = [];
     $themePath = FCPATH . 'themes/';
     if ($handle = opendir($themePath)) {
         while (false !== ($entry = readdir($handle))) {
             if ($entry != "." && $entry != ".." && is_dir($themePath . $entry)) {
                 $data['themes'][$entry] = $entry;
             }
         }
         closedir($handle);
     }
     asort($data['themes']);
     //get locales
     $locales = \ResourceBundle::getLocales('');
     $data['locales'] = [];
     foreach ($locales as $locale) {
         $data['locales'][$locale] = locale_get_display_name($locale);
     }
     asort($data['locales']);
     //get ISO 4217 codes
     $data['iso_4217'] = [];
     $iso_4217 = json_decode(json_encode(simplexml_load_file(FCPATH . 'ISO_4217.xml')));
     $iso_4217 = $iso_4217->CcyTbl->CcyNtry;
     foreach ($iso_4217 as $iso_code) {
         if (isset($iso_code->Ccy)) {
             $data['iso_4217'][$iso_code->Ccy] = $iso_code->Ccy;
         }
     }
     asort($data['iso_4217']);
     $data['countries_menu'] = \CI::Locations()->get_countries_menu();
     if (!empty($data['country_id'])) {
         $data['zones_menu'] = \CI::Locations()->get_zones_menu($data['country_id']);
     } else {
         $countries_menu = array_keys($data['countries_menu']);
         $data['zones_menu'] = \CI::Locations()->get_zones_menu(array_shift($countries_menu));
     }
     $data['page_title'] = lang('common_gocart_configuration');
     $pages = \CI::Pages()->get_pages_tiered();
     $data['pages'] = [];
     foreach ($pages['all'] as $page) {
         if (empty($page->url)) {
             $data['pages'][$page->id] = $page->title;
         }
     }
     if (\CI::form_validation()->run() == FALSE) {
         $data['error'] = validation_errors();
         $this->view('settings', $data);
     } else {
         \CI::session()->set_flashdata('message', lang('config_updated_message'));
         $save = \CI::input()->post();
         //fix boolean values
         $save['ssl_support'] = (bool) \CI::input()->post('ssl_support');
         $save['require_login'] = (bool) \CI::input()->post('require_login');
//.........这里部分代码省略.........
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:101,代码来源:AdminSettings.php

示例3: khoang_cach

 public function khoang_cach($province, $district, $ward, $address)
 {
     $get_province = \CI::Locations()->get_zone($province);
     $province = $get_province->name;
     $address_tmp_1 = trim(str_replace(" ", "+", $address . "+" . $ward . "+" . $district . "+" . $province), "+");
     //echo $address_tmp_1;exit;
     //$address_tmp_2 = trim(str_replace(" ","+",$ward."+".$district."+".$province),"+");
     //$address_tmp_3 = trim(str_replace(" ","+",$district."+".$province),"+");
     //$address_tmp_4 = trim(str_replace(" ","+",$province),"+");
     //$details = 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=10.880659,106.750029&destinations=234+le+van+luong+nha+be+ho+chi+minh+vietnam&key=AIzaSyDIafD0HzwUeKBRqqufYxe080MCJniWERs';
     $details = 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=' . str_replace(' ', '', $this->data['basic']['LAT_LON_GOOGLE_MAP']->unit) . '&destinations=' . $address_tmp_1 . '+vietnam&key=AIzaSyDIafD0HzwUeKBRqqufYxe080MCJniWERs';
     $json = file_get_contents($details);
     $details = json_decode($json, TRUE);
     if ($details['rows'][0]['elements'][0]['status'] == 'OK') {
         $km = $details['rows'][0]['elements'][0]['distance']['text'];
         $km = str_replace(',', '', $km);
         $this->distance = ceil($km);
         if ($this->distance < 50) {
             $this->vc_duong_ngan($this->distance);
         } else {
             $this->vc_duong_dai($this->distance);
         }
     } else {
         $this->error_distance = true;
     }
     //echo $this->distance;echo "<pre>"; print_r($details); echo "</pre>";
     //echo $this->distance.':';echo $this->gia_vc_duong_dai;exit;
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:28,代码来源:Setup.php

示例4: addressForm

 public function addressForm($customer_id, $id = false)
 {
     $data['id'] = $id;
     $data['company'] = '';
     $data['firstname'] = '';
     $data['lastname'] = '';
     $data['email'] = '';
     $data['phone'] = '';
     $data['address1'] = '';
     $data['address2'] = '';
     $data['city'] = '';
     $data['country_id'] = '';
     $data['zone_id'] = '';
     $data['zip'] = '';
     $data['customer_id'] = $customer_id;
     $data['page_title'] = lang('address_form');
     //get the countries list for the dropdown
     $data['countries_menu'] = \CI::Locations()->get_countries_menu();
     if ($id) {
         $address = \CI::Customers()->get_address($id);
         //fully escape the address
         form_decode($address);
         //merge the array
         $data = array_merge($data, $address);
         $data['zones_menu'] = \CI::Locations()->get_zones_menu($data['country_id']);
     } else {
         //if there is no set ID, the get the zones of the first country in the countries menu
         $country_keys = array_keys($data['countries_menu']);
         $data['zones_menu'] = \CI::Locations()->get_zones_menu(array_shift($country_keys));
     }
     \CI::load()->library('form_validation');
     \CI::form_validation()->set_rules('company', 'lang:company', 'trim|max_length[128]');
     \CI::form_validation()->set_rules('firstname', 'lang:firstname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('lastname', 'lang:lastname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('email', 'lang:email', 'trim|required|valid_email|max_length[128]');
     \CI::form_validation()->set_rules('phone', 'lang:phone', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('address1', 'lang:address', 'trim|required|max_length[128]');
     \CI::form_validation()->set_rules('address2', 'lang:address', 'trim|max_length[128]');
     \CI::form_validation()->set_rules('city', 'lang:city', 'trim|required');
     \CI::form_validation()->set_rules('country_id', 'lang:country', 'trim|required');
     \CI::form_validation()->set_rules('zone_id', 'lang:state', 'trim|required');
     \CI::form_validation()->set_rules('zip', 'lang:zip', 'trim|required|max_length[32]');
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('customer_address_form', $data);
     } else {
         $a['customer_id'] = $customer_id;
         // this is needed for new records
         $a['id'] = empty($id) ? '' : $id;
         $a['field_data']['company'] = \CI::input()->post('company');
         $a['field_data']['firstname'] = \CI::input()->post('firstname');
         $a['field_data']['lastname'] = \CI::input()->post('lastname');
         $a['field_data']['email'] = \CI::input()->post('email');
         $a['field_data']['phone'] = \CI::input()->post('phone');
         $a['field_data']['address1'] = \CI::input()->post('address1');
         $a['field_data']['address2'] = \CI::input()->post('address2');
         $a['field_data']['city'] = \CI::input()->post('city');
         $a['field_data']['zip'] = \CI::input()->post('zip');
         $a['field_data']['zone_id'] = \CI::input()->post('zone_id');
         $a['field_data']['country_id'] = \CI::input()->post('country_id');
         $country = \CI::Locations()->get_country(\CI::input()->post('country_id'));
         $zone = \CI::Locations()->get_zone(\CI::input()->post('zone_id'));
         $a['field_data']['zone'] = $zone->code;
         // save the state for output formatted addresses
         $a['field_data']['country'] = $country->name;
         // some shipping libraries require country name
         $a['field_data']['country_code'] = $country->iso_code_2;
         // some shipping libraries require the code
         \CI::Customers()->save_address($a);
         \CI::session()->set_flashdata('message', lang('message_saved_address'));
         redirect('admin/customers/addresses/' . $customer_id);
     }
 }
开发者ID:thijmenvenus,项目名称:GoCart3,代码行数:72,代码来源:AdminCustomers.php

示例5: generator

 public function generator($eng, $alt, $can, $con, $hz = 50, $phase = 3, $gen_number = 1, $order_id = null)
 {
     /* \CI::load()->library('Setup');
     		\CI::Setup()->set(120);
     		echo (\CI::Setup()->bon_dung(5000, 2, 3));
     		exit;*/
     \CI::lang()->load('products');
     if ($order_id > 0) {
         $data['order'] = \CI::Orders()->getOrder($order_id, true);
     }
     //echo \CI::db()->last_query();exit;
     if ($eng == '' || $alt == '') {
         redirect(site_url());
     }
     $power_factor = 0.8;
     $can = \CI::uri()->segment(5);
     // only test on demo, we will get option for canopy
     $con = \CI::uri()->segment(6);
     $hz = \CI::uri()->segment(7);
     $phase = \CI::uri()->segment(8);
     $gen_number = \CI::uri()->segment(9);
     $order_id = \CI::uri()->segment(10);
     if (!empty($this->gen_compare)) {
         $con = $this->gen_compare['con'];
         $can = $this->gen_compare['can'];
         $hz = $this->gen_compare['hz'];
         $phase = $this->gen_compare['phase'];
         $gen_number = $this->gen_compare['gen_number'];
         $other = $this->gen_compare['other'];
     }
     if (!isset($gen_number) or $gen_number == 0) {
         $gen_number = 1;
     }
     $engine = \CI::Products()->getProduct($eng);
     $alternator = \CI::Products()->getProduct($alt);
     $canopy = \CI::Products()->getProduct($can);
     $controller = \CI::Products()->getProduct($con);
     if (empty($engine) || empty($alternator)) {
         redirect(site_url());
     }
     $engine->manufacturer = \CI::Products()->getManufacturers($engine->manufacturers);
     $alternator->manufacturer = \CI::Products()->getManufacturers($alternator->manufacturers);
     if (isset($canopy->manufacturers)) {
         $canopy->manufacturer = \CI::Products()->getManufacturers($canopy->manufacturers);
         $canopy_manufacturer_code = $canopy->manufacturer->code;
         $price_can = $canopy->price_1;
     } else {
         $canopy_manufacturer_code = 'N';
         $price_can = 0;
     }
     if (isset($controller->manufacturers)) {
         $controller->manufacturer = \CI::Products()->getManufacturers($controller->manufacturers);
         $controller_manufacturer_code = $controller->manufacturer->code;
         $price_con = $controller->price_1;
     } else {
         $controller_manufacturer_code = 'N';
         $price_con = 0;
     }
     $engine_parameters = \CI::Products()->getParameters($engine->id, 'engines');
     $engine_alternator = \CI::Products()->getParameters($alternator->id, 'alternators', $hz);
     $parameter_con = \CI::Products()->getParameters($controller->id, 'controllers');
     //echo '<pre>';print_r($alternator);exit;
     $get_provinces = \CI::Locations()->get_zones(230);
     foreach ($get_provinces as $value) {
         $provinces[$value->id] = $value->name;
     }
     $data['provinces'] = $provinces;
     $data['page_title'] = $engine->name;
     $data['meta'] = $engine->meta;
     $data['seo_title'] = !empty($engine->seo_title) ? $engine->seo_title : $engine->name;
     $data['product'] = $engine;
     $data['engine_parameters'] = $engine_parameters;
     $data['alt'] = $alternator;
     $data['eng'] = $engine;
     $data['engine_alternator'] = $engine_alternator;
     $data['hz'] = $hz;
     $data['phase'] = $phase;
     $data['gen_number'] = $gen_number;
     $data['can'] = $can;
     $data['con'] = $con;
     $data['parameter_con'] = $parameter_con;
     $generators = array();
     if ($engine_alternator->efficiency_standby < $engine_alternator->efficiency) {
         $engine_alternator->efficiency_standby = $engine_alternator->efficiency;
     }
     if ($hz == 50) {
         $generators['kVA'] = $generators['kVA_standby'] = $engine_parameters->standby / $power_factor * ($engine_alternator->efficiency * 0.01);
         $generators['kVA_prime'] = $engine_parameters->prime / $power_factor * ($engine_alternator->efficiency * 0.01);
     } else {
         $generators['kVA'] = $generators['kVA_standby'] = $engine_parameters->standby_2 / $power_factor * ($engine_alternator->efficiency * 0.01);
         $generators['kVA_prime'] = $engine_parameters->prime_2 / $power_factor * ($engine_alternator->efficiency * 0.01);
     }
     $generators['price'] = $engine->price_1 + $alternator->price_1 + $price_can + $price_con;
     if ($engine_alternator->power < $generators['kVA']) {
         $generators['kVA'] = $engine_alternator->power;
     }
     if ($engine->days > $alternator->days) {
         $generators['days'] = $engine->days;
     } else {
         $generators['days'] = $alternator->days;
//.........这里部分代码省略.........
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:101,代码来源:Product.php

示例6: array_keys

<div class="addressFormContainer">
    <?php 
$countries = CI::Locations()->get_countries_menu();
$country_keys = array_keys($countries);
$zone_menu = ['' => ''] + CI::Locations()->get_zones_menu(array_shift($country_keys));
?>
    <div id="addressError" class="alert red hide"></div>
    
    <div class="col-nest">
        <?php 
echo form_open('checkout/add-address', ['id' => 'addressForm']);
?>
            <div class="col" data-cols="1">

                <label><?php 
echo lang('address_company');
?>
</label>
                <?php 
echo form_input(['name' => 'company']);
?>

                <div class="col-nest">
                    <div class="col" data-cols="1/2" data-medium-cols="1/2" data-small-cols="1/2">
                        <label class="required"><?php 
echo lang('address_firstname');
?>
</label>
                        <?php 
echo form_input(['name' => 'firstname']);
?>
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:31,代码来源:address_form.old.php

示例7: getZoneOptions

    public function getZoneOptions($id)
    {
        $zones = \CI::Locations()->get_zones_menu($id);
        foreach ($zones as $id => $z) {
            ?>

            <option value="<?php 
            echo $id;
            ?>
"><?php 
            echo $z;
            ?>
</option>

        <?php 
        }
    }
开发者ID:alextoshinov,项目名称:musymeshop,代码行数:17,代码来源:Addresses.php


注:本文中的CI::Locations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。