Commit 48b19c1c authored by Raph El's avatar Raph El
Browse files

Form : edit by admin

parent 341ed31b
......@@ -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 ;
}
......
......@@ -68,9 +68,18 @@ var oform = {
// subLabel : "Vous remplirez les question de chaques étapes par la suite",
// values : []
// },
image : dyFInputs.image(),
id : { 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"}
},
......@@ -82,20 +91,23 @@ 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]);
});
// $.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]);
// });
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