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
37c91bcc
Commit
37c91bcc
authored
Apr 06, 2020
by
Tibor Katelbach
Browse files
Merge remote-tracking branch 'origin/development' into development
parents
72ae2f8e
178b7c23
Changes
4
Hide whitespace changes
Inline
Side-by-side
controllers/answer/IndexAction.php
View file @
37c91bcc
...
...
@@ -31,7 +31,7 @@ class IndexAction extends CAction
//Rest::json($params); exit;
$params
[
"answer"
]
=
$answer
;
// TODO améliorer getdataForAnser pour soit viré la création de lanswers soit charger la bonne answer
//Rest::json($params); exit;
$form
=
PHDB
::
findOne
(
Form
::
COLLECTION
,
array
(
"id"
=>
$_GET
[
"form"
]));
$parentForm
=
Slug
::
getElementBySlug
(
$form
[
"id"
]);
...
...
models/Answer.php
View file @
37c91bcc
...
...
@@ -46,5 +46,24 @@ class Answer{
}
public
static
function
csv
(
$elements
,
$idElt
,
$valElt
,
$forms
){
$elements
[
$idElt
][
"id"
]
=
$idElt
;
$elements
[
$idElt
][
"user"
]
=
$valElt
[
"user"
];
$elements
[
$idElt
][
"created"
]
=
$valElt
[
"created"
];
if
(
!
empty
(
$valElt
[
"answers"
])){
foreach
(
$forms
as
$keyF
=>
$valF
)
{
if
(
!
empty
(
$valF
[
"id"
])
&&
!
empty
(
$valElt
[
"answers"
][
$valF
[
"id"
]])){
foreach
(
$valElt
[
"answers"
][
$valF
[
"id"
]]
as
$keyAns
=>
$valAns
)
{
if
(
!
empty
(
$valF
[
"inputs"
])
&&
!
empty
(
$valF
[
"inputs"
][
$keyAns
])
&&
!
empty
(
$valF
[
"inputs"
][
$keyAns
][
"label"
])){
$elements
[
$idElt
][
$valF
[
"inputs"
][
$keyAns
][
"label"
]]
=
$valAns
;
}
}
}
}
}
return
$elements
;
}
}
?>
\ No newline at end of file
models/Form.php
View file @
37c91bcc
...
...
@@ -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
;
}
...
...
views/tpls/forms/oforms.php
View file @
37c91bcc
...
...
@@ -73,6 +73,15 @@ var oform = {
image
:
dyFInputs
.
image
(),
formid
:
{
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
"
}
},
...
...
@@ -84,23 +93,16 @@ 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
]);
});
tplCtx
.
value
.
id
=
tplCtx
.
value
.
formid
;
delete
tplCtx
.
value
.
formid
;
tplCtx
.
value
.
id
=
tplCtx
.
value
.
formid
;
mylog
.
log
(
"
save tplCtx
"
,
tplCtx
);
if
(
typeof
tplCtx
.
value
==
"
undefined
"
)
...
...
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