Commit cdb967e2 authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

refactor path to save

parent ad39b0cb
......@@ -5,7 +5,7 @@ if($canEditForm === true){
$subFormIds = array_merge( $subFormIds, $form["subForms"] );
?>
<div class="col-xs-12 padding-10 text-center" style="background-color: #eee">
<h4>Admin Form</h4>
<h4>Admin Form : <?php echo $form["name"] ?></h4>
<a href='javascript:;' data-id='<?php echo (String)$form["_id"]; ?>' class="configBtn btn btn-danger bold"><i class='fa fa-cogs'></i> CONFIG </a>
<a href='javascript:;' data-id='<?php echo (String)$form["_id"]; ?>' class='addStepBtn btn btn-danger bold'> <i class='fa fa-plus'></i> Ajouter une étape </a>
</div>
......@@ -129,6 +129,7 @@ var addStepParams = {
properties : {
name : {
label : "Nommé cette étape de votre questionnaire",
value : ""
}
},
save : function (formData) {
......
......@@ -2,7 +2,7 @@
$debug = false;
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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>" : "";
$paramsData = [
"group" => [
......
......@@ -34,7 +34,7 @@
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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>" : "";
?>
<thead>
<tr>
......
......@@ -28,7 +28,7 @@
$editBtnL = "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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 = ($canEdit) ? " <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>" : "";
$paramsData = [
......@@ -295,12 +295,12 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<script type="text/javascript">
if(typeof costum != "undefined" && costum != null && typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum != "undefined" && costum != null && typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
//costum.lists.financerTypeList = <?php //echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.workerList = <?php echo json_encode($orgs); ?>;
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
dyFObj.elementObjParams.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
//dyFObj.elementObjParams.financerTypeList = <?php //echo json_encode(Ctenat::$financerTypeList); ?>;
dyFObj.elementObjParams.workerList = <?php echo json_encode($orgs); ?>;
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answer["answers"][$copy])) ? $answer["answers"][$copy] : null ); ?>;
......@@ -349,7 +349,7 @@ $(document).ready(function() {
budgetCopy : {
label : "Input Bugdet",
inputType : "select",
options : costum.lists.budgetInputList
options : dyFObj.elementObjParams.budgetInputList
}
},
save : function () {
......
......@@ -8,7 +8,7 @@
<?php
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$kunik.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "nature" => [
"investissement" => "Investissement",
......
......@@ -57,7 +57,7 @@
? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$kunik.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter un élément </a>"
: "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$kunik."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$kunik."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
?>
<thead>
<tr>
......
......@@ -7,7 +7,7 @@
$editBtnL = (Yii::app()->session["userId"] == $answer["user"] && isset($parentForm["params"][$keyTpl.$key]) ) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$keyTpl.$key.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter un élément </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$keyTpl.$key."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$keyTpl.$key."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "type" => [
Organization::COLLECTION => "Organization",
......
......@@ -6,7 +6,7 @@
<?php
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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 = ($canEdit) ? " <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>" : "";
$communityLinks = array();
if(!empty($form["parent"])){
......@@ -215,10 +215,10 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
costum.lists.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.financersList = <?php echo json_encode($orgs); ?>;
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
dyFObj.elementObjParams.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
dyFObj.elementObjParams.financersList = <?php echo json_encode($orgs); ?>;
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answer["answers"][$kunik])) ? $answer["answers"][$kunik] : null ); ?>;
sectionDyf.<?php echo $kunik ?>ParamsData = <?php echo json_encode( $paramsData ); ?>;
......
......@@ -27,7 +27,7 @@ if($wizard){
$editBtnL = "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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>" : "";
......@@ -201,12 +201,13 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<?php if($mode != "pdf"){ ?>
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
costum.lists.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.financersList = <?php echo json_encode($orgs); ?>;
if(typeof dyFObj.elementObjParams.lists == "undefined")
dyFObj.elementObjParams = {};
dyFObj.elementObjParams.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
dyFObj.elementObjParams.financerTypeList = <?php echo json_encode(Ctenat::$financerTypeList); ?>;
dyFObj.elementObjParams.financersList = <?php echo json_encode($orgs); ?>;
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answer["answers"][$budgetKey])) ? $answer["answers"][$budgetKey] : null ); ?>;
......@@ -260,7 +261,7 @@ $(document).ready(function() {
budgetCopy : {
label : "Input Bugdet",
inputType : "select",
options : costum.lists.budgetInputList
options : dyFObj.elementObjParams.budgetInputList
},
openFinancing : {
inputType : "checkboxSimple",
......
......@@ -8,7 +8,7 @@
<?php
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='answers.".$kunik.".' class='add".$keyTpl." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$parentForm["_id"]."' data-collection='".Form::COLLECTION."' data-path='params.".$keyTpl."' class='previewTpl edit".$keyTpl."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
$paramsData = [ "titles" => [ "Indicateur",
"Objectif / Réalisé",
......@@ -119,9 +119,10 @@ $properties = [
</div>
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
costum.lists.indicateurs = <?php echo json_encode($indicateurs); ?>;
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
cdyFObj.elementObjParams.indicateurs = <?php echo json_encode($indicateurs); ?>;
var <?php echo $keyTpl ?>Data = <?php echo json_encode( (isset($answer["answers"][$kunik])) ? $answer["answers"][$kunik] : null ); ?>;
sectionDyf.<?php echo $keyTpl ?>ParamsData = <?php echo json_encode( $paramsData ); ?>;
......
......@@ -3,7 +3,7 @@
if($saveOneByOne)
$inpClass = " saveOneByOne";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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 = ($canEdit) ? " <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>" : "";
$paramsData = [ "list" => [ ] ];
......
......@@ -6,7 +6,7 @@
$editBtnL = (Yii::app()->session["userId"] == $answer["user"]) ? " <a href='javascript:;' data-id='".$answer["_id"]."' data-collection='".Form::ANSWER_COLLECTION."' data-path='".$answerPath."' class='add".$kunik." btn btn-default'><i class='fa fa-plus'></i> Ajouter une ligne </a>" : "";
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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 = ($canEdit) ? " <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>" : "";
$paramsData = [ "listQuestion" => [ "acquis" => "Acquis",
"discussion" => "En discussion",
......
......@@ -9,7 +9,7 @@ $paramsData = [ "options" => [ ] ];
if( isset($parentForm["params"][$key]) )
$paramsData = $parentForm["params"][$key];
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$key."' class='previewTpl edit".$key."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.".$key."' class='previewTpl edit".$key."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
?>
<div class="form-group">
......
......@@ -4,7 +4,7 @@ if( $mode != "pdf" ){
{
if( isset($form['id']) )
{
$editParamsBtn = ($canEdit) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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 = ($canEdit) ? " <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>" : "";
$paramsData = [
"limitRoles" =>["Financeur"]
......
......@@ -49,7 +49,7 @@ if($answer){
$editBtnL = "";
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->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>" : "";
$paramsData = [
......@@ -319,13 +319,11 @@ if( isset($parentForm["params"]["financement"]["tpl"])){
?>
<script type="text/javascript">
if(typeof costum.lists == "undefined")
costum.lists = {};
if(typeof costum.lists == "undefined")
costum.lists.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
if(typeof dyFObj.elementObjParams == "undefined")
dyFObj.elementObjParams = {};
//costum.lists.financerTypeList = <?php //echo json_encode(Ctenat::$financerTypeList); ?>;
costum.lists.workerList = <?php echo json_encode($orgs); ?>;
dyFObj.elementObjParams.budgetInputList = <?php echo json_encode( Yii::app()->session["budgetInputList"] ); ?>;
dyFObj.elementObjParams.workerList = <?php echo json_encode($orgs); ?>;
var <?php echo $kunik ?>Data = <?php echo json_encode( (isset($answer["answers"][$copy])) ? $answer["answers"][$copy] : null ); ?>;
......@@ -381,7 +379,7 @@ $(document).ready(function() {
budgetCopy : {
label : "Input Bugdet",
inputType : "select",
options : costum.lists.budgetInputList
options : dyFObj.elementObjParams.budgetInputList
}
},
save : function () {
......
......@@ -18,7 +18,9 @@ if( !isset($parentForm["startDate"]) ||
if($showForm)
{
$params =[ "formId" => $formId,
$params =[
"parentForm"=>$parentForm,
"formId" => $formId,
"form" => $form,
"answer" => $answer,
"mode" => $mode,
......
......@@ -101,6 +101,7 @@ if( isset( $form["inputs"] ) ){ ?>
"titleColor"=> (isset($this->costum["colors"]["pink"])) ? $this->costum["colors"]["pink"] : "#16A9B1",
"info" => isset($input["info"]) ? $input["info"] : "" ,
"placeholder" => isset($input["placeholder"]) ? $input["placeholder"] : "" ,
"parentForm" => $parentForm,
"form" => $form,
"key" => $key,
"kunik" => $kunik,
......
......@@ -19,7 +19,7 @@ if($mode == "r" || $mode == "pdf"){ ?>
<?php
}else{
$editParamsBtn = ($canEditForm) ? " <a href='javascript:;' data-id='".$el["_id"]."' data-collection='".$this->costum["contextType"]."' data-path='costum.form.params.".$key."' class='previewTpl edit".$key."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.".$key."' class='previewTpl edit".$key."Params btn btn-xs btn-danger'><i class='fa fa-cog'></i> </a>" : "";
?>
<div class="form-group">
......
......@@ -126,7 +126,8 @@ if( isset($parentForm["subForms"]) && count($parentForm["subForms"]) > 1 ) {
//echo "<div class='markdown'>";
echo "<div class=''>";
echo $this->renderPartial("survey.views.tpls.forms.formSection",
[ "formId" => $v,
[ "parentForm"=>$parentForm,
"formId" => $v,
"form" => $forms[$v],
"wizard" => true,
"answer"=>$answer,
......@@ -162,7 +163,9 @@ if( isset($parentForm["subForms"]) && count($parentForm["subForms"]) > 1 ) {
//echo "<div class='markdown'>";
echo "<div class=''>";
echo $this->renderPartial("survey.views.tpls.forms.formSection",
[ "formId" => $parentForm["subForms"][0],
[
"parentForm"=>$parentForm,
"formId" => $parentForm["subForms"][0],
"form" => $forms[$parentForm["subForms"][0]],
"wizard" => true,
"answer"=>$answer,
......
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