getElementsByTagName("dati-identificativi-persona"); $nodePersonaNascita = $objDOM->getElementsByTagName("estremi-nascita"); $nodePersonaResidenza = $objDOM->getElementsByTagName("indirizzo"); //Utils::print_array($objDOM); //looping if tag config have more than one foreach ($nodePersona as $searchNode) { //$denominazione = $searchNode->getAttribute('denominazione'); $this->cognome = $searchNode->getAttribute('cognome'); $this->nome = $searchNode->getAttribute('nome'); $this->sesso = $searchNode->getAttribute('sesso'); $this->c_fiscale = $searchNode->getAttribute('c-fiscale'); } foreach($nodePersonaNascita as $searchnascita){ $this->dt=$searchnascita->getAttribute('dt'); $this->comune=$searchnascita->getAttribute('comune'); $this->provincia=$searchnascita->getAttribute('provincia'); } foreach($nodePersonaResidenza as $searchresidenza){ $this->comune_residenza=$searchresidenza->getAttribute('comune'); $this->provincia_residenza=$searchresidenza->getAttribute('provincia'); $this->cap_residenza=$searchresidenza->getAttribute('cap'); $this->indirizzo_residenza=$searchresidenza->getAttribute('toponimo')." ".$searchresidenza->getAttribute('via')." ".$searchresidenza->getAttribute('n-civico'); } $nodeImprese = $objDOM->getElementsByTagName("imprese-persona"); foreach ($nodeImprese as $searchNode) { $impresa = ImpresaPersona::List($searchNode); $this->imprese_persona = $impresa; $this->n_imprese_rappresentante = count($impresa); } //echo $i; } } public static function Load ($cfSPID = ""){ global $LoggedAccount; $return = array(); $options = array( 'trace'=> 1, 'exceptions'=> false, 'cache_wsdl'=>WSDL_CACHE_NONE, 'login'=> IC_WSDL_USR, 'password'=> IC_WSDL_PSW ); //$LoggedAccount->CODICE_FISCALE = 'BSSRNT54P18H501Q'; $client = new MySoapClient(IC_WSDL_URL, $options); if($cfSPID!=""){ $request = array( 'RichiestaSchedaPersonaCustom' => array('tipoServizio' => 'SCHEDA_RAPPR', 'codiceFiscalePersona' => $cfSPID)); }else{ $request = array( 'RichiestaSchedaPersonaCustom' => array('tipoServizio' => 'SCHEDA_RAPPR', 'codiceFiscalePersona' => $LoggedAccount->CODICE_FISCALE)); } try { $client->__soapCall('schedaPersonaCustom', $request); $response = $client->__getLastResponse(); //$response = str_replace("",'',$response); ///My Invalid Symbol //$response = str_ireplace(array('SOAP-ENV:','SOAP:'),'',$response); //$xml = new SimpleXMLElement($response); //echo htmlentities($response);exit(); $objDOM = new DOMDocument(); $objDOM->loadXML($response); $sp = new SchedaPersona($objDOM); //$return = Utils::ObjectToArray($sp); $return = $sp; } catch (Exception $exc) { echo $exc->getTraceAsString(); } return $return; } } class ImpresaPersona{ public $chiave_impresa = 0; public $denominazione = ''; public $c_fiscale = ''; public $n_rea = ''; public $provincia = ''; public $comune = ''; public $indirizzo = ''; public $cariche = array(); public $cluster_db = false; // campo per stabilire se il codice fiscale Azienda รจ idoneo a presentare la domanda public $in_domanda = false; // campo per controllare se l'impresa ha presentato una domanda public $stato_domanda = 0; // campo per controllare lo stato della domanda public $id_istanza = 0; // campo per identificare l'istanza presentata public $data_completamento = null; // campo per controllare lo stato della domanda public $gruppo_elenco_jquery = null; // campo utilizzato per il raggruppamento nelle liste delle aziende JQUERY public function __construct($objDOM = null) { global $con, $LoggedAccount; if ($objDOM == null) return; if (is_object($objDOM)) { $nodeImpresa = $objDOM->getElementsByTagName('impresa-persona'); foreach ($nodeImpresa as $s) { $this->chiave_impresa = $s->getAttribute('chiave-impresa'); $datiIdentificativiImpresa = $s->getElementsByTagName('dati-identificativi-impresa'); foreach ($datiIdentificativiImpresa as $d) { $this->denominazione = $d->getAttribute('denominazione'); $this->c_fiscale = $d->getAttribute('c-fiscale'); $domanda = Domanda::verificaPresenzaDomanda($LoggedAccount->CODICE_FISCALE, $d->getAttribute('c-fiscale')); if($domanda->ID > 0 && $domanda->VERSIONE == 0){ // VECCHIA DOMANDA INSERITA $this->stato_domanda = intval($domanda->STATO); $this->in_domanda = true;// $this->id_istanza = intval($domanda->ID);// $this->cluster_db = true; $this->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; }else if($domanda->ID >0 && $domanda->VERSIONE == 1){ // NUOVA DOMANDA INSERITA $this->stato_domanda = intval($domanda->STATO); $this->in_domanda = false;// $this->id_istanza = intval($domanda->ID);// $this->cluster_db = true; $this->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; }else { // NESSUNA DOMANDA INSERITA E CONTROLLO NEL CLUSTER DB LA PRESENZA DELL'IMPRESA $this->stato_domanda = 0; $this->in_domanda = false;// $this->cluster_db = ClusterDb::Exists($d->getAttribute('c-fiscale')); } $this->n_rea = $d->getAttribute('n-rea'); $indirizzoLocalizzazione = $d->getElementsByTagName('indirizzo-localizzazione'); foreach($indirizzoLocalizzazione as $ind){ $this->comune = $ind->getAttribute('comune'); $this->provincia = $ind->getAttribute('provincia'); $this->indirizzo = $ind->getAttribute('toponimo').' '.$ind->getAttribute('via').($ind->getAttribute('n-civico')!='' ? ' n. '.$ind->getAttribute('n-civico') : '').($ind->getAttribute('cap')!='' ? ' '.$ind->getAttribute('cap') : ''); } } $persona = $s->getElementsByTagName('persona'); foreach ($persona as $p){ $this->cariche = new ImpresaPersonaCariche($p); } } } } public function List($objDOM = null){ global $LoggedAccount; $record = array(); $recordAmerigo=array(); if (is_object($objDOM)) { $nodeImpresa = $objDOM->getElementsByTagName('impresa-persona'); foreach ($nodeImpresa as $s) { $adesione=0; $preparazione=0; $nocluster=0; $impresa = new ImpresaPersona(); $impresa->chiave_impresa = $s->getAttribute('chiave-impresa'); $datiIdentificativiImpresa = $s->getElementsByTagName('dati-identificativi-impresa'); foreach ($datiIdentificativiImpresa as $d) { $impresa->denominazione = $d->getAttribute('denominazione'); $impresa->c_fiscale = $d->getAttribute('c-fiscale'); $domanda = Domanda::verificaPresenzaDomanda($LoggedAccount->CODICE_FISCALE, $d->getAttribute('c-fiscale')); if($domanda->ID > 0 && $domanda->VERSIONE == 0){ // VECCHIA DOMANDA INSERITA $adesione=1; $impresa->gruppo_elenco_jquery = 'adesione'; $impresa->stato_domanda = intval($domanda->STATO); $impresa->in_domanda = true;// $impresa->id_istanza = intval($domanda->ID);// $impresa->cluster_db = true; $impresa->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; }else if($domanda->ID >0 && $domanda->VERSIONE == 1){ // NUOVA DOMANDA INSERITA $preparazione=1; $impresa->gruppo_elenco_jquery = 'preparazione'; $impresa->stato_domanda = intval($domanda->STATO); $impresa->in_domanda = false;// $impresa->id_istanza = intval($domanda->ID);// $impresa->cluster_db = true; $impresa->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; }else { // NESSUNA DOMANDA INSERITA E CONTROLLO NEL CLUSTER DB LA PRESENZA DELL'IMPRESA $nocluster=1; $impresa->gruppo_elenco_jquery = 'nocluster'; $impresa->stato_domanda = 0; $impresa->in_domanda = false;// $impresa->cluster_db = ClusterDb::Exists($d->getAttribute('c-fiscale')); } $impresa->n_rea = $d->getAttribute('n-rea'); $indirizzoLocalizzazione = $d->getElementsByTagName('indirizzo-localizzazione'); foreach($indirizzoLocalizzazione as $ind){ $impresa->comune = $ind->getAttribute('comune'); $impresa->provincia = $ind->getAttribute('provincia'); $impresa->indirizzo = $ind->getAttribute('toponimo').' '.$ind->getAttribute('via').($ind->getAttribute('n-civico')!='' ? ' n. '.$ind->getAttribute('n-civico') : '').($ind->getAttribute('cap')!='' ? ' '.$ind->getAttribute('cap') : ''); } } $persona = $s->getElementsByTagName('persona'); foreach ($persona as $p){ $impresa->cariche = ImpresaPersonaCariche::List($p); } $record[] = $impresa; // if($adesione==1){ // $recordAmerigo['adesione'][]=$impresa; // }else if($preparazione==1){ // $recordAmerigo['preparazione'][]=$impresa; // }else if($nocluster==1){ // $recordAmerigo['nocluster'][]=$impresa; // } } } // return $recordAmerigo; return $record; } } class ImpresaPersonaCariche{ public $p_carica = ''; public $c_carica = ''; public $dt_atto_nomina = ''; public $c_durata = ''; public $descrizione_durata = ''; public function __construct($objDOM = null) { global $con; if ($objDOM == null) return; if (is_object($objDOM)) { $nodeCariche = $objDOM->getElementsByTagName('cariche'); foreach ($nodeCariche as $c) { $carica = $c->getElementsByTagName('carica'); foreach ($carica as $d) { $this->p_carica = $d->getAttribute('p-carica'); $this->c_carica = $d->getAttribute('c-carica'); $this->dt_atto_nomina = $d->getAttribute('c-carica'); $this->c_durata = $d->getAttribute('c-durata'); $this->descrizione_durata = $d->getAttribute('descrizione-durata'); } } } } public function List($objDOM = null) { $record = array(); if (is_object($objDOM)) { $nodeCariche = $objDOM->getElementsByTagName('cariche'); foreach ($nodeCariche as $c) { $car = new ImpresaPersonaCariche(); $carica = $c->getElementsByTagName('carica'); foreach ($carica as $d) { $car->p_carica = $d->getAttribute('p-carica'); $car->c_carica = $d->getAttribute('c-carica'); $car->dt_atto_nomina = $d->getAttribute('c-carica'); $car->c_durata = $d->getAttribute('c-durata'); $car->descrizione_durata = $d->getAttribute('descrizione-durata'); } } $record[] = $car; } return $record; } }