Commit c935217d authored by Raph El's avatar Raph El
Browse files

CressReunion : btn generate

parent 49c05b2f
......@@ -6,6 +6,6 @@ class ValidateAction extends CAction
$res = Answer::validate($_POST);
//Rest::json($_POST);
Rest::json($_POST);
}
}
\ No newline at end of file
......@@ -523,11 +523,12 @@
"position" : "4",
"generateElement" : {
"organizations" : {
"aressForm1.multitextvalidationaressForm110" : "name",
"aressForm1.multitextvalidationaressForm111" : "sigle",
"aressForm1.multitextvalidationaressForm112" : "siren",
"aressForm1.multitextvalidationaressForm110" : "name",
"aressForm1.multitextvalidationaressForm110" : "name",
"from" : "aressForm1.multitextvalidationaressForm110",
"to" : "name",
"from" : "aressForm1.multitextvalidationaressForm111",
"to" : "sigle",
"from" : "aressForm1.multitextvalidationaressForm112",
"to" : "siren"
}
}
}
......
......@@ -367,15 +367,47 @@ class Answer{
public static function validate($params){
$costum = CacheHelper::getCostum();
$set = array();
if(!empty($params["validated"]) && $params["validated"] === true)
$set["validated"] = true;
if(!empty($params["input"]["generateElement"])){
$mapping = array();
$import = array(
'file' => array(json_encode(array($params["answer"]))),
'nameFile' => "test",
'typeFile' => 'json',
"warnings" => "false"
);
foreach ($params["input"]["generateElement"] as $type => $map) {
$mapping = array();
foreach ($map as $k => $v) {
$mapping[] =array(
'idHeadCSV' => $v["from"],
'valueAttributeElt' => $v["to"]
);
}
$import['infoCreateData'] = $mapping;
$import['typeElement'] = $type;
$resImport = Import::previewData($import, true, true, true);
Rest::json($resImport); exit;
}
}
if(Costum::isSameFunction("answerValidate")){
$paramBeforeValidate = Costum::sameFunction("answerValidate", $params);
}
$set["validated"] = true;
PHDB::update(Answer::COLLECTION,
array( "_id" => new MongoId((string)$params["answerId"])),
array( '$set' => $set ) );
$res = array('result' => true, "msg" => "Valider");
if(!empty($set)){
PHDB::update(Answer::COLLECTION,
array( "_id" => new MongoId((string)$params["answerId"])),
array( '$set' => $set ) );
$res = array('result' => true, "msg" => "Valider");
}
return $res;
}
......
<?php
var_dump($input);
if($mode != "pdf"){
?>
<div class="">
......@@ -10,12 +10,14 @@ if($mode != "pdf"){
</div>
<script type="text/javascript">
var paramsInput = <?php echo json_encode($input); ?>;
jQuery(document).ready(function() {
mylog.log("render form input","/modules/costum/views/tpls/forms/cplx/validate.php");
$("#validation<?php echo $kunik ?>").click(function(){
var params = {
answerId : answerId,
answer : answerObj.answers
answer : answerObj.answers,
input : paramsInput
};
ajaxPost(
......
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