Commit 627110c6 authored by Anatole Rakotoson's avatar Anatole Rakotoson
Browse files

correction mulicheckbox multitext multiradio

parent ece0dec8
......@@ -109,7 +109,7 @@
$value = (!empty($answers)) ? " value='".$answers."' " : "";
$inpClass = " saveOneByOne";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
......@@ -130,12 +130,12 @@ $paramsData = [
];
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]) ) {
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"]) ) {
$paramsData["list"] = Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"];
if( isset($parentForm["params"][$kunik]) ) {
if( isset($parentForm["params"][$kunik]["global"]["list"]) ) {
$paramsData["list"] = $parentForm["params"][$kunik]["global"]["list"];
foreach ($paramsData["list"] as $k => $v) {
if(isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["tofill"][$v]) ){
$paramsData["tofill"] += array($v => Yii::app()->session["costum"]["form"]["params"][$kunik]["tofill"][$v]);
if(isset($parentForm["params"][$kunik]["tofill"][$v]) ){
$paramsData["tofill"] += array($v => $parentForm["params"][$kunik]["tofill"][$v]);
} else {
$paramsData["tofill"] += [$v => "simple"];
}
......@@ -145,12 +145,12 @@ if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]) ) {
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]) ) {
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"]) ) {
//$paramsData["list"] = Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"];
if( isset($parentForm["params"][$kunik]) ) {
if( isset($parentForm["params"][$kunik]["global"]["list"]) ) {
//$paramsData["list"] = $parentForm["params"][$kunik]["global"]["list"];
foreach ($paramsData["list"] as $k => $v) {
if(isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["placeholdersckb"][$v]) ){
$paramsData["placeholdersckb"] += array($v => Yii::app()->session["costum"]["form"]["params"][$kunik]["placeholdersckb"][$v]);
if(isset($parentForm["params"][$kunik]["placeholdersckb"][$v]) ){
$paramsData["placeholdersckb"] += array($v => $parentForm["params"][$kunik]["placeholdersckb"][$v]);
} else {
$paramsData["placeholdersckb"] += [$v => ""];
}
......@@ -175,7 +175,7 @@ if($mode == "r")
<?php
if( !isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]['list']) )
if( !isset($parentForm["params"][$kunik]["global"]['list']) )
{
echo "<br/><span class='text-red text-center'><i class='fa fa-warning fa-2x'></i> THIS FIELD HAS TO BE CONFIGURED FIRST </span>";
} else
......@@ -187,7 +187,7 @@ if($mode == "r")
<tr class=""><th >
<div class="col-md-12">
<?php
foreach (Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"] as $ix => $lbl)
foreach ($parentForm["params"][$kunik]["global"]["list"] as $ix => $lbl)
{
$ckd = "";
$place = "";
......@@ -201,7 +201,7 @@ if($mode == "r")
?>
<!-- <tr class="thckd"><theih > -->
<div class="col-md-<?php echo (isset(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'])) ? Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 70px;">
<div class="col-md-<?php echo (isset($parentForm["params"][$kunik]['global']['width'])) ? $parentForm["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 50px;">
<div class="">
<label for="<?php echo $kunik.$ix ?>" class="responsemulticheckboxplus">
......@@ -235,11 +235,11 @@ if($mode == "r")
<?php
if($canEdit)
if($canEditForm)
{
echo " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtn editone".$kunik."Params".$ix." '><i class='fa fa-cog'></i> </a>";
echo " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtn editone".$kunik."Params".$ix." '><i class='fa fa-cog'></i> </a>";
......@@ -251,7 +251,7 @@ if($mode == "r")
{
if($value == "cplx")
{
echo " <a alt='placeholder' href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtnP editonep".$kunik."Params".$ix." '><i class='fa fa-pencil'></i> </a>";
echo " <a alt='placeholder' href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtnP editonep".$kunik."Params".$ix." '><i class='fa fa-pencil'></i> </a>";
}
}
}
......@@ -298,7 +298,7 @@ if($mode == "r")
<?php
if( !isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]['list']) )
if( !isset($parentForm["params"][$kunik]["global"]['list']) )
{
echo "<br/><span class='text-red text-center'><i class='fa fa-warning fa-2x'></i> THIS FIELD HAS TO BE CONFIGURED FIRST ".$editParamsBtn."</span>";
} else
......@@ -310,7 +310,7 @@ if($mode == "r")
<tr class=""><th >
<div class="col-md-12">
<?php
foreach (Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"] as $ix => $lbl)
foreach ($parentForm["params"][$kunik]["global"]["list"] as $ix => $lbl)
{
$ckd = "";
$place = "";
......@@ -324,7 +324,7 @@ if($mode == "r")
?>
<!-- <tr class="thckd"><theih > -->
<div class="col-md-<?php echo (isset(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'])) ? Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 70px;">
<div class="col-md-<?php echo (isset($parentForm["params"][$kunik]['global']['width'])) ? $parentForm["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 50px;">
<div class="thckd">
<input data-id="<?php echo $kunik ?>" class=" ckbCo " id="<?php echo $kunik.$ix ?>" data-form='<?php echo $form["id"] ?>' <?php echo $ckd?> type="checkbox" name="<?php echo $kunik ?>" data-type="<?php
......@@ -378,11 +378,11 @@ if($mode == "r")
<?php
if($canEdit)
if($canEditForm)
{
echo " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtn editone".$kunik."Params".$ix." '><i class='fa fa-cog'></i> </a>";
echo " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtn editone".$kunik."Params".$ix." '><i class='fa fa-cog'></i> </a>";
......@@ -394,7 +394,7 @@ if($mode == "r")
{
if($value == "cplx")
{
echo " <a alt='placeholder' href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtnP editonep".$kunik."Params".$ix." '><i class='fa fa-pencil'></i> </a>";
echo " <a alt='placeholder' href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtnP editonep".$kunik."Params".$ix." '><i class='fa fa-pencil'></i> </a>";
}
}
}
......@@ -501,7 +501,7 @@ jQuery(document).ready(function() {
inputType : "select",
label : "Nombre d'element par ligne",
options : sectionDyf.<?php echo $kunik ?>ParamsData.width,
value : "<?php echo (isset(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width']) and Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'] != "") ? $paramsData["width"][strval(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'])] : ''; ?>"
value : "<?php echo (isset($parentForm["params"][$kunik]['global']['width']) and $parentForm["params"][$kunik]['global']['width'] != "") ? $paramsData["width"][strval($parentForm["params"][$kunik]['global']['width'])] : ''; ?>"
}
},
save : function () {
......
......@@ -97,7 +97,7 @@
$value = (!empty($answers)) ? " value='".$answers."' " : "";
$inpClass = " saveOneByOne";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$kunik."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
......@@ -116,13 +116,12 @@ $paramsData = [
]
];
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]) ) {
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"]) ) {
$paramsData["list"] = Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"];
if( isset($parentForm["params"][$kunik]) ) {
if( isset($parentForm["params"][$kunik]["global"]["list"]) ) {
$paramsData["list"] = $parentForm["params"][$kunik]["global"]["list"];
foreach ($paramsData["list"] as $k => $v) {
if(isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["tofill"][$v]) ){
$paramsData["tofill"] += array($v => Yii::app()->session["costum"]["form"]["params"][$kunik]["tofill"][$v]);
if(isset($parentForm["params"][$kunik]["tofill"][$v]) ){
$paramsData["tofill"] += array($v => $parentForm["params"][$kunik]["tofill"][$v]);
} else {
$paramsData["tofill"] += [$v => "simple"];
}
......@@ -132,12 +131,12 @@ if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]) ) {
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]) ) {
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"]) ) {
//$paramsData["list"] = Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"];
if( isset($parentForm["params"][$kunik]) ) {
if( isset($parentForm["params"][$kunik]["global"]["list"]) ) {
//$paramsData["list"] = $parentForm["params"][$kunik]["global"]["list"];
foreach ($paramsData["list"] as $k => $v) {
if(isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["placeholdersradio"][$v]) ){
$paramsData["placeholdersradio"] += array($v => Yii::app()->session["costum"]["form"]["params"][$kunik]["placeholdersradio"][$v]);
if(isset($parentForm["params"][$kunik]["placeholdersradio"][$v]) ){
$paramsData["placeholdersradio"] += array($v => $parentForm["params"][$kunik]["placeholdersradio"][$v]);
} else {
$paramsData["placeholdersradio"] += [$v => ""];
}
......@@ -157,7 +156,7 @@ if($mode == "r")
<?php
if( !isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"]) )
if( !isset($parentForm["params"][$kunik]["global"]["list"]) )
{
echo "<br/><span class='text-red text-center'><i class='fa fa-warning fa-2x'></i> THIS FIELD HAS TO BE CONFIGURED FIRST </span>";
} else
......@@ -169,7 +168,7 @@ if($mode == "r")
<tr class=""><th >
<div class="col-md-12">
<?php
foreach (Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"] as $ix => $lbl)
foreach ($parentForm["params"][$kunik]["global"]["list"] as $ix => $lbl)
{
if(isset($answer["answers"][$form["id"]][$kunik]["value"]) && $answer["answers"][$form["id"]][$kunik]["value"] == $lbl)
......@@ -177,7 +176,7 @@ if($mode == "r")
?>
<!-- <tr class="thradio"><theih > -->
<div class="col-md-<?php echo (isset(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'])) ? Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 70px;">
<div class="col-md-<?php echo (isset($parentForm["params"][$kunik]['global']['width'])) ? $parentForm["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 50px;">
<div class="">
<label for="<?php echo $kunik.$ix ?>" class="responsemultiradio">
......@@ -247,7 +246,7 @@ if($mode == "r")
<?php
if( !isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"]) )
if( !isset($parentForm["params"][$kunik]["global"]["list"]) )
{
echo "<br/><span class='text-red text-center'><i class='fa fa-warning fa-2x'></i> THIS FIELD HAS TO BE CONFIGURED FIRST ".$editParamsBtn."</span>";
} else
......@@ -259,7 +258,7 @@ if($mode == "r")
<tr class=""><th >
<div class="col-md-12">
<?php
foreach (Yii::app()->session["costum"]["form"]["params"][$kunik]["global"]["list"] as $ix => $lbl)
foreach ($parentForm["params"][$kunik]["global"]["list"] as $ix => $lbl)
{
$ckd = "";
if(isset($answer["answers"][$form["id"]][$kunik]["value"]) && $answer["answers"][$form["id"]][$kunik]["value"] == $lbl)
......@@ -269,7 +268,7 @@ if($mode == "r")
?>
<!-- <tr class="thradio"><theih > -->
<div class="col-md-<?php echo (isset(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'])) ? Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 70px;">
<div class="col-md-<?php echo (isset($parentForm["params"][$kunik]['global']['width'])) ? $parentForm["params"][$kunik]['global']['width'] : '12'; ?> col-xs-12 col-sm-12" style="min-height: 50px;">
<div class="thradio">
<input data-id="<?php echo $kunik ?>" class=" radioCo " id="<?php echo $kunik.$ix ?>" data-form='<?php echo $form["id"] ?>' <?php echo $ckd?> type="radio" name="<?php echo $kunik ?>" data-type="<?php
......@@ -322,11 +321,11 @@ if($mode == "r")
<?php
if($canEdit)
if($canEditForm)
{
echo " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtn editone".$kunik."Params".$ix." '><i class='fa fa-cog'></i> </a>";
echo " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl paramsonebtn editone".$kunik."Params".$ix." '><i class='fa fa-cog'></i> </a>";
......@@ -338,7 +337,7 @@ if($mode == "r")
{
if($value == "cplx")
{
echo " <a alt='placeholder' href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtnP editonep".$kunik."Params".$ix." '><i class='fa fa-pencil'></i> </a>";
echo " <a alt='placeholder' href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl paramsonebtnP editonep".$kunik."Params".$ix." '><i class='fa fa-pencil'></i> </a>";
}
}
}
......@@ -413,7 +412,7 @@ jQuery(document).ready(function() {
answer.id = "<?php echo $answer["_id"]; ?>";
answer.value = {"value" : $(this).data("imp"), "type" : "cplx", "textsup" : $(this).val()};
dataHelper.path2Value(answer , function(params) {
toastr.success('saved');
//toastr.success('saved');
} );
}
})
......@@ -433,7 +432,7 @@ jQuery(document).ready(function() {
inputType : "select",
label : "Nombre d'element par ligne",
options : sectionDyf.<?php echo $kunik ?>ParamsData.width,
value : "<?php echo (isset(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width']) and Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'] != "") ? $paramsData["width"][strval(Yii::app()->session["costum"]["form"]["params"][$kunik]['global']['width'])] : ''; ?>"
value : "<?php echo (isset($parentForm["params"][$kunik]['global']['width']) and $parentForm["params"][$kunik]['global']['width'] != "") ? $paramsData["width"][strval($parentForm["params"][$kunik]['global']['width'])] : ''; ?>"
}
},
save : function () {
......
......@@ -150,6 +150,13 @@
right: 5px;
}
.responsemultitext:before{
content: '\f0a9';
margin-right: 15px;
font-family: FontAwesome;
color: #d9534f;
}
</style>
<?php
......@@ -170,10 +177,19 @@ if($saveOneByOne)
$inpClass .= " saveOneByOne";
if($mode == "r"){ ?>
<div class="col-xs-12" id="<?php echo $kunik ?>">
<label for="<?php echo $kunik ?>"><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label ?></h4></label>
<?php echo ((!empty($answer["answers"][$form["id"]][$kunik])) ? $answer["answers"][$form["id"]][$kunik] : "") ; ?>
</div>
<div class="input-grp " style="position: relative; padding-top: 50px; text-transform: unset;">
<label for="<?php echo $key ?>"><h4 style="text-transform: unset; color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn ?></h4></label>
<div>
<?php if(!empty($answer["answers"][$form["id"]][$kunik])) {?>
<label class="responsemultitext">
<?php echo ((!empty($answer["answers"][$form["id"]][$kunik])) ? $answer["answers"][$form["id"]][$kunik] : "") ;
?>
</label>
<?php } ?>
</div>
</div>
<?php
}else{
?>
......@@ -183,8 +199,8 @@ if($mode == "r"){ ?>
<div class="multiinput" data-validate="Valid email is required: ex@abc.xyz">
<input <?php echo $value ?> data-id="<?php echo $kunik ?>" data-form='<?php echo $form["id"] ?>' class="effect-2 validate-input" placeholder="<?php echo (isset($placeholder)) ? $placeholder : '' ?>" type="<?php
if( isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["validation"]) ) {
echo Yii::app()->session["costum"]["form"]["params"][$kunik]["validation"];
if( isset($parentForm["params"][$kunik]["validation"]) ) {
echo $parentForm["params"][$kunik]["validation"];
}else{
echo "text";
}
......@@ -193,10 +209,10 @@ if($mode == "r"){ ?>
<span class="focus-border"></span>
<?php
if($canEdit){
if($canEditForm){
echo " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".Yii::app()->session["costum"]["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtn edit".$kunik."ParamsMt '><i class='fa fa-cog' style='padding: 4px;'></i> </a>";
echo " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='costum.form.params.".$kunik."' class='previewTpl paramsonebtn edit".$kunik."ParamsMt '><i class='fa fa-cog' style='padding: 4px;'></i> </a>";
}
?>
......@@ -222,7 +238,7 @@ if($mode == "r"){ ?>
inputType : "select",
label : "type de l'input",
options : sectionDyf.<?php echo $kunik ?>ParamsData.validation,
values : "<?php echo (isset(Yii::app()->session["costum"]["form"]["params"][$kunik]["validation"])) ? Yii::app()->session["costum"]["form"]["params"][$kunik]["validation"] : ''; ?>"
values : "<?php echo (isset($parentForm["params"][$kunik]["validation"])) ? $parentForm["params"][$kunik]["validation"] : ''; ?>"
}
},
save : function () {
......
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