|
|
|
@ -24,7 +24,7 @@ class GatewayForm
|
|
|
|
|
{
|
|
|
|
|
if(!empty($this->getForm()))
|
|
|
|
|
{
|
|
|
|
|
$query = "INSERT INTO Form(title, description) VALUES(:title, :description)";
|
|
|
|
|
$query = "INSERT INTO `form`(title, description) VALUES(:title, :description)";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':title' => array($title, PDO::PARAM_STR),
|
|
|
|
|
':description' => array($description, PDO::PARAM_STR)
|
|
|
|
@ -41,7 +41,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
public function deleteForm(array $idform): void
|
|
|
|
|
{
|
|
|
|
|
$query = "DELETE FROM Form WHERE id = :id";
|
|
|
|
|
$query = "DELETE FROM `form` WHERE id = :id";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':id' => array($idform[0], PDO::PARAM_INT)
|
|
|
|
|
));
|
|
|
|
@ -50,7 +50,7 @@ class GatewayForm
|
|
|
|
|
public function assignKeywordToQuestion(string $keyword, int $idQuestion, string $response): void
|
|
|
|
|
{
|
|
|
|
|
$query = "SELECT pr.id
|
|
|
|
|
FROM Propose p, PossibleResponse pr
|
|
|
|
|
FROM `propose` p, `possibleresponse` pr
|
|
|
|
|
WHERE p.question = :id AND p.possibleResponse = pr.id
|
|
|
|
|
AND pr.content = :response";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
@ -60,7 +60,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
$idPossibleResponse = $this->connection->getResults()[0][0];
|
|
|
|
|
|
|
|
|
|
$query = "INSERT INTO Reference(possibleResponse, keyword) VALUES(:possibleResponse, :keyword)";
|
|
|
|
|
$query = "INSERT INTO `reference`(possibleResponse, keyword) VALUES(:possibleResponse, :keyword)";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':possibleResponse' => array($idPossibleResponse, PDO::PARAM_INT),
|
|
|
|
|
':keyword' => array($keyword, PDO::PARAM_STR)
|
|
|
|
@ -69,7 +69,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
public function deleteKeywordFromQuestion(string $keyword, int $idQuestion, string $response): void
|
|
|
|
|
{
|
|
|
|
|
$query = "SELECT pr.id FROM Propose p, PossibleResponse r
|
|
|
|
|
$query = "SELECT pr.id FROM `propose` p, `possibleresponse` r
|
|
|
|
|
WHERE p.question = :id AND p.possibleResponse = pr.id
|
|
|
|
|
AND pr.content = :response";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
@ -79,7 +79,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
$idPossibleResponse = $this->connection->getResults()[0][0];
|
|
|
|
|
|
|
|
|
|
$query = "DELETE FROM Reference WHERE response = :idResponse AND keyword = :idKeyword";
|
|
|
|
|
$query = "DELETE FROM `reference` WHERE response = :idResponse AND keyword = :idKeyword";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':idResponse' => array($idPossibleResponse, PDO::PARAM_INT),
|
|
|
|
|
':idKeyword' => array($keyword, PDO::PARAM_INT)
|
|
|
|
@ -88,7 +88,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
public function updateTitleToForm(int $id, string $title): void
|
|
|
|
|
{
|
|
|
|
|
$query = "UPDATE Form SET title = :title WHERE id = :id";
|
|
|
|
|
$query = "UPDATE `form` SET title = :title WHERE id = :id";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':title' => array($title, PDO::PARAM_STR),
|
|
|
|
|
':id' => array($id, PDO::PARAM_INT)
|
|
|
|
@ -97,7 +97,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
public function updateDescriptionToForm(int $id, string $description): void
|
|
|
|
|
{
|
|
|
|
|
$query = "UPDATE Form SET title = :title WHERE description = :description";
|
|
|
|
|
$query = "UPDATE `form` SET title = :title WHERE description = :description";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':description' => array($description, PDO::PARAM_STR),
|
|
|
|
|
':id' => array($id, PDO::PARAM_INT)
|
|
|
|
@ -106,7 +106,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
public function deleteDescriptionToForm(int $idForm): void
|
|
|
|
|
{
|
|
|
|
|
$query = "UPDATE Form SET title = :title WHERE description = :description";
|
|
|
|
|
$query = "UPDATE `form` SET title = :title WHERE description = :description";
|
|
|
|
|
$this->connection->executeQuery($query, array(
|
|
|
|
|
':description' => array('', PDO::PARAM_STR),
|
|
|
|
|
':id' => array($idForm, PDO::PARAM_INT)
|
|
|
|
@ -115,7 +115,7 @@ class GatewayForm
|
|
|
|
|
|
|
|
|
|
public function existsForm(): bool
|
|
|
|
|
{
|
|
|
|
|
$query = "SELECT * FROM Form";
|
|
|
|
|
$query = "SELECT * FROM `form`";
|
|
|
|
|
$this->connection->executeQuery($query);
|
|
|
|
|
return !empty($this->connection->getResults());
|
|
|
|
|
}
|
|
|
|
|