|
@@ -4,6 +4,10 @@ defined('BASEPATH') or exit('No direct script access allowed');
|
4
|
4
|
class ParserFile
|
5
|
5
|
{
|
6
|
6
|
|
|
7
|
+ protected $idLicitacion = 0;
|
|
8
|
+ protected $datos_iniciales = array();
|
|
9
|
+ protected $contrat_folder = array();
|
|
10
|
+ protected $keyPadreRecursiva = "";
|
7
|
11
|
protected $rutaDiaria = "";
|
8
|
12
|
protected $rutaMensual = FCPATH . "DOWNLOADS/MONTH/format";
|
9
|
13
|
|
|
@@ -32,7 +36,10 @@ class ParserFile
|
32
|
36
|
foreach ($files as $file) {
|
33
|
37
|
$resultEntries = array();
|
34
|
38
|
$entrada = file_get_contents($file);
|
35
|
|
- $xml = simplexml_load_string($entrada);
|
|
39
|
+ $xml = simplexml_load_string($entrada, "SimpleXMLElement", LIBXML_NOCDATA);
|
|
40
|
+ $json = json_encode($xml);
|
|
41
|
+ $array = json_decode($json, true);
|
|
42
|
+
|
36
|
43
|
$filename = basename($file);
|
37
|
44
|
$aux = 0;
|
38
|
45
|
foreach ($xml->entry as $clave => $row) {
|
|
@@ -67,15 +74,17 @@ class ParserFile
|
67
|
74
|
$resultEntries[$filename][$aux]['additionalDocs'] = $this->nodoAdditionalDocumentReference($row);
|
68
|
75
|
|
69
|
76
|
$aux++;
|
|
77
|
+
|
|
78
|
+ //$this->recurseXML($array['entry'], true);
|
70
|
79
|
}
|
71
|
80
|
|
72
|
81
|
$this->CI->parserdatabasebruto->setDatosParser($resultEntries, $fechaInicioParser, $datosPerfil);
|
73
|
|
-
|
74
|
82
|
$this->CI->parserdatabaselimpio->index();
|
75
|
83
|
|
76
|
84
|
//$str = print_r($resultEntries, true);
|
77
|
85
|
|
78
|
86
|
//file_put_contents($this->rutaDiaria . "/text_" . $filename . ".txt", $str);
|
|
87
|
+
|
79
|
88
|
}
|
80
|
89
|
|
81
|
90
|
return;
|
|
@@ -131,9 +140,9 @@ class ParserFile
|
131
|
140
|
|
132
|
141
|
$resultEntries['locatedContractingParty']['buyerProfileURIID'] = $this->existNodo($LocatedContractingParty, "BuyerProfileURIID", 'string');
|
133
|
142
|
|
134
|
|
- if (isset($LocatedContractingParty->ParentLocatedParty)) {
|
135
|
|
- $this->RecurseXML($LocatedContractingParty->ParentLocatedParty);
|
136
|
|
- }
|
|
143
|
+ /*if (isset($LocatedContractingParty->ParentLocatedParty)) {
|
|
144
|
+ $this->RecurseXML($LocatedContractingParty->ParentLocatedParty);
|
|
145
|
+ }*/
|
137
|
146
|
}
|
138
|
147
|
$resultFinal = $this->array_remove_empty($resultEntries);
|
139
|
148
|
return $resultFinal;
|
|
@@ -539,22 +548,47 @@ class ParserFile
|
539
|
548
|
}
|
540
|
549
|
}
|
541
|
550
|
|
542
|
|
- private function recurseXML($xml, $parent = "")
|
|
551
|
+ /*private function recurseXML($xml, $isEntrys = false)
|
|
552
|
+ {
|
|
553
|
+ //TODO: 01-02-22- me he quedado acabando esto
|
|
554
|
+ $idLicitacion = 0;
|
|
555
|
+ $child_count = 0;
|
|
556
|
+ $result = array();
|
|
557
|
+ $mapaNodo = array("id", "link", "summary", "title");
|
|
558
|
+ foreach ($xml as $key => $value) {
|
|
559
|
+ //$child_count++;
|
|
560
|
+ //TODO: Identificar que es una entry
|
|
561
|
+ //TODO: Parsear por mapa y guardar en attr de clase el id de la licitacion
|
|
562
|
+ //TODO: Detectar en un array si es un attributo y recoger ese valor
|
|
563
|
+ if ($key == "TenderingProcess") {
|
|
564
|
+ $idAjeno = $this->idLicitacion;
|
|
565
|
+ $idCompuesta = $resultSet->idCompuesta;
|
|
566
|
+ $result['bruto_contrato'] = array(
|
|
567
|
+ array("expediente" => 1, "id_ajena" => "1892739", "idCompuesta" => 1892739_01),
|
|
568
|
+ array("expediente" => 2, "id_ajena" => "123346", "idCompuesta" => 01),
|
|
569
|
+ array("expediente" => 2, "id_ajena" => "678789", "idCompuesta" => 01),
|
|
570
|
+ )
|
|
571
|
+ $result['bruto_contrato'] = array(
|
|
572
|
+ array("expediente" => 1, "id_ajena" => "1892739", "idCompuesta" => 01),
|
|
573
|
+ array("expediente" => 2, "id_ajena" => "1892739", "idCompuesta" => 01),
|
|
574
|
+ array("expediente" => 2, "id_ajena" => "678789", "idCompuesta" => 01),
|
|
575
|
+ )
|
|
576
|
+ }
|
|
577
|
+ if (is_array($value)) {
|
|
578
|
+ $this->recurseXML($value);
|
|
579
|
+ } else {
|
|
580
|
+ if ($key == "id") {
|
|
581
|
+ $idLicitacion = $value;
|
|
582
|
+ }
|
|
583
|
+ }
|
|
584
|
+ /* if ($this->RecurseXML($value, $parent . "." . $key) == 0) // no childern, aka "leaf node"
|
543
|
585
|
{
|
544
|
|
- //TODO: 01-02-22- me he quedado acabando esto
|
545
|
|
- $child_count = 0;
|
546
|
|
- $result = array();
|
547
|
|
- $mapaNodo = array();
|
548
|
|
- foreach ($xml as $key => $value) {
|
549
|
|
- $child_count++;
|
550
|
|
- if ($this->RecurseXML($value, $parent . "." . $key) == 0) // no childern, aka "leaf node"
|
551
|
|
- {
|
552
|
|
- //print($parent . "." . (string) $key . " = " . (string) $value . "<BR>\n");
|
|
586
|
+ print($parent . "." . (string) $key . " = " . (string) $value . "<BR>\n");
|
553
|
587
|
|
554
|
|
- }
|
555
|
|
- }
|
556
|
|
- return $child_count;
|
557
|
588
|
}
|
|
589
|
+ }
|
|
590
|
+ return $child_count;
|
|
591
|
+ }*/
|
558
|
592
|
|
559
|
593
|
public function array_remove_empty($haystack)
|
560
|
594
|
{
|