Sfoglia il codice sorgente

limitar descarga ficheros

Nermosis 3 anni fa
parent
commit
3833692bbc

+ 1 - 1
application/controllers/Parser.php Vedi File

139
             $attrHref = $row['@attributes']['href'];
139
             $attrHref = $row['@attributes']['href'];
140
 
140
 
141
             if ($attrNext === "next") {
141
             if ($attrNext === "next") {
142
-                if (!strpos($attrHref, "20220127_")) {
142
+                if (!strpos($attrHref, "20220209_180023")) { //"20220127_")) {
143
                     $enlace = $attrHref;
143
                     $enlace = $attrHref;
144
                 } else {
144
                 } else {
145
                     $enlace = "";
145
                     $enlace = "";

+ 5 - 90
application/libraries/ParserFile.php Vedi File

38
         foreach ($files as $file) {
38
         foreach ($files as $file) {
39
             $resultEntries = array();
39
             $resultEntries = array();
40
             $entrada = file_get_contents($file);
40
             $entrada = file_get_contents($file);
41
-            $xml = simplexml_load_string($entrada, "SimpleXMLElement", LIBXML_NOCDATA);
41
+            $xml = simplexml_load_string($entrada, "SimpleXMLElement"); //, LIBXML_NOCDATA | LIBXML_PARSEHUGE);
42
             $json = json_encode($xml);
42
             $json = json_encode($xml);
43
             $array = json_decode($json, true);
43
             $array = json_decode($json, true);
44
 
44
 
109
     {
109
     {
110
         $resultEntries = array();
110
         $resultEntries = array();
111
         if (array_key_exists("ContractFolderStatus", $xml)) {
111
         if (array_key_exists("ContractFolderStatus", $xml)) {
112
-            $contractFolder = $xml['ContractFolderStatus'];
112
+            $contractFolder = (array) $xml['ContractFolderStatus'];
113
 
113
 
114
             $resultEntries['ContractFolderID'] = (string) $contractFolder['ContractFolderID'];
114
             $resultEntries['ContractFolderID'] = (string) $contractFolder['ContractFolderID'];
115
             $resultEntries['ContractFolderStatusCode'] = (string) $contractFolder['ContractFolderStatusCode'];
115
             $resultEntries['ContractFolderStatusCode'] = (string) $contractFolder['ContractFolderStatusCode'];
116
-            //$resultEntries['ContractFolderStatusCodeAttr'] = $this->existAttribute($contractFolder, "ContractFolderStatusCode", "string", 'listURI');
116
+            $resultEntries['ContractFolderStatusCodeAttr'] = $this->existAttribute($contractFolder, "ContractFolderStatusCode", "string", 'listURI');
117
             $resultEntries['id_ajena_licitacion'] = $this->idLicitacion;
117
             $resultEntries['id_ajena_licitacion'] = $this->idLicitacion;
118
             $resultEntries['id_compuesta'] = $this->idLicitacion . "_01";
118
             $resultEntries['id_compuesta'] = $this->idLicitacion . "_01";
119
             $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
119
             $resultEntries['fecha_creacion_log'] = $this->fechaInicioParser;
342
         }
342
         }
343
 
343
 
344
         //$resultFinal = $this->array_remove_empty($resultEntries);
344
         //$resultFinal = $this->array_remove_empty($resultEntries);
345
-        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
346
-        return $resultFinal;
345
+        return $resultEntries;
347
     }
346
     }
348
 
347
 
349
     private function nodoTenderingTerms($xml)
348
     private function nodoTenderingTerms($xml)
424
             $resultEntries["tenderingTerm"]['language'] = $this->existNodo($TenderingTerms['Language'], 'ID', 'string');
423
             $resultEntries["tenderingTerm"]['language'] = $this->existNodo($TenderingTerms['Language'], 'ID', 'string');
425
         }
424
         }
426
 
425
 
427
-        //$resultFinal = $this->array_remove_empty($resultEntries);
428
-        $resultFinal = $this->checkArrayValuesEmpty($resultEntries);
429
-        return $resultFinal;
426
+        return $resultEntries;
430
     }
427
     }
431
 
428
 
432
     private function nodoTenderingProcess($xml)
429
     private function nodoTenderingProcess($xml)
640
                 break;
637
                 break;
641
         }
638
         }
