|
|
|
@ -99,32 +99,64 @@ class GatewayQuestion
|
|
|
|
|
{
|
|
|
|
|
$query = "SELECT * FROM Question WHERE form = :form";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':form' => array($idForm, PDO::PARAM_STR)
|
|
|
|
|
':form' => array($idForm, PDO::PARAM_INT)
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$listQuestions = $this->connection->getResults();
|
|
|
|
|
$possibleResponses = [];
|
|
|
|
|
$possibleResponsesContent = [];
|
|
|
|
|
$keywordsResponses = [];
|
|
|
|
|
|
|
|
|
|
if(!empty($resultQuestion)) {
|
|
|
|
|
|
|
|
|
|
$resultQuestion = $this->connection->getResults();
|
|
|
|
|
$possibleResponse = [];
|
|
|
|
|
$keywordResponse = [];
|
|
|
|
|
for ($i = 0; $i < count($resultQuestion); $i++) {
|
|
|
|
|
|
|
|
|
|
if ($resultQuestion[$i]["type"] != "BusinessClass/TextQuestion") {
|
|
|
|
|
|
|
|
|
|
if(!empty($resultQuestion))
|
|
|
|
|
{
|
|
|
|
|
for ($i=0; $i < count($resultQuestion); $i++)
|
|
|
|
|
{
|
|
|
|
|
if($resultQuestion[$i]["type"]!="TextQuestion")
|
|
|
|
|
{
|
|
|
|
|
$query = "SELECT pr.* FROM Propose p, PossibleResponse pr
|
|
|
|
|
WHERE p.question = :questionId AND p.possibleResponse = pr.id";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':questionId' => array($resultQuestion[$i]["id"], PDO::PARAM_INT)
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$possibleResponse[] = $this->connection->getResults();
|
|
|
|
|
$possibleResponses[] = $this->connection->getResults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tmpTab = [];
|
|
|
|
|
foreach ($possibleResponses[$i] as $row){
|
|
|
|
|
$query = "SELECT k.* FROM Keyword k, Reference r
|
|
|
|
|
WHERE k.word = r.keyword AND r.possibleResponse = :id";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':id' => array($row["id"], PDO::PARAM_INT)
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$tmpTab[] = $this->connection->getResults();
|
|
|
|
|
|
|
|
|
|
var_dump($tmpTab);
|
|
|
|
|
|
|
|
|
|
$possibleResponsesContent[] = $row["content"];
|
|
|
|
|
}
|
|
|
|
|
$keywordsResponses[] = $tmpTab["word"];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$possibleResponses[] = null;
|
|
|
|
|
$keywordsResponses[] = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return array($resultQuestion, $possibleResponsesContent, $keywordsResponses);
|
|
|
|
|
}
|
|
|
|
|
return array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if(!empty($resultQuestion))
|
|
|
|
|
{
|
|
|
|
|
for ($i=0; $i < count($resultQuestion); $i++)
|
|
|
|
|
{
|
|
|
|
|
if($resultQuestion[$i]["type"]!="BusinessClass/TextQuestion")
|
|
|
|
|
{
|
|
|
|
|
$tmpTab = [];
|
|
|
|
|
foreach ($possibleResponse[$i] as $row){
|
|
|
|
|
var_dump($row);
|
|
|
|
|
$query = "SELECT k.* FROM Keyword k, Reference r
|
|
|
|
|
WHERE k.word = r.keyword AND r.possibleResponse = :id";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
@ -132,16 +164,22 @@ class GatewayQuestion
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$tmpTab[] = $this->connection->getResults();
|
|
|
|
|
|
|
|
|
|
var_dump($tmpTab);
|
|
|
|
|
|
|
|
|
|
$possibleResponsesContent[] = $row["content"];
|
|
|
|
|
}
|
|
|
|
|
$keywordResponse[] = $tmpTab;
|
|
|
|
|
$keywordResponse[] = $tmpTab["word"];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$possibleResponse[] = null;
|
|
|
|
|
$keywordResponse[] = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return array($resultQuestion, $possibleResponse, $keywordResponse);
|
|
|
|
|
return array($resultQuestion, $possibleResponsesContent, $keywordResponse);
|
|
|
|
|
}
|
|
|
|
|
return array();
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
}
|