Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
survey
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pixel Humain
survey
Commits
2e68bb95
Commit
2e68bb95
authored
Jun 26, 2020
by
Raph El
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hotfix
parent
fff33c76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
models/Answer.php
models/Answer.php
+6
-4
No files found.
models/Answer.php
View file @
2e68bb95
...
@@ -366,6 +366,7 @@ class Answer{
...
@@ -366,6 +366,7 @@ class Answer{
}
}
public
static
function
validate
(
$params
){
public
static
function
validate
(
$params
){
//Rest::json($params); exit;
$costum
=
CacheHelper
::
getCostum
();
$costum
=
CacheHelper
::
getCostum
();
$set
=
array
();
$set
=
array
();
$res
=
array
(
'result'
=>
false
,
"msg"
=>
"Erreur"
);
$res
=
array
(
'result'
=>
false
,
"msg"
=>
"Erreur"
);
...
@@ -373,18 +374,19 @@ class Answer{
...
@@ -373,18 +374,19 @@ class Answer{
$answer
=
PHDB
::
findOneById
(
Answer
::
COLLECTION
,
$params
[
"answerId"
]);
$answer
=
PHDB
::
findOneById
(
Answer
::
COLLECTION
,
$params
[
"answerId"
]);
if
(
!
empty
(
$answer
)){
if
(
!
empty
(
$answer
)){
//Rest::json($answer); exit;
if
(
!
empty
(
$params
[
"input"
][
"validated"
])
&&
(
$params
[
"input"
][
"validated"
]
===
true
||
$params
[
"input"
][
"validated"
]
===
"true"
)
)
if
(
!
empty
(
$params
[
"input"
][
"validated"
])
&&
(
$params
[
"input"
][
"validated"
]
===
true
||
$params
[
"input"
][
"validated"
]
===
"true"
)
)
$set
[
"validated"
]
=
true
;
$set
[
"validated"
]
=
true
;
if
(
!
empty
(
$params
[
"input"
][
"generateElement"
])){
if
(
!
empty
(
$params
[
"input"
][
"generateElement"
])){
$mapping
=
array
();
$mapping
=
array
();
$import
=
array
(
$import
=
array
(
'file'
=>
array
(
json_encode
(
array
(
$
params
[
"answer"
]
))),
'file'
=>
array
(
json_encode
(
array
(
$
answer
))),
'nameFile'
=>
"test"
,
'nameFile'
=>
"test"
,
'typeFile'
=>
'json'
,
'typeFile'
=>
'json'
,
"warnings"
=>
"false"
"warnings"
=>
"false"
);
);
//Rest::json($import); exit;
foreach
(
$params
[
"input"
][
"generateElement"
]
as
$type
=>
$map
)
{
foreach
(
$params
[
"input"
][
"generateElement"
]
as
$type
=>
$map
)
{
$mapping
=
array
();
$mapping
=
array
();
foreach
(
$map
as
$k
=>
$v
)
{
foreach
(
$map
as
$k
=>
$v
)
{
...
@@ -397,7 +399,7 @@ class Answer{
...
@@ -397,7 +399,7 @@ class Answer{
$import
[
'typeElement'
]
=
$type
;
$import
[
'typeElement'
]
=
$type
;
//Rest::json($import); exit;
//Rest::json($import); exit;
$resImport
=
Import
::
previewData
(
$import
,
true
,
true
,
true
);
$resImport
=
Import
::
previewData
(
$import
,
true
,
true
,
true
);
//
Rest::json($resImport); exit;
Rest
::
json
(
$resImport
);
exit
;
foreach
(
$resImport
[
"elementsObj"
]
as
$keyElt
=>
$elt
)
{
foreach
(
$resImport
[
"elementsObj"
]
as
$keyElt
=>
$elt
)
{
$elt
=
Import
::
checkElement
(
$elt
,
$type
);
$elt
=
Import
::
checkElement
(
$elt
,
$type
);
if
(
!
empty
(
$elt
[
"msgError"
]))
if
(
!
empty
(
$elt
[
"msgError"
]))
...
...
Write
Preview
Markdown
is supported
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