|
|
|
@ -55,10 +55,10 @@ class ModelAdmin
|
|
|
|
|
if (!empty($form)) {
|
|
|
|
|
$res = $this->client->request(
|
|
|
|
|
'POST',
|
|
|
|
|
'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/addQuestion?
|
|
|
|
|
content='.$questionContent.'&
|
|
|
|
|
classQuestion='.get_class($question).'&
|
|
|
|
|
idForm='.$form[0]['id']
|
|
|
|
|
'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/addQuestion?'.
|
|
|
|
|
'content='.$questionContent.'&'.
|
|
|
|
|
'classQuestion='.get_class($question).'&'.
|
|
|
|
|
'idForm='.$form[0]['id']
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('AddQuestion failed');
|
|
|
|
@ -88,9 +88,9 @@ class ModelAdmin
|
|
|
|
|
if (!validate::type($type)) {
|
|
|
|
|
throw new Exception('Type de question invalide');
|
|
|
|
|
}
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deleteQuestion?
|
|
|
|
|
classQuestion='.$type.'&
|
|
|
|
|
id='.$idQuestion
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deleteQuestion?'.
|
|
|
|
|
'classQuestion='.$type.'&'.
|
|
|
|
|
'id='.$idQuestion
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('DeleteQuestion failed');
|
|
|
|
@ -118,10 +118,10 @@ class ModelAdmin
|
|
|
|
|
if(!validate::categories($categories)){
|
|
|
|
|
throw new Exception('Categories invalides');
|
|
|
|
|
}
|
|
|
|
|
$res = $this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertResponseInQuestion?
|
|
|
|
|
response='.$response.'&
|
|
|
|
|
categories='.json_encode($categories).'&
|
|
|
|
|
$idQuestion='.$idQuestion
|
|
|
|
|
$res = $this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertResponseInQuestion?'.
|
|
|
|
|
'response='.$response.'&'.
|
|
|
|
|
'categories='.json_encode($categories).'&'.
|
|
|
|
|
'idQuestion='.$idQuestion
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('InsertResponseInQuestion failed');
|
|
|
|
@ -140,8 +140,8 @@ class ModelAdmin
|
|
|
|
|
public function deleteResponse(): void
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deletePossibleResponse?
|
|
|
|
|
id='.$_POST["possibleResponse"]
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deletePossibleResponse?'.
|
|
|
|
|
'id='.$_POST["possibleResponse"]
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('DeletePossibleResponse failed');
|
|
|
|
@ -167,9 +167,9 @@ class ModelAdmin
|
|
|
|
|
$formulaire = json_decode($res->getBody());
|
|
|
|
|
if (empty($formulaire)) {
|
|
|
|
|
$form = new Form(0, "Votre avis nous intéresse !!!", "Description de notre formulaire", array());
|
|
|
|
|
$res = $this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertForm?
|
|
|
|
|
title='.$form->getTitle().'&
|
|
|
|
|
description='.$form->getDescription()
|
|
|
|
|
$res = $this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertForm?'.
|
|
|
|
|
'title='.$form->getTitle().'&'.
|
|
|
|
|
'description='.$form->getDescription()
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('InsertForm failed');
|
|
|
|
@ -194,8 +194,8 @@ class ModelAdmin
|
|
|
|
|
if(!validate::keyword($keyword)){
|
|
|
|
|
throw new Exception('Mot-clef invalide');
|
|
|
|
|
}
|
|
|
|
|
$res = $this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertKeyword?
|
|
|
|
|
keyword='.$keyword
|
|
|
|
|
$res = $this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertKeyword?'.
|
|
|
|
|
'keyword='.$keyword
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('InsertKeyword failed');
|
|
|
|
@ -214,8 +214,8 @@ class ModelAdmin
|
|
|
|
|
public function deleteKeyword(): void
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deleteKeyword?
|
|
|
|
|
keyword='.$_POST["idCateg"]
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deleteKeyword?'.
|
|
|
|
|
'keyword='.$_POST["idCateg"]
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('DeleteKeyword failed');
|
|
|
|
@ -270,9 +270,8 @@ class ModelAdmin
|
|
|
|
|
throw new Exception('GetForm failed');
|
|
|
|
|
}
|
|
|
|
|
$idForm = json_decode($res->getBody())[0]["id"];
|
|
|
|
|
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllQuestions?
|
|
|
|
|
idForm='.$idForm
|
|
|
|
|
);
|
|
|
|
|
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllQuestions?'.
|
|
|
|
|
'idForm='.$idForm);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('GetAllQuestions failed');
|
|
|
|
|
}
|
|
|
|
@ -303,9 +302,8 @@ class ModelAdmin
|
|
|
|
|
$responsesCandidate = json_decode($res->getBody());
|
|
|
|
|
$results = [];
|
|
|
|
|
foreach ($responsesCandidate as $response) {
|
|
|
|
|
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getDetailsListResponsesOfCandidate?
|
|
|
|
|
id='.$response["id"]
|
|
|
|
|
);
|
|
|
|
|
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getDetailsListResponsesOfCandidate?'.
|
|
|
|
|
'id='.$response["id"]);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('GetDetailsListResponsesOfCandidate failed');
|
|
|
|
|
}
|
|
|
|
@ -326,8 +324,8 @@ class ModelAdmin
|
|
|
|
|
public function deleteResponsesCandidate(): void
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deleteListResponseOfCandidate?
|
|
|
|
|
id='.Clean::int($_POST["idResponseCandidate"])
|
|
|
|
|
$res = $this->client->request('DELETE', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/deleteListResponseOfCandidate?'.
|
|
|
|
|
'id='.Clean::int($_POST["idResponseCandidate"])
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
throw new Exception('DeleteListResponseOfCandidate failed');
|
|
|
|
|