Commit be2384c7 authored by Clément Damiens's avatar Clément Damiens
Browse files

hotfix folders & push first mail notif

parent cdf55b7a
......@@ -5,6 +5,7 @@ class Answer{
const CONTROLLER = "answer";
const ICON = "fa-calendar-check-o";
public static function getById($id, $fields=array()){
return PHDB::findOne( self::COLLECTION, array( "_id" => new MongoId((string)$id) ), $fields );
}
......@@ -250,7 +251,7 @@ class Answer{
$answerList[$key]["todo"] = $todo;
$answerList[$key]["done"] = $done;
$answerList[$key]["tasksPerson"] = $tasksPerson;
$answerList[$key]["canEdit"] = self::canEdit( $ans, null, Yii::app()->session["userId"]) ;
$answerList[$key]["canEdit"] = self::canEdit( $ans, $form, Yii::app()->session["userId"]) ;
}
}
return $answerList;
......@@ -273,6 +274,51 @@ class Answer{
}
return $elements;
}
public static $mailTpl=array(
"validation"=>array(
"subject"=> "La candidature {nameAns} a été validée",
"msg"=>"Nous vous informons que la candidature que vous avez soumise a été validée par les administrateurs. Vous pouvez retrouvez toutes les informations au lien suivant"
)
);
public static function getCommunityToNotify($answer, $entry=null){
$arrayMail=array();
if(!empty($answer["links"])){
foreach($answer["links"] as $k => $v){
if($k=="answered" && (empty($entry) || in_array("answered",$entry))){
foreach($v as $id){
$people=Element::getElementById($id, Person::COLLECTION, null, array("email") );
array_push($arrayMail, $people["email"]);
}
}
}
if(Costum::isSameFunction("getAnswerCommunityToNotify")){
// CARREFUL $costumUserArray need to be return as result : return $params["costumUserArray"]
array_merge($arrayMail, Costum::sameFunction("getAnswerCommunityToNotify", array(
"answer"=>$answer)));
}
}
return $arrayMail;
}
public static function getMailNotifification($id, $key, $step){
$costum = CacheHelper::getCostum();
$answer=Answer::getById($id);
$mailsCommunity=Answer::getCommunityToNotify($answer);
$answer["mappingValues"]=array();
$form=Form::getById($answer["form"]);
if(isset($form["mapping"]))
$answer["mappingValues"]=Answer::getMappingValues($res["form"]["mapping"], $ans);
$nameAnsw=(isset($answer["mappingValues"]["name"])) ? $answer["mappingValues"]["name"] : "";
foreach($mailsCommunity as $email){
/*if(Costum::isSameFunction("getAnswerCommunityToNotify")){
}else{
$subject= ;
$msg="Bonjour {contactName}, ";
}*/
}
}
}
?>
\ 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