diff --git a/.drone.yml b/.drone.yml index 1eefb48..df15d7b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,11 +8,11 @@ trigger: steps: - - name: coverage-image + - name: image-app image: plugins/docker settings: - dockerfile: ./Source/Tests/Dockerfile - context: Source/Tests + dockerfile: ./Source/Dockerfile + context: Source/ registry: hub.codefirst.iut.uca.fr repo: hub.codefirst.iut.uca.fr/dorian.hodin/sae4.01_formulaire username: @@ -20,17 +20,15 @@ steps: password: from_secret: SECRET_PASSWD - #conteneur deployment - - name: deploy-coverage + - name: deploy-app image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest environment: IMAGENAME: hub.codefirst.iut.uca.fr/dorian.hodin/sae4.01_formulaire:latest - CONTAINERNAME: coverage-image + CONTAINERNAME: image-app COMMAND: create OVERWRITE: true ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal - depends_on: [ coverage-image ] - + depends_on: [ image-app ] - name: setup_PHP_for_SonarQube image: sonarsource/sonar-scanner-cli @@ -46,6 +44,5 @@ steps: -Dsonar.language=php -Dsonar.host.url=https://codefirst.iut.uca.fr/sonar -Dsonar.php.coverage.reportPaths=coverage.xml - depends_on: [ deploy-coverage ] - + depends_on: [ deploy-app ] diff --git a/Source/.htaccess b/Source/.htaccess index db7c21f..56d0b29 100644 --- a/Source/.htaccess +++ b/Source/.htaccess @@ -25,4 +25,7 @@ RewriteRule ^goToResponses$ %{ENV:APP_ROOT}index.php?page=goToResponses [L] RewriteRule ^deleteQuestion$ %{ENV:APP_ROOT}index.php?page=deleteQuestion [L] RewriteRule ^deleteResponse$ %{ENV:APP_ROOT}index.php?page=deleteResponse [L] RewriteRule ^deleteKeyword$ %{ENV:APP_ROOT}index.php?page=deleteKeyword [L] -RewriteRule ^deleteResponsesCandidate$ %{ENV:APP_ROOT}index.php?page=deleteResponsesCandidate [L] \ No newline at end of file +RewriteRule ^deleteResponsesCandidate$ %{ENV:APP_ROOT}index.php?page=deleteResponsesCandidate [L] + + +AddType text/css *.css \ No newline at end of file diff --git a/Source/Dockerfile b/Source/Dockerfile new file mode 100644 index 0000000..cbc36b9 --- /dev/null +++ b/Source/Dockerfile @@ -0,0 +1,10 @@ +FROM php:8.1-apache +RUN apt-get update && apt-get install -y git +COPY . /var/www/html +WORKDIR /var/www/html/Config +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +RUN composer update && composer install +RUN a2enmod rewrite +RUN a2enmod actions +RUN AddType text/css *.css +RUN service apache2 restart diff --git a/Source/Model/FactoryQuestion.php b/Source/Model/FactoryQuestion.php index 64129e2..061a798 100644 --- a/Source/Model/FactoryQuestion.php +++ b/Source/Model/FactoryQuestion.php @@ -23,14 +23,14 @@ class FactoryQuestion extends Factory $questions = []; if ($results[0] != null) { for ($i = 0; $i < count($results[0]); $i++) { - if (strcmp($results[0][$i]['type'], "BusinessClass\TextQuestion") == 0) { - $questions[] = new TextQuestion($results[0][$i]['id'], $results[0][$i]['content']); + if (strcmp($results[0][$i]->type, "BusinessClass/TextQuestion") == 0) { + $questions[] = new TextQuestion($results[0][$i]->id, $results[0][$i]->content); } else { $possiblesResponses = $results[1][$i]; - $content = $results[0][$i]['content']; + $content = $results[0][$i]->content; $categories = $results[2][$i]; - $id = $results[0][$i]['id']; - $questions[] = new $results[0][$i]['type']($possiblesResponses, $content, $categories, $id); + $id = $results[0][$i]->id; + $questions[] = new $results[0][$i]->type($possiblesResponses, $content, $categories, $id); } } } diff --git a/Source/Model/ModelAdmin.php b/Source/Model/ModelAdmin.php index a586835..c9771ac 100644 --- a/Source/Model/ModelAdmin.php +++ b/Source/Model/ModelAdmin.php @@ -51,6 +51,7 @@ class ModelAdmin throw new Exception('GetForm failed'); } $form = json_decode($res->getBody()); + echo $form; if (!empty($form)) { $res = $this->client->request( 'POST', diff --git a/Source/Model/ModelCandidate.php b/Source/Model/ModelCandidate.php index 8ac6939..3e302b1 100644 --- a/Source/Model/ModelCandidate.php +++ b/Source/Model/ModelCandidate.php @@ -99,10 +99,9 @@ class ModelCandidate return "PAS DE FORMULAIRE\n"; } - $title = $form[0]['title']; - $description = $form[0]['description']; - $res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllQuestions? - idForm='.$form[0]['id'] + $title = $form[0]->title; + $description = $form[0]->description; + $res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllQuestions?idForm='.$form[0]->id ); if ($res->getStatusCode()!=200){ throw new Exception('GetAllQuestion failed'); diff --git a/Source/Views/HTML/admin.php b/Source/Views/HTML/admin.php index e1e6918..0a23f23 100644 --- a/Source/Views/HTML/admin.php +++ b/Source/Views/HTML/admin.php @@ -11,8 +11,8 @@ - - + + diff --git a/Source/Views/HTML/categories.php b/Source/Views/HTML/categories.php index cc398b5..e18021e 100644 --- a/Source/Views/HTML/categories.php +++ b/Source/Views/HTML/categories.php @@ -5,7 +5,7 @@ global $googleApis, $googleStatic, $poppins, $icon, $logoUCA; ?> - + diff --git a/Source/Views/HTML/continue.php b/Source/Views/HTML/continue.php index 2b8a00d..486577b 100644 --- a/Source/Views/HTML/continue.php +++ b/Source/Views/HTML/continue.php @@ -13,8 +13,8 @@ - - + + diff --git a/Source/Views/HTML/error.php b/Source/Views/HTML/error.php index 51350c9..aa2c170 100644 --- a/Source/Views/HTML/error.php +++ b/Source/Views/HTML/error.php @@ -1,8 +1,8 @@ - - + + Error Page

