Esempio n. 1
0
 public static function getInstance()
 {
     if (self::$Instance == NULL) {
         $class = __CLASS__;
         self::$Instance = new $class();
     }
     return self::$Instance;
 }
Esempio n. 2
0
 public function cities()
 {
     $stateID = uri::segment(3);
     $data = array();
     if (input::post('title') == 'any') {
         $data[''] = __('any', 'system', array(), array(), false);
     } else {
         $data[''] = __('select', 'system', array(), array(), false);
     }
     foreach (geo_helper::getCities($stateID) as $id => $name) {
         $data[$id . ' '] = $name;
     }
     view::ajaxResponse($data);
 }
Esempio n. 3
0
            }
            ?>
		<?php 
        }
        ?>

		<?php 
        break;
        ?>

	<?php 
    case 'country':
        ?>

		<?php 
        echo form_helper::select($name, array('' => isset($field['select']) && $field['select'] ? __('select', 'system') : __('any', 'system')) + geo_helper::getCountries(), form_helper::setSelect($name, isset($value[$name]) ? $value[$name] : ''), array('class' => 'select ' . (isset($field['class']) && $field['class'] ? $field['class'] : ''), 'style' => isset($field['style']) && $field['style'] ? $field['style'] : '', 'id' => $id));
        ?>

		<?php 
        break;
        ?>

	<?php 
    case 'birthday':
        ?>

		<?php 
        echo form_helper::select($name . '__from', array('' => __('range_from', 'system')) + array_helper::buildArray(isset($field['config']['min_age']) ? $field['config']['min_age'] : 18, isset($field['config']['max_age']) ? $field['config']['max_age'] : 99), form_helper::setSelect($name . '__from', isset($value[$name . '__from']) ? $value[$name . '__from'] : ''), array('class' => 'select ' . (isset($field['class']) && $field['class'] ? $field['class'] : ''), 'style' => isset($field['style']) && $field['style'] ? $field['style'] : '', 'id' => $id . '__from'));
        ?>
		-
		<?php 
Esempio n. 4
0
 public function parseFields($fields, $data, $multilang = false, $escape = false)
 {
     // Loop through fields
     foreach ($fields as $fieldID => $field) {
         // Do we have a single value field?
         if ($this->getValueFormat($field['type']) != 'multiple' && $field['type'] != 'section') {
             $keyword = 'data_' . $field['keyword'] . ($multilang && $field['multilang'] ? '_' . session::item('language') : '');
             $value = isset($data[$keyword]) ? $data[$keyword] : '';
             // Do we have multiple option field?
             if ($this->isMultiValue($field['type'])) {
                 if (isset($field['items'][$value])) {
                     $data[$keyword] = array($value => $escape ? text_helper::entities($field['items'][$value]) : $field['items'][$value]);
                 } else {
                     $data[$keyword] = '';
                 }
             } elseif ($this->getValueFormat($field['type']) == 'location') {
                 if ($value) {
                     $data[$keyword] = array($value => $escape && (!isset($field['html']) || !$field['html']) ? text_helper::entities(geo_helper::getCountry($value)) : geo_helper::getCountry($value));
                 }
                 if ($data['data_' . $field['keyword'] . '_state']) {
                     $data[$keyword . '_state'] = array($data['data_' . $field['keyword'] . '_state'] => $escape && (!isset($field['html']) || !$field['html']) ? text_helper::entities($data['data_' . $field['keyword'] . '_state_name']) : $data['data_' . $field['keyword'] . '_state_name']);
                 }
                 if ($data['data_' . $field['keyword'] . '_city']) {
                     $data[$keyword . '_city'] = array($data['data_' . $field['keyword'] . '_city'] => $escape && (!isset($field['html']) || !$field['html']) ? text_helper::entities($data['data_' . $field['keyword'] . '_city_name']) : $data['data_' . $field['keyword'] . '_city_name']);
                 }
             } elseif ($this->getValueFormat($field['type']) == 'country') {
                 if ($value) {
                     $data[$keyword] = array($value => $escape && (!isset($field['html']) || !$field['html']) ? text_helper::entities(geo_helper::getCountry($value)) : geo_helper::getCountry($value));
                 }
             } else {
                 $data[$keyword] = $escape && (!isset($field['html']) || !$field['html']) ? text_helper::entities($value) : $value;
             }
         }
     }
     return $data;
 }
Esempio n. 5
0
 private function getCountry($data, $metaData, $additionData = '')
 {
     $languages = $this->ssb_helper->getArrayLangCode();
     $wc = $this->ssb_data->getWC(true);
     $continent_data = isset($data['patternsSettings']['wc']['continent']) ? $data['patternsSettings']['wc']['continent'] : '';
     $patternsSettings = $this->ssb_data->getSetting('patternsSettings');
     $continent_setting = $patternsSettings['wc']['continent'];
     if (!count($wc) or $continent_data != $continent_setting) {
         include_once DIR_CONFIG . 'ssb_library/admin/generators/geo_helper.php';
         $geo_helper = geo_helper::getInstance();
         $continents_data = array();
         foreach ($languages as $l_code) {
             $continents = $geo_helper->getCountries($l_code, $continent_data);
             $continents_data[$l_code] = $continents;
             $this->ssb_data->setWC($continents, $l_code);
         }
         $wc = $this->ssb_data->getWC(true, $continents_data);
     }
     $data = array('continent' => $continent_data, 'continents' => $wc, 'languages' => $languages, 'status' => 'ajax-reload');
     echo json_encode($data);
 }