*"; } // Stampa la label con il nome interno del campo private static function printCodeLabel(array $options) { // Dividiamo la data reference $split = explode(".", $options["attrs"]["data-reference"] ?? "."); $index = array_key_last($split); $label = $split[$index]; // Se la label trovata non è utile cerchiamone una utile while($index > 0 && (in_array($label, ["codice", "*"]) || is_numeric($label))) { $label = $split[--$index]; } ?> {"__{$method}"}($parameters[2] ?? "", $parameters[1]); } $parameters[0]["rel"] = $this->validation($parameters[0]); return $this->{"__{$method}"}($parameters[0]); } } /** * Selezione codice istat * * @return void */ public function __codice_istat(array $options) { $options["attrs"]["class"][] = "not-chosen"; $options["field_id"] = uniqid("codice_istat_"); if (!empty($options["val"])) { global $pdo; $option = $pdo->go("SELECT * FROM b_istat_anac WHERE codice_istat = :codice_istat", [":codice_istat" => $options["val"]])->fetch(PDO::FETCH_ASSOC); if($option) $options["options"] = [$option["codice_istat"] => "{$option["etichetta"]}"]; } ob_start(); echo $this->__select($options); ?> $options["val"]]; ob_start(); echo $this->__select($options); ?> __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); } /** * __decimal * * @param mixed $options * @return void */ 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"]) > 3) { $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 " data-regex="" title="" rel="" data-rel="" printAttributes($options["attrs"] ?? []) ?> id="slugify($options["name"]) ?>" name="" value=""> -help" class="form-text text-muted">
"> label($options["name"], $options, $options["title"] ?? null); ?>
-help" class="form-text text-muted"> 3 && $rel[3] != "Checked") { $rel[3] = "Checked"; $options["rel"] = implode(";", $rel); } ob_start(); ?>
">
" type="checkbox" value="" name="" rel="" title="" id="slugify($options["name"]) ?>" printAttributes($options["attrs"] ?? []) ?>>

{$options["name"]}

"; } return null; } /** * Print CPV Selector * * @param mixed $options * @return void */ public function __cpv(array $options) { global $pdo; $id = $this->slugify(uniqid('', true)); ob_start(); ?>
"> printAttributes($options["attrs"] ?? []) ?> placeholder=" CPV" title=" CPV" autocomplete="false" class="form-control">
mt-3">
go("SELECT * FROM b_cpv WHERE codice = :codice", [":codice" => $options["val"]])->fetch(PDO::FETCH_ASSOC); if (!empty($cpv)) { ?>
" class="list-group-item d-flex align-items-center"> - " id="" value="" >
 
"> label($options["name"], $options, $options["title"] ?? null); ?> -help" class="form-text text-muted">
$value) { if ($key !== "class") { echo ' ' . $key . (isset($value) ? '="' . $value . '"' : null) . ' '; } } } } /** * Print datetime input * * @param Array $options * @return void */ public function __datetime(array $options = []) { $options["input"]["class"][] = "datetimepick"; $options["rel"] = explode(";", $options["rel"]); $options["rel"][3] = "DT"; $object = $options["object"] ?? ""; if ($object == "date_full") { $options["input"]["class"][] = "datepick"; $options["rel"][3] = "D"; } else if ($object == "time") { $options["input"]["class"][] = "timepick"; $options["rel"][3] = "T"; } $options["rel"] = implode(";", $options["rel"]); return $this->__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="" name=""> slugify($options["name"]) ?>" value="" name="">
">