public function renderWidget($ps_widget_id, &$pa_settings) { parent::renderWidget($ps_widget_id, $pa_settings); $this->opo_view->setVar('request', $this->getRequest()); $t_form = new ca_search_forms(); if (!($vn_form_id = (int) $pa_settings["form_code"])) { $va_forms = caExtractValuesByUserLocale($t_form->getForms(array('table' => 'ca_objects', 'user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_READ_ACCESS__))); $va_tmp = array_keys($va_forms); $vn_form_id = array_shift($va_tmp); } $t_form->load($vn_form_id); $this->opo_view->setVar("t_form", $t_form); if ($t_form->haveAccessToForm($this->getRequest()->user->getUserID(), __CA_SEARCH_FORM_READ_ACCESS__)) { $vo_dm = Datamodel::load(); $vo_result_context = new ResultContext($this->getRequest(), $vo_dm->getTableName($t_form->get("table_num")), "advanced_search"); $va_form_data = $vo_result_context->getParameter('form_data'); $this->opo_view->setVar("controller_name", $this->getAdvancedSearchControllerNameForTable($vo_dm->getTableName($t_form->get("table_num")))); $this->opo_view->setVar('form_data', $va_form_data); $this->opo_view->setVar('form_elements', $t_form->getHTMLFormElements($this->getRequest(), $va_form_data)); } else { $t_form->clear(); } return $this->opo_view->render('main_html.php'); }
/** * Returns summary of current advanced search parameters suitable for display. * * @return string Summary of current search criteria ready for display */ public function getCriteriaForDisplay($pn_form_id = null) { $t_form = new ca_search_forms(); if (!($vn_form_id = $pn_form_id)) { if (!($vn_form_id = $this->opo_result_context->getParameter('form_id')) || !$t_form->haveAccessToForm($this->request->getUserID(), __CA_SEARCH_FORM_READ_ACCESS__, $vn_form_id)) { if (sizeof($va_forms = $t_form->getForms(array('table' => $this->ops_tablename, 'user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_READ_ACCESS__)))) { $va_tmp = array_keys($va_forms); $vn_form_id = array_shift($va_tmp); } } } $t_form->load($vn_form_id); $va_form_data = $this->opo_result_context->getParameter('form_data'); $va_buf = array(); if (!($t_model = $this->opo_datamodel->getTableInstance($this->ops_tablename, true))) { return '?'; } foreach ($va_form_data as $vs_bundle => $vs_value) { if (!trim($vs_value)) { continue; } $va_buf[] = $t_model->getDisplayLabel($vs_bundle) . ": " . $vs_value; } return join("; ", $va_buf); }