data->get_parameter("defaults", array()); $ajax_submit_path = $this->data->get_parameter("ajax_submit_path", ""); $embeddable_id = $this->data->get_parameter("sm_embeddable_id", ""); $multiple_display_form_type = $this->data->get_parameter("multiple_display_form_type", "radio"); $lang = $this->data->get_api()->get_country(); $questions = $this->data->get_data("questions"); $translation = $this->data->get_parameter("translate"); //the worktype can be displayed in different ways. Setup for a seperate form object renderer //and prefilter the data for the selectable items foreach ($questions as $qid => $qdata){ if ($qdata['name'] == 'sp_id_worktype'){ $available_worktypes = $this->data->get_parameter("worktypes", array()); if (count($available_worktypes) == 1){ $questions[$qid]["type"] = "hidden"; $questions[$qid]["default"] = $available_worktypes[0]; } else { if (count($available_worktypes)){ foreach ($questions[$qid]['options'] as $k => $option){ if (! in_array($option["value"], $available_worktypes)){ unset($questions[$qid]['options'][$k]); } } } $questions[$qid]['options'] = array_values($questions[$qid]['options']); $questions[$qid]["type"] = ($multiple_display_form_type == 'select' ? "select" : "worktypelist"); } } } $s = ""; if ($params = $this->data->get_parameter("sm_display_defaults", false)){ $s .= ""; } $s .= "
\n"; $json_messages = $this->setup_jquery_validate_messages($this->data->get_data("questions")); $error_string = $translation->trans("Please fix these errors :"); $s .= "\n"; return $s; } }