예제 #1
0
<?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";
예제 #2
0
*/
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 {
        $error = 'Незаполнено название поставщика';
    }
}
// Информация о текущем городе
$city = $city_model->get_city($city_id);
// Районы города
$temp = $city_model->get_districts($city_id);
$districs = array();
foreach ($temp as $tmp) {
    $districs[$tmp['district_id']] = $tmp;
}
// Подкатегории и поставщики
$subcategories_tmp = $provider_model->get_all_subcategories();
$providers_tmp = array();
foreach ($subcategories_tmp as $subcategory) {
    $prefix_table = $subcategory['prefix_table'];
    $providers_tmp[$prefix_table] = $provider_model->get_providers($prefix_table, $city_id);
}
// Подготавливаем подкатегории
$subcategories = array();