<?php

$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
$current_user = wp_get_current_user();
$current_user_id = $current_user->ID;
if ($current_user_id != 0) {
    $role = $current_user->roles[0];
    $user_role = '';
    $result = null;
    switch ($role) {
        case 'subscriber':
            $result = TospurDao::search_view_house_by_user_id($current_user_id);
            break;
        case 'zygw':
            $result = TospurDao::search_view_house_by_consultant_id($current_user_id);
            break;
    }
    if ($result) {
        $context['result'] = $result;
    } else {
        $context['result'] = null;
    }

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

?>