Commit 318a7b14 authored by Anatole Rakotoson's avatar Anatole Rakotoson
Browse files

Merge remote-tracking branch 'origin/qa' into qa

parents b82d86ff 318f2cd5
......@@ -7335,6 +7335,67 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
$events = Element::getLastEvents("organizations", "5e203fc98b509c36568b4584", 4, "2016-01-23T00:00:00+04:00");
Rest::json($events); exit;
}
public function actionAddZonePF(){
//$level1 = Zone::createLevel("PF", "Polynésie française", "1");
$url = "https://nominatim.openstreetmap.org/details.php?osmtype=R&osmid=3412620&class=boundary&format=json&email=".Yii::app()->params["contactEmail"];
$nominatim = SIG::getUrl($url);
//var_dump(json_decode($nominatim)); exit;
$nominatim = json_decode($nominatim, true);
$zone=array();
$info=array();
$translates=array();
if(!empty($nominatim)){
$zone["name"] = $nominatim["localname"];
$zone["countryCode"] = "PF";
$zone["level"] = array("1");
// $zone["geo"] = SIG::getFormatGeo($nominatim["lat"], $nominatim["lon"]);
// $zone["geoPosition"] = SIG::getFormatGeoPosition($nominatim["lat"], $nominatim["lon"]);
$lat = $nominatim["geometry"]["coordinates"][1];
$lon = $nominatim["geometry"]["coordinates"][0];
$zone["geo"] = SIG::getFormatGeo($lat, $lon);
$zone["geoPosition"] = SIG::getFormatGeoPosition($lat, $lon);
//$zone["geoShape"] = $nominatim["geojson"];
if(!empty($nominatim["osm_id"]))
$zone["osmID"] = $nominatim["osm_id"];
if(!empty($nominatim["extratags"]["wikidata"]))
$zone["wikidataID"] = $nominatim["extratags"]["wikidata"];
if(!empty($nominatim["names"])){
foreach ($nominatim["names"] as $keyName => $valueName) {
$arrayName = explode(":", $keyName);
if(!empty($arrayName[1]) && $arrayName[0] == "name" && strlen($arrayName[1]) == 2 && $nominatim["localname"] != $valueName){
$translates[strtoupper($arrayName[1])] = $valueName;
}
}
}
$info["countryCode"] = $zone["countryCode"];
$info["parentType"] = Zone::COLLECTION;
$info["translates"] = $translates;
$info["origin"] = $nominatim["localname"];
}
$res = array(
"zone" =>$zone,
"info" =>$info
);
// PHDB::insert(Zone::COLLECTION, $zone );
// $info["parentId"] = (String) $zone["_id"];
// PHDB::insert(Zone::TRANSLATE, $info);
// PHDB::update(Zone::COLLECTION,
// array("_id"=>new MongoId((String) $zone["_id"])),
// array('$set' => array("translateId" => (String)$info["_id"]))
// );
Rest::json($res);
}
public function actionCitySaintPierreEtMichellon(){
//$level1 = Zone::createLevel("PF", "Polynésie française", "1");
$city = PHDB::find(City::COLLECTION, array('postalCodes.postalCode'=> '97500'));
Rest::json($city); exit;
}
public function actionBashforeachActiveTags() {
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
......
......@@ -32,7 +32,7 @@ HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->requ
$cssAnsScriptFilesModule = array(
'/js/default/calendar.js',
);
HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModule, $this->module->assetsUrl);
HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModule, Yii::app()->getModule( "co2" )->getAssetsUrl());
HtmlHelper::registerCssAndScriptsFiles( array( '/css/calendar.css') , Yii::app()->theme->baseUrl. '/assets');
$calendarParams=(@Yii::app()->session["paramsConfig"]["pages"]["#agenda"] && @Yii::app()->session["paramsConfig"]["pages"]["#agenda"]["calendar"]) ?Yii::app()->session["paramsConfig"]["pages"]["#agenda"]["calendar"] : null;
if(isset(Yii::app()->session["costum"]) && !empty($calendarParams)){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment