| 1 |
<?php |
<?php |
| 2 |
// $Id: view.inc,v 1.151.2.16 2009/11/02 23:34:26 merlinofchaos Exp $ |
// $Id: view.inc,v 1.151.2.17 2009/11/10 23:20:05 merlinofchaos Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file view.inc |
* @file view.inc |
| 5 |
* Provides the view object type and associated methods. |
* Provides the view object type and associated methods. |
| 384 |
} |
} |
| 385 |
|
|
| 386 |
/** |
/** |
|
* Render the exposed filter form. |
|
|
* |
|
|
* This actually does more than that; because it's using FAPI, the form will |
|
|
* also assign data to the appropriate handlers for use in building the |
|
|
* query. |
|
|
*/ |
|
|
function render_exposed_form($block = FALSE) { |
|
|
// Deal with any exposed filters we may have, before building. |
|
|
$form_state = array( |
|
|
'view' => &$this, |
|
|
'display' => &$this->display_handler->display, |
|
|
'method' => 'get', |
|
|
'rerender' => TRUE, |
|
|
'no_redirect' => TRUE, |
|
|
); |
|
|
|
|
|
// Some types of displays (eg. attachments) may wish to use the exposed |
|
|
// filters of their parent displays instead of showing an additional |
|
|
// exposed filter form for the attachment as well as that for the parent. |
|
|
if (!$this->display_handler->displays_exposed() || (!$block && $this->display_handler->get_option('exposed_block'))) { |
|
|
unset($form_state['rerender']); |
|
|
} |
|
|
|
|
|
if (!empty($this->ajax)) { |
|
|
$form_state['ajax'] = TRUE; |
|
|
} |
|
|
|
|
|
$output = drupal_build_form('views_exposed_form', $form_state); |
|
|
if (!empty($form_state['js settings'])) { |
|
|
$this->js_settings = $form_state['js settings']; |
|
|
} |
|
|
|
|
|
return $output; |
|
|
} |
|
|
|
|
|
/** |
|
| 387 |
* Build all the arguments. |
* Build all the arguments. |
| 388 |
*/ |
*/ |
| 389 |
function _build_arguments() { |
function _build_arguments() { |
| 557 |
$this->_pre_query(); |
$this->_pre_query(); |
| 558 |
|
|
| 559 |
if ($this->display_handler->uses_exposed()) { |
if ($this->display_handler->uses_exposed()) { |
| 560 |
$this->exposed_widgets = $this->render_exposed_form(); |
$exposed_form = $this->display_handler->get_exposed_form_plugin(); |
| 561 |
|
$this->exposed_widgets = $exposed_form->render_exposed_form(); |
| 562 |
if (form_set_error() || !empty($this->build_info['abort'])) { |
if (form_set_error() || !empty($this->build_info['abort'])) { |
| 563 |
$this->built = TRUE; |
$this->built = TRUE; |
| 564 |
return empty($this->build_info['fail']); |
return empty($this->build_info['fail']); |
| 608 |
// Allow style handler to affect the query: |
// Allow style handler to affect the query: |
| 609 |
$this->style_plugin->query($this->display_handler->use_group_by()); |
$this->style_plugin->query($this->display_handler->use_group_by()); |
| 610 |
|
|
| 611 |
|
// Allow exposed form to affect the query: |
| 612 |
|
if (isset($exposed_form)) { |
| 613 |
|
$exposed_form->query(); |
| 614 |
|
} |
| 615 |
|
|
| 616 |
if (variable_get('views_sql_signature', FALSE)) { |
if (variable_get('views_sql_signature', FALSE)) { |
| 617 |
$this->query->add_signature($this); |
$this->query->add_signature($this); |
| 618 |
} |
} |
| 620 |
// Let modules modify the query just prior to finalizing it. |
// Let modules modify the query just prior to finalizing it. |
| 621 |
$this->query->alter($this); |
$this->query->alter($this); |
| 622 |
|
|
| 623 |
// Build the necessary info to execute the query. |
// Only build the query if we weren't interrupted. |
| 624 |
$this->query->build($this); |
if (empty($this->built)) { |
| 625 |
|
// Build the necessary info to execute the query. |
| 626 |
|
$this->query->build($this); |
| 627 |
|
} |
| 628 |
|
|
| 629 |
$this->built = TRUE; |
$this->built = TRUE; |
| 630 |
$this->build_time = views_microtime() - $start; |
$this->build_time = views_microtime() - $start; |
| 720 |
$this->start_query_capture(); |
$this->start_query_capture(); |
| 721 |
} |
} |
| 722 |
|
|
| 723 |
|
$exposed_form = $this->display_handler->get_exposed_form_plugin(); |
| 724 |
|
$exposed_form->pre_render(); |
| 725 |
|
|
| 726 |
// Check for already-cached output. |
// Check for already-cached output. |
| 727 |
if (!empty($this->live_preview)) { |
if (!empty($this->live_preview)) { |
| 728 |
$cache = FALSE; |
$cache = FALSE; |
| 770 |
} |
} |
| 771 |
} |
} |
| 772 |
|
|
| 773 |
|
$exposed_form->post_render($this->display_handler->output); |
| 774 |
|
|
| 775 |
if ($cache) { |
if ($cache) { |
| 776 |
$cache->post_render($this->display_handler->output); |
$cache->post_render($this->display_handler->output); |
| 777 |
} |
} |