|
|
|
@ -49,7 +49,7 @@ class ModelAdmin
|
|
|
|
|
if (validate::type($type)) {
|
|
|
|
|
$question = new $type(0, $questionContent);
|
|
|
|
|
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
if ($res->getStatusCode() != 200){
|
|
|
|
|
throw new Exception('GetForm failed');
|
|
|
|
|
}
|
|
|
|
|
$form = json_decode($res->getBody());
|
|
|
|
@ -130,7 +130,7 @@ class ModelAdmin
|
|
|
|
|
if ($res->getStatusCode() != 200) {
|
|
|
|
|
throw new Exception('InsertResponseInQuestion failed');
|
|
|
|
|
}
|
|
|
|
|
} catch (GuzzleException | ClientException $g){
|
|
|
|
|
} catch (GuzzleException | ClientException $g) {
|
|
|
|
|
echo "Error : " . $g->getMessage();
|
|
|
|
|
throw new Exception($g->getMessage(), $g->getCode(), $g);
|
|
|
|
|
}
|
|
|
|
@ -167,7 +167,7 @@ class ModelAdmin
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
|
|
|
|
|
if ($res->getStatusCode()!=200){
|
|
|
|
|
if ($res->getStatusCode() != 200) {
|
|
|
|
|
throw new Exception('GetForm failed');
|
|
|
|
|
}
|
|
|
|
|
$formulaire = json_decode($res->getBody());
|
|
|
|
@ -207,7 +207,7 @@ class ModelAdmin
|
|
|
|
|
if ($res->getStatusCode() != 200) {
|
|
|
|
|
throw new Exception('InsertKeyword failed');
|
|
|
|
|
}
|
|
|
|
|
} catch (GuzzleException | ClientException $g){
|
|
|
|
|
} catch (GuzzleException | ClientException $g) {
|
|
|
|
|
echo "Error : " . $g->getMessage();
|
|
|
|
|
throw new Exception($g->getMessage(), $g->getCode(), $g);
|
|
|
|
|
}
|
|
|
|
@ -228,7 +228,7 @@ class ModelAdmin
|
|
|
|
|
if ($res->getStatusCode() != 200) {
|
|
|
|
|
throw new Exception('DeleteKeyword failed');
|
|
|
|
|
}
|
|
|
|
|
} catch (GuzzleException | ClientException $g){
|
|
|
|
|
} catch (GuzzleException | ClientException $g) {
|
|
|
|
|
echo "Error : " . $g->getMessage();
|
|
|
|
|
throw new Exception($g->getMessage(), $g->getCode(), $g);
|
|
|
|
|
}
|
|
|
|
@ -281,7 +281,8 @@ class ModelAdmin
|
|
|
|
|
}
|
|
|
|
|
$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);
|
|
|
|
|
'idForm='.$idForm
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode() != 200) {
|
|
|
|
|
throw new Exception('GetAllQuestions failed');
|
|
|
|
|
}
|
|
|
|
@ -290,7 +291,7 @@ class ModelAdmin
|
|
|
|
|
} else {
|
|
|
|
|
return array();
|
|
|
|
|
}
|
|
|
|
|
} catch (GuzzleException | ClientException $g){
|
|
|
|
|
} catch (GuzzleException | ClientException $g) {
|
|
|
|
|
echo "Error : " . $g->getMessage();
|
|
|
|
|
throw new Exception($g->getMessage(), $g->getCode(), $g);
|
|
|
|
|
}
|
|
|
|
@ -314,14 +315,15 @@ class ModelAdmin
|
|
|
|
|
$results = [];
|
|
|
|
|
foreach ($responsesCandidate as $response) {
|
|
|
|
|
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getDetailsListResponseOfCandidate?'.
|
|
|
|
|
'id='.$response->id);
|
|
|
|
|
'id='.$response->id
|
|
|
|
|
);
|
|
|
|
|
if ($res->getStatusCode() != 200) {
|
|
|
|
|
throw new Exception('GetDetailsListResponsesOfCandidate failed');
|
|
|
|
|
}
|
|
|
|
|
$results[] =json_decode($res->getBody());
|
|
|
|
|
}
|
|
|
|
|
return $results;
|
|
|
|
|
} catch (GuzzleException | ClientException $g){
|
|
|
|
|
} catch (GuzzleException | ClientException $g) {
|
|
|
|
|
echo "Error : " . $g->getMessage();
|
|
|
|
|
throw new Exception($g->getMessage(), $g->getCode(), $g);
|
|
|
|
|
}
|
|
|
|
|