642
     }
639
     }
643
-
644
-    /*private function recurseXML($xml, $isEntrys = false)
645
-    {
646
-    //TODO: 01-02-22- me he quedado acabando esto
647
-    $idLicitacion = 0;
648
-    $child_count = 0;
649
-    $result = array();
650
-    $mapaNodo = array("id", "link", "summary", "title");
651
-    foreach ($xml as $key => $value) {
652
-    //$child_count++;
653
-    //TODO: Identificar que es una entry
654
-    //TODO: Parsear por mapa y guardar en attr de clase el id de la licitacion
655
-    //TODO: Detectar en un array si es un attributo y recoger ese valor
656
-    if ($key == "TenderingProcess") {
657
-    $idAjeno = $this->idLicitacion;
658
-    $idCompuesta = $resultSet->idCompuesta;
659
-    $result['bruto_contrato'] = array(
660
-    array("expediente" => 1, "id_ajena" => "1892739", "idCompuesta" => 1892739_01),
661
-    array("expediente" => 2, "id_ajena" => "123346", "idCompuesta" => 01),
662
-    array("expediente" => 2, "id_ajena" => "678789", "idCompuesta" => 01),
663
-    )
664
-    $result['bruto_contrato'] = array(
665
-    array("expediente" => 1, "id_ajena" => "1892739", "idCompuesta" => 01),
666
-    array("expediente" => 2, "id_ajena" => "1892739", "idCompuesta" => 01),
667
-    array("expediente" => 2, "id_ajena" => "678789", "idCompuesta" => 01),
668
-    )
669
-    }
670
-    if (is_array($value)) {
671
-    $this->recurseXML($value);
672
-    } else {
673
-    if ($key == "id") {
674
-    $idLicitacion = $value;
675
-    }
676
-    }
677
-    /* if ($this->RecurseXML($value, $parent . "." . $key) == 0) // no childern, aka "leaf node"
678
-    {
679
-    print($parent . "." . (string) $key . " = " . (string) $value . "<BR>\n");
680
-
681
-    }
682
-    }
683
-    return $child_count;
684
-    }*/
685
-
686
-    public function array_remove_empty($haystack)
687
-    {
688
-        foreach ($haystack as $key => $value) {
689
-            if (is_array($value)) {
690
-                $haystack[$key] = $this->array_remove_empty($haystack[$key]);
691
-            }
692
-
693
-            if (empty($haystack[$key])) {
694
-                unset($haystack[$key]);
695
-            }
696
-        }
697
-
698
-        return $haystack;
699
-    }
700
-
701
-    public function checkArrayValuesEmpty($arrayCheck)
702
-    {
703
-        $valuesTotales = count($arrayCheck);
704
-        $valuesVacios = 0;
705
-        foreach ($arrayCheck as $key => $value) {
706
-
707
-            if (is_array($value)) {
708
-                $arrayCheck[$key] = $this->checkArrayValuesEmpty($arrayCheck[$key]);
709
-            } else {
710
-                $value = trim($value);
711
-                if (empty($arrayCheck[$key])) {
712
-                    $valuesVacios++;
713
-                }
714
-            }
715
-
716
-        }
717
-
718
-        if ($valuesTotales == $valuesVacios) {
719
-            $this->array_remove_empty($arrayCheck);
720
-        } else {
721
-            return $arrayCheck;
722
-        }
723
-    }
724
-
725
 }
640
 }
726
 
641
 
727
 /* End of file ParserFile.php */
642
 /* End of file ParserFile.php */