Commit fa8e1ba2 authored by GROSS-AMBLARD David's avatar GROSS-AMBLARD David
Browse files

Preparing for new task type 11

parent d17a9b66
......@@ -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) {
......
......@@ -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");
......
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