Beispiel #1
0
function timeWindow($date, $date1, $date2)
{
    if (!$date && !$date1 && !$date2) {
        return array('0000-00-00', '0000-00-00');
    }
    if ($date1 || $date2) {
        if ($date1) {
            $date1 = extendDate($date1, false);
        } else {
            $date1 = extendDate('0001', false);
        }
        if ($date2) {
            $date2 = extendDate($date2, true);
        } else {
            $date2 = extendDate('9999', true);
        }
    } else {
        $date1 = extendDate($date, false);
        $date2 = extendDate($date, true);
    }
    if (!isValidDateIso($date1) || !isValidDateIso($date2)) {
        $date1 = '0000-00-00';
        $date2 = '0000-00-00';
    }
    return array($date1, $date2);
}
Beispiel #2
0
 private function setMdHead()
 {
     if (array_key_exists('MD_Metadata', $this->md_values)) {
         foreach ($this->md_values['MD_Metadata'] as $x => $md) {
             $this->md_head[$x]['report'] = '';
             $this->md_head[$x]['iso'] = array_key_exists('SV_ServiceIdentification', $md['identificationInfo'][0]) ? 'MS' : 'MD';
             if ($this->md_head[$x]['iso'] == 'MS' && isset($this->md_values['MD_Metadata'][$x]['hierarchyLevelName'][0]['@']) && $this->md_values['MD_Metadata'][$x]['hierarchyLevelName'][0]['@'] == 'MapContext') {
                 //   /MD_Metadata/hierarchyLevelName
                 $this->md_head[$x]['iso'] = 'MC';
             }
             // uuid
             $this->md_head[$x]['uuid'] = '';
             if (isset($this->md_values['MD_Metadata'][$x]['fileIdentifier'][0]['@']) && $this->md_values['MD_Metadata'][$x]['fileIdentifier'][0]['@'] != '') {
                 $this->md_head[$x]['uuid'] = $this->md_values['MD_Metadata'][$x]['fileIdentifier'][0]['@'];
             }
             // geografický rozsah
             $this->md_head[$x]['bbox_x1'] = '';
             $this->md_head[$x]['bbox_x2'] = '';
             $this->md_head[$x]['bbox_y1'] = '';
             $this->md_head[$x]['bbox_y2'] = '';
             if (isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['westBoundLongitude'][0]['@'])) {
                 /// MD_Metadata  / identificationInfo  / MD_DataIdentification  / extent  / EX_Extent  / geographicElement  / EX_GeographicBoundingBox
                 $this->md_head[$x]['bbox_x1'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['westBoundLongitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['westBoundLongitude'][0]['@'] : '';
                 $this->md_head[$x]['bbox_x2'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['eastBoundLongitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['eastBoundLongitude'][0]['@'] : '';
                 $this->md_head[$x]['bbox_y1'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['southBoundLatitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['southBoundLatitude'][0]['@'] : '';
                 $this->md_head[$x]['bbox_y2'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['northBoundLatitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['northBoundLatitude'][0]['@'] : '';
             } elseif (isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['westBoundLongitude'][0]['@'])) {
                 $this->md_head[$x]['bbox_x1'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['westBoundLongitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['westBoundLongitude'][0]['@'] : '';
                 $this->md_head[$x]['bbox_x2'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['eastBoundLongitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['eastBoundLongitude'][0]['@'] : '';
                 $this->md_head[$x]['bbox_y1'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['southBoundLatitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['southBoundLatitude'][0]['@'] : '';
                 $this->md_head[$x]['bbox_y2'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['northBoundLatitude'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['geographicElement'][0]['EX_GeographicBoundingBox'][0]['northBoundLatitude'][0]['@'] : '';
             }
             // časový rozsah
             $this->md_head[$x]['range_begin'] = '';
             $this->md_head[$x]['range_end'] = '';
             if (isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['beginPosition'][0]['@'])) {
                 $this->md_head[$x]['range_begin'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['beginPosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['beginPosition'][0]['@'] : '';
                 $this->md_head[$x]['range_end'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['endPosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['endPosition'][0]['@'] : '';
             } elseif (isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['beginPosition'][0]['@'])) {
                 $this->md_head[$x]['range_begin'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['beginPosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['beginPosition'][0]['@'] : '';
                 $this->md_head[$x]['range_end'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['endPosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimePeriod'][0]['endPosition'][0]['@'] : '';
             } elseif (isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@'])) {
                 $this->md_head[$x]['range_begin'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@'] : '';
                 $this->md_head[$x]['range_end'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['MD_DataIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@'] : '';
             } elseif (isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@'])) {
                 $this->md_head[$x]['range_begin'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@'] : '';
                 $this->md_head[$x]['range_end'] = isset($this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@']) ? $this->md_values['MD_Metadata'][$x]['identificationInfo'][0]['SV_ServiceIdentification'][0]['extent'][0]['EX_Extent'][0]['temporalElement'][0]['EX_TemporalExtent'][0]['extent'][0]['TimeInstant'][0]['timePosition'][0]['@'] : '';
             }
             if ($this->md_head[$x]['range_begin'] != '' || $this->md_head[$x]['range_end'] != '') {
                 //odstranění času, pokud tam je
                 $this->md_head[$x]['range_begin'] = $this->deleteTimeFromDate($this->md_head[$x]['range_begin']);
                 $this->md_head[$x]['range_end'] = $this->deleteTimeFromDate($this->md_head[$x]['range_end']);
                 // kontrola správnosti datumu
                 if (!isValidDateIso($this->md_head[$x]['range_begin']) || !isValidDateIso($this->md_head[$x]['range_end'])) {
                     $this->setReport($x, 'error', "WARNING: range_begin='" . $this->md_head[$x]['range_begin'] . "' and range_end='" . $this->md_head[$x]['range_end'] . "'");
                     $this->md_head[$x]['range_begin'] = '';
                     $this->md_head[$x]['range_end'] = '';
                 }
             }
             $this->md_head[$x]['recno'] = -1;
             $this->setLangMd($x, $this->md_head[$x]['iso']);
             $this->setLangsMd($x, $this->md_head[$x]['iso']);
             $this->setTitle($x, $this->md_head[$x]['iso']);
         }
     }
     if (array_key_exists('metadata', $this->md_values)) {
         foreach ($this->md_values['metadata'] as $x => $md) {
             $this->md_head[$x]['report'] = '';
             $this->md_head[$x]['iso'] = 'DC';
             if (isset($this->md_values['metadata'][$x]['coverage'][0]['@']) && $this->md_values['metadata'][$x]['coverage'][0]['@'] != '') {
                 // geografický rozsah
                 $this->md_head[$x]['bbox_x1'] = '';
                 $this->md_head[$x]['bbox_x2'] = '';
                 $this->md_head[$x]['bbox_y1'] = '';
                 $this->md_head[$x]['bbox_y2'] = '';
                 $pom = DCGeom($this->md_values['metadata'][$x]['coverage'][0]['@']);
                 if (count($pom) == 4) {
                     $this->md_head[$x]['bbox_x1'] = isset($pom['x1']) && trim($pom['x1']) != '' ? trim($pom['x1']) : '';
                     $this->md_head[$x]['bbox_x2'] = isset($pom['x2']) && trim($pom['x2']) != '' ? trim($pom['x2']) : '';
                     $this->md_head[$x]['bbox_y1'] = isset($pom['y1']) && trim($pom['y1']) != '' ? trim($pom['y1']) : '';
                     $this->md_head[$x]['bbox_y2'] = isset($pom['y2']) && trim($pom['y2']) != '' ? trim($pom['y2']) : '';
                 }
             }
             // uuid
             $this->md_head[$x]['uuid'] = '';
             if (isset($this->md_values['metadata'][$x]['identifier']) && is_array($this->md_values['metadata'][$x]['identifier'])) {
                 $z = -1;
                 for ($y = 0; $y < count($this->md_values['metadata'][$x]['identifier']); $y++) {
                     if (isset($this->md_values['metadata'][$x]['identifier'][$y]['@']) && $this->md_values['metadata'][$x]['identifier'][$y]['@'] != '') {
                         $pom = $this->getDcUuid($this->md_values['metadata'][$x]['identifier'][$y]['@']);
                         if ($pom != -1) {
                             $this->md_head[$x]['uuid'] = $pom;
                             $z = $y;
                             break;
                         }
                     }
                 }
                 if ($z > -1) {
                     //odstarnění uuid z pole
                     array_splice($this->md_values['metadata'][$x]['identifier'], $z, 1);
                 }
             }
             // časový rozsah
             $this->md_head[$x]['range_begin'] = '';
             $this->md_head[$x]['range_end'] = '';
             $this->md_head[$x]['recno'] = -1;
             $this->setLangMd($x, $this->md_head[$x]['iso']);
             $this->setLangsMd($x, $this->md_head[$x]['iso']);
             $this->setTitle($x, $this->md_head[$x]['iso']);
         }
     }
     if (array_key_exists('featureCatalogue', $this->md_values)) {
         foreach ($this->md_values['featureCatalogue'] as $x => $md) {
             $this->md_head[$x]['report'] = '';
             $this->md_head[$x]['iso'] = 'FC';
             // uuid
             $this->md_head[$x]['uuid'] = '';
             $this->md_head[$x]['recno'] = -1;
             $z = -1;
             for ($y = 0; $y < count($this->md_values['featureCatalogue'][$x]['id']); $y++) {
                 if (isset($this->md_values['featureCatalogue'][$x]['id'][$y]['@']) && $this->md_values['featureCatalogue'][$x]['id'][$y]['@'] != '') {
                     $this->md_head[$x]['uuid'] = $this->md_values['featureCatalogue'][$x]['id'][$y]['@'];
                 }
             }
             if ($z > -1) {
                 //odstarnění uuid z pole
                 array_splice($this->md_values['featureCatalogue'][$x]['id'], $z, 1);
             }
             $this->setLangMd($x, $this->md_head[$x]['iso']);
             $this->setLangsMd($x, $this->md_head[$x]['iso']);
             $this->setTitle($x, $this->md_head[$x]['iso']);
         }
     }
 }