本文整理汇总了PHP中Zone类的典型用法代码示例。如果您正苦于以下问题:PHP Zone类的具体用法?PHP Zone怎么用?PHP Zone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderCabinetProps
/**
* Render cabinet properties into this view.
*
* The cabinet properties zone, row, model, maximum weight and installation date
* are rendered to be for this page. It checks if the user is allowed to see the
* content of the cabinet and only if the user does the information is provided.
*
* @param Cabinet $cab
* @param CabinetAudit $audit
* @param string $AuditorName
*/
function renderCabinetProps($cab, $audit, $AuditorName)
{
$tmpDC = new DataCenter();
$tmpDC->DataCenterID = $cab->DataCenterID;
$tmpDC->GetDataCenter();
$AuditorName = $AuditorName != '' ? "<br>{$AuditorName}" : "";
$renderedHTML = "\t\t<table id=\"cabprop\">\n\t\t\t<tr><td>" . __("Last Audit") . ":</td><td id=\"lastaudit\">{$audit->AuditStamp}{$AuditorName}</td></tr>\n\t\t\t<tr><td>" . __("Model") . ":</td><td>{$cab->Model}</td></tr>\n\t\t\t<tr><td>" . __("Data Center") . ":</td><td>{$tmpDC->Name}</td></tr>\n\t\t\t<tr><td>" . __("Install Date") . ":</td><td>{$cab->InstallationDate}</td></tr>\n";
if ($cab->ZoneID) {
$zone = new Zone();
$zone->ZoneID = $cab->ZoneID;
$zone->GetZone();
$renderedHTML .= "\t\t\t<tr><td>" . __("Zone") . ":</td><td>{$zone->Description}</td></tr>\n";
}
if ($cab->CabRowID) {
$cabrow = new CabRow();
$cabrow->CabRowID = $cab->CabRowID;
$cabrow->GetCabRow();
$renderedHTML .= "\t\t\t<tr><td>" . __("Row") . ":</td><td>{$cabrow->Name}</td></tr>\n";
}
$renderedHTML .= "\t\t\t<tr><td>" . __("Tags") . ":</td><td>" . renderTagsToString($cab) . "</td></tr>\n";
// This is out of context here and makes the information confusing.
// $renderedHTML .= ' <tr><td class="left">' . __('Front Edge') . ':</td>';
// $renderedHTML .= "<td class=\"right\">$cab->FrontEdge </td></tr>\n";
$renderedHTML .= "\t\t</table>\n";
return $renderedHTML;
}
示例2: port
function port($type = 0, $_pays = false, $_cpostal = "")
{
if ($_SESSION['navig']->commande->transport == "" && !$type) {
return -1;
}
if ($_SESSION['navig']->adresse != 0) {
$chadr = 1;
} else {
$chadr = 0;
}
$modules = new Modules();
if (!$type) {
$modules->charger_id($_SESSION['navig']->commande->transport);
} else {
$modules->charger_id($type);
}
if ($modules->type != Modules::TRANSPORT || !$modules->actif) {
return -1;
}
$p = new Pays();
if ($chadr) {
$adr = new adresse();
$adr->charger($_SESSION['navig']->adresse);
$p->charger($adr->pays);
$cpostal = $adr->cpostal;
} else {
$p->charger($_SESSION['navig']->client->pays);
$cpostal = $_SESSION['navig']->client->cpostal;
}
// Prise en compte des infos passée, si aucune des infos précédentes n'est pertinente.
if (empty($p->id) && $_pays) {
$p->charger($_pays);
}
if (empty($cpostal) && $_cpostal != "") {
$cpostal = $_cpostal;
}
$zone = new Zone();
$zone->charger($p->zone);
try {
$port = ActionsModules::instance()->instancier($modules->nom);
$port->nbart = $_SESSION['navig']->panier->nbart();
$port->poids = $_SESSION['navig']->panier->poids();
$port->total = $_SESSION['navig']->panier->total();
$port->zone = $p->zone;
$port->pays = $p->id;
$port->unitetr = $zone->unite;
$port->cpostal = $cpostal;
$frais = $port->calcule();
ActionsModules::instance()->appel_module("port", $frais);
return $frais;
} catch (exception $e) {
return -1;
}
}
示例3: run
public function run($request)
{
$zone = new Zone();
$zone->Name = "International";
$zone->Description = "All countries";
$zone->write();
$countries = ShopConfig::current()->getCountriesList();
foreach ($countries as $code => $country) {
$zoneregion = new ZoneRegion(array('ZoneID' => $zone->ID, 'Country' => $code));
$zoneregion->write();
echo ".";
}
}
示例4: destroy
public function destroy($id)
{
if (Auth::user()->is_admin) {
$count = 0;
$zone = Zone::find($id);
$clients = Client::select('zone_id')->get();
foreach ($clients as $key => $client) {
$u = $client->zone_id;
$uarray = explode(',', $u);
if (in_array($id, $uarray, true)) {
$count = $count + 1;
}
}
if ($count > 0) {
$field = $count == 1 ? ' ' : 's';
$field2 = $count == 1 ? ' pertenece' : ' pertenecen';
$message = $count . " Cliente" . $field . $field2 . " a la zona " . $zone->name;
Session::flash('error', $message);
return Redirect::to('zonas/' . $id);
} else {
$zone->delete();
$message = "Zona Eliminada con éxito";
Session::flash('message', $message);
return Redirect::to('zonas');
}
}
}
示例5: check
public function check(Discount $discount)
{
$zones = $discount->Zones();
if (!$zones->exists()) {
return true;
}
$address = $this->order->getShippingAddress();
if (!$address) {
$this->error(_t("OrderCouponModifier.NOTINZONE", "This coupon can only be used for a specific shipping location."));
return false;
}
$currentzones = Zone::get_zones_for_address($address);
if (!$currentzones || !$currentzones->exists()) {
$this->error(_t("OrderCouponModifier.NOTINZONE", "This discount can only be used for a specific shipping location."));
return false;
}
//check if any of currentzones is in zones
$inzone = false;
foreach ($currentzones as $zone) {
if ($zones->find('ID', $zone->ID)) {
$inzone = true;
break;
}
}
if (!$inzone) {
$this->error(_t("OrderCouponModifier.NOTINZONE", "This discount can only be used for a specific shipping location."));
return false;
}
return true;
}
示例6: state
public function state($country_id)
{
if (!empty($country_id)) {
//$cid = explode(",",$_POST[])
return Zone::find_by_sql("SELECT * FROM zone WHERE country_id={$country_id}");
}
}
示例7: zone_fork
public function zone_fork($disposition_id, $disposition, $url, $theme, $page, $zone)
{
$url = str_replace(url(), '', $url);
if (!$url || preg_match('#^index(?:\\.|/)#', $url)) {
$url = '/';
}
if (extension($url) == 'html') {
$url = substr($url, 0, -5) . '/*';
}
$url = explode('/', $url);
if (!empty($url[0]) && ($module = $this->load->module($url[0])) && !empty($module->routes) && ($method = $module->get_method(array_slice($url, 1, -1), TRUE))) {
$url = array($url[0], $method, '*');
}
$url = implode('/', $url);
if ($page == '*' || !$this->db->select('1')->from('nf_dispositions')->where('page', $url)->row()) {
foreach ($disposition as &$rows) {
foreach ($rows->cols as &$col) {
foreach ($col->widgets as &$w) {
$widget = $this->db->select('widget', 'type', 'title', 'settings')->from('nf_widgets')->where('widget_id', $w->widget_id)->row();
$w->widget_id = $this->db->insert('nf_widgets', array('widget' => $widget['widget'], 'type' => $widget['type'], 'title' => $widget['title'], 'settings' => $widget['settings']));
}
}
}
return Zone::display($this->db->insert('nf_dispositions', array('theme' => $theme, 'page' => $url, 'zone' => $zone, 'disposition' => serialize($disposition))), $disposition, $url, $zone, TRUE);
} else {
$this->model()->delete_disposition($disposition);
$this->db->where('disposition_id', $disposition_id)->delete('nf_dispositions');
$disposition = $this->db->select('disposition_id', 'disposition')->from('nf_dispositions')->where('theme', $theme)->where('page', '*')->where('zone', $zone)->row();
return Zone::display($disposition['disposition_id'], unserialize($disposition['disposition']), '*', $zone, TRUE);
}
}
示例8: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index($id)
{
$site = Site::find($id);
$zones = Zone::all();
$data = array('page' => 'sites', 'tab' => 'manage', 'site' => $site, 'zones' => $zones);
return View::make('site_zone.index', $data);
}
示例9: actionCreate
public function actionCreate()
{
$model = new Zone();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Zone'])) {
$model->attributes = $_POST['Zone'];
if ($model->save()) {
Flashes::addInfoFlash(Yii::t('amo', 'Zone created successfully'));
$this->redirect(array('view', 'id' => $model->zid));
} else {
Flashes::addErrorFlash(Yii::t('amo', 'Could not create the zone.') . ' ' . Yii::t('amo', 'Please, try again later.'));
}
}
$this->render('create', array('model' => $model));
}
示例10: renderForm
public function renderForm()
{
if (!($obj = $this->loadObject(true))) {
return;
}
$address_layout = AddressFormat::getAddressCountryFormat($obj->id);
if ($value = Tools::getValue('address_layout')) {
$address_layout = $value;
}
$default_layout = '';
$default_layout_tab = array(array('firstname', 'lastname'), array('company'), array('vat_number'), array('address1'), array('address2'), array('postcode', 'city'), array('Country:name'), array('phone'), array('phone_mobile'));
foreach ($default_layout_tab as $line) {
$default_layout .= implode(' ', $line) . "\r\n";
}
$this->fields_form = array('legend' => array('title' => $this->l('Countries'), 'image' => '../img/admin/world.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Country:'), 'name' => 'name', 'lang' => true, 'size' => 30, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Country name')), array('type' => 'text', 'label' => $this->l('ISO code:'), 'name' => 'iso_code', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Two -- or three -- letter ISO code (e.g. U.S. for United States)') . '.
<a href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm" target="_blank">' . $this->l('Official list here') . '
</a>.'), array('type' => 'text', 'label' => $this->l('Call prefix:'), 'name' => 'call_prefix', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('International call prefix, (e.g. 1 for United States)')), array('type' => 'select', 'label' => $this->l('Default currency:'), 'name' => 'id_currency', 'options' => array('query' => Currency::getCurrencies(), 'id' => 'id_currency', 'name' => 'name', 'default' => array('label' => $this->l('Default store currency'), 'value' => 0))), array('type' => 'select', 'label' => $this->l('Zone:'), 'name' => 'id_zone', 'options' => array('query' => Zone::getZones(), 'id' => 'id_zone', 'name' => 'name'), 'desc' => $this->l('Geographical region')), array('type' => 'radio', 'label' => $this->l('Need zip/postal code:'), 'name' => 'need_zip_code', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'need_zip_code_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'need_zip_code_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'text', 'label' => $this->l('Zip/post code format:'), 'name' => 'zip_code_format', 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Zip Code format (L for a letter, N for a number and C for the ISO code). For example, NNNNN for the United States. No verification if undefined.')), array('type' => 'address_layout', 'label' => $this->l('Address format:'), 'name' => 'address_layout', 'address_layout' => $address_layout, 'encoding_address_layout' => urlencode($address_layout), 'encoding_default_layout' => urlencode($default_layout), 'display_valid_fields' => $this->displayValidFields()), array('type' => 'radio', 'label' => $this->l('Address Standardization:'), 'name' => 'standardization', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'standardization_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'standardization_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Active:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Display this country to your customers (the selected country will always be displayed in the Back Office)')), array('type' => 'radio', 'label' => $this->l('Contains following states:'), 'name' => 'contains_states', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'contains_states_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'contains_states_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Do you need a tax identification number?'), 'name' => 'need_identification_number', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'need_identification_number_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'need_identification_number_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Display tax label (e.g. "Tax incl."):'), 'name' => 'display_tax_label', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'display_tax_label_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'display_tax_label_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No'))))));
if (Shop::isFeatureActive()) {
$this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso');
}
$this->fields_form['submit'] = array('title' => $this->l('Save '), 'class' => 'button');
if ($this->object->iso_code == 'US') {
$this->object->standardization = Configuration::get('PS_TAASC');
}
return parent::renderForm();
}
示例11: add
public function add($nom)
{
$this->nom = $nom;
$this->unite = 0;
$this->id = parent::add();
redirige("zone.php?id=" . $this->id . "&action=showZone#zone");
}
示例12: calculateRate
function calculateRate(ShippingPackage $package, $address)
{
$rate = null;
$ids = Zone::get_zones_for_address($address);
if (!$ids) {
return $rate;
}
$ids = $ids->map('ID', 'ID');
$packageconstraints = array("Weight" => 'weight', "Volume" => 'volume', "Value" => 'value', "Quantity" => 'quantity');
$constraintfilters = array();
foreach ($packageconstraints as $db => $pakval) {
$mincol = "\"ZonedShippingRate\".\"{$db}Min\"";
$maxcol = "\"ZonedShippingRate\".\"{$db}Max\"";
$constraintfilters[] = "(" . "{$mincol} >= 0" . " AND {$mincol} <= " . $package->{$pakval}() . " AND {$maxcol} > 0" . " AND {$maxcol} >= " . $package->{$pakval}() . " AND {$mincol} < {$maxcol}" . ")";
}
$filter = "(" . implode(") AND (", array("\"ZonedShippingMethodID\" = " . $this->ID, "\"ZoneID\" IN(" . implode(",", $ids) . ")", implode(" OR ", $constraintfilters))) . ")";
//order by zone specificity
$orderby = "";
if (count($ids) > 1) {
$orderby = "CASE \"ZonedShippingRate\".\"ZoneID\"";
$count = 1;
foreach ($ids as $id) {
$orderby .= " WHEN {$id} THEN {$count} ";
$count++;
}
$orderby .= "ELSE {$count} END ASC,";
}
$orderby .= "\"ZonedShippingRate\".\"Rate\" ASC";
if ($sr = DataObject::get_one("ZonedShippingRate", $filter, true, $orderby)) {
$rate = $sr->Rate;
}
$this->CalculatedRate = $rate;
return $rate;
}
示例13: getContent
function getContent()
{
$configKeys = array('EBAY_SECURITY_TOKEN', 'PS_LANG_DEFAULT');
// Load prestashop ebay's configuration
$configs = Configuration::getMultiple($configKeys);
$profile_configs = $this->ebay_profile->getMultiple(array('EBAY_DELIVERY_TIME', 'EBAY_ZONE_NATIONAL', 'EBAY_ZONE_INTERNATIONAL'));
// Check if the module is configured
if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) {
$template_vars = array('error_form_shipping' => 'true');
return $this->display('error_paypal_email.tpl', $template_vars);
}
$nb_shipping_zones_excluded = DB::getInstance()->getValue('SELECT COUNT(*)
FROM ' . _DB_PREFIX_ . 'ebay_shipping_zone_excluded
WHERE `id_ebay_profile` = ' . (int) $this->ebay_profile->id);
if (!$nb_shipping_zones_excluded) {
EbayShippingZoneExcluded::loadEbayExcludedLocations($this->ebay_profile->id);
}
$module_filters = version_compare(_PS_VERSION_, '1.4.5', '>=') ? Carrier::CARRIERS_MODULE : 2;
//INITIALIZE CACHE
$psCarrierModule = $this->ebay_profile->getCarriers($configs['PS_LANG_DEFAULT'], false, false, false, null, $module_filters);
$url_vars = array('id_tab' => '3', 'section' => 'shipping');
if (version_compare(_PS_VERSION_, '1.5', '>')) {
$url_vars['controller'] = Tools::getValue('controller');
} else {
$url_vars['tab'] = Tools::getValue('tab');
}
$zones = Zone::getZones(true);
foreach ($zones as &$zone) {
$zone['carriers'] = Carrier::getCarriers($this->context->language->id, false, false, $zone['id_zone']);
}
$template_vars = array('eBayCarrier' => EbayShippingService::getCarriers($this->ebay_profile->ebay_site_id), 'psCarrier' => $this->ebay_profile->getCarriers($configs['PS_LANG_DEFAULT']), 'psCarrierModule' => $psCarrierModule, 'existingNationalCarrier' => EbayShipping::getNationalShippings($this->ebay_profile->id), 'existingInternationalCarrier' => EbayShippingInternationalZone::getExistingInternationalCarrier($this->ebay_profile->id), 'deliveryTime' => $profile_configs['EBAY_DELIVERY_TIME'], 'prestashopZone' => Zone::getZones(), 'excludeShippingLocation' => EbayShippingZoneExcluded::cacheEbayExcludedLocation($this->ebay_profile->id), 'internationalShippingLocations' => EbayShippingLocation::getInternationalShippingLocations(), 'deliveryTimeOptions' => EbayDeliveryTimeOptions::getDeliveryTimeOptions(), 'formUrl' => $this->_getUrl($url_vars), 'ebayZoneNational' => isset($profile_configs['EBAY_ZONE_NATIONAL']) ? $profile_configs['EBAY_ZONE_NATIONAL'] : false, 'ebayZoneInternational' => isset($profile_configs['EBAY_ZONE_INTERNATIONAL']) ? $profile_configs['EBAY_ZONE_INTERNATIONAL'] : false, 'ebay_token' => $configs['EBAY_SECURITY_TOKEN'], 'id_ebay_profile' => $this->ebay_profile->id, 'newPrestashopZone' => $zones);
return $this->display('shipping.tpl', $template_vars);
}
示例14: actionUpdate
public function actionUpdate($id)
{
$model = new SettingsForm();
if (isset($_POST['SettingsForm'])) {
$model->attributes = $_POST['SettingsForm'];
if ($model->validate() && $model->save()) {
$this->redirect(array('index'));
}
} else {
$model->loadDataFromStore($id);
}
$directories = glob(Yii::getPathOfAlias('webroot.themes') . "/*", GLOB_ONLYDIR);
$themes = array();
foreach ($directories as $directory) {
$themes[] = basename($directory);
}
$layouts = CHtml::listData(Layout::model()->findAll(), 'layout_id', 'name');
$countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name');
$zones = CHtml::listData(Zone::model()->findAllByAttributes(array('country_id' => $model->country)), 'zone_id', 'name');
$languages = CHtml::listData(Language::model()->findAll(), 'language_id', 'name');
$currencies = CHtml::listData(Currency::model()->findAll(), 'currency_id', 'title');
$yesNoOptions = array(0 => Yii::t('settings', 'No'), 1 => Yii::t('settings', 'Yes'));
$lengthClasses = CHtml::listData(LengthClassDescription::model()->findAll(), 'length_class_id', 'title');
$weightClasses = CHtml::listData(WeightClassDescription::model()->findAll(), 'weight_class_id', 'title');
$taxesOptions = array("" => Yii::t("settings", "--- None ---"), "shipping" => Yii::t("settings", "Shipping Address"), "payment" => Yii::t("settings", "Payment Address"));
$customerGroups = CHtml::listData(CustomerGroupDescription::model()->findAll(), 'customer_group_id', 'name');
$informations = array_merge(array(0 => Yii::t("settings", "--- None ---")), CHtml::listData(InformationDescription::model()->findAll(), 'information_id', 'title'));
// TODO: localisation
$orderStatuses = CHtml::listData(OrderStatus::model()->findAllByAttributes(array('language_id' => 1)), 'order_status_id', 'name');
// TODO: localisation
$returnStatuses = CHtml::listData(ReturnStatus::model()->findAllByAttributes(array('language_id' => 1)), 'return_status_id', 'name');
$mailProtocols = array("mail" => Yii::t("settings", "Mail"), "smtp" => Yii::t("settings", "SMTP"));
$this->render('update', array('model' => $model, 'themes' => $themes, 'layouts' => $layouts, 'countries' => $countries, 'zones' => $zones, 'languages' => $languages, 'currencies' => $currencies, 'yesNoOptions' => $yesNoOptions, 'lengthClasses' => $lengthClasses, 'weightClasses' => $weightClasses, 'taxesOptions' => $taxesOptions, 'customerGroups' => $customerGroups, 'informations' => $informations, 'orderStatuses' => $orderStatuses, 'returnStatuses' => $returnStatuses, 'mailProtocols' => $mailProtocols));
}
示例15: getcomboboxesAction
public function getcomboboxesAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
if (!$this->getRequest()->isXmlHttpRequest()) {
$this->view->msg = 'Not Ajax Request';
$this->_forward('error', 'error');
} else {
$zones = Zone::getAllZones();
$contexts = Context::getAllContexts();
$agents = Agent::getAllAgents();
$this->view->zones = $zones;
$this->view->agents = $agents;
$this->view->contexts = $contexts;
$this->render('aclcomboboxes');
}
} else {
if (!$this->getRequest()->isXmlHttpRequest()) {
$this->view->msg = 'Not Ajax Request';
$this->_forward('error', 'error');
} else {
$this->view->msg = 'Invalid User';
$this->_forward('error', 'error');
}
}
}