/** * @throws FolderIDMissingException */ public static function add_value_item($type_array, $category_array, $holder_class, $holder_id, $position_id) { global $user, $regional; if (class_exists($holder_class)) { $item_holder = new $holder_class($holder_id); if ($item_holder instanceof ItemHolderInterface) { $folder_id = $item_holder->get_item_holder_value("folder_id", $position_id); } } if (is_numeric($folder_id)) { if (count($type_array) != 1 and !$_POST['type_id']) { $result = array(); $counter = 0; if (count($type_array) == 0) { $value_obj = Value::get_instance(null); $value_type_array = ValueType::list_entries(); foreach ($value_type_array as $key => $value) { $value_type = new ValueType($value); $result[$counter]['value'] = $value; $result[$counter]['content'] = $value_type->get_name(); $counter++; } } else { foreach ($type_array as $key => $value) { $value_type = new ValueType($value); $result[$counter]['value'] = $value; $result[$counter]['content'] = $value_type->get_name(); $counter++; } } } elseif (count($type_array) != 1 and $_POST['type_id']) { $type_id = $_POST['type_id']; } else { $type_id = $type_array[0]; } if (!$type_id) { $template = new HTMLTemplate("data/value_select_list.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("select", $result); if ($_POST['keywords']) { $template->set_var("keywords", $_POST['keywords']); } else { $template->set_var("keywords", ""); } if ($_POST['description']) { $template->set_var("description", $_POST['description']); } else { $template->set_var("description", ""); } $template->output(); } else { $value_type = new ValueType($type_id); $template = new HTMLTemplate("data/value_add.html"); $template->set_var("decimal_separator", $regional->get_decimal_separator()); $template->set_var("thousand_separator", $regional->get_thousand_separator()); $template->set_var("session_id", $_GET['session_id']); $template->set_var("folder_id", $folder_id); $template->set_var("type_id", $type_id); $template->set_var("get_array", serialize($_GET)); if ($_GET['retrace']) { $template->set_var("retrace", "index.php?" . http_build_query(Retrace::resolve_retrace_string($_GET['retrace']))); } else { $template->set_var("retrace", "index.php?username="******"&session_id=" . $_GET['session_id']); } $template->set_var("title", $value_type->get_name()); require_once "value_form.io.php"; $value_form_io = new ValueFormIO(null, $type_id, $folder_id); $value_form_io->set_field_class("DataValueAddValues"); $template->set_var("value", $value_form_io->get_content()); if ($_POST['keywords']) { $template->set_var("keywords", $_POST['keywords']); } else { $template->set_var("keywords", ""); } if ($_POST['description']) { $template->set_var("description", $_POST['description']); } else { $template->set_var("description", ""); } $template->output(); } } else { throw new FolderIDMissingException(); } }