예제 #1
0
파일: batch.php 프로젝트: rebe100x/YAKREP
                 $info->zone = $zone;
                 $info->placeName = $currentPlace->title;
                 // Duplicate info for each date
                 foreach ($location->dates as $date) {
                     $eventDate = array();
                     $dateDay = DateTime::createFromFormat('Y-m-d', $date->date);
                     $dateFrom = DateTime::createFromFormat('Y-m-d H:i:s', $date->date . " " . $date->timeStart);
                     $eventDate['dateFrom'] = new MongoDate(date_timestamp_get($dateFrom));
                     $dateEnd = DateTime::createFromFormat('Y-m-d H:i:s', $date->date . " " . $date->timeEnd);
                     $eventDate['dateEnd'] = new MongoDate(date_timestamp_get($dateEnd));
                     // hreventdate format example 2012-04-13 21:30
                     $eventDate['hreventdate'] = $date->date . " - " . mb_substr($date->timeStart, 0, -3);
                     $info->eventDate = $eventDate;
                     $dateEndPrint = strtotime("+7 days", date_timestamp_get($dateEnd));
                     $info->dateEndPrint = new MongoDate($dateEndPrint);
                     $res = $info->saveToMongoDB('', $debug, $updateFlag);
                 }
                 /* End info insertion in mongodb */
             }
             /* End place insertion in mongodb */
             $results['parse']++;
             $results['row']++;
             $row++;
         }
     }
     print_debug("<hr />");
 }
 // Temporary break after 15 insertions
 if ($row > 15) {
     break;
 }
예제 #2
0
     $info->licence = $licence;
     $info->pubDate = gmmktime();
     $info->dateEndPrint = gmmktime(0, 0, 0, 9, 1, 2013);
     $info->heat = 1;
     $cat = array("TRANSPORT#STATION", "STATISTIQUES");
     $info->setYakCat($cat);
     $info->status = 1;
     $info->print = 1;
     $info->yakType = 3;
     $info->setZone("PARIS");
     $info->placeName = 'station ' . $title;
     // NOTE, since it goes in the YAKDICO, we need to add the word 'station' before. If we do not all words 'CHATELET' will be detected by semantic
     $locationQuery = 'station ' . $data[2] . ' ' . $title . ' ' . $zip . ' ' . $city . ', France';
     $cat = array("TRANSPORT#STATION", "STATISTIQUES");
     $info->setYakCat($cat);
     $res = $info->saveToMongoDB($locationQuery, $debug, $updateFlag);
     if (!empty($res['error'])) {
         echo $res['error'];
         echo '<br><b>BATCH FAILLED</b><br>';
         exit;
     }
     foreach ($res as $k => $v) {
         if (isset($v)) {
             $results[$k] += $v;
         }
     }
 } else {
     $results['rejected']++;
     $results['row']++;
     echo 'rejected' . $data[10];
 }
예제 #3
0
            $info->user = 0;
            $info->zone = 15;
            $info->address = $Nom . " " . $Org_Commune;
            $dateUpdatedAt = DateTime::createFromFormat('Y-m-d', $datpar);
            $info->pubDate = new MongoDate($dateUpdatedAt->getTimestamp());
            $info->eventDate = $eventDateTotal;
            echo '<br>dateEndPrint' . date('Y m d', $dateEndPrint);
            $info->dateEndPrint = new MongoDate($dateEndPrint);
            $info->print = 1;
            $info->outGoingLink = $url;
            $info->access = 2;
            $info->yakType = 2;
            if ($photo[0]['Path'] != '') {
                $info->thumb = "/thumb/" . createImgThumb(ltrim($photo[0][Path], "/"), $conf);
            }
            $info->setYakCatOuest($cat);
            $info->filesourceId = '50e42ac09bab884612000000';
            $info->filesourceTitle = $fileTitle;
            $info->licence = $licence;
            $info->placeId = $newPlace['record']['_id'];
            $info->saveToMongoDB("", 1, $updateFlag);
            echo '<br><b>INFO:</b> <br>';
            print_r($info);
            //------------------------------
            unset($Date_ev);
            unset($Date);
            unset($Commune);
            echo "fin " . $baba . "</br>";
        }
    }
}