Commit 37c91bcc authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

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

parents 72ae2f8e 178b7c23
......@@ -31,7 +31,7 @@ class IndexAction extends CAction
//Rest::json($params); exit;
$params["answer"] = $answer;
// TODO améliorer getdataForAnser pour soit viré la création de lanswers soit charger la bonne answer
//Rest::json($params); exit;
$form = PHDB::findOne( Form::COLLECTION , array("id"=>$_GET["form"]));
$parentForm = Slug::getElementBySlug($form["id"]);
......
......@@ -46,5 +46,24 @@ class Answer{
}
public static function csv($elements, $idElt, $valElt, $forms ){
$elements[$idElt]["id"] = $idElt;
$elements[$idElt]["user"] = $valElt["user"];
$elements[$idElt]["created"] = $valElt["created"];
if(!empty($valElt["answers"])){
foreach ($forms as $keyF => $valF) {
if(!empty($valF["id"]) && !empty($valElt["answers"][$valF["id"]])){
foreach ($valElt["answers"][$valF["id"]] as $keyAns => $valAns) {
if(!empty($valF["inputs"]) && !empty($valF["inputs"][$keyAns]) && !empty($valF["inputs"][$keyAns]["label"])){
$elements[$idElt][$valF["inputs"][$keyAns]["label"]] = $valAns;
}
}
}
}
}
return $elements;
}
}
?>
\ No newline at end of file
......@@ -457,7 +457,8 @@ class Form {
} else if(Authorisation::isInterfaceAdmin()){
$res = true;
}
} else if (Authorisation::isParentAdmin($id, Form::COLLECTION , Yii::app()->session["userId"], $form) )
$res = true;
return $res ;
}
......
......@@ -73,6 +73,15 @@ var oform = {
image : dyFInputs.image(),
formid : { inputType : "hidden",value:"<?php echo $el["slug"].count($forms) ?>"},
parentSlug : { inputType : "hidden",value:"<?php echo $el["slug"] ?>"},
parent : {
inputType : "finder",
label : tradDynForm.whoiscarrytheproject,
multiple : true,
rules : { required : true, lengthMin:[1, "parent"]},
initType: ["organizations", "projects"],
openSearch :true
},
image : dyFInputs.image(),
tpl : { inputType : "hidden",value:"survey.views.tpls.forms.formWizard"},
answersTpl : { inputType : "hidden",value:"survey.views.tpls.forms.answers"}
},
......@@ -84,23 +93,16 @@ var oform = {
afterSave : function(){
dyFObj.commonAfterSave();
},
save : function () {
save : function (formData) {
mylog.log('save tplCtx formData', formData)
delete formData.collection ;
tplCtx = {
collection : "forms",
value : {}
value : formData
};
$.each( oform.jsonSchema.properties , function(k,val) {
if(val.inputType == "properties")
tplCtx.value[k] = getPairsObj('.'+k+val.inputType);
else if(val.inputType == "array")
tplCtx.value[k] = getArray('.'+k+val.inputType);
else
tplCtx.value[k] = $("#"+k).val();
mylog.log("value",'.'+k+val.inputType,tplCtx.value[k]);
});
tplCtx.value.id = tplCtx.value.formid;
delete tplCtx.value.formid;
tplCtx.value.id = tplCtx.value.formid;
mylog.log("save tplCtx",tplCtx);
if(typeof tplCtx.value == "undefined")
......
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