<?php

/* $Id: cities.php 8 2011-01-11 Alex $ */
$page = "providers/gameprovider";
include "header.php";
include 'include/providers/class_gameprovider.php';
include 'include/providers/class_game.php';
include 'include/providers/class_gamecommand.php';
include 'include/class_city.php';
$provider_id = (int) $_GET['provider_id'];
$user_id = $user->user_info['user_id'];
// Модель поставщика
$gameprovider = new se_gameprovider();
$game_model = new se_game();
$city_model = new se_city();
$command_model = new se_gamecommand();
$provider_info = $gameprovider->get_gameprovider($provider_id);
$games = $game_model->get_current_games($provider_id);
$city = $city_model->get_city($provider_info['city_id']);
$commands = $command_model->get_available_commands($user_id);
foreach ($games as &$game) {
    $game['game_sdate'] = date('d-m-Y, h:m', $game['game_sdate']);
}
$smarty->assign_by_ref('provider_info', $provider_info);
$smarty->assign_by_ref('games', $games);
$smarty->assign('city', $city['name']);
$smarty->assign('user_id', $user_id);
include "footer.php";
Beispiel #2
0
define('SE_PAGE_AJAX', TRUE);
$page = "city_ajax";
include "header.php";
include "include/class_city.php";
include "include/class_provider.php";
// This is ajax
//header("Content-Type: application/json");
// Get info (post only)
$action = isset($_POST['action']) ? $_POST['action'] : NULL;
// Must be logged in to use tasks below this section
if (!$user->user_exists) {
    //echo json_encode(array('result' => FALSE, 'err' => 1));
    //exit();
}
// Create city object
$city_model = new se_city();
// Модель поставщиков
$provider_model = new se_provider();
if ($action == 'get_regions') {
    $area_id = isset($_POST['area_id']) ? $_POST['area_id'] : null;
    $regions = $city_model->get_regions($area_id);
    foreach ($regions as $region) {
        echo '<option value="' . $region['region_id'] . '">' . $region['name'] . '</option>';
    }
    die;
} else {
    if ($action == 'get_provider') {
        $prefix_table = isset($_POST['prefix_table']) ? $_POST['prefix_table'] : null;
        $provider_id = isset($_POST['provider_id']) ? $_POST['provider_id'] : null;
        if ($prefix_table && $provider_id) {
            $provider = $provider_model->get_provider($prefix_table, $provider_id);
Beispiel #3
0
<?php

/* $Id: cities.php 8 2011-01-11 Alex $ */
$page = "city";
$error = '';
include "header.php";
include "include/class_city.php";
include "include/class_provider.php";
$city_id = (int) $_GET['city_id'];
// Основная модель городов
$city_model = new se_city();
// Модель поставщиков
$provider_model = new se_provider();
/* 
    Важно!!
    
    В дальнейшем $city_id передавать в конструктор при создании объектов:
    
    $city_model = new se_city($city_id);  
    $provider_model = new se_provider($city_id);  
*/
if (isset($_POST['submit'])) {
    $prefix_table = isset($_POST['category']) ? trim($_POST['category']) : NULL;
    $provider_name = isset($_POST['provider']) ? trim($_POST['provider']) : NULL;
    if ($prefix_table && $provider_name) {
        $data = array('name' => $provider_name);
        $provider_id = $provider_model->add_provider($prefix_table, $data);
        if ($provider_id) {
            $provider_model->add_provider_city($prefix_table, $provider_id, $city_id);
        }
    } else {
Beispiel #4
0
<?php

/* $Id: cities.php 8 2011-01-11 Alex $ */
$page = "cities";
$error = '';
include "header.php";
include "include/class_city.php";
// Основная модель городов
$city = new se_city();
if (isset($_POST['submit'])) {
    $area_id = isset($_POST['area_id']) ? $_POST['area_id'] : NULL;
    $region_id = isset($_POST['region_id']) ? $_POST['region_id'] : NULL;
    $region = isset($_POST['region']) ? trim($_POST['region']) : NULL;
    $city_name = isset($_POST['city']) ? trim($_POST['city']) : NULL;
    if ($area_id && $region) {
        $region_id = $city->add_region($region, $area_id);
    }
    if ($region_id && $city_name) {
        $city_id = $city->add_city($city_name, $region_id);
    } else {
        $error = 'Незаполнено название города';
    }
}
// Города-миллионники
$main_cities = $city->get_main_cities();
// Округа
$areas = $city->get_areas();
// Регионы и города
// Структура массива - $regions[area][$i][fields]
$regions = array();
// Структура массива - $cities[region][$i][fields]