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.
49 righe
1.5 KiB
49 righe
1.5 KiB
<?php |
|
|
|
$mode = $_REQUEST['action']; |
|
switch ($mode) { |
|
case "saveVote": |
|
saveVote(); |
|
break; |
|
|
|
case "getData": |
|
getData(); |
|
break; |
|
} |
|
|
|
function saveVote() { |
|
global $LoggedAccount, $con; |
|
$response = Utils::initDefaultResponse(-999, ''); |
|
if (!Utils::isStatoSportelloPreparazione()) { |
|
$response['erroreDescrizione'] = "Accesso non consentito (0)"; |
|
exit(json_encode($response)); |
|
} |
|
$customerSatisfaction = CustomerSatisfaction::getByCf(); |
|
if (isset($customerSatisfaction['ID']) && $customerSatisfaction['ID'] > 0) { |
|
$response['erroreDescrizione'] = "Hai già espresso il voto"; |
|
exit(json_encode($response)); |
|
} |
|
CustomerSatisfaction::checkVerificaDatiPreSalvataggio(); |
|
$customer = new CustomerSatisfaction(); |
|
$customer->CODICE_FISCALE = $LoggedAccount->CODICE_FISCALE; |
|
$customer->VALORE = $_POST['valore']; |
|
$controlliDomanda = $customer->checkDatiPreSave(); |
|
if ($controlliDomanda['checkDati']) { |
|
$response = $customer->Save(); |
|
if ($response['esito'] == 1) { |
|
$return['esito'] = 1; |
|
} |
|
} else { |
|
$response['erroreDescrizione'] = ("<b>" . $controlliDomanda['txt_dati_mancanti'] . "</b>"); |
|
} |
|
exit(json_encode($response)); |
|
} |
|
|
|
function getData() { |
|
global $con; |
|
$response = Utils::initDefaultResponse(-999, ''); |
|
$dati = CustomerSatisfaction::getData(); |
|
$response['esito']=1; |
|
$response['dati']=$dati; |
|
exit(json_encode($response)); |
|
}
|
|
|