Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
druid-public
headwork
Commits
fa8e1ba2
Commit
fa8e1ba2
authored
Nov 19, 2021
by
GROSS-AMBLARD David
Browse files
Preparing for new task type 11
parent
d17a9b66
Changes
2
Hide whitespace changes
Inline
Side-by-side
pages/showTasks/showTasks.php
View file @
fa8e1ba2
...
...
@@ -445,29 +445,24 @@ function insertAnswer($conn, $id, $artifactid, $value, $mass, $isAjax=false, $he
// Checking if whether or not the answer is a JSON object
$isJson
=
false
;
if
(
$type
>=
5
and
$type
<=
7
)
{
if
(
(
$type
>=
5
and
$type
<=
7
)
or
(
$type
==
11
))
{
json_decode
(
$value
);
$isJson
=
json_last_error
()
==
JSON_ERROR_NONE
;
$isJson
=
(
json_last_error
()
==
JSON_ERROR_NONE
)
;
}
if
(
!
empty
(
$checker
)
&&
!
$isJson
)
{
debug
(
"<p>
$checker
on</p>"
);
$stmt
=
$conn
->
query
(
"select '
$value
'
$checker
as result from dual"
);
$checked
=
$stmt
->
fetch
()[
'result'
];
debug
(
"<p> res
$checked
</p>"
);
}
else
{
debug
(
"no checker"
);
$checked
=
true
;
}
// Checking if the answer is valid depending of its type
if
(((
$checked
and
$type
!=
3
)
or
(
$checked
and
$type
==
3
and
strlen
(
preg_replace
(
"/
\r
|
\n
/"
,
""
,
$value
))
>
0
))
and
$value
!==
null
)
{
//TODO : gérer la partie ressource "help"
$query
=
"insert into Answer(idtask, artifact, user, mass, value"
.
(
$help
?
", help"
:
""
)
.
") values "
;
if
(
$type
==
3
||
((
$type
==
5
||
$type
==
6
||
$type
==
7
)
&&
$isJson
))
{
// Multi-line answer or JSON answer
if
(
$type
==
3
||
((
$type
==
5
||
$type
==
6
||
$type
==
7
||
$type
==
11
)
&&
$isJson
))
{
// Multi-line answer or JSON answer
$values
=
""
;
if
(
$type
==
3
)
{
foreach
(
explode
(
PHP_EOL
,
$value
)
as
$val
)
{
...
...
test.php
View file @
fa8e1ba2
...
...
@@ -4,8 +4,6 @@ require_once("pages/profile/profile.php");
require_once
(
"lib/HWlib.php"
);
require_once
(
"lib/HTML.php"
);
require_once
(
"pages/skills/skills.php"
);
require_once
(
"tasks.php"
);
require_once
(
"connection.php"
);
require_once
(
"lib/artifacts.php"
);
require_once
(
"pages/startup/startup.php"
);
require_once
(
"pages/workflowdesign/workflowdesign.php"
);
...
...
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