I have a view with 2 exposed filter.. I only want to change the result of my view when filters are used, ie if they have any value and press the button to run the filters.
I try to used the hook_views_pre_render, but doesn't work...
function node_db_views_pre_render(&$view) {
if($view->name=="demo" && $view->current_display == 'page_1' && $view->exposed_input['date_filter'] != NULL) {
$get_date = $view->exposed_input['date_filter'];
$min = $get_date['min']['value'];
$max = $get_date['max']['value'];
$query_power = "SELECT h.id, h.name, count(c.room_id) as busy
FROM table_1 c JOIN table_2 h ON c.id = h.id
WHERE '%s' < c.in_date OR '%s' > c.in_date
AND '%s' < c.out_date OR '%s' > c.out_date";
$result = db_query($query_power, $min, $min, $max, $max);
$items = get_rows($result); // this is a function gets the data from the sentence and makes a array.
$view->result = $items;
}
}
Exist other hook that can help me?..Thanks :D