Commit f6607f0f authored by Nicolas Nambinintsoa's avatar Nicolas Nambinintsoa
Browse files

Merge remote-tracking branch 'origin/master'

parents 70419a20 ac859564
......@@ -128,22 +128,28 @@ class AgendaAction extends CAction
if(!empty($searchP["startDateUTC"]))
usort($allEvents,"mySortEvent");
}else{
$allEvents = PHDB::findAndSortAndLimitAndIndex( PHType::TYPE_EVENTS, $queries["global"],
array("startDate"=>-1));
}
$results["results"]=$allEvents;
if(!empty($searchP['count'])){
$queryCountDate=array(
'$or' =>array(
array("openingHours.dayOfWeek" => array('$exists' => 1)),
array(
"startDate" => array( '$gte' => new MongoDate((float)$startD)
)),
array(
"startDate" => array( '$lte' => new MongoDate( (float)$startD )),
"endDate" => array( '$gte' => new MongoDate( (float)$startD ))
if(!empty($startD)){
$queryCountDate=array(
'$or' =>array(
array("openingHours.dayOfWeek" => array('$exists' => 1)),
array(
"startDate" => array( '$gte' => new MongoDate((float)$startD)
)),
array(
"startDate" => array( '$lte' => new MongoDate( (float)$startD )),
"endDate" => array( '$gte' => new MongoDate( (float)$startD ))
)
)
)
);
$queries[Event::COLLECTION]=SearchNew::addQuery($queries["global"], $queryCountDate );
);
$queries[Event::COLLECTION]=SearchNew::addQuery($queries["global"], $queryCountDate );
}else
$queries[Event::COLLECTION]=$queries["global"];
$results["count"]=SearchNew::countResults($searchP, $queries);
}
......
......@@ -137,7 +137,7 @@ class Badge {
foreach ($badge as $key => $value) {
if(!self::checkBadgeInListBadges((empty($value["name"])?$value:$value["name"]), $badges)){
$newBadge["name"] = (empty($value["name"])?$value:$value["name"]);
$newBadge["date"] = (empty($value["date"])?new mongoDate(time()):$value["date"]);
$newBadge["date"] = (empty($value["date"])?new MongoDate(time()):$value["date"]);
$newListBadges[] = $newBadge;
}
}
......@@ -147,7 +147,7 @@ class Badge {
}else if(is_string($badge)){
if(!self::checkBadgeInListBadges($badge, $badges)){
$newBadge["name"] = $badge;
$newBadge["date"] = new mongoDate(time());
$newBadge["date"] = new MongoDate(time());
$badges[] = $newBadge;
$res = array("result" => true, "badges" => $badges);
}
......@@ -189,12 +189,12 @@ class Badge {
if(is_array($badges)){
foreach ($badges as $key => $value) {
$newBadge["name"] = (empty($value["name"])?$value:$value["name"]);
$newBadge["date"] = (empty($value["date"])?new mongoDate(time()):$value["date"]);
$newBadge["date"] = (empty($value["date"])?new MongoDate(time()):$value["date"]);
$newListBadges[] = $newBadge;
}
}else if(is_string($badges)){
$newBadge["name"] = $badges;
$newBadge["date"] = new mongoDate(time());
$newBadge["date"] = new MongoDate(time());
$newListBadges[] = $newBadge;
}
return $newListBadges;
......
......@@ -949,7 +949,10 @@ class Link {
$parentUsersList = Element::getCommunityByTypeAndId($parentType, $parentId, "all");
$parentController = Element::getControlerByCollection($parentType);
$parentConnectAs = self::$linksTypes[$parentType][$childType];
$childConnectAs=self::$linksTypes[$childType][$parentType];
if ($childType == Organization::COLLECTION && $parentType == Organization::COLLECTION)
$childConnectAs = "memberOf";
else
$childConnectAs=self::$linksTypes[$childType][$parentType];
if(!$isConnectingAdmin)
$typeOfDemand=Link::$connectTypes[$parentType];
}
......
......@@ -805,7 +805,7 @@ class Person {
if(!empty($forced)){
$person=array_merge($person,$forced);
}
$person["created"] = new mongoDate(time());
$person["created"] = new MongoDate(time());
$person["collection"] = self::COLLECTION;
//$person["preferences"] = array("seeExplanations"=> true);
$person["preferences"] = Preference::initPreferences(self::COLLECTION);
......@@ -2102,7 +2102,7 @@ public static function isUniqueEmail($email) {
$newPerson["@context"] = array("@vocab"=>"http://schema.org",
"ph"=>"http://pixelhumain.com/ph/ontology/");
$newPerson["roles"] = Role::getDefaultRoles();
$newPerson["created"] = new mongoDate(time());
$newPerson["created"] = new MongoDate(time());
$newPerson["preferences"] = array("seeExplanations"=> true);
if(!empty($newPerson["image"])){
......@@ -2387,7 +2387,7 @@ public static function isUniqueEmail($email) {
if ($res["result"]) {
//Anonymize the user : Remove all fields from the person
$where = array("_id" => new MongoId($id));
$action = array("username" => $id, "email" => $id."@communecter.org", "name" => "Citoyen supprimé", "deletedDate" => new mongoDate(time()), "status" => "deleted");
$action = array("username" => $id, "email" => $id."@communecter.org", "name" => "Citoyen supprimé", "deletedDate" => new MongoDate(time()), "status" => "deleted");
PHDB::update(self::COLLECTION, $where, $action);
Log::save(array("userId" => $userId, "browser" => @$_SERVER["HTTP_USER_AGENT"], "ipAddress" => @$_SERVER["REMOTE_ADDR"], "created" => new MongoDate(time()), "action" => "deleteUser", "params" => array("id" => $id)));
} else {
......
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