Commit b72516cb authored by Raph El's avatar Raph El
Browse files

Test Hofix event recurrent

parent fbd7ad1c
......@@ -7428,4 +7428,55 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
echo "create tags collection";
}
}
public function actionRecurentEvents() {
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
$events=PHDB::find(Event::COLLECTION,
array("openingHours" => array('$exists' => 1)),
array("name", "openingHours", "startDate", "endDate", "created", "updated", "modified", "creator", "source", "address"));
$count = array(
"source" => array(),
"notSource" => 0,
"FR" => 0,
"RE" => 0,
"all" => 0,
"notAddress" => 0,
"fuseau" => array()
);
//Rest::json($count); exit;
foreach ($events as $key => $value) {
if( !empty($value["address"]) ){
if(empty($count[$value["address"]["addressCountry"]]))
$count[$value["address"]["addressCountry"]] = 0 ;
$count[$value["address"]["addressCountry"]]++;
if(empty($count["fuseau"][$value["address"]["addressCountry"]]))
$count["fuseau"][$value["address"]["addressCountry"]] = geoip_time_zone_by_country_and_region($value["address"]["addressCountry"]) ;
}else{
if(!empty($value["source"])){
if(empty($count["source"][$value["source"]["key"]]))
$count["source"][$value["source"]["key"]] = 0;
$count["source"][$value["source"]["key"]]++;
}else
$count["notSource"]++;
$count["notAddress"]++;
}
$count["all"]++;
// if(!empty($value["creator"])){
// $events[$key]["creatorNew"] = PHDB::findOneById( Person::COLLECTION,
// $value["creator"],
// array() );
// }
// $events[$key]["createdNew"] =date(DateTime::ISO8601, $value["created"] ) ;
}
Rest::json($count);
}
}
}
\ No newline at end of file
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