<?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) {
    require_once(WP_PLUGIN_DIR . "/tospur/Dao/SearchDao.php");
    $city = SearchDao::searchCity();
    $context['city'] = $city;
    $city_id = $_GET['city_id'];
    if (!isset($city_id)) {
        $city_id = $city[0]->id;
    }
    foreach ($city as $value) {
        if ($value->id == $city_id) {
            $context['city_name'] = $value->value;
        }
    }
    $context['city_id'] = $city_id;
    $context['default_head'] = get_avatar_url(1);

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