add detect interesting profiles
continuous-integration/drone/push Build is passing Details

interestingProfiles
Alexis 2 years ago
parent 4ab9c2dafb
commit 7e795d02ee

@ -25,4 +25,5 @@ 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]
RewriteRule ^deleteResponsesCandidate$ %{ENV:APP_ROOT}index.php?page=deleteResponsesCandidate [L]
RewriteRule ^goToProfiles$ %{ENV:APP_ROOT}index.php?page=goToProfiles [L]

@ -1,74 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit une question avec plusieurs réponses.
*/
abstract class BoxQuestion extends Question
{
/**
* @var array|mixed
*/
private array $possibleResponses;
/**
* @var array|mixed
*/
private array $categories;
public function __construct(int $ctp, array $args)
{
switch ($ctp) {
case 4:
parent::__construct($args[3], $args[1]);
$this->categories = $args[2];
$this->possibleResponses = $args[0];
break;
case 2:
parent::__construct($args[0], $args[1]);
break;
default:
break;
}
}
/**
* Permet de définir la manière dont la question doit s'afficher en HTML.
*
* @return string
*/
abstract public function printStrategy(): string;
/**
* @return array
*/
public function getPossibleResponses(): array
{
return $this->possibleResponses;
}
/**
* @param array $possibleResponses
*/
public function setPossibleResponses(array $possibleResponses): void
{
$this->possibleResponses = $possibleResponses;
}
/**
* @return array
*/
public function getCategories(): array
{
return $this->categories;
}
/**
* @param array $categories
*/
public function setCategories(array $categories): void
{
$this->categories = $categories;
}
}

@ -1,43 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit une question à choix multiples.
*/
class CheckBoxQuestion extends BoxQuestion
{
public function __construct()
{
parent::__construct(func_num_args(), func_get_args());
}
/**
* Permet de définir la manière dont la question doit s'afficher en HTML.
*
* @return string
*/
public function printStrategy(): string
{
$id = $this->getId();
$content = $this->getContent();
$possibleResponses = $this->getPossibleResponses();
$categories = $this->getCategories();
$html = "<div class='tab'>
<h6>$content</h6>";
for ($i = 0; $i < count($possibleResponses); $i++) {
$categoriesSplit = $id."||".$possibleResponses[$i]."||";
foreach ($categories[$i] as $category) {
$categoriesSplit.= $category."_";
}
$html.= "<p><input style='-webkit-appearance: checkbox;' type='checkbox' name='answers[]' value='$categoriesSplit' />
<label>$possibleResponses[$i]</label></p>";
}
$html.= "\t\t\t</div>\n";
return $html;
}
}

