{$options['name']}"; } /** * Setup validation rules * * @param Array $options * @return void */ private function validation(Array $options) { $rel = []; $rel[] = "N"; $rel[] = "0"; $rel[] = "0"; $rel[] = "A"; if(! empty($options["required"])) { $rel[0] = "S"; $rel[1] = "1"; } if(! empty($options["rel"]) && is_array($options["rel"])) { $rel = $options["rel"]; } $field = substr($options["name"], (strrpos($options["name"], "[") + 1), ((strrpos($options["name"], "]") - 1) - (strrpos($options["name"], "[")))); if(! empty($this->settings["required_if_fields"][$field])) { if(! empty($this->settings["required_if_fields"][$field]["field"])) { $rel[3] = "required_if_empty"; $rel[4] = $this->slugify(str_replace("[[FORM]]", "[{$this->form_section}]", $this->settings["required_if_fields"][$field]["field"])); } } return implode(";", $rel); } /** * Check inaccessible methods * * @param String $method * @param Array $parameters * @return void */ public function __call($method, $parameters) { if(method_exists($this, "__{$method}")) { if($method == "label") { return $this->{"__{$method}"}($parameters[2] ?? "", $parameters[1]); } if(! empty($parameters[0]["rel"])) { $parameters[0]["rel"] = $this->validation($parameters[0]); } return $this->{"__{$method}"}($parameters[0]); } } /** * Print select * * @param Array $options * @return void */ public function __select(Array $options) { // Supporto per readonly if(!empty($options["attrs"]) && !empty($options["attrs"]["readonly"])) { $dummy_options = $options; $dummy_options["attrs"]["disabled"] = 1; // Previene che venga aggiornato il suo valore $dummy_options["attrs"]["data-dummy"] = true; $dummy_options["name"] = "dummy_" . $dummy_options["name"]; if(isset($options["options"][$options["val"]])) { $dummy_options["val"] = $options["options"][$options["val"]]; } $options["value"] = $options["val"]; return $this->__text($dummy_options) . $this->__hidden_but_better($options); } if(! empty($options["name"])) { ob_start(); ?>
"> label($options["name"], $options, $options["title"] ?? null); ?> -help" class="form-text text-muted">
__text($options); } public function __decimal(Array $options = []) { $options["rel"] = explode(";", $options["rel"]); $options["rel"][3] = "2D"; $options["rel"] = implode(";", $options["rel"]); return $this->__text($options); } /** * Print Select with Nuts Codes * * @param mixed $options * @return void */ function __nuts(Array $options = []) { global $pdo; $bind = []; $sql = "SELECT nuts, descrizione, data_fine_validita FROM b_nuts WHERE data_fine_validita = '' OR data_fine_validita IS NULL"; if(! empty($options["data_fine_validita"])) { $sql .= "OR DATE(data_fine_validita) >= :data_fine_validita"; $bind[":data_fine_validita"] = $options["data_fine_validita"]; } $nuts = $pdo->go($sql, $bind); if($nuts->rowCount() > 0) { while ($code = $nuts->fetch(PDO::FETCH_ASSOC)) { if (strlen($code["nuts"]) > 4) { $options["options"][$code["nuts"]] = $code["descrizione"]; if (! empty($code["data_fine_validita"])) { $data_fine_validita = mysql2date($code["data_fine_validita"]); $options["options"][$code["nuts"]] = "{$code["descrizione"]} (data fine validità {$data_fine_validita})"; } } } } $options["type"] = "select"; return $this->__select($options); } /** * Print text input * * @param Array $options * @return void */ public function __text(Array $options = []) { if(! empty($options["name"])) { $class = null; if(! empty($options["input"]["class"]) && is_array($options["input"]["class"])) { $class = implode(" ", $options["input"]["class"]); } if(! empty($options["override"])) { foreach ($options["override"] as $key => $value) { if (array_key_exists($key, $options)) { $options[$key] = $value; } } } ob_start(); ?>
"> label($options["name"], $options, $options["title"] ?? null); } ?> " class="form-control " title="" rel="" $value) { echo " {$key}=\"{$value}\" "; } } ?> id="slugify($options["name"]) ?>" name="" value="" read_only) {?> disabled > -help" class="form-text text-muted">
suggestionTriggers[] = $this->slugify($options["name"]); } return ob_get_clean(); } return null; } /** * Print textarea input * * @param Array $options * @return void */ public function __textarea(Array $options = []) { if(! empty($options["name"])) { ob_start(); ?>
"> label($options["name"], $options, $options["title"] ?? null); ?>
suggestionTriggers[] = $this->slugify($options["name"]); } return $html = ob_get_clean(); } return null; } /** * Print value input * * @param Array $options * @return void */ public function __value(Array $options) { if (!empty($options["name"])) { ob_start(); ?>
row px-3">
label($options["name"], $options, $options["title"] ?? null); } ?> " class="form-control" title="" rel="" $value) { echo "{$key}=\"{$value}\""; } } ?> id="slugify($options["name"]) ?>" name="[value]" value="">
label($options["name"], $options, __guue("Valuta")); ?> -help" class="form-text text-muted">
__text($dummy_options); echo $this->__hidden_but_better($value_options); echo $this->__hidden_but_better($type_options); endif; ?>
row px-3">
label($options["name"], $options, $options["title"] ?? null); } ?> " class="form-control" title="" rel="" $value) { echo "{$key}=\"{$value}\""; } } ?> id="slugify($options["name"]) ?>" name="[value]" value="">
label($options["name"], $options, __guue("Tipologia")); ?> -help" class="form-text text-muted">
3 && $rel[3] != "Checked") { $rel[3] = "Checked"; $options["rel"] = implode(";",$rel); } ob_start(); $checked = false; ?>
">
" type="checkbox" value="__£__" name="" rel ="" title="" id="slugify($options["name"]) ?>" $value) { if($key !== "class") { echo "{$key}=\"{$value}\" "; } } } ?>>
suggestionTriggers[] = $this->slugify($options["name"]); } return $html = ob_get_clean(); } return null; } /** * Print a text line * * @param array $options * @return void */ public function __text_line(Array $options = []) { if(! empty($options["name"])) { return "

{$options["name"]}

"; } return null; } /** * Print a weight data * * @param array $options * @return void */ public function __weight(Array $options = []) { if(! empty($options["name"])) { $class = null; if(! empty($options["input"]["class"]) && is_array($options["input"]["class"])) $class = implode(" ", $options["input"]["class"]); if(! empty($options["override"])) { foreach ($options["override"] as $key => $value) { if (array_key_exists($key, $options)) { $options[$key] = $value; } } } ob_start(); ?>
m-0">
label($options["name"], $options, $options["title"] ?? null); ?>
" class="col-sm-12 col-md-8 form-control " title="" rel="" $value) { echo "{$key}=\"{$value}\" "; } } ?> id="slugify($options["name"]) ?>" name="" value="">
/100
suggestionTriggers[] = $this->slugify($options["name"]); } return $html = ob_get_clean(); } return null; } public function __cpv(Array $options) { global $pdo; $id = $this->slugify($options["name"]); ob_start(); ?>
">
"> $value) { if($key == "class") continue; echo "{$key}=\"{$value}\" "; } } ?> type="text" placeholder=" CPV" title=" CPV" autocomplete="false" class="form-control" >
">
go("SELECT * FROM b_cpv WHERE codice = :codice", [":codice" => $options["val"]])->fetch(PDO::FETCH_ASSOC); if(! empty($cpv)) { ?>
" class="list-group-item py-2 d-flex align-items-center bg-secondary-muted "> - " id="" value="" >
"> label($options["name"], $options, $options["title"] ?? null); ?> -help" class="form-text text-muted">
__text($options); } /** * Print datetime input * * @param Array $options * @return void */ public function __date(Array $options = []) { $options["input"]["class"] = ["datepick"]; $options["rel"] = explode(";", $options["rel"]); $options["rel"][3] = "D"; $options["rel"] = implode(";", $options["rel"]); return $this->__text($options); } /** * Print datetime input * * @param Array $options * @return void */ public function __time(Array $options = []) { $options["input"]["class"] = ["time"]; $options["rel"] = explode(";", $options["rel"]); $options["rel"][3] = "T"; $options["rel"] = implode(";", $options["rel"]); if (!empty($options["val"])) { preg_match('/^\d{2}:\d{2}/',$options["val"],$m); if (!empty($m)) { $options["val"] = $m[0]; } } return $this->__text($options); } /** * Print datetime input * * @param Array $options * @return void */ public function __email(Array $options = []) { $options["rel"] = explode(";", $options["rel"]); $options["rel"][3] = "E"; $options["rel"] = implode(";", $options["rel"]); return $this->__text($options); } /** * Print datetime input * * @param Array $options * @return void */ public function __url(Array $options = []) { $options["rel"] = explode(";", $options["rel"]); $options["rel"][3] = "L"; $options["rel"] = implode(";", $options["rel"]); return $this->__text($options); } /** * Print label * * @param String $name * @param String $title * @return void */ public function __label(String $name, Array $options, String $title = null) { if(! empty($name)) { ob_start(); ?>
">
$value) { echo "{$key}=\"{$value}\" "; } } ?>> info["valori"], $options["key"]); $object = json_decode(@gzinflate(base64_decode($options["object"])), 1); if(! empty($values) && ! empty($object) && (! empty($options["object"]) || $options["object"] !== "empty") || ! empty($object["force-show"])) { $form = str_replace('.xsd', '', $object["xsd"]); $ted = new TedEsender($form, $this->info["codice"], $this->settings); $ted->setMode("bs4formgenerator"); $ted->debug = $this->debug; if (isset($options["ignored_keys"])) $ted->ignored_keys = array_merge($ted->ignored_keys,$options["ignored_keys"]); if(! empty($object["child"])) { $child = new SimpleXMLIterator($object["child"]); } $title = end($object["settings"]["name"]); if(! isset($object["multiple"]) || ! empty($object["multiple"])) { if(! empty($object["key"])) { $name = strtoupper($object["key"]); if(! in_array($name, $object["settings"]["name"])) { $object["settings"]["name"][] = $name; } } $object["settings"]["name"][] = "£"; foreach ($values["£"] ?? $values as $id => $value) { $s = $object["settings"]; $s["name"][] = $id; $ted->fields = []; $ted->getField($object["section"], $child, $s); $ted->ignored_keys[] = $id; ?>
" id="">
ignored_keys)); echo $ted->translate(str_replace("DYN_SECTION_", "", $title ?? $name)); ?>
printFields($object["section"]); ?>
fields = []; $ted->getField($object["section"], $child, $object["settings"]); $title = end($object["settings"]["name"]); #region[ShowToGaetano] #OCCHIO CHE QUI SI POTREBBE PRESENTARE UN BUG INFIMO: #In alcuni casi l'id non veniva valorizzato e rompeva l'interfaccia. #Aggiungendolo come variabile qui e specificando l'id del container funziona #Però non so per quale motivo questo errore si presenti solo nell'F14 e mai prima $id = uniqid(); #endregion ?>
">
ignored_keys)); echo $ted->translate(str_replace("DYN_SECTION_", "", $title ?? $name)); ?>
printFields($object["section"]); ?>
" value="" name=""> " value="" name="">
">