if (isset($this) && is_a($this,"concorso")) {
$lotti = $this->getLotti();
if (!empty($this->printSelectLottiConditions)) {
$checkInstance = clone $this;
$tmp = $lotti;
$lotti = [];
if (!is_array($this->printSelectLottiConditions)) {
$this->printSelectLottiConditions = [$this->printSelectLottiConditions];
}
foreach($tmp AS $tl) {
$checks = 0;
foreach($this->printSelectLottiConditions AS $check) {
$checkInstance->setLotto($tl["codice"]);
if ($check == "hasPartecipanti" && !empty($checkInstance->getPartecipanti())) {
$checks++;
}
if ($check == "hasPartecipantiOnline") {
$checkPartecipanti = $checkInstance->getPartecipanti();
if (!empty($checkPartecipanti)) {
foreach($checkPartecipanti AS $checkPar) {
if (!empty($checkPar["codice_operatore"])) {
$checks++;
break;
}
}
}
}
if ($check == "hasInvito" && !empty($checkInstance->hasInvito($tl["codice"]))) {
$checks++;
}
if ($check == "hasAggiudicatari" && !empty($checkInstance->getAggiudicatari())) {
$checks++;
}
if ($check == "hasAggiudicatariMultipli") {
$checkPartecipanti = $checkInstance->getAggiudicatari();
$extraInfo = $checkInstance->getExtraInfo();
if (count($checkPartecipanti) > 1 || !empty($extraInfo["lotto"]["estremi_sorteggio"])) {
$checks++;
break;
}
}
if ($check == "hasCriteri" && !empty($checkInstance->getCriteri())) {
$checks++;
}
if ($check == "hasCriteriValutabili" && !empty($checkInstance->getCriteriValutabili())) {
$checks++;
}
if ($check == "hasCriteriCommissione" && !empty($checkInstance->returnCriteri($checkInstance->round["codice"],["tipologia"=>"Q"]))) {
$checks++;
}
}
if ($checks == count($this->printSelectLottiConditions)) {
$lotti[] = $tl;
}
}
unset($checkInstance);
}
if (!empty($lotti)) {
if (count($lotti) > 1) {
if ($allOption) {
array_unshift($lotti,["codice"=>"","oggetto"=>__("Tutti i lotti")]);
}
foreach($lotti AS $lotto) {
$class = "btn-primary";
$label = "";
if (!empty($stati[$lotto["codice"]])) {
$class = $stati[$lotto["codice"]]["class"];
$label = $stati[$lotto["codice"]]["label"] ?? "";
} else {
if (isset($lotto["stato"])) {
if ($lotto["stato"] == 95) {
$class = "btn-warning";
$label = __("Lotto deserto");
}
if ($lotto["stato"] == 99) {
$class = "btn-warning";
$label = __("Lotto non aggiudicato");
}
}
}
?>
" class="btn btn-lg btn-block = $class ?> my-1">
if (!empty($lotto["codice"])) { ?>
= __("Lotto") ?> #= $lotto["numero"] ?>
= $lotto["oggetto"] ?>
} else { ?>
= $lotto["oggetto"] ?>
} ?>
if (!empty($label)) { ?>
= $label ?> } ?>
}
} else {
echo '';
die();
}
}
}
?>