protected function _isFormEditable() { $pn_form_id = $this->request->getParameter('form_id', pInteger); if ($pn_form_id == 0) { return true; } // allow creation of new forms $t_form = new ca_search_forms(); if (!$t_form->haveAccessToForm($this->request->getUserID(), __CA_BUNDLE_DISPLAY_EDIT_ACCESS__, $pn_form_id)) { // is user allowed to edit form? $this->notification->addNotification(_t("You cannot edit that form"), __NOTIFICATION_TYPE_ERROR__); $this->response->setRedirect(caNavUrl($this->request, 'manage', 'SearchForm', 'ListForms')); return false; } else { return true; } }
/** * 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); }