<?php

require_once(dirname(__FILE__) . '/dao.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 = dao::search_view_house_by_user_id($current_user_id);
            break;
        case 'editor':
            $result = dao::search_view_house_by_consultant_id($current_user_id);
            break;
    }
    if ($result) {
        $context['result'] = $result;
    } else {
        $context['result'] = null;
    }
}

Timber::render('list.html', $context);

?>