Commit 5a470b38 authored by Raph El's avatar Raph El
Browse files

Merge branch 'development' of https://gitlab.adullact.net/pixelhumain/survey into development

parents 3e87bf12 c153bac3
......@@ -70,7 +70,7 @@
"financement" : {
"limitRoles" : [
"Financeur",
"opérateur"
"Opérateur"
],
"financerTypeList" : {
"acteursocioeco" : "Acteur Socio-économique",
......
......@@ -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
......@@ -25,7 +25,7 @@ if( $mode != "pdf" ){
<tbody class="directoryLines">
<tr>
<?php $label=(@$answer["step"]=="deal12") ? "Opérateur sélectionner par le ménage" : "Intention opérateur"; ?>
<?php $label=(@$answer["step"]=="deal12") ? "Opérateur sélectionné par le ménage" : "Intention opérateur"; ?>
<td colspan='2' ><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label ?></h4></td>
</tr>
<?php
......
......@@ -496,7 +496,13 @@ $(document).ready(function() {
});
});
function closePrioModal(){
prioModal.modal('hide');
}
function closePrioModalRel (){
closePrioModal();
urlCtrl.loadByHash(location.hash);
}
</script>
<?php } else {
//echo "<h4 class='text-red'>CALENDAR works with existing answers</h4>";
......
......@@ -442,6 +442,13 @@ $(document).ready(function() {
prioModal.modal("show");
});
});
function closePrioModal(){
prioModal.modal('hide');
}
function closePrioModalRel (){
closePrioModal();
urlCtrl.loadByHash(location.hash);
}
</script>
<?php } ?>
<?php } else {
......
......@@ -170,7 +170,7 @@ if( $mode != "pdf" ){
today = today.getDate() + '/' + (today.getMonth()+1) + '/' + today.getFullYear();
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
id : "<?php echo (string)$answer['_id'] ?>",
collection : "answers",
path : "validation."+formData.form,
value : {
......@@ -181,7 +181,7 @@ if( $mode != "pdf" ){
user : userId
}
};
if(costum.form.subForms.length == $.inArray( "<?php echo $form['id'] ?>", costum.form.subForms )+1 && formData.valid == "valid")
if(form.subForms.length == $.inArray( "<?php echo $form['id'] ?>", form.subForms )+1 && formData.valid == "valid")
ctxTpl.value.finished = true;
mylog.log("validation save",ctxTpl);
......@@ -191,13 +191,13 @@ if( $mode != "pdf" ){
//only increment step form to next step if step valid
if( ctxTpl.value.valid == "valid" || ctxTpl.value.valid == "validReserve" ){
step = 0;
if(costum.form.subForms.length == $.inArray( "<?php echo $form['id'] ?>", costum.form.subForms )+1)
if(form.subForms.length == $.inArray( "<?php echo $form['id'] ?>", form.subForms )+1)
step = "all";
else
step = costum.form.subForms[$.inArray( "<?php echo $form['id'] ?>", costum.form.subForms )+1];
step = form.subForms[$.inArray( "<?php echo $form['id'] ?>", form.subForms )+1];
ctxTpl = {
id : "<?php echo $answer['_id'] ?>",
id : "<?php echo (string)$answer['_id'] ?>",
collection : "answers",
path : "step",
value : step
......
......@@ -715,7 +715,13 @@ $(document).ready(function() {
});
function closePrioModal(){
prioModal.modal('hide');
}
function closePrioModalRel (){
closePrioModal();
urlCtrl.loadByHash(location.hash);
}
var listObj = {
addTodoItem : function () {
......
......@@ -3,9 +3,10 @@
.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
</style>
<?php
if( !isset($parentForm["startDate"]) ||
( time() > strtotime($parentForm["startDate"]) &&
( !isset($parentForm["endDate"]) || time() <= strtotime($parentForm["endDate"])))
( time() > strtotime(str_replace("/","-",$parentForm["startDate"])) &&
( !isset($parentForm["endDate"]) || time() <= strtotime(str_replace("/","-",$parentForm["endDate"]))))
)
{
if( isset(Yii::app()->session["userId"]))
......@@ -58,9 +59,9 @@ if( !isset($parentForm["startDate"]) ||
}
} else {
if(time() < strtotime($parentForm["startDate"]) )
if(time() < strtotime(str_replace("/","-",$parentForm["startDate"])) )
echo "<h4 class='text-center text-red'><i class='fa fa-warning'></i> Les réponses commenceront le ".$parentForm["startDate"]."</h4>";
else if ( time() > strtotime($parentForm["endDate"]))
else if ( time() > strtotime(str_replace("/","-",$parentForm["endDate"])))
echo "<h4 class='text-center text-red'><i class='fa fa-warning'></i> Le temps de réponses est écoulé depuis le ".$parentForm["endDate"]."</h4>";
}
?>
......
......@@ -132,7 +132,7 @@
echo "<td>";
if(isset($a[$i])) {
if(is_array($a[$i])){
echo implode(",",$a["especeCible"]);
echo implode(",",$a[$i]);
} else {
if($i == "site") {
echo "<a href='".$a[$i]."'>".$a[$i]."</a>";
......
......@@ -41,10 +41,10 @@ $initAnswerFiles=Document::getListDocumentsWhere(array(
<?php } ?>
<div class="col-xs-12 fine-uploader-manual-trigger no-padding" id="<?php echo $domUploader; ?>" data-type="" data-id=""></div>
<?php if(isset($uploaderObj["docType"]) && $uploaderObj["docType"]=="image"){ ?>
<script type="text/template" id="qq-template-gallery">
<script type="text/template" id="qq-template-gallery<?php echo $domUploader ?>">
<?php }else{ ?>
<script type="text/template" id="qq-template-manual-trigger">
<?php } ?>
<script type="text/template" id="qq-template-manual-trigger<?php echo $domUploader ?>">
<?php } ?>
<div class="qq-uploader-selector qq-uploader qq-upload-drop-area-active<?php if(isset($fieldObj["docType"]) && $fieldObj["docType"]=="image"){ echo " qq-gallery"; } ?>" qq-drop-area-text="drop files" style="<?php if(!isset($uploaderObj["paste"]) || $uploaderObj["paste"]){ ?>border-radius:0px 0px 10px 10px;<?php } ?>">
<div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container">
......@@ -151,6 +151,7 @@ $initAnswerFiles=Document::getListDocumentsWhere(array(
<!---->
</div>
<?php } ?>
</div>
<?php if($mode != "pdf"){ ?>
<script type="text/javascript">
//var domUploader="<?php echo $domUploader ?>";
......@@ -160,7 +161,7 @@ $initAnswerFiles=Document::getListDocumentsWhere(array(
jQuery(document).ready(function() {
$("#"+uploadAnswerObj.dom).off();
$("#"+uploadAnswerObj.dom).fineUploader({
template: ((uploadAnswerObj.docType=="image") ? 'qq-template-gallery' : 'qq-template-manual-trigger'),
template: ((uploadAnswerObj.docType=="image") ? 'qq-template-gallery'+uploadAnswerObj.dom : 'qq-template-manual-trigger'+uploadAnswerObj.dom),
paste: {
defaultName: 'pasted_image',
//promptForName:true,
......@@ -331,12 +332,15 @@ $initAnswerFiles=Document::getListDocumentsWhere(array(
idUploader=$(this).data("dom-uploader");
listObject=$("#"+idUploader).fineUploader('getUploads');
goToUpload=false;
alert(idUploader);
mylog.log(listObject);
if(listObject.length > 0){
$.each(listObject, function(e,v){
if(v.status == "submitted")
goToUpload=true;
});
}
alert(goToUpload);
if( goToUpload ){
insideCallBMulti=true;
$("#"+idUploader).fineUploader('uploadStoredFiles');
......
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