Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
134 righe
4.5 KiB
134 righe
4.5 KiB
<?php |
|
include '../lib/api_oci.php'; |
|
$mode = $_REQUEST['action']; |
|
switch ($mode) { |
|
case 'listClick': |
|
//echo "------------"; |
|
domandeClickDay(); |
|
break; |
|
case 'createSpb': |
|
createSpb(); |
|
break; |
|
case 'getDomandeUtenteInfrastrutture': |
|
//echo "------------"; |
|
getDomandeUtenteInfrastrutture(); |
|
break; |
|
case 'sendDomandaPhp': |
|
sendDomandaPhp(); |
|
break; |
|
} |
|
|
|
|
|
function createSpb() |
|
{ |
|
global $LoggedAccount; |
|
$dataExp = new DateTime(); |
|
$dataExp->add(new DateInterval('PT15M'));// Aggiungo 15 minuti |
|
exit(Utils::getJwt(array("codiceFiscale"=>$LoggedAccount->CODICE_FISCALE,"exp" => $dataExp->getTimestamp(),"inresponseto"=>$LoggedAccount->INRESPONSETO),SECRET_JWT_KEY)); |
|
} |
|
|
|
function getDomandeUtenteInfrastrutture() |
|
{ |
|
global $LoggedAccount; |
|
$result = array(); |
|
$domande = Domanda::GetDomandeUtenteInfrastrutture($LoggedAccount->CODICE_FISCALE); |
|
//Utils::print_array($domande); |
|
|
|
foreach ($domande as $d) |
|
{ |
|
$paramsBody = array(); |
|
$listaDomande = array(); |
|
$paramsBody['codiceFiscale'] = $LoggedAccount->CODICE_FISCALE; |
|
$paramsBody['inresponseto'] = $LoggedAccount->INRESPONSETO; |
|
$listaDomande[]['idDomanda'] = $d['ID']; |
|
$paramsBody['listaDomande'] = $listaDomande; |
|
$d['calling'] = base64_encode(json_encode($paramsBody)); |
|
|
|
$result[] = $d; |
|
|
|
} |
|
|
|
exit(json_encode($result)); |
|
|
|
} |
|
|
|
function sendDomandaPhp() |
|
{ |
|
global $LoggedAccount; |
|
$body = $_POST['corpo']; |
|
$body_decoded = base64_decode($body); |
|
$body_array = json_decode($body_decoded,true); |
|
|
|
if($LoggedAccount->CODICE_FISCALE != $body_array['codiceFiscale']) |
|
exit(json_encode(array("status"=> "error", "statusResponse" => -999, "reason" => array("name" => "userNotMatch", "message" => "il token non corrisponde alla richiesta")))); |
|
|
|
if(count($body_array['listaDomande']) <= 0) |
|
exit(json_encode(array("status"=> "error", "statusResponse" => -999, "reason" => array("name" => "listMustBeProvided", "message" => "Lista domande non presente o vuota")))); |
|
|
|
$res = Domanda::PresentaDomanda($body_array['listaDomande'][0]['idDomanda']); |
|
|
|
exit(json_encode($res)); |
|
} |
|
|
|
|
|
|
|
function domandeClickDay() { |
|
global $LoggedAccount; |
|
|
|
$rec = array(); |
|
|
|
$listaCompletate = Domanda::domandeClickDay(); |
|
$i= 0; |
|
|
|
$arrayIdDomande = array(); |
|
$arrayAllgenerico = array(); |
|
$arrayAllgenerico['codiceFiscale'] = $LoggedAccount->CODICE_FISCALE; |
|
$arrayAllgenerico['secret'] = SECRET_JWT_KEY; |
|
$arrayAllgenerico['host'] = HOST_CLICKDAY; |
|
$arrayAllgenerico['path'] = PATH_CLICKDAY; |
|
$arrayAllgenerico['port'] = PORT_CLICKDAY; |
|
$dataExp = new DateTime(); |
|
$dataExp->add(new DateInterval('PT15M'));// Aggiungo 15 minuti |
|
$arrayAllgenerico['exp'] = $dataExp->getTimestamp(); |
|
//echo $dataExp->getTimestamp(); |
|
$numeroDomande = 0; |
|
|
|
foreach ($listaCompletate as $key => $value) { |
|
$controlloBottone = Domanda::controlloContributo($value['SEDEOPERATIVA_PROVINCIA']); |
|
|
|
if ($controlloBottone == 1) { |
|
$arrayIdDomande[]['idDomanda'] = intval($value['ID']); |
|
} |
|
$arraySingolo = array(); |
|
$arraySingolo = $arrayAllgenerico; |
|
$idDomanda[0]['idDomanda'] = intval($value['ID']); |
|
$arraySingolo['listaDomande'] = $idDomanda; |
|
$arraySingolo = json_encode($arraySingolo); |
|
/* $esitoEsiste = DomandeInviate::statoDomandaCompletata(intval($value['ID'])); */ |
|
if ($value['STATO'] == 2) { |
|
$onclick = ""; |
|
$classButton = "btn btn-success"; |
|
$classIcon = "fa fa-check"; |
|
$btnValue = "Istanza Inviata"; |
|
$disabled = "disabled"; |
|
$numeroDomande++; |
|
} else { |
|
$onclick = "sendJwt('" . base64_encode($arraySingolo) . "','" . intval($value['ID']) . "')"; |
|
|
|
$classButton = "btn btn-primary"; |
|
$classIcon = "fa fa-arrow-circle-right"; |
|
$btnValue = "Invia Istanza"; |
|
$disabled = ""; |
|
} |
|
$buttonJwt = ''; |
|
if ($controlloBottone == 1) { |
|
$buttonJwt = '<button type="button" class="'.$classButton.'" '.$disabled.' onclick="'.$onclick.'" id="btnSend'.intval($value['ID']).'"> <i id="iSend'.intval($value['ID']).'" class="'.$classIcon.'"> </i> '.$btnValue.'</button>'; |
|
} |
|
|
|
$rec[$i][$key] = $value; |
|
$rec[$i]['button'] = $buttonJwt; |
|
$i++; |
|
} |
|
|
|
exit(json_encode($rec)); |
|
}
|
|
|