Пример #1
0
    $jardin = json_decode($jardinJSON[0], 1);
    $currentPlace = new Place();
    $currentPlace->title = $jardin['name'];
    echo $jardin['name'] . "<br>";
    $currentPlace->filesourceTitle = $fileTitle;
    $currentPlace->location->lat = $jardin['lat'];
    $currentPlace->location->lng = $jardin['lng'];
    $currentPlace->licence = $licence;
    $currentPlace->origin = $origin;
    $currentPlace->address->street = $jardin['address'];
    $currentPlace->address->state = "Paris";
    $currentPlace->address->area = "Ile-de-France";
    $currentPlace->address->zip = $jardin['zipcode'];
    $currentPlace->address->city = "Paris";
    $currentPlace->address->country = "France";
    $currentPlace->contact->opening = "http://parcsetjardins.equipement.paris.fr/tousleshoraires";
    $currentPlace->setTagOutdoor();
    $cat = array("#GEOLOCALISATION", "GEOLOCALISATION#YAKDICO", "LOISIR", "LOISIR#ESPACEVERT");
    $currentPlace->setYakCat($cat);
    $currentPlace->setZone("PARIS");
    $res = $currentPlace->saveToMongoDB('', $debug, $updateFlag);
    foreach ($res as $k => $v) {
        if (isset($v)) {
            $results[$k] += $v;
        }
    }
    $results['parse']++;
    $results['row']++;
    $row++;
}
$currentPlace->prettyLog($results);
Пример #2
0
     } else {
         $content = "";
     }
 } elseif (!empty($data[5])) {
     $title = $data[5];
     $content = "";
 }
 $place->title = $title;
 $place->content = $content;
 $place->origin = $origin;
 $place->filesourceTitle = $fileTitle;
 $place->licence = $licence;
 $place->setTel($data[16], "tel");
 $place->setMail($data[18]);
 $place->setWeb($data[19]);
 $place->setZone("MONTPELLIER");
 // YakCat
 $cat = array("GEOLOCALISATION", "GEOLOCALISATION#YAKDICO");
 $place->setYakCat($cat);
 $place->setYakCat(array($data[9]));
 if (!empty($data[33]) || !empty($data[34]) || !empty($data[20])) {
     $place->setTagCarPark();
 }
 $transportation = "";
 if (!empty($data[37])) {
     $transportation = "Tram: " . $data[37] . "<br>";
 }
 if (!empty($data[38])) {
     $transportation = "Bus: " . $data[37];
 }
 $place->contact->transportation = $transportation;
Пример #3
0
         $currentPlace->filesourceTitle = $fileTitle;
         $currentPlace->licence = $licence;
         $currentPlace->setTagIndoor();
         // YakCat
         $cat = array("CULTURE", "GEOLOCALISATION", "GEOLOCALISATION#YAKDICO", "CULTURE#CINEMA");
         $currentPlace->setYakCat($cat);
         if (substr(trim($data[7]), 0, 2) == "75") {
             $zoneName = "PARIS";
         } elseif (substr(trim($data[7]), 0, 2) == "34") {
             $zoneName = "MONTPELLIER";
         } else {
             $results['rejected']++;
             $results['row']++;
             continue;
         }
         $currentPlace->setZone($zoneName);
         print "<b>{$currentPlace->title}</b><br>";
         $locationQuery = $query = $data[4] . " " . $data[5] . ' ' . $data[7] . ' ' . $data[6] . ', France';
         //echo $locationQuery;
         $res = $currentPlace->saveToMongoDB($locationQuery, $debug, $updateFlag);
         foreach ($res as $k => $v) {
             if (isset($v)) {
                 $results[$k] += $v;
             }
         }
         $results['parse']++;
     }
     $results['row']++;
     $row++;
 }
 fclose($handle);
Пример #4
0
     echo "<br>" . $data[0] . " " . $data[4] . " =><b>Not in France</b>";
     $results['rejected']++;
     $results['row']++;
     continue;
 }
 // if no valid address, we skip
 $street = trim($data[6] . " " . $data[7] . " " . $data[8] . " " . $data[9]);
 if (strlen($street) == 0) {
     echo "<br>" . $data[0] . " <b>no address</b> " . $street;
     $results['rejected']++;
     $results['row']++;
     continue;
 }
 // If zone isn't Paris or Montpellier, skip
 if (preg_match("/paris/i", $data[14])) {
     $currentPlace->setZone("PARIS");
 } else {
     if (preg_match("/montpellier/i", $data[14])) {
         $currentPlace->setZone("MONTPELLIER");
     } else {
         echo "<br>" . $data[0] . " <b>not in your zone</b> ";
         $results['rejected']++;
         $results['row']++;
         continue;
     }
 }
 /* title logic :
 				- we take field 38 if not empty
 				- if 38 is empty , we take field 0 but first par goes in title and second goes in content
 			*/
 $title = "";