Beispiel #1
0
 /**
  * Обновление географического кеша
  * @return void
  */
 public function action_geo_cache_updater()
 {
     if (Arr::get($_GET, 'start') != 'geo_cache') {
         return;
     }
     if (Geography::update_geography_params()) {
         echo "Географический кэш успешно обновлен в " . Date::formatted_time() . " \n";
     } else {
         echo "Ошибка обновления географического кэша \n";
     }
 }
Beispiel #2
0
 /**
  * Для обновления пощиций маркеров на карте
  */
 public function action_ajax_map_update()
 {
     if ($this->request->is_ajax()) {
         $this->auto_render = FALSE;
         $metro_stations = Arr::get($_POST, 'metro_stations');
         if (!$metro_stations) {
             $result['error'] = 'Ошибка обновления карты';
             echo json_encode($result);
             return;
         }
         $updated_count = 0;
         foreach ($metro_stations as $metro) {
             $pairs = array();
             foreach ($metro as $field => $value) {
                 $pairs[$field] = $value;
             }
             unset($pairs['id']);
             $query = DB::update('metro')->set($pairs)->where('id', '=', $metro['id'])->execute();
             if ($query) {
                 $updated_count++;
             }
         }
         Geography::update_geography_params();
         $result['msg'] = 'updated metro stations: ' . $updated_count;
         echo json_encode($result);
     }
 }
Beispiel #3
0
 /**
  * Возвращаем гео параметры автосервисов
  * @static
  * @return mixed|void
  */
 public static function get_geography_params()
 {
     $cache = Cache::instance();
     if (!$cache->get('geo_params')) {
         return Geography::update_geography_params();
     } else {
         return $cache->get('geo_params');
     }
 }