@ -1,99 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit un formulaire.
*/
class Form
{
/**
* @var int
*/
private int $id;
/**
* @var string
*/
private string $title;
/**
* @var string
*/
private string $description;
/**
* @var array
*/
private array $questions; // La liste des questions dans un formulaire
/**
* @param int $id
* @param string $title
* @param string $description
* @param array $questions
*/
public function __construct(int $id, string $title, string $description, array $questions)
{
$this->id = $id;
$this->title = $title;
$this->description = $description;
$this->questions = $questions;
}
/**
* @return string
*/
public function getTitle(): string
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle(string $title): void
{
$this->title = $title;
}
/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription(string $description): void
{
$this->description = $description;
}
/**
* @return array
*/
public function getQuestions(): array
{
return $this->questions;
}
/**
* @param array $questions
*/
public function setQuestions(array $questions): void
{
$this->questions = $questions;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
}

@ -1,16 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit l'affiche d'une question.
*/
interface IPrintQuestionStrategy
{
/**
* Permet de définir la manière dont la question doit s'afficher en HTML.
*
* @return string
*/
public function printStrategy(): string;
}

@ -1,54 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit une catégorie associable à une réponse.
*/
class Keyword
{
/**
* @var int
*/
private int $id;
/**
* @var string
*/
private string $word;
/**
* @param int $id
* @param string $word
*/
public function __construct(int $id, string $word)
{
$this->id = $id;
$this->word = $word;
}
/**
* @return string
*/
public function getWord(): string
{
return $this->word;
}
/**
* @param string $word
*/
public function setWord(string $word): void
{
$this->word = $word;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
}

@ -1,46 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit une question avec plusieurs réponse mais une seule possible.
*/
class ListBoxQuestion extends BoxQuestion
{
public function __construct()
{
parent::__construct(func_num_args(), func_get_args());
}
/**
* Permet de définir la manière dont la question doit s'afficher en HTML.
*
* @return string
*/
public function printStrategy(): string
{
$id = $this->getId();
$content = $this->getContent();
$possibleResponses = $this->getPossibleResponses();
$categories = $this->getCategories();
$html = "<div class='tab'>
<h6>$content</h6>
<select name='answers[]'>";
for ($i = 0; $i < count($possibleResponses); $i++) {
$categoriesSplit = $id."||".$possibleResponses[$i]."||";
foreach ($categories[$i] as $category) {
$categoriesSplit.= $category."_";
}
$html.= "<p> <option value='$categoriesSplit'>$possibleResponses[$i]</option> </p>";
}
$html.= "\t\t\t\t</select>
</div>\n";
return $html;
}
}

@ -1,62 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit une question.
*/
abstract class Question implements IPrintQuestionStrategy
{
/**
* @var int
*/
private int $id;
/**
* @var string
*/
private string $content;
/**
* @param int $id
* @param string $content
*/
public function __construct(int $id, string $content)
{
$this->id = $id;
$this->content = $content;
}
/**
* Permet de définir la manière dont la question doit s'afficher en HTML.
*
* @return string
*/
abstract public function printStrategy(): string;
/**
* @return string
*/
public function getContent(): string
{
return $this->content;
}
/**
* @param string $content
*/
public function setContent(string $content): void
{
$this->content = $content;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
}

@ -1,99 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit une possibilité de réponse à une question.
*/
class Response
{
/**
* @var int
*/
private int $id;
/**
* @var string
*/
private string $date;
/**
* @var string
*/
private string $titleForm;
/**
* @var array
*/
private array $questionsResponses;
/**
* @param int $id
* @param string $date
* @param string $titleForm
* @param array $questionsResponses
*/
public function __construct(int $id, string $date, string $titleForm, array $questionsResponses)
{
$this->id = $id;
$this->date = $date;
$this->titleForm = $titleForm;
$this->questionsResponses = $questionsResponses;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return string
*/
public function getDate(): string
{
return $this->date;
}
/**
* @param string $date
*/
public function setDate(string $date): void
{
$this->date = $date;
}
/**
* @return string
*/
public function getTitleForm(): string
{
return $this->titleForm;
}
/**
* @param string $titleForm
*/
public function setTitleForm(string $titleForm): void
{
$this->titleForm = $titleForm;
}
/**
* @return array
*/
public function getQuestionsResponses(): array
{
return $this->questionsResponses;
}
/**
* @param array $questionsResponses
*/
public function setQuestionsResponses(array $questionsResponses): void
{
$this->questionsResponses = $questionsResponses;
}
}

@ -1,27 +0,0 @@
<?php
namespace BusinessClass;
/**
* Définit une question qui propose d'écrire du texte en guise de réponse
*/
class TextQuestion extends Question
{
/**
* Permet de définir la manière dont la question doit s'afficher en HTML.
*
* @return string
*/
public function printStrategy(): string
{
$content = $this->getContent();
$id = $this->getId();
return "<div class='tab'>
<h6>$content</h6>
<p>
<input data-id='$id' placeholder='...' oninput='this.className = '''' type='text' name='answers[]'>
</p>
</div>\n";
}
}

@ -1,306 +0,0 @@
<?php
/*
MIT License
Copyright (c) 2012 Danny van Kooten <hi@dannyvankooten.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Config;
use RuntimeException;
class AltoRouter
{
/**
* @var array Array of all routes (incl. named routes).
*/
protected $routes = [];
/**
* @var array Array of all named routes.
*/
protected $namedRoutes = [];
/**
* @var string Can be used to ignore leading part of the Request URL (if main file lives in subdirectory of host)
*/
protected $basePath = '';
/**
* @var array Array of default match types (regex helpers)
*/
protected $matchTypes = [
'i' => '[0-9]++',
'a' => '[0-9A-Za-z]++',
'h' => '[0-9A-Fa-f]++',
'*' => '.+?',
'**' => '.++',
'' => '[^/\.]++'
];
/**
* Create router in one call from config.
*
* @param array $routes
* @param string $basePath
* @param array $matchTypes
* @throws Exception
*/
public function __construct(array $routes = [], $basePath = '', array $matchTypes = [])
{
$this->addRoutes($routes);
$this->setBasePath($basePath);
$this->addMatchTypes($matchTypes);
}
/**
* Retrieves all routes.
* Useful if you want to process or display routes.
* @return array All routes.
*/
public function getRoutes()
{
return $this->routes;
}
/**
* Add multiple routes at once from array in the following format:
*
* $routes = [
* [$method, $route, $target, $name]
* ];
*
* @param array $routes
* @return void
* @author Koen Punt
* @throws Exception
*/
public function addRoutes($routes)
{
if (!is_array($routes) && !$routes instanceof Traversable) {
throw new RuntimeException('Routes should be an array or an instance of Traversable');
}
foreach ($routes as $route) {
call_user_func_array([$this, 'map'], $route);
}
}
/**
* Set the base path.
* Useful if you are running your application from a subdirectory.
* @param string $basePath
*/
public function setBasePath($basePath)
{
$this->basePath = $basePath;
}
/**
* Add named match types. It uses array_merge so keys can be overwritten.
*
* @param array $matchTypes The key is the name and the value is the regex.
*/
public function addMatchTypes(array $matchTypes)
{
$this->matchTypes = array_merge($this->matchTypes, $matchTypes);
}
/**
* Map a route to a target
*
* @param string $method One of 5 HTTP Methods, or a pipe-separated list of multiple HTTP Methods (GET|POST|PATCH|PUT|DELETE)
* @param string $route The route regex, custom regex must start with an @. You can use multiple pre-set regex filters, like [i:id]
* @param mixed $target The target where this route should point to. Can be anything.
* @param string $name Optional name of this route. Supply if you want to reverse route this url in your application.
* @throws Exception
*/
public function map($method, $route, $target, $name = null)
{
$this->routes[] = [$method, $route, $target, $name];
if ($name) {
if (isset($this->namedRoutes[$name])) {
throw new RuntimeException("Can not redeclare route '{$name}'");
}
$this->namedRoutes[$name] = $route;
}
return;
}
/**
* Reversed routing
*
* Generate the URL for a named route. Replace regexes with supplied parameters
*
* @param string $routeName The name of the route.
* @param array @params Associative array of parameters to replace placeholders with.
* @return string The URL of the route with named parameters in place.
* @throws Exception
*/
public function generate($routeName, array $params = [])
{
// Check if named route exists
if (!isset($this->namedRoutes[$routeName])) {
throw new RuntimeException("Route '{$routeName}' does not exist.");
}
// Replace named parameters
$route = $this->namedRoutes[$routeName];
// prepend base path to route url again
$url = $this->basePath . $route;
if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
foreach ($matches as $index => $match) {
list($block, $pre, $type, $param, $optional) = $match;
if ($pre) {
$block = substr($block, 1);
}
if (isset($params[$param])) {
// Part is found, replace for param value
$url = str_replace($block, $params[$param], $url);
} elseif ($optional && $index !== 0) {
// Only strip preceding slash if it's not at the base
$url = str_replace($pre . $block, '', $url);
} else {
// Strip match block
$url = str_replace($block, '', $url);
}
}
}
return $url;
}
/**
* Match a given Request Url against stored routes
* @param string $requestUrl
* @param string $requestMethod
* @return array|boolean Array with route information on success, false on failure (no match).
*/
public function match($requestUrl = null, $requestMethod = null)
{
$params = [];
// set Request Url if it isn't passed as parameter
if ($requestUrl === null) {
$requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
}
// strip base path from request url
$requestUrl = substr($requestUrl, strlen($this->basePath));
// Strip query string (?a=b) from Request Url
if (($strpos = strpos($requestUrl, '?')) !== false) {
$requestUrl = substr($requestUrl, 0, $strpos);
}
$lastRequestUrlChar = $requestUrl ? $requestUrl[strlen($requestUrl)-1] : '';
// set Request Method if it isn't passed as a parameter
if ($requestMethod === null) {
$requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
}
foreach ($this->routes as $handler) {
list($methods, $route, $target, $name) = $handler;
$method_match = (stripos($methods, $requestMethod) !== false);
// Method did not match, continue to next route.
if (!$method_match) {
continue;
}
if ($route === '*') {
// * wildcard (matches all)
$match = true;
} elseif (isset($route[0]) && $route[0] === '@') {
// @ regex delimiter
$pattern = '`' . substr($route, 1) . '`u';
$match = preg_match($pattern, $requestUrl, $params) === 1;
} elseif (($position = strpos($route, '[')) === false) {
// No params in url, do string comparison
$match = strcmp($requestUrl, $route) === 0;
} else {
// Compare longest non-param string with url before moving on to regex
// Check if last character before param is a slash, because it could be optional if param is optional too (see https://github.com/dannyvankooten/AltoRouter/issues/241)
if (strncmp($requestUrl, $route, $position) !== 0 && ($lastRequestUrlChar === '/' || $route[$position-1] !== '/')) {
continue;
}
$regex = $this->compileRoute($route);
$match = preg_match($regex, $requestUrl, $params) === 1;
}
if ($match) {
if ($params) {
foreach ($params as $key => $value) {
if (is_numeric($key)) {
unset($params[$key]);
}
}
}
return [
'target' => $target,
'params' => $params,
'name' => $name
];
}
}
return false;
}
/**
* Compile the regex for a given route (EXPENSIVE)
* @param $route
* @return string
*/
protected function compileRoute($route)
{
if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
$matchTypes = $this->matchTypes;
foreach ($matches as $match) {
list($block, $pre, $type, $param, $optional) = $match;
if (isset($matchTypes[$type])) {
$type = $matchTypes[$type];
}
if ($pre === '.') {
$pre = '\.';
}
$optional = $optional !== '' ? '?' : null;
//Older versions of PCRE require the 'P' in (?P<named>)
$pattern = '(?:'
. ($pre !== '' ? $pre : null)
. '('
. ($param !== '' ? "?P<$param>" : null)
. $type
. ')'
. $optional
. ')'
. $optional;
$route = str_replace($block, $pattern, $route);
}
}
return "`^$route$`u";
}
}

@ -1,52 +0,0 @@
<?php
namespace Config;
require_once(__DIR__.'/vendor/autoload.php');
class Autoload
{
private static $instance = null;
public static function charger()
{
if (null !== self::$instance) {
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
}
self::$instance = new self();
if (!spl_autoload_register(array(self::$instance, 'autoloader'))) {
throw new RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
}
}
public static function shutDown()
{
if (null !== self::$instance) {
if (!spl_autoload_unregister(array(self::$instance, 'autoloader'))) {
throw new RuntimeException('Could not stop the autoload');
}
self::$instance = null;
}
}
private static function autoloader($className)
{
$folder = "./";
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strripos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
require_once $folder.$fileName;
}
}

@ -1,69 +0,0 @@
<?php
namespace Config;
class Clean
{
/**
* Cette fonction prend une chaîne de caractères en entrée et retourne une version nettoyée de cette chaîne.
* Elle supprime les espaces de début et de fin, ainsi que toutes les balises HTML, et encode les
* caractères spéciaux.
*
* @param string $string La chaîne à nettoyer
* @return string La chaîne nettoyée
*/
public static function simpleString(string $string): string
{
$string = trim($string);
$string = strip_tags($string);
return htmlspecialchars($string);
}
/**
* Cette fonction prend un tableau de chaînes de caractères en entrée et retourne un tableau de chaînes
* nettoyées.
* Elle supprime les espaces de début et de fin, ainsi que toutes les balises HTML, et encode les
* caractères spéciaux.
*
* @param array $array Le tableau de chaînes à nettoyer
* @return array Le tableau de chaînes nettoyées
*/
public static function simpleStringArray(array $array): array
{
$array = array_map('trim', $array);
$array = array_map('strip_tags', $array);
$array = array_map('htmlspecialchars', $array);
return $array;
}
/**
* Cette fonction prend une chaîne de caractères en entrée et retourne une version nettoyée de cette chaîne.
* Elle supprime les espaces de début et de fin, ainsi que toutes les balises HTML, et encode les
* caractères spéciaux.
* @param $email
* @return string La chaîne nettoyée
*/
public static function email($email): string
{
$email = self::simpleString($email);
return filter_var($email, FILTER_SANITIZE_EMAIL);
}
/**
* Cette fonction prend un nombre entier en entrée, nettoie et retourne une version formatée de l'entier.
* Elle applique la fonction filter_var avec le filtre FILTER_SANITIZE_NUMBER_INT.
* @param int $int Le nombre entier à nettoyer et formater
* @return int Le nombre entier formaté
*/
public static function int(int $int): int
{
return filter_var($int, FILTER_SANITIZE_NUMBER_INT);
}
}

@ -1,54 +0,0 @@
<?php
namespace Config;
use PDO;
use PDOStatement;
/**
* Définit une connection à la base de données.
*/
class Connection extends PDO
{
/**
* @var PDOStatement
*/
private PDOStatement $stmt;
public function __construct(string $dsn, string $username, string $password)
{
parent::__construct($dsn, $username, $password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
/**
* Éxécute une réquête SQL.
*
* @param string $query
* @param array $parameters
* @return bool Returns `true` on success, `false` otherwise
*/
public function executeQuery(string $query, array $parameters = []): bool
{
$this->stmt = parent::prepare($query);
foreach ($parameters as $name => $value) {
$this->stmt->bindValue($name, $value[0], $value[1]);
}
return $this->stmt->execute();
}
/**
* Permet de récupère le résultat de la dernière réquête éxecuté avec
* la fonction executeQuery().
*
* @return array
*/
public function getResults(): array
{
return $this->stmt->fetchAll();
}
}

@ -1,158 +0,0 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
* $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
* $classLoader->register();
*
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Roman S. Borschel <roman@code-factory.org>
* @author Matthew Weier O'Phinney <matthew@zend.com>
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
*/
class SplClassLoader
{
private string $fileExtension = '.php';
private ?string $namespace;
private ?string $includePath;
private string $namespaceSeparator = '\\';
/**
* Creates a new <tt>SplClassLoader</tt> that loads classes of the
* specified namespace.
*
* @param string|null $ns The namespace to use.
* @param string|null $includePath
*/
public function __construct(string $ns = null, string $includePath = null)
{
$this->namespace = $ns;
$this->includePath = $includePath;
}
/**
* Sets the namespace separator used by classes in the namespace of this class loader.
*
* @param string $sep The separator to use.
*/
public function setNamespaceSeparator(string $sep): void
{
$this->namespaceSeparator = $sep;
}
/**
* Gets the namespace seperator used by classes in the namespace of this class loader.
*
* @return string
*/
public function getNamespaceSeparator(): string
{
return $this->namespaceSeparator;
}
/**
* Sets the base include path for all class files in the namespace of this class loader.
*
* @param string $includePath
*/
public function setIncludePath(string $includePath): void
{
$this->includePath = $includePath;
}
/**
* Gets the base include path for all class files in the namespace of this class loader.
*
* @return string $includePath
*/
public function getIncludePath(): string
{
return $this->includePath;
}
/**
* Sets the file extension of class files in the namespace of this class loader.
*
* @param string $fileExtension
*/
public function setFileExtension(string $fileExtension): void
{
$this->fileExtension = $fileExtension;
}
/**
* Gets the file extension of class files in the namespace of this class loader.
*
* @return string $fileExtension
*/
public function getFileExtension(): string
{
return $this->fileExtension;
}
/**
* Installs this class loader on the SPL autoload stack.
*/
public function register(): void
{
spl_autoload_register(array($this, 'loadClass'));
}
/**
* Uninstalls this class loader from the SPL autoloader stack.
*/
public function unregister(): void
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $className The name of the class to load.
* @return void
*/
public function loadClass(string $className): void
{
$concatenateNamespace = $this->namespace . $this->namespaceSeparator;
if (null === $this->namespace || str_starts_with($className, $concatenateNamespace)) {
$fileName = '';
$namespace = '';
if (false !== ($lastNsPos = strripos($className, $this->namespaceSeparator))) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace($this->namespaceSeparator, DIRECTORY_SEPARATOR, $namespace);
$fileName .= DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->fileExtension;
require_once ($this->includePath !== null ? $this->includePath . DIRECTORY_SEPARATOR : '') . $fileName;
}
}
}

@ -1,138 +0,0 @@
<?php
namespace Config;
class Validate
{
/**
* Valide une adresse e-mail en utilisant la fonction filter_var() de PHP et une
* longueur maximale définie globalement.
*
* @param string $email L'adresse e-mail à valider.
* @return bool Vrai si l'adresse e-mail est valide et respecte la longueur maximale définie, faux sinon.
*/
public static function email(String $email): bool
{
global $emailMaxLength;
return (filter_var($email, FILTER_VALIDATE_EMAIL) && strlen($email) <= $emailMaxLength);
}
/**
* Valide un pseudo en vérifiant que la longueur est suffisante, qu'il contient uniquement des
* caractères alphanumériques, et qu'il respecte la longueur maximale définie globalement.
*
* @param string $pseudo Le pseudo à valider.
* @return bool Vrai si le pseudo est valide, faux sinon.
*/
public static function login(string $login) : bool
{
global $loginMaxLength;
return (strlen($login) >= 3 && preg_match("#[a-zA-Z0-9]+#", $login) && strlen($login) <= $loginMaxLength);
}
/**
* Valide un mot de passe en vérifiant que la longueur est suffisante, qu'il contient au moins un chiffre
* et une lettre, et qu'il respecte la longueur maximale définie globalement.
*
* @param string $password Le mot de passe à valider.
* @return bool Vrai si le mot de passe est valide, faux sinon.
*/
public static function password(string $password) : bool
{
global $passwordMaxLength;
return (strlen($password) >= 8 && strlen($password) <=$passwordMaxLength &&
preg_match("/\d/", $password) && preg_match("#[a-zA-Z]+#", $password));
}
/**
* Vérifie si le mot-clé est valide.
*
* @param string $keyword Le mot-clé a vérifié.
* @return bool Vrai si le mot-clé est valide, faux sinon.
*/
public static function keyWord(string $keyword) : bool
{
global $keyWordMaxLength;
return (strlen($keyword) <= $keyWordMaxLength && strlen($keyword) >= 3);
}
/**
* Vérifie si le titre est valide.
*
* @param string $title Le titre a vérifié.
* @return bool Vrai si le titre est valide, faux sinon.
*/
public static function title(string $title) : bool
{
global $titleMaxLength;
return (strlen($title) <= $titleMaxLength && strlen($title) >= 3);
}
/**
* Vérifie si le type est valide.
*
* @param string $type Le type a vérifié.
* @return bool Vrai si le type est valide, faux sinon.
*/
public static function type(string $type) : bool
{
global $typeMaxLength;
return (strlen($type) <= $typeMaxLength && strlen($type) >=3);
}
/**
* Vérifie si la réponse est valide.
*
* @param string $response La réponse a vérifié.
* @return bool Vrai si la réponse est valide, faux sinon.
*/
public static function response(string $response) : bool
{
global $responseMaxLength;
return (strlen($response) <= $responseMaxLength);
}
/**
* Vérifie si le nom est valide.
*
* @param string $name Le nom a vérifié.
* @return bool Vrai si le nom est valide, faux sinon.
*/
public static function username(string $username): bool
{
global $usernameMaxLength;
return (strlen($username) >= 3 && preg_match("#[a-zA-Z0-9]+#", $username) && strlen($username) <= $usernameMaxLength);
}
/**
* Vérifie si la description est valide.
*
* @param string $description La description a vérifié.
* @return bool Vrai si la description est valide, faux sinon.
*/
public static function categories(array $categories): bool
{
global $categoryMaxLength;
foreach ($categories as $category) {
if (strlen($category) > $categoryMaxLength) {
return false;
}
}
return true;
}
public static function answer(string $answer): bool
{
global $answerMaxLength;
return (strlen($answer) <= $answerMaxLength);
}
}

@ -1,8 +0,0 @@
{
"name": "dorian/config",
"description": "composer for guzzle client",
"require": {
"guzzlehttp/psr7": "^2.4",
"guzzlehttp/guzzle": "^7.5"
}
}

@ -1,621 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3dca324180ba7c8b11cc23a565f02dff",
"packages": [
{
"name": "guzzlehttp/guzzle",
"version": "7.5.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba",
"reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.5",
"guzzlehttp/psr7": "^1.9 || ^2.4",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
},
"provide": {
"psr/http-client-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"ext-curl": "*",
"php-http/client-integration-tests": "^3.0",
"phpunit/phpunit": "^8.5.29 || ^9.5.23",
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"suggest": {
"ext-curl": "Required for CURL handler support",
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
},
"branch-alias": {
"dev-master": "7.5-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle is a PHP HTTP client library",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"psr-18",
"psr-7",
"rest",
"web service"
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.5.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
"type": "tidelift"
}
],
"time": "2022-08-28T15:39:27+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "1.5.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "b94b2807d85443f9719887892882d0329d1e2598"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598",
"reference": "b94b2807d85443f9719887892882d0329d1e2598",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.5.2"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
"type": "tidelift"
}
],
"time": "2022-08-28T14:55:35+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "2.4.4",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf",
"reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"ralouphie/getallheaders": "^3.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1",
"http-interop/http-factory-tests": "^0.9",
"phpunit/phpunit": "^8.5.29 || ^9.5.23"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
},
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.4.4"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
"type": "tidelift"
}
],
"time": "2023-03-09T13:19:02+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/master"
},
"time": "2020-06-29T06:28:15+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/master"
},
"time": "2019-04-30T12:38:16+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
},
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"support": {
"issues": "https://github.com/ralouphie/getallheaders/issues",
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
},
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-01-02T09:53:40+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.3.0"
}

@ -1,54 +0,0 @@
<?php
use Config\Connection;
$rep = __DIR__ . '/../';
$views['form'] = 'Views/HTML/form.php';
$views['admin'] = 'Views/HTML/admin.php';
$views['adminLogin'] = 'Views/HTML/adminLogin.php';
$views['possibleResponsesForm'] = 'Views/HTML/possibleResponsesForm.php';
$views['continue'] = 'Views/HTML/continue.php';
$views['categories'] = 'Views/HTML/categories.php';
$views['questions'] = 'Views/HTML/questions.php';
$views['responses'] = 'Views/HTML/responses.php';
$views['thanks'] = 'Views/HTML/thanks.php';
$views['error'] = 'Views/HTML/error.php';
$_SERVER['BASE_URI'] = '';
$controller['Candidate'] = 'ControllerCandidate';
$controller['Admin'] = 'ControllerAdmin';
$googleApis = "https://fonts.googleapis.com";
$googleStatic = "https://fonts.gstatic.com";
$poppins = "https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap";
$icon = "https://cdn.uca.fr/images/favicon/favicon.ico";
$logoUCA = "https://cdn.uca.fr/images/logos/logo_uca_mini_light.png";
function connect() //temoignage formulaire
{
$dsn = "mysql:host=localhost;dbname=temoignage;charset=utf8";
$login = "root";
try {
$connection = new Connection($dsn, $login, "root");
} catch (PDOException $e) {
http_response_code(404);
return http_response_code();
}
return $connection;
}
$emailMaxLength=150;
$pseudoMaxLength=50;
$passwordMaxLength=500;
$keyWordMaxLength=50;
$titleMaxLength=50;
$typeMaxLength=50;
$responseMaxLength=200;
$categoryMaxLenght=150;
$answerMaxLength=1500;

@ -1,179 +0,0 @@
<?php
namespace Controller;
use Model\ModelAdmin;
use Config\Clean;
use Config\Validate;
/**
* Permet de controller les réponses à fournir en fonction des actions passer dans l'URL
* par l'administrateur
*/
class ControllerAdmin
{
/**
* Ajoute une question grâce à son contenu et son type récupéré dans le tableau $_POST
* Si la question n'est pas une question texte, on appelle un nouveau formulaire permettant
* d'ajouter des réponses prédéfinies à la question.
*
* @return void
*/
public function addQuestion(): void
{
$type = Clean::simpleString($_POST['type']);
$idQuestion = (new ModelAdmin())->addQuestion();
if (strcmp($type, "BusinessClass\TextQuestion") == 0) {
$this->goToQuestions();
} else {
$categories = (new ModelAdmin())->getCategories();
$questionContent = $_POST['question'];
global $rep, $views;
require_once($rep.$views['possibleResponsesForm']);
}
}
/**
* Supprime une question par son id récupéré par le tableau $_POST ainsi que les possibles réponses associées
*
* @return void
*/
public function deleteQuestion(): void
{
(new ModelAdmin())->deleteQuestion();
$this->goToQuestions();
}
/**
* Ajoute une possibilité de réponse à une question, on assige également cette réponse
* à des catégories. On propose ensuite à l'utilisateur de continuer l'ajout d'autre réponses.
*
* @return void
*/
public function addResponse(): void
{
(new ModelAdmin())->addResponse();
$categories = (new ModelAdmin())->getCategories();
$idQuestion = Clean::int($_POST['idQuestion']);
$questionContent = Clean::simpleString($_POST['question']);
$type = Clean::simpleString($_POST['type']);
global $rep, $views;
require_once($rep.$views['continue']);
}
/**
* Permet de supprimer une possible réponse par son id récupéré par le tableau $_POST
*
* @return void
*/
public function deleteResponse(): void
{
(new ModelAdmin())->deleteResponse();
$this->goToQuestions();
}
/**
* Permet de proposer à l'utiliser de continuer ou non à ajouter des possibilités de réponses à l'aide
* de la fonction addResponse(). Si non, il retourne à la page d'admnistration.
*
* @return void
*/
public function continueResponse(): void
{
$choose = Clean::simpleString($_POST['choose']);
if ($choose == "Oui") {
$idQuestion = Clean::int($_POST['idQuestion']);
$categories = (new ModelAdmin())->getCategories();
$questionContent = Clean::simpleString($_POST['question']);
$type = Clean::simpleString($_POST['type']);
global $rep, $views;
require_once($rep.$views['possibleResponsesForm']);
} else {
$this->goToQuestions();
}
}
/**
* Permet de créer un nouveau formulaire avec un titre et une description.
*
* @return void
*/
public function createForm(): void
{
(new ModelAdmin())->createForm();
}
/**
* Permet d'ajouter une catégories (mot-clef) à notre application
*
* @return void
*/
public function addKeyword(): void
{
(new ModelAdmin())->addKeyword();
$this->goToCategories();
}
/**
* Permet de supprimer un mot clef qui sera récupéré par le tableau $_POST
*
* @return void
*/
public function deleteKeyword(): void
{
(new ModelAdmin())->deleteKeyword();
$this->goToCategories();
}
/**
* Permet de naviguer jusqu'à la page de gestion des catégories
*
* @return void
*/
public function goToCategories(): void
{
$categories = (new ModelAdmin())->getCategories();
global $rep, $views;
require_once($rep.$views['categories']);
}
/**
* Permet de naviguer jusqu'à la page de gestion des questions
*
* @return void
*/
public function goToQuestions(): void
{
$questions = (new ModelAdmin())->getQuestions();
global $rep, $views;
require_once($rep.$views['questions']);
}
/**
* Permet de naviguer jusqu'à la page de gestion des réponses
*
* @return void
*/
public function goToResponses(): void
{
$responsesCandidate = (new ModelAdmin())->getResponsesCandidate();
global $rep, $views;
require_once($rep.$views['responses']);
}
public function goToAdministration(): void
{
global $rep, $views;
require_once($rep.$views['admin']);
}
public function deleteResponsesCandidate(): void
{
(new ModelAdmin())->deleteResponsesCandidate();
$this->goToResponses();
}
}

@ -1,66 +0,0 @@
<?php
namespace Controller;
use Model\ModelCandidate;
use Exception;
/**
* Permet de controller les réponses à fournir en fonction des actions passer dans l'URL
* par l'utilisateur
*/
class ControllerCandidate
{
/**
* Permet de naviguer jusqu'au formulaire.
*
* @return void
*/
public function goToForm(): void
{
global $rep, $views;
$html = (new ModelCandidate())->getForm();
require_once($rep.$views['form']);
}
public function goToAdminLogin(): void
{
global $rep, $views;
require_once($rep.$views['adminLogin']);
}
/**
* Permet de finaliser la saisie du formulaire et de le soumettre.
*
* @return void
*/
public function submitForm(): void
{
(new ModelCandidate())->submitForm();
$this->goToThanks();
}
public function goToThanks(): void
{
global $rep, $views;
require_once($rep.$views['thanks']);
}
public function login() :void {
global $rep,$views;
try{
$model= new ModelCandidate();
$model->login();
if($_SESSION['role'] == "Admin") {
require_once($rep . $views['admin']);
}
else
{
require_once($rep . $views['adminLogin']);
}
} catch (Exception $e) {
$error = $e->getMessage();
require_once($rep . $views['adminLogin']);
}
}
}

@ -1,82 +0,0 @@
<?php
namespace Controller;
use Exception;
use PDOException;
use Config\Validate;
use Config\Clean;
use Config\AltoRouter;
/**
* Permet de gérer l'appel des controllers en fonction de l'action et du rôle de l'utilisateur
*/
class FrontController {
private $router;
private $rights;
public function __construct() {
$this->router = new AltoRouter();
$this->router->setBasePath($_SERVER['BASE_URI']);
$this->mapRoutes();
$this->rights = array (
'Candidate' => array('ControllerCandidate'),
'Admin' => array('ControllerCandidate','ControllerAdmin')
);
}
public function run() {
global $error,$rep,$views;
$exists=false;
$match = $this->router->match();
if ($match) {
$target = $match['target'];
$params = $match['params'];
if(!isset($_SESSION['role'])) {
$_SESSION['role'] = 'Candidate';
}
$role = Clean::simpleString($_SESSION['role']);
foreach($this->rights[$role] as $controllerName) {
if(strcmp($controllerName,$target[0])===0) {
$controllerClass = '\Controller\\' . $target[0];
$controller = new $controllerClass();
$controller->{$target[1]}($params);
$exists=true;
}
}
if(!$exists) {
$error = '403';
require_once($rep . $views['error']);
}
} else {
// no route was matched
$error = '404';
require_once($rep . $views['error']);
}
}
private function mapRoutes() {
global $controller;
$this->router->map('GET', '/', array($controller['Candidate'], 'goToForm'), 'goToForm');
$this->router->map('POST', '/submitForm', array($controller['Candidate'], 'submitForm'), 'submitForm');
$this->router->map('POST', '/addQuestion', array($controller['Admin'], 'addQuestion'), 'addQuestion');
$this->router->map('POST', '/addResponse', array($controller['Admin'], 'addResponse'), 'addResponse');
$this->router->map('POST','/continueResponse',array($controller['Admin'],'continueResponse'),'continueResponse');
$this->router->map('POST','/createForm',array($controller['Admin'],'createForm'),'createForm');
$this->router->map('POST','/addKeyword',array($controller['Admin'],'addKeyword'),'addKeyword');
$this->router->map('GET','/goToAdmin',array($controller['Admin'],'goToAdmin'),'goToAdmin');
$this->router->map('GET','/goToAdminLogin',array($controller['Candidate'],'goToAdminLogin'),'goToLogin');
$this->router->map('POST','/login',array($controller['Candidate'],'login'),'login');
$this->router->map('GET','/logout',array($controller['Admin'],'logout'),'logout');
$this->router->map('GET','/goToCategories',array($controller['Admin'],'goToCategories'),'goToCategories');
$this->router->map('GET','/goToQuestions',array($controller['Admin'],'goToQuestions'),'goToQuestions');
$this->router->map('GET','/goToResponses',array($controller['Admin'],'goToResponses'),'goToResponses');
$this->router->map('POST','/deleteQuestion',array($controller['Admin'],'deleteQuestion'),'deleteQuestion');
$this->router->map('POST','/deleteResponse',array($controller['Admin'],'deleteResponse'),'deleteResponse');
$this->router->map('POST','/deleteKeyword',array($controller['Admin'],'deleteKeyword'),'deleteKeyword');
$this->router->map('POST','/deleteResponsesCandidate',array($controller['Admin'],'deleteResponsesCandidate'),'deleteResponsesCandidate');
}
}

@ -1,13 +0,0 @@
<?php
namespace Exceptions;
use Exception;
class InexistantLoginException extends Exception
{
public function __construct()
{
parent::__construct("Identifiant inexistant");
}
}

@ -1,12 +0,0 @@
<?php
namespace Exceptions;
use Exception;
class InvalidLoginOrPasswordException extends Exception
{
public function __construct()
{
parent::__construct("Identifiant ou mot de passe invalide");
}
}

@ -1,13 +0,0 @@
<?php
namespace Exceptions;
use Exception;
class InvalidUsernameOrPasswordException extends Exception
{
public function __construct($message = "nom d'utilisateur ou mot de passe invalide", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

@ -1,35 +0,0 @@
<?php
namespace Model;
use BusinessClass\Question;
/**
* Décrit les fonctionnalités principale d'une frabique
*/
abstract class Factory
{
/**
* Permet de créer un objet grâce au retour d'une Gateway.
*
* @param array $results
*
* @return array
*/
abstract public function create(array $results): array;
/**
* Permet de récupérer les objets créer par la fonction create().
*
* @param array $results
* @param string $type
*
* @return array
*/
public static function getBuiltObjects(array $results, string $type): array
{
$type = "\\Model\\Factory" . $type;
return (new $type())->create($results);
}
}

@ -1,40 +0,0 @@
<?php
namespace Model;
use BusinessClass\Question;
use BusinessClass\TextQuestion;
/**
* Décrit une fabrique de questions
*/
class FactoryQuestion extends Factory
{
/**
* Permet de créer une liste de question en fonction du retour d'une gateway
* passer en paramètre. On prend en compte les différents type de question.
*
* @param array $results
*
* @return array
*/
public function create(array $results): array
{
$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']);
} else {
$possiblesResponses = $results[1][$i];
$content = $results[0][$i]['content'];
$categories = $results[2][$i];
$id = $results[0][$i]['id'];
$questions[] = new $results[0][$i]['type']($possiblesResponses, $content, $categories, $id);
}
}
}
return $questions;
}
}

@ -1,303 +0,0 @@
<?php
namespace Model;
use BusinessClass\Form;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use PDOException;
use Config\Validate;
use Config\Clean;
/**
* Permet de développer les fonctions appelées par le controllerAdmin pour gérer
* les actions de l'administrateur
*/
class ModelAdmin
{
private Client $client;
public function __construct(){
$this->client = new Client();
}
public function goToAdmin(): void
{
global $rep, $views;
try{
require_once($rep . $views['admin']);
} catch (PDOException $e) {
$error = $e->getMessage();
require_once($rep . $views['form']);
}
}
/**
* Permet de créer et d'ajouter une question et de retourner son ID afin de la
* reconnaitre facilement dans la suite du code.
*
* @return int
* @throws Exception
*/
public function addQuestion(): int
{
$questionContent = Clean::simpleString($_POST['question']);
$type = Clean::simpleString($_POST['type']);
try {
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');
$form = json_decode($res->getBody());
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']
);
return json_decode($res->getBody());
}
} else {
throw new Exception('Type de question invalide');
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
return -1;
}
/**
* Permet de supprimer une question du formulaire
*
* @return void
* @throws Exception
*/
public function deleteQuestion():void
{
$idQuestion = Clean::int($_POST["idQuestion"]);
$type = Clean::simpleString($_POST["type"]);
try {
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
);
if ($res->getStatusCode()!=200){
throw new Exception('DeleteQuestion failed');
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet d'ajouter une possibilité de réponse à une question en l'assignant à des catégories.
*
* @return void
* @throws Exception
*/
public function addResponse(): void
{
$idQuestion = Clean::int($_POST['idQuestion']);
$response = Clean::simpleString($_POST['response']);
$categories = Clean::simpleStringArray($_POST['categories']);
if ($categories == null) {
$categories = [];
}
try {
if(!validate::categories($categories)){
throw new Exception('Categories invalides');
}
$this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertResponseInQuestion?
response='.$response.'&
categories='.$categories.'&
$idQuestion='.$idQuestion
);
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet de supprimer une possible réponse à une question
*
* @return void
* @throws Exception
*/
public function deleteResponse(): void
{
try {
$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');
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet de créer un nouveau formulaire en précisant son titre et sa description.
*
* @return void
* @throws Exception
*/
public function createForm(): void
{
try {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
$formulaire = json_decode($res->getBody());
if (empty($formulaire)) {
$form = new Form(0, "Votre avis nous intéresse !!!", "Description de notre formulaire", array());
$this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertForm?
title='.$form->getTitle().'&
description='.$form->getDescription()
);
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet d'ajouter une nouvelle catégorie (mot-clef)
*
* @return void
* @throws Exception
*/
public function addKeyword(): void
{
$keyword = Clean::simpleString($_POST['keyword']);
try {
if(!validate::keyword($keyword)){
throw new Exception('Mot-clef invalide');
}
$this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertKeyword?
keyword='.$keyword
);
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet de supprimer une catégorie (mot-clef)
*
* @return void
* @throws Exception
*/
public function deleteKeyword(): void
{
try {
$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');
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet de récupérer toutes les catégories existantes.
*
* @return array
* @throws Exception
*/
public function getCategories(): array
{
$categories = [];
try {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllKeyword');
$res = json_decode($res->getBody());
foreach ($res as $category) {
$categories[] = $category["word"];
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
return $categories;
}
/**
* Permet de récupérer toutes les questions existantes.
*
* @return array
* @throws Exception
*/
public function getQuestions(): array
{
try {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/existsForm');
if (json_decode($res->getBody())){
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
$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
);
$questionsArray = json_decode($res->getBody());
return Factory::getBuiltObjects($questionsArray, "Question");
}else{
return array();
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet de récupérer toutes les réponses existantes.
*
* @return array
* @throws Exception
*/
public function getResponsesCandidate(): array
{
try {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getAllListResponsesOfCandidate');
$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"]
);
$results[] = json_decode($res->getBody());
}
return $results;
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet de supprimer les réponses d'une personne d'un formulaire
*
* @return void
* @throws Exception
*/
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"])
);
if ($res->getStatusCode()!=200){
throw new Exception('DeleteListResponseOfCandidate failed');
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
}

@ -1,179 +0,0 @@
<?php
namespace Model;
use Config\Clean;
use Config\Validate;
use Exception;
use Exceptions\InvalidLoginOrPasswordException;
use Exceptions\InexistantLoginException;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
/**
* Permet de développer les fonctions appelées par le controllerCandidate pour gérer
* les actions de l'utilisateur
*/
class ModelCandidate
{
private Client $client;
public function __construct(){
$this->client = new Client();
}
/**
* Permet de soumettre et d'envoyer la réponse à un formulaire.
*
* @return void
* @throws Exception
*/
public function submitForm(): void
{
$answersAndCategories = $_POST['answers'];
$dataIds = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && Clean::simpleString($_POST['action']) === 'submitForm') {
$dataIdsJson = $_POST['data_ids'];
$dataIds = json_decode($dataIdsJson);
}
$answer = [];
$category = [];
$questionsId = [];
foreach ($answersAndCategories as $answerAndCategory) {
$exploded = explode("||",$answerAndCategory);
if( count($exploded) == 3 ){
$questionsId[] = Clean::int($exploded[0]);
$answer[] = Clean::simpleString($exploded[1]);
$categs = Clean::simpleStringArray($exploded[2]);
$categs = explode("_", $categs);
array_pop($categs);
$category[] = $categs;
}
else {
$questionsId[] = array_shift($dataIds);
$answer[] = $answerAndCategory;
$category[] = [];
}
}
try {
if(!Validate::answer($answer) || !Validate::category($category)){
throw new Exception("Les réponses ne sont pas valides");
}
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
$form = json_decode($res->getBody());
$title = $form[0]["title"];
$this->client->request('POST', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/insertListResponsesOfCandidate?
id='.implode(",",$questionsId).'&
answer='.implode(",",$answer).'&
category='.implode(",",$category).'&
titleForm='.$title
);
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
/**
* Permet de récupérer le code html à afficher dans la page du formulaire,
* on récupère donc le formulaire et toutes les questions qu'il contient.
* On les traduit en code HTML puis on le retourne. On utilise une Factory
* pour récupérer les questions.
*
* @return string
* @throws Exception
*/
public function getForm(): string
{
try {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
$form = json_decode($res->getBody());
if (empty($form)) {
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']
);
$questionsTab = json_decode($res->getBody());
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
$questions = Factory::getBuiltObjects($questionsTab, "Question");
$nbQuestions = count($questions);
$time = round(($nbQuestions * 20)/60);
$html = "<div class='container mt-5'>
<div class='row d-flex justify-content-center align-items-center'>
<div class='col-md-8'>
<form id='regForm' method='post' action='submitForm'>
<h1 id='register'>$title</h1>
<div class='all-steps' id='all-steps'>";
$html .= str_repeat("<span class='step'><i class='fa'></i></span>", sizeof($questions));
$html.= "</div>";
foreach ($questions as $question) {
$html.= $question->printStrategy()."\n";
}
if (count($questions) > 0) {
$html.= "<div class='thanks-message text-center' id='text-message'> <img src='https://i.imgur.com/O18mJ1K.png' alt='text-message' width='100' class='mb-4' >
<h3>Souhaitez-vous envoyer vos réponses ?</span>
<input type='hidden' name='data_ids' value=''>
<input type='submit' value='Envoyer' id='button'>\n
<input type='hidden' name='action' value='submitForm'>
</div>
<div style='overflow:auto;' id='nextprevious'>
<div style='float:right;'>
<button type='button' id='prevBtn' onclick='nextPrev(-1)'><i class='fa fa-angle-double-left'></i></button>
<button type='button' id='nextBtn' onclick='nextPrev(1)'><i class='fa fa-angle-double-right'></i></button> </div>
</div>
</form>
</div>
</div>
</div>";
} else {
$html.= "\t\t</form>\n
\t</div>\n";
}
return $html;
}
/**
* @throws InvalidLoginOrPasswordException
* @throws InexistantLoginException
* @throws Exception
*/
public function login() :void {
global $rep,$views,$sel;
$password = Clean::simpleString($_REQUEST['password']);
$identifiant = Clean::simpleString($_REQUEST['login']);
try {
if (Validate::login($identifiant) && Validate::password($password)) {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getPasswordWithLogin?
login='.$identifiant
);
$passwordbdd = json_decode($res->getBody());
if ($passwordbdd == null) {
throw new InexistantLoginException();
}
if (password_verify($sel . $password, $passwordbdd)) {
$_SESSION['role'] = 'Admin';
} else {
$_SESSION['role'] = 'Visitor';
}
} else {
throw new InvalidLoginOrPasswordException();
}
}catch (GuzzleException $g){
throw new Exception($g->getMessage(),$g->getCode(),$g);
}
}
}

@ -1,75 +0,0 @@
.acolorba {
background-color: #006D82;
}
.logo {
width: auto;
height: 100px;
padding: 24px 0;
}
.card {
width: 450px;
margin: 0 auto;
background: white;
border-radius: 24px;
padding: 24px;
}
#main-content {
margin-right: 10px;
margin-left: 10px;
}
.content {
box-shadow: none !important;
}
input {
max-width: 350px;
padding: 12px 16px;
height: 48px;
background: #ffffff;
border: 1px solid #CACAC9;
border-radius: 12px;
color: #4A4A49;
}
h3 {
font-size: 24px;
line-height: 150%;
color: #6D6D6C;
text-align: center;
margin: 0 0 24px;
font-weight: bold;
}
body, p, span, div, a, h1, h2, h3, h4, h5, h6{
font-family: 'Barlow', sans-serif;
}
.margin-space {
margin: 12px;
}
button{
padding: 12px 32px;
background: #006D82 !important;
border-radius: 12px;
height: 48px;
border: none;
color: white;
font-weight: 700;
}
a {
text-decoration: none;
background-color: transparent;
color: #018786 !important;
margin: 10px;
font-weight: bold;
}
a:hover {
color: #006D82 !important;
}

@ -1,51 +0,0 @@
* {
margin: 0;
padding: 0;
}
body {
background-image: url('../IMAGES/background_uca.png');
background-attachment: fixed;
background-size: cover;
background-repeat: no-repeat;
font-family : 'Poppins', 'Signika', sans-serif;
}
h1 {
text-align: center;
font-weight: bold;
font-size: 200%;
padding: 1.5%;
color: white;
background-color: rgb(23,143,150);
}
:not(h1) {
color: #5e5c5c;
}
#logoUCA {
position: absolute;
padding-left: 3%;
padding-top: 2%;
}
#container {
display: flex;
flex-direction: row;
justify-content: space-around;
}
.form-center {
text-align: center;
}
.hidden-content {
visibility: hidden;
}
.button-continue {
border-radius: 10px;
width: 1rem;
color: red;
}

@ -1,95 +0,0 @@
h3 {
text-align: center;
}
h4 {
text-align: center;
font-weight: normal;
}
#container_form {
display: flex;
flex-direction: row;
justify-content: center;
margin-top: 3%;
}
#container_form h2{
padding-top: 1%;
}
#button {
margin-top: 5%;
width: 15%;
height: 3%;
margin-left: 79%;
margin-bottom: 10%;
cursor: pointer;
background-color: #ebceb2;
color: black;
border-radius: 20px;
}
#button:hover {
background-color: rgba(23, 143, 150, 0.7);
}
#container_testimony, #container_personalInfos {
display: flex;
flex-direction: column;
margin-right: 2.5%;
margin-left: 2.5%;
}
#container_personalInfos {
width: 15%;
}
#container_personalInfos .inputs {
margin-bottom: 4%;
border-radius: 10px;
height: 6%;
padding-left: 4%;
float: left;
}
#container_testimony {
width: 60%;
}
#container_testimony #description {
height: 10em;
border-radius: 20px;
padding: 3%;
font-size: 1.2em;
margin-bottom: 4%;
}
#container_testimony #video {
font-weight: bold;
}
textarea {
resize: none;
}
@media screen and (max-width: 1024px)
{
#container_form {
flex-direction: column;
align-items: center;
}
#container_personalInfos {
width: 60%;
}
#container_form #button {
margin-top: 12%;
}
#logoUCA {
display: none;
}
}

@ -1,124 +0,0 @@
body {
background: #eee
}
#regForm {
background-color: #ffffff;
margin: 0px auto;
font-family: Poppins;
padding: 40px;
border-radius: 30px;
background-color: rgba(23,143,150,0.7);
}
#register{
color: white;
}
h1 {
text-align: center;
font-family: Poppins;
}
h6 {
font-size: 1.5rem;
}
input {
padding: 10px;
width: 100%;
font-size: 17px;
font-family: Raleway;
border: 1px solid #aaaaaa;
border-radius: 10px;
-webkit-appearance: none;
}
.tab input:focus{
border:1px solid #6a1b9a !important;
outline: none;
}
input.invalid {
border:1px solid #e03a0666;
}
.tab {
display: none
}
button {
background-color: #6A1B9A;
color: #ffffff;
border: none;
border-radius: 50%;
padding: 10px 20px;
font-size: 17px;
font-family: Raleway;
cursor: pointer
}
button:hover {
opacity: 0.8
}
button:focus{
outline: none !important;
}
#prevBtn {
background-color: #bbbbbb
}
.all-steps{
text-align: center;
margin-top: 30px;
margin-bottom: 30px;
width: 100%;
display: inline-flex;
justify-content: center;
}
.step {
height: 10px;
width: 10px;
margin: 0 2px;
background-color: #bbbbbb;
border: none;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 15px;
color: #6a1b9a;
opacity: 0.5;
}
.step.active {
opacity: 1
}
.step.finish {
color: #fff;
background: green;
opacity: 1;
}
.all-steps {
text-align: center;
margin-top: 30px;
margin-bottom: 30px
}
.thanks-message {
display: none
}

File diff suppressed because it is too large Load Diff

@ -1,107 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="Views/css/styles.css" rel="stylesheet" />
<link href="Views/css/stylesForm.css" rel="stylesheet" />
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<title>Formulaire de témoignage</title>
</head>
<body>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Administration</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php?action=GoToAddTestimony">Témoignages</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5">
<div class="row d-flex justify-content-center align-items-center">
<div class="col-md-8">
<form id="regForm" method="post" action="addQuestion">
<h1 id="register">Ajout d'une question</h1>
<div class="all-steps" id="all-steps">
<span class="step"><i class="fa"></i></span>
<span class="step"><i class="fa"></i></span>
</div>
<div class="tab">
<h6>Écrivez la question : </h6>
<p>
<input placeholder="Question..." oninput="this.className = ''" name="question">
</p>
</div>
<div class="tab">
<h6>Séléctionnez le type de question souhaitée :
<br>- Text permet d'écrire la réponse librement.
<br>- ListBox permet de choisir une réponse parmi plusieurs possibilités.
<br>- CheckBox permet de choisir une ou plusieurs réponses parmi plusieurs possibilités.</h6>
<select name="type">
<p> <option value="BusinessClass\TextQuestion">Text</option> </p>
<p> <option value="BusinessClass\ListBoxQuestion">ListBox</option> </p>
<p> <option value="BusinessClass\CheckBoxQuestion">CheckBox</option> </p>
</select>
</div>
<div class="thanks-message text-center" id="text-message"> <img src="https://i.imgur.com/O18mJ1K.png" width="100" class="mb-4">
<h3>Souhaitez-vous ajouter votre question ?</h3>
<input type='submit' value='Ajouter' id='button'>
<input type='hidden' name='action' value='addQuestion'>
</div>
<div style="overflow:auto;" id="nextprevious">
<div style="float:right;">
<button type="button" id="prevBtn" onclick="nextPrev(-1)"><i class="fa fa-angle-double-left"></i></button>
<button type="button" id="nextBtn" onclick="nextPrev(1)"><i class="fa fa-angle-double-right"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
<br><br>
<footer class="py-5 bg-white">
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/js/scripts.js"></script>
</body>
</html>

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.grid-min.css">
<link rel="stylesheet" href="Views\CSS\adminLogin.css">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Barlow&display=swap" rel="stylesheet">
</head>
<body class="acolorba d-flex flex-column align-items-center">
<img src="Views\IMAGES\logoUca.png" class="logo">
<article class="card">
<main id="main-content">
<section id="content">
<form method="post" action="login" class="d-flex flex-column align-items-center">
<h3>Service d'authentification</h3>
<div id="adminRegistrationErrorPanel" class="margin-space">
<?php
if (isset($error)) {
echo $error;
}
?>
</div>
<label class="margin-space" for="login">
<input type="text" name="login" id="login" placeholder="Identifiant" required>
</label>
<label class="margin-space" for="password">
<input type="password" name="password" id="password" placeholder="Mot de passe" required>
</label>
<button class="margin-space" name="submitBtn" type="submit">Se connecter</button>
</form>
</section>
</main>
</article>
</body>
</html>

@ -1,73 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="Views/css/styles.css" rel="stylesheet" />
<link href="Views/css/stylesForm.css" rel="stylesheet" />
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<title>Formulaire de témoignage</title>
</head>
<body>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Administration</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php?action=GoToAddTestimony">Témoignages</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="text-center">
<h2>Continuer d'ajouter des possibilités de réponses ?</h2>
<form method="post" action="continueResponse">
<input name="idQuestion" type="hidden" value="<?php echo $idQuestion; ?>">
<input name="question" type="hidden" value="<?php echo $questionContent; ?>">
<input name="type" type="hidden" value="<?php echo $type; ?>">
<br>
<input type="submit" name="choose" value="Oui" style="width: 20%">
<br>
<input type="submit" name="choose" value="Non" style="width: 20%">
<input type="hidden" name="action" value="continueResponse">
</form>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/js/scripts.js"></script>
</body>
</html>

@ -1,9 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/common.css">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<body class="d-flex flex-column align-items-center">
<h1><?php echo $error ?></h1>
</body>
</html>

@ -1,45 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/styles.css" />
<link rel="stylesheet" href="Views/CSS/stylesForm.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<title>Formulaire de témoignage</title>
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
</head>
<body>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<?php echo $html; ?>
<br><br>
<footer class="py-5 bg-white">
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/JS/scripts.js"></script>
<script src="Views/JS/getData-Ids.js"></script>
</body>
</html>

@ -23,35 +23,15 @@
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
<a href="goToProfiles">Les profils intéressants</a>
</div>
<br>
<div class="form-center">
<h3>Les catégories :</h3>
<form method="post" action="addKeyword">
<label for="keyword"></label><input id="keyword" name="keyword" type="text" size="25" placeholder="...">
<input type="submit" value="Ajouter">
<input type="hidden" name="action" value="addKeyword">
</form>
<br>
<ul class="form-center">
<form method="post" action="deleteKeyword">
<?php
foreach ($categories as $category) {
?> <li><?php
echo '<form method="post" action="deleteKeyword">';
echo $category;
echo ' <input type="submit" value="Delete">';
echo ' <input type="hidden" name="idCateg" value="'.$category.'">';
echo ' <input type="hidden" name="page" value="deleteQuestion">';
echo '</form>';
}
?>
</li>
</ul>
<!-- Add profiles -->
</div>
</body>
</html>
</html>

@ -1,108 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="Views/css/styles.css" rel="stylesheet" />
<link href="Views/css/stylesForm.css" rel="stylesheet" />
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<title>Formulaire de témoignage</title>
</head>
<body>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Administration</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php?action=GoToAddTestimony">Témoignages</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5">
<div class="row d-flex justify-content-center align-items-center">
<div class="col-md-8">
<form id="regForm" method="post" action="addResponse">
<input name="idQuestion" type="hidden" value="<?php echo $idQuestion; ?>">
<input name="question" type="hidden" value="<?php echo $questionContent; ?>">
<input name="type" type="hidden" value="<?php echo $type; ?>">
<h1 id="register">Ajout de réponse possible pour votre question : <?php echo $questionContent;?> </h1>
<div class="all-steps" id="all-steps">
<span class="step"><i class="fa"></i></span>
<span class="step"><i class="fa"></i></span>
</div>
<div class="tab">
<h6>Entrez une réponse : </h6>
<p>
<input placeholder="Réponse..." oninput="this.className = ''" name="response">
</p>
</div>
<div class="tab">
<h6>Séléctionnez les catégories associées à cette réponse : </h6>
<?php foreach ($categories as $category) { ?>
<p>
<label for="category"><?php echo $category ?></label>
<input style='-webkit-appearance: checkbox;' id="category" type="checkbox" name="categories[]" value="<?php echo $category ?>">
</p>
<?php } ?>
</div>
<div class="thanks-message text-center" id="text-message"> <img src="https://i.imgur.com/O18mJ1K.png" width="100" class="mb-4">
<h3>Souhaitez-vous ajouter votre réponse ?</h3>
<input type='submit' value='Ajouter' id='button'>
<input type='hidden' name='action' value='addResponse'>
</div>
<div style="overflow:auto;" id="nextprevious">
<div style="float:right;">
<button type="button" id="prevBtn" onclick="nextPrev(-1)"><i class="fa fa-angle-double-left"></i></button>
<button type="button" id="nextBtn" onclick="nextPrev(1)"><i class="fa fa-angle-double-right"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
<br><br>
<footer class="py-5 bg-white">
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/js/scripts.js"></script>
</body>
</html>

@ -1,81 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/base.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<title>Formulaire de témoignage</title>
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
</head>
<body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<h1>Administration</h1>
<div class="form-center">
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>
<div class="form-center">
<h3>Les questions :</h3>
<br>
<form method="post" action="addQuestion">
<div>
<label for="question">Écrivez la question : </label>
<br>
<input id="question" name="question" type="text" size="70">
</div>
<div>
<br>
<label for="type">Séléctionnez le type de question souhaitée :
<br>- Text permet d'écrire la réponse librement.
<br>- ListBox permet de choisir une réponse parmi plusieurs possibilités.
<br>- CheckBox permet de choisir une ou plusieurs réponses parmi plusieurs possibilités.
</label>
<br>
<select id="type" name="type">
<option value="BusinessClass\TextQuestion">Text</option>
<option value="BusinessClass\ListBoxQuestion">ListBox</option>
<option value="BusinessClass\CheckBoxQuestion">CheckBox</option>
</select>
</div>
<br>
<input type="submit" value="Ajouter">
<input type="hidden" name="action" value="addQuestion">
</form>
<br>
<hr>
<br>
<ul class="form-center">
<?php
foreach ($questions as $question) {
?>
<form method="post" action="deleteQuestion">
<li><?php echo $question->printStrategy();
echo '<input type="submit" value="Delete">';
echo '<input type="hidden" name="idQuestion" value="'.$question->getId().'">';
echo '<input type="hidden" name="type" value="<'.get_class($question).'">';
echo '<input type="hidden" name="page" value="deleteQuestion">';
echo ' </li>';
echo '</form>';
}
?>
</ul>
</div>
</body>
</html>

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/base.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<title>Formulaire de témoignage</title>
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
</head>
<body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<h1>Administration</h1>
<div class="form-center">
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>
<div class="form-center">
<h3>Les réponses :</h3>
<br>
<div id="listResponses">
<form method="post" action="deleteResponsesCandidate">
<?php
foreach ($responsesCandidate as $response) { ?>
<i><?php echo $response[0]["date"];;?></i>
<p>Catégories associées :
<?php
echo " | ";
foreach ($response[2] as $category)
if(!empty($category)) {
echo $category[0] . " | ";
}
?>
</p>
<?php foreach ($response[1] as $questionResponses) { ?>
<p><i>Question : </i><?php echo $questionResponses["content"]; ?></p>
<p><i>Réponse : </i><?php echo $questionResponses["questionContent"]; ?></p>
<?php
} ?>
<input type="submit" value="Delete">
<input type="hidden" name="idResponseCandidate" value="<?php echo $response[0]["id"] ?>">
<input type="hidden" name="action" value="deleteResponsesCandidate">
<hr><br>
<?php
}
?>
</form>
</div>
</div>
</body>
</html>

@ -1,51 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/styles.css" />
<link rel="stylesheet" href="Views/CSS/stylesForm.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<title>Formulaire de témoignage</title>
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
</head>
<body>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<div class='container mt-5'>
<div class='row d-flex justify-content-center align-items-center'>
<div class='col-md-8'>
<div class="text-center">
<h2>Merci d'avoir participé à ce questionnaire !</h2>
<p>Nous vous recontacterons si votre profil nous intéresse.</p>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/JS/scripts.js"></script>
<script src="Views/JS/getData-Ids.js"></script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

@ -1,8 +0,0 @@
const printCategoryButton = document.querySelector('#printCategory');
printCategoryButton.addEventListener('click', printCategories);
const printQuestionButton = document.querySelector('#printQuestion');
printQuestionButton.addEventListener('click', printQuestion);
const printFormQuestionButton = document.querySelector('#addNewQuestion');
printFormQuestionButton.addEventListener('click', addQuestion);

@ -1,16 +0,0 @@
/**
* Permet d'afficher la liste des catégories en fonction
* du choix de l'utilisateur (lorsqu'il clique sur le bouton)
*/
function printCategories() {
const printCategoryButton = document.querySelector('#printCategory');
const ul = document.querySelector("#listCategories");
if(printCategoryButton.innerText === "Les catégories ▲") {
printCategoryButton.innerText = "Les catégories ▼";
ul.style.visibility = "hidden";
} else {
printCategoryButton.innerText = "Les catégories ▲";
ul.style.visibility = "visible";
}
}

@ -1,34 +0,0 @@
/**
* Permet d'afficher ou non la liste des questions en fonction
* du choix de l'utilisateur. (lorsqu'il clique sur le bouton)
*/
function printQuestion() {
const printQuestionButton = document.querySelector('#printQuestion');
const ul = document.querySelector("#listQuestions");
if(printQuestionButton.innerText === "Les questions ▲") {
printQuestionButton.innerText = "Les questions ▼";
ul.style.visibility = "hidden";
} else {
printQuestionButton.innerText = "Les questions ▲";
ul.style.visibility = "visible";
}
}
/**
* Permet d'afficher le formulaire permettant d'ajouter une question
* si l'utilisateur clique sur le bouton.
*/
function addQuestion() {
const printAddQuestionFormButton = document.querySelector('#addNewQuestion');
const form = document.querySelector('#addQuestionForm');
if(printAddQuestionFormButton.innerText === "Ajouter une question ▲") {
printAddQuestionFormButton.innerText = "Ajouter une question ▼";
form.style.visibility = "hidden";
} else {
printAddQuestionFormButton.innerText = "Ajouter une question ▲";
form.style.visibility = "visible";
}
}

@ -1,9 +0,0 @@
let dataIds = [];
let elements = document.querySelectorAll('[data-id]');
elements.forEach(function(element) {
dataIds.push(element.getAttribute('data-id'));
});
let dataIdsInput = document.querySelector('input[name="data_ids"]');
dataIdsInput.value = JSON.stringify(dataIds);

@ -1,11 +0,0 @@
let responsesAndCategories = new Map();
function addResponse() {
const response = document.querySelector('#response');
const categories = document.querySelectorAll(".categories");
responsesAndCategories.set(response.value, categories.forEach(category => console.log(category.value)));
}
const addPossiblesResponsesButton = document.querySelector('#addNewResponse');
addPossiblesResponsesButton.addEventListener('click', addResponse);

@ -1,68 +0,0 @@
var currentTab = 0;
document.addEventListener("DOMContentLoaded", function(event) {
showTab(currentTab);
});
function showTab(n) {
var x = document.getElementsByClassName("tab");
x[n].style.display = "block";
if (n == 0) {
document.getElementById("prevBtn").style.display = "none";
} else {
document.getElementById("prevBtn").style.display = "inline";
}
if (n == (x.length - 1)) {
document.getElementById("nextBtn").innerHTML = '<i class="fa fa-angle-double-right"></i>';
} else {
document.getElementById("nextBtn").innerHTML = '<i class="fa fa-angle-double-right"></i>';
}
fixStepIndicator(n)
}
function nextPrev(n) {
var x = document.getElementsByClassName("tab");
if (n == 1 && !validateForm()) return false;
x[currentTab].style.display = "none";
currentTab = currentTab + n;
if (currentTab >= x.length) {
document.getElementById("nextprevious").style.display = "none";
document.getElementById("all-steps").style.display = "none";
document.getElementById("register").style.display = "none";
document.getElementById("text-message").style.display = "block";
}
showTab(currentTab);
}
function validateForm() {
var x, y, i, valid = true;
x = document.getElementsByClassName("tab");
y = x[currentTab].getElementsByTagName("input");
for (i = 0; i < y.length; i++) {
if (y[i].value == "") {
y[i].className += " invalid";
valid = false;
}
}
if (valid) {
document.getElementsByClassName("step")[currentTab].className += " finish";
}
return valid;
}
function fixStepIndicator(n) {
var i, x = document.getElementsByClassName("step");
for (i = 0; i < x.length; i++) {
x[i].className = x[i].className.replace(" active", "");
}
x[n].className += " active";
}

@ -5,7 +5,7 @@ use Config\Autoload;
require_once(__DIR__.'/Config/Autoload.php');
require_once(__DIR__.'/Config/config.php');
require_once(__DIR__.'/Config/Autoload.php');
require_once(__DIR__.'/Config/Connection.php');
Autoload::charger();
session_start();

Loading…
Cancel
Save