Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pixel Humain
survey
Commits
65ec750d
Commit
65ec750d
authored
Apr 08, 2020
by
Tibor Katelbach
Browse files
subForms and active
parent
7e89cc6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
models/Form.php
View file @
65ec750d
...
...
@@ -667,17 +667,19 @@ class Form {
{
$f
=
PHDB
::
findOne
(
Form
::
COLLECTION
,
[
"id"
=>
$formId
]);
$allforms
[
$formId
]
=
$f
;
foreach
(
$f
[
"inputs"
]
as
$key
=>
$inp
)
{
if
(
in_array
(
$inp
[
"type"
],
[
"tpls.forms.cplx.budget"
]
)
)
$budgetInputList
[
$formId
.
"."
.
$key
]
=
$formId
.
"."
.
$key
;
if
(
in_array
(
$inp
[
"type"
],
[
"tpls.forms.cplx.tpls.forms.cplx.financementFromBudget"
,
"tpls.forms.cplx.tpls.forms.cplx.suiviFromBudget"
,
"tpls.forms.cplx.tpls.forms.cplx.decideFromBudget"
]
)
)
$stockBudgetInputs
=
true
;
}
if
(
isset
(
$f
[
"inputs"
])){
foreach
(
$f
[
"inputs"
]
as
$key
=>
$inp
)
{
if
(
in_array
(
$inp
[
"type"
],
[
"tpls.forms.cplx.budget"
]
)
)
$budgetInputList
[
$formId
.
"."
.
$key
]
=
$formId
.
"."
.
$key
;
if
(
in_array
(
$inp
[
"type"
],
[
"tpls.forms.cplx.tpls.forms.cplx.financementFromBudget"
,
"tpls.forms.cplx.tpls.forms.cplx.suiviFromBudget"
,
"tpls.forms.cplx.tpls.forms.cplx.decideFromBudget"
]
)
)
$stockBudgetInputs
=
true
;
}
}
}
}
...
...
views/tpls/forms/oforms.php
View file @
65ec750d
...
...
@@ -6,7 +6,10 @@
<?php
$ct
=
0
;
$subFormIds
=
[];
foreach
(
$forms
as
$fix
=>
$f
)
{
if
(
isset
(
$f
[
"ids"
]))
$subFormIds
=
array_merge
(
$subFormIds
,
$f
[
"ids"
]
);
if
(
$ct
==
0
)
echo
'<div class="row ">'
;
?>
...
...
@@ -17,6 +20,11 @@ foreach ($forms as $fix => $f) {
<span
class=
"col-xs-2"
>
<a
href=
"javascript:;"
class=
"editFormBtn"
data-id=
"
<?php
echo
$fix
?>
"
><i
class=
"fa fa-pencil text-dark"
></i></a>
<a
href=
"javascript:;"
class=
"deleteFormBtn"
data-id=
"
<?php
echo
$fix
?>
"
><i
class=
"fa fa-trash text-red"
></i></a>
</span></h4>
<?php
$activStr
=
"<span class='label label-danger'><i class='fa fa-thumbs-o-down'></i> Pas activé</span>"
;
if
(
isset
(
$f
[
'active'
])
&&
$f
[
'active'
]
==
true
)
$activStr
=
"<span class='label label-success'><i class='fa fa-thumbs-o-up'></i> Activé</span>"
;
;
?>
active :
<?php
echo
$activStr
?>
<br/>
steps :
<br/>
<?php
if
(
isset
(
$f
[
'ids'
])){
...
...
@@ -30,7 +38,7 @@ foreach ($forms as $fix => $f) {
<a
href=
'javascript:;'
data-id=
'
<?php
echo
$fix
?>
'
class=
"configBtn btn btn-xs btn-danger col-sm-4 col-sm-12 bold"
>
<i
class=
'fa fa-cogs'
></i>
CONFIG
</a>
<a
href=
'costum/co/index/slug/
<?php
echo
$el
[
"slug"
]
?>
/
form
/
<?php
echo
$fix
?>
#answer.id.new
'
class=
"btn btn-xs btn-primary col-sm-4 col-xs-12 bold"
>
<a
target=
'_blank'
href=
'costum/co/index/slug/
<?php
echo
$el
[
"slug"
]
?>
#answer.index.id.new.
form
.
<?php
echo
$fix
?>
'
class=
"btn btn-xs btn-primary col-sm-4 col-xs-12 bold"
>
<i
class=
'fa fa-file-text-o'
></i>
RÉPONDRE
</a>
</div>
...
...
@@ -42,11 +50,17 @@ foreach ($forms as $fix => $f) {
echo
"</div>"
;
$ct
=
0
;
}
}
?>
}
?>
<script
type=
"text/javascript"
>
var
tplCtx
=
{};
var
formsData
=
<?php
echo
(
!
empty
(
$forms
))
?
json_encode
(
$forms
)
:
"null"
;
?>
;
var
subForms
=
<?php
echo
json_encode
(
$subFormIds
)
?>
;
jQuery
(
document
).
ready
(
function
()
{
mylog
.
log
(
"
render
"
,
"
/modules/costum/views/tpls/forms/cplx/answers.php
"
);
...
...
@@ -154,6 +168,13 @@ var oformParams = {
description
:
"
lisez bien les options
"
,
icon
:
"
fa-question
"
,
properties
:
{
active
:
{
inputType
:
"
checkboxSimple
"
,
label
:
"
Activé (Ouvert aux Réponses)
"
,
subLabel
:
"
Activer pour partagé et ouvrir le questionnaire aux réponses.
"
,
params
:
{
onText
:
"
Oui
"
,
offText
:
"
Non
"
,
onLabel
:
"
Oui
"
,
offLabel
:
"
Non
"
,
labelText
:
"
Activé
"
},
checked
:
false
},
ids
:
{
inputType
:
"
array
"
,
label
:
"
Nommé chaque étape de votre questionnaire
"
,
...
...
@@ -222,17 +243,21 @@ var oformParams = {
tplCtx
.
value
[
k
]
=
getArray
(
'
.
'
+
k
+
val
.
inputType
);
if
(
k
==
"
ids
"
){
$
.
each
(
tplCtx
.
value
[
k
],
function
(
ix
,
fName
)
{
var
newFormId
=
"
<?php
echo
$el
[
"slug"
]
?>
"
+
slugify
(
fName
);
tplCtx
.
value
[
k
][
ix
]
=
newFormId
;
var
newForm
=
{
collection
:
"
forms
"
,
value
:
{
id
:
newFormId
,
name
:
fName
,
type
:
"
openForm
"
,
}
};
dataHelper
.
path2Value
(
newForm
,
function
()
{
}
);
if
(
!
$
.
inArray
(
fName
,
subForms
)
==
-
1
)
var
newFormId
=
"
<?php
echo
$el
[
"slug"
]
?>
"
+
subForms
.
length
;
tplCtx
.
value
[
k
][
ix
]
=
newFormId
;
var
newForm
=
{
collection
:
"
forms
"
,
value
:
{
id
:
newFormId
,
name
:
fName
,
type
:
"
openForm
"
,
inputs
:
{}
}
};
dataHelper
.
path2Value
(
newForm
,
function
()
{
}
);
countSubForms
++
;
}
})
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment