<?php

$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();

$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
    $default_city_id = get_option('default_city_id');
    $city_id = ($default_city_id) ? $default_city_id : 2;
    if ($_GET['cityId']){
        $city_id = $_GET['cityId'];
    }
    $context['city_id'] = $city_id;

    $city = SearchDao::searchCity();
    $context['city'] = $city;
    foreach ($city as $value) {
        if ($value->id == $city_id) {
            $context['city_name'] = $value->value;
        }
    }
    $context['default_head'] = $context['theme'] . '/img/head.png';

    Timber::render('consultant_list.html', $context);
}else{
    wp_redirect($const_login_page);
    exit;
}
?>