/** * Example of direct usage HTML templates instead waHtmlControl * (non-PHPdoc) * @see waShipping::getSettingsHTML() */ public function getSettingsHTML($params = array()) { $values = $this->getSettings(); if (!empty($params['value'])) { $values = array_merge($values, $params['value']); } $view = wa()->getView(); $app_config = wa()->getConfig(); if (method_exists($app_config, 'getCurrencies')) { $view->assign('currencies', $app_config->getCurrencies()); } $namespace = ''; if (!empty($params['namespace'])) { if (is_array($params['namespace'])) { $namespace = array_shift($params['namespace']); while (($namspace_chunk = array_shift($params['namespace'])) !== null) { $namespace .= "[{$namspace_chunk}]"; } } else { $namespace = $params['namespace']; } } $view->assign('namespace', $namespace); $view->assign('values', $values); $view->assign('p', $this); $html = ''; $html .= $view->fetch($this->path . '/templates/settings.html'); $html .= parent::getSettingsHTML($params); return $html; }
public function getSettingsHTML($params = array()) { $values = $this->getSettings(); if (!empty($params['value'])) { $values = array_merge($values, $params['value']); } $view = wa()->getView(); $cm = new waCountryModel(); $view->assign('countires', $cm->all()); if (!empty($values['country'])) { $rm = new waRegionModel(); $view->assign('regions', $rm->getByCountry($values['country'])); } $namespace = ''; if (!empty($params['namespace'])) { if (is_array($params['namespace'])) { $namespace = array_shift($params['namespace']); while (($namspace_chunk = array_shift($params['namespace'])) !== null) { $namespace .= "[{$namspace_chunk}]"; } } else { $namespace = $params['namespace']; } } $view->assign('namespace', $namespace); $view->assign('values', $values); $view->assign('p', $this); $view->assign('xhr_url', wa()->getAppUrl('webasyst') . '?module=backend&action=regions'); $html = $view->fetch($this->path . '/templates/settings.html'); $html .= parent::getSettingsHTML($params); return $html; }
/** * @see waShipping::getSettingsHTML() * @param array $params * @return string HTML */ public function getSettingsHTML($params = array()) { $params += array('translate' => array(&$this, '_w')); $values = $this->getSettings(); if (!empty($params['value'])) { $values = array_merge($values, $params['value']); } if (!$values['rate_zone']['country']) { $l = substr(wa()->getUser()->getLocale(), 0, 2); if ($l == 'ru') { $values['rate_zone']['country'] = 'rus'; $values['rate_zone']['region'] = '77'; $values['city'] = ''; } else { $values['rate_zone']['country'] = 'usa'; } } $view = wa()->getView(); $cm = new waCountryModel(); $view->assign('countries', $cm->all()); if (!empty($values['rate_zone']['country'])) { $rm = new waRegionModel(); $view->assign('regions', $rm->getByCountry($values['rate_zone']['country'])); } if (!empty($values['rate'])) { self::sortRates($values['rate']); if ($values['rate_by'] == 'price') { $values['rate'] = array_reverse($values['rate']); } } else { $values['rate'] = array(); $values['rate'][] = array('limit' => 0, 'cost' => 0.0); } $app_config = wa()->getConfig(); if (method_exists($app_config, 'getCurrencies')) { $view->assign('currencies', $app_config->getCurrencies()); } $namespace = ''; if (!empty($params['namespace'])) { if (is_array($params['namespace'])) { $namespace = array_shift($params['namespace']); while (($namespace_chunk = array_shift($params['namespace'])) !== null) { $namespace .= "[{$namespace_chunk}]"; } } else { $namespace = $params['namespace']; } } $view->assign('namespace', $namespace); $view->assign('values', $values); $view->assign('p', $this); $html = ''; $view->assign('xhr_url', wa()->getAppUrl('webasyst') . '?module=backend&action=regions'); $view->assign('map_adapters', wa()->getMapAdapters()); $html .= $view->fetch($this->path . '/templates/settings.html'); $html .= parent::getSettingsHTML($params); return $html; }
public function getSettingsHTML($params = array()) { $options = array(); foreach ($this->getServices() as $service) { $options[] = array('value' => $service['id'], 'title' => $service['name']); } $params['options']['product_code'] = $options; return parent::getSettingsHTML($params); }
public function getSettingsHTML($params = array()) { $options = array(); foreach (uspsServices::getServices('Domestic') as $service) { $options[] = array('value' => $service['id'], 'title' => $service['name']); } $params['options']['services_domestic'] = $options; $options = array(); foreach (uspsServices::getServices('International') as $service) { $options[] = array('value' => $service['id'], 'title' => $service['name']); } $params['options']['services_international'] = $options; return parent::getSettingsHTML($params); }
public function getSettingsHTML($params = array()) { $values = $this->getSettings(); if (!empty($params['value'])) { $values = array_merge($values, $params['value']); } $namespace = ''; if ($params['namespace']) { $namespace = is_array($params['namespace']) ? '[' . implode('][', $params['namespace']) . ']' : $params['namespace']; } $view = wa()->getView(); $autoescape = $view->autoescape(); $view->autoescape(TRUE); $view->assign(array('namespace' => $namespace, 'values' => $values, 'p' => $this)); $html = $view->fetch($this->path . '/templates/settings.html'); $view->autoescape($autoescape); return $html . parent::getSettingsHTML($params); }
public function getSettingsHTML($params = array()) { $model = new waRegionModel(); if (!isset($params['options'])) { $params['options'] = array(); } $params['options']['region'] = array(); foreach ($model->getByCountry('rus') as $region) { $params['options']['region'][$region['code']] = $region['name']; } return parent::getSettingsHTML($params); }