diff --git a/Source/Views/HTML/form.php b/Source/Views/HTML/form.php index b5a7670..670af97 100644 --- a/Source/Views/HTML/form.php +++ b/Source/Views/HTML/form.php @@ -5,14 +5,14 @@ global $googleApis, $googleStatic, $poppins, $icon, $logoUCA; ?> - - + + - - - + + + Formulaire de témoignage diff --git a/Source/Views/HTML/possibleResponsesForm.php b/Source/Views/HTML/possibleResponsesForm.php index 1f56468..f2c4912 100644 --- a/Source/Views/HTML/possibleResponsesForm.php +++ b/Source/Views/HTML/possibleResponsesForm.php @@ -11,8 +11,8 @@ - - + + diff --git a/Source/Views/HTML/questions.php b/Source/Views/HTML/questions.php index bc6cf6b..f162113 100644 --- a/Source/Views/HTML/questions.php +++ b/Source/Views/HTML/questions.php @@ -5,7 +5,7 @@ global $googleApis, $googleStatic, $poppins, $icon, $logoUCA; ?> - + diff --git a/Source/Views/HTML/responses.php b/Source/Views/HTML/responses.php index 1d0a41f..8ae6427 100644 --- a/Source/Views/HTML/responses.php +++ b/Source/Views/HTML/responses.php @@ -5,7 +5,7 @@ global $googleApis, $googleStatic, $poppins, $icon, $logoUCA; ?> - + diff --git a/Source/Views/HTML/thanks.php b/Source/Views/HTML/thanks.php index bc9f585..57002f3 100644 --- a/Source/Views/HTML/thanks.php +++ b/Source/Views/HTML/thanks.php @@ -5,8 +5,8 @@ global $googleApis, $googleStatic, $poppins, $icon, $logoUCA; ?> - - + + diff --git a/Source/Views/JS/scripts.js b/Source/Views/JS/scripts.js index e21d364..5329fc1 100644 --- a/Source/Views/JS/scripts.js +++ b/Source/Views/JS/scripts.js @@ -1,4 +1,4 @@ -var currentTab = 0; +let currentTab = 0; document.addEventListener("DOMContentLoaded", function(event) {