Lyanis SOUIDI
6a654ae0d7
- Ajout du blog - Ajout de la page équipe - Modification du header (style) - Modification du footer (contenu + style) - Ajout du plan du site - Ajout des mentions légales - Ajout du favicon - Ajout des balises OpenGraph - Ajout du logo GitHub
329 lines
18 KiB
PHP
329 lines
18 KiB
PHP
<?php
|
|
function age($date): int {
|
|
$date = new DateTime($date);
|
|
$now = new DateTime();
|
|
$interval = $now->diff($date);
|
|
return $interval->y;
|
|
}
|
|
|
|
try {
|
|
$error = false;
|
|
$dbh = new PDO('mysql:host=saeweb2022.souidi.fr;dbname=saeweb2022', "saeweb2022");
|
|
|
|
$url = parse_url($_SERVER["REQUEST_URI"])["path"];
|
|
|
|
if (str_ends_with($url, "/")) {
|
|
$url = substr($url, 0, -1);
|
|
}
|
|
|
|
$url = explode("/", $url);
|
|
|
|
if (end($url) == "team") {
|
|
$mode = "list";
|
|
$employees = array();
|
|
|
|
foreach($dbh->query('SELECT name, jobTitle, slug FROM employee;') as $row) {
|
|
$employees[] = $row;
|
|
}
|
|
} else {
|
|
$mode = "view";
|
|
$sth = $dbh->prepare("SELECT name, jobTitle, birthdate, email FROM employee WHERE employee.slug = ?;");
|
|
$sth->execute([end($url)]);
|
|
$employee = $sth->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (empty($employee)) {
|
|
http_response_code(404);
|
|
$error = "notfound";
|
|
}
|
|
|
|
if (isset($_GET["articles"])) {
|
|
$mode = "articles";
|
|
$sth = $dbh->prepare("SELECT article.title, article.slug, article.created_at, article.excerpt FROM article JOIN employee ON article.author=employee.id WHERE employee.slug = ? ORDER BY article.created_at DESC;");
|
|
$sth->execute([end($url)]);
|
|
$employee["articles"] = $sth->fetchAll(PDO::FETCH_ASSOC);
|
|
} else {
|
|
$employee['age'] = age($employee['birthdate']);
|
|
$sth = $dbh->prepare("SELECT social.name, social.url FROM employee_social social JOIN employee ON social.employeeId=employee.id WHERE employee.slug = ?;");
|
|
$sth->execute([end($url)]);
|
|
$employee["socials"] = $sth->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$employee['cv'] = array('formation' => array(), 'work' => array(), 'language' => array(), 'skill' => array(), 'project' => array());
|
|
if (isset($_GET["cv"])) {
|
|
$mode = "cv";
|
|
$sth = $dbh->prepare("SELECT cv.type, cv.title, cv.description, cv.link FROM cv JOIN employee ON cv.employeeId=employee.id WHERE employee.slug = ? ORDER BY cv.priority;");
|
|
$sth->execute([end($url)]);
|
|
foreach ($sth->fetchAll(PDO::FETCH_ASSOC) as $e) {
|
|
if ($e['type'] == "skill") {
|
|
$employee['cv'][$e['type']][$e['title']][] = $e['description'];
|
|
} else {
|
|
$employee['cv'][$e['type']][] = array(
|
|
'title' => $e['title'],
|
|
'description' => $e['description'],
|
|
'link' => $e['link']
|
|
);
|
|
}
|
|
}
|
|
} else {
|
|
$sth = $dbh->prepare("SELECT article.title, article.slug, article.created_at, article.excerpt FROM article JOIN employee ON article.author=employee.id WHERE employee.slug = ? ORDER BY article.created_at DESC LIMIT 2;");
|
|
$sth->execute([end($url)]);
|
|
$employee["articles"] = $sth->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$sth = $dbh->prepare("SELECT cv.title, cv.description, cv.link FROM cv JOIN employee ON cv.employeeId=employee.id WHERE employee.slug = ? AND cv.type = 'formation' ORDER BY cv.priority LIMIT 1;");
|
|
$sth->execute([end($url)]);
|
|
foreach ($sth->fetchAll(PDO::FETCH_ASSOC) as $e) {
|
|
$employee['cv']['formation'][] = array(
|
|
'title' => $e['title'],
|
|
'description' => $e['description'],
|
|
'link' => $e['link']
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
$sth = null;
|
|
}
|
|
|
|
$dbh = null;
|
|
} catch (PDOException) {
|
|
http_response_code(503);
|
|
$error = "db";
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="icon" href="../assets/img/favicon_dark.ico" media="(prefers-color-scheme: light)">
|
|
<link rel="icon" href="../assets/img/favicon_light.ico" media="(prefers-color-scheme: dark)">
|
|
<?php
|
|
if ($mode == 'list') {
|
|
echo '<title>Équipe - Elite Solar</title>';
|
|
echo '<meta property="og:title" content="Équipe - Elite Solar">';
|
|
echo '<meta name="description" content="L\équipe d\Elite Solar">';
|
|
echo '<meta property="og:description" content="L\équipe d\Elite Solar">';
|
|
} elseif ($mode == 'view') {
|
|
echo '<title>'. $employee['name'] .' - Elite Solar</title>';
|
|
echo '<meta property="og:title" content="'. $employee['name'] .' - Elite Solar">';
|
|
echo '<meta name="description" content="'. $employee['name'] .' chez Elite Solar">';
|
|
echo '<meta property="og:description" content="'. $employee['name'] .' chez Elite Solar">';
|
|
} elseif ($mode == 'articles') {
|
|
echo '<title>Articles de '. $employee['name'] .' - Elite Solar</title>';
|
|
echo '<meta property="og:title" content="Articles de '. $employee['name'] .' - Elite Solar">';
|
|
echo '<meta name="description" content="Articles de '. $employee['name'] .' chez Elite Solar">';
|
|
echo '<meta property="og:description" content="Articles de '. $employee['name'] .' chez Elite Solar">';
|
|
} elseif ($mode == 'cv') {
|
|
echo 'CV de ' . $employee['name'];
|
|
echo '<title>CV de '. $employee['name'] .' - Elite Solar</title>';
|
|
echo '<meta property="og:title" content="CV de '. $employee['name'] .' - Elite Solar">';
|
|
echo '<meta name="description" content="CV de '. $employee['name'] .'">';
|
|
echo '<meta property="og:description" content="CV de '. $employee['name'] .'">';
|
|
}
|
|
?>
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:site_name" content="Elite Solar">
|
|
<meta property="og:locale" content="fr_FR">
|
|
<link rel="stylesheet" href="../assets/css/style.css">
|
|
<link rel="stylesheet" href="../assets/css/header.css">
|
|
<link rel="stylesheet" href="../assets/css/footer.css">
|
|
<link rel="stylesheet" href="../assets/css/team.css">
|
|
<script src="../assets/js/header.js"></script>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div>
|
|
<a href="../"><img id="logo" src="../assets/img/logo_noir.png" height="60"></a>
|
|
<img id="burger-menu" alt="Menu" onclick="burgerMenu()" src="../assets/img/open-menu.svg">
|
|
<nav>
|
|
<ul id="menu" class="invisible">
|
|
<li><a href="../">Accueil</a></li>
|
|
<li><a href="../about">Qui sommes-nous ?</a></li>
|
|
<li><a href="../product">Produit</a></li>
|
|
<li><a href="../contact">Contact</a></li>
|
|
<li><a href="../faq">FAQ</a></li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
<main>
|
|
<?php
|
|
if ($error == "db") {
|
|
echo '<nav class="crumbs">
|
|
<ol>
|
|
<li class="crumb"><a href="../">Accueil</a></li> >
|
|
<li class="crumb">Équipe</li>
|
|
</ol>
|
|
</nav>
|
|
<p>Une erreur est survenue lors du chargement de la page.</p>';
|
|
} elseif ($error == "notfound") {
|
|
echo '<nav class="crumbs">
|
|
<ol>
|
|
<li class="crumb"><a href="../">Accueil</a></li> >
|
|
<li class="crumb"><a href="./">Équipe</a></li>
|
|
<li class="crumb">Employé</li>
|
|
</ol>
|
|
</nav>' .
|
|
"<h1>Page introuvable</h1>
|
|
<p>La page que vous cherchez à atteindre ne peut pas être trouvée.
|
|
Il est possible qu'elle ait été supprimée ou déplacée. Si vous avez saisi manuellement son adresse,
|
|
veuillez vérifier une éventuelle erreur de saisie.</p><br>
|
|
<p><a href='../../'>Retour à la page d'accueil</a></p>";
|
|
} else {
|
|
if ($mode == 'list') {
|
|
echo '<nav class="crumbs">
|
|
<ol>
|
|
<li class="crumb"><a href="../">Accueil</a></li> >
|
|
<li class="crumb">Équipe</li>
|
|
</ol>
|
|
</nav>' .
|
|
"<h1>Notre équipe</h1><br><div id='team'>";
|
|
foreach ($employees as $employee) {
|
|
echo '<div>
|
|
<a href="' . $employee['slug'] . '"><h2>' . $employee['name'] . '</h2></a>
|
|
<p>' . $employee['jobTitle'] . '</p>
|
|
</div>';
|
|
}
|
|
echo "</div>";
|
|
echo"<br><p id='join'>Vous souhaitez rejoindre notre équipe ? Contactez-nous par mail à l'adresse suivante : <a href='mailto:elitesolar.contact77@gmail.com'>elitesolar.contact77@gmail.com</a></p>";
|
|
} elseif ($mode == 'view') {
|
|
echo '<nav class="crumbs">
|
|
<ol>
|
|
<li class="crumb"><a href="../">Accueil</a></li> >
|
|
<li class="crumb"><a href="./">Équipe</a></li> >
|
|
<li class="crumb">' . $employee["name"] . '</li>
|
|
</ol>
|
|
</nav>' .
|
|
"<h1>" . $employee["name"] . "</h1>";
|
|
echo "<h2>" . $employee["age"] . " ans | " . $employee["jobTitle"] . "</h2>";
|
|
|
|
echo '<ul id="social">';
|
|
foreach ($employee["socials"] as $social) {
|
|
echo '<li><a target="_blank" href="https://' . $social["url"] . '"><img src="../assets/img/' . $social["name"] . '.svg" width="30" height="30" alt="' . $social["name"] . '"></a></li>';
|
|
}
|
|
echo '</ul>';
|
|
|
|
echo "<h2>Articles récents (<a href='?articles'>Voir tout</a>)</h2>";
|
|
if (empty($employee["articles"])) echo '<p>Aucun article.</p>';
|
|
echo '<ul id="articles">';
|
|
foreach ($employee["articles"] as $article) {
|
|
$date = new DateTime($article['created_at']);
|
|
echo '<li><a href="../blog/' . $article["slug"] . '">' . $article["title"] . '</a><br>
|
|
Date : ' . $date->format('d/m/Y') . '<br>
|
|
Extrait : ' . $article["excerpt"] . '</li>';
|
|
}
|
|
echo '</ul>';
|
|
|
|
echo '<div id="formation"><h2>Formation (<a href="?cv">Voir le CV</a>)</h2>';
|
|
if (empty($employee["cv"]["formation"])) echo '<p>Aucune formation enregistrée.</p>';
|
|
foreach ($employee["cv"]["formation"] as $formation) {
|
|
echo '<b>' . $formation["title"] . '</b><ul><li>' . $formation["description"] . '</li></ul>';
|
|
}
|
|
echo '</div>';
|
|
} elseif ($mode == "cv") {
|
|
echo '<nav class="crumbs">
|
|
<ol>
|
|
<li class="crumb"><a href="../">Accueil</a></li> >
|
|
<li class="crumb"><a href="./">Équipe</a></li> >
|
|
<li class="crumb"><a href="./' . end($url) . '">' . $employee["name"] . '</a></li> >
|
|
<li class="crumb">CV</li>
|
|
</ol>
|
|
</nav>' .
|
|
"<h1> CV de <a href='./" . end($url) . "'>" . $employee["name"] . "</a></h1>";
|
|
echo "<div id='cv'><div class='left'>";
|
|
|
|
echo "<h2>Informations</h2>" .
|
|
"<ul>
|
|
<li><b>Âge :</b> " . $employee["age"] . "</li>
|
|
<li><b>Adresse électronique :</b> " . $employee["email"] . "</li>";
|
|
foreach ($employee["socials"] as $social) {
|
|
if ($social["name"] == "linkedin" || $social["name"] == "github") {
|
|
echo "<li><a target='_blank' href='https://". $social['url'] ."'>" . $social["url"] . "</a></li>";
|
|
}
|
|
}
|
|
echo "</ul>";
|
|
|
|
echo '<div id="formation"><h2>Formation</h2><div>';
|
|
if (empty($employee["cv"]["formation"])) echo '<p>Aucune formation enregistrée.</p>';
|
|
foreach ($employee["cv"]["formation"] as $formation) {
|
|
echo '<b>' . $formation["title"] . '</b><ul><li>' . $formation["description"] . '</li></ul>';
|
|
}
|
|
echo '</div></div>';
|
|
|
|
echo '<div id="work"><h2>Expérience</h2><div>';
|
|
if (empty($employee["cv"]["work"])) echo '<p>Aucune expérience enregistrée.</p>';
|
|
foreach ($employee["cv"]["work"] as $work) {
|
|
echo '<b>' . $work["title"] . '</b><ul><li>' . $work["description"] . '</li></ul>';
|
|
}
|
|
echo '</div></div>';
|
|
|
|
echo '<div id="language"><h2>Langues</h2><div>';
|
|
if (empty($employee["cv"]["language"])) echo '<p>Aucune langue enregistrée.</p>';
|
|
echo '<ul>';
|
|
foreach ($employee["cv"]["language"] as $language) {
|
|
echo '<li><b>' . $language["title"] . '</b> : ' . $language["description"] . '</li>';
|
|
}
|
|
echo '</ul></div></div></div>';
|
|
|
|
echo '<div class="right"><div id="skill"><h2>Compétences</h2>';
|
|
if (empty($employee["cv"]["skill"])) echo '<div><p>Aucune compétence enregistrée.</p></div>';
|
|
while ($skill = current($employee["cv"]["skill"])) {
|
|
echo '<div><b>' . key($employee["cv"]["skill"]) . '</b><ul><li>';
|
|
echo implode('</li><li>', $skill);
|
|
echo '</li></ul></div>';
|
|
next($employee["cv"]["skill"]);
|
|
}
|
|
echo '</div>';
|
|
|
|
echo '<div id="project"><h2>Projets</h2>';
|
|
if (empty($employee["cv"]["project"])) echo '<p>Aucun projet enregistré.</p>';
|
|
foreach ($employee["cv"]["project"] as $project) {
|
|
if (empty($project["link"])) {
|
|
echo '<b>' . $project["title"] . '</b><ul><li>' . $project["description"] . '</li></ul>';
|
|
} else {
|
|
echo '<b><a target="_blank" href="' . $project["link"] . '">' . $project["title"] . '</a></b><ul><li>' . $project["description"] . '</li></ul>';
|
|
}
|
|
}
|
|
echo '</div></div></div>';
|
|
} elseif ($mode == 'articles') {
|
|
echo '<nav class="crumbs">
|
|
<ol>
|
|
<li class="crumb"><a href="../">Accueil</a></li> >
|
|
<li class="crumb"><a href="./">Équipe</a></li> >
|
|
<li class="crumb"><a href="./' . end($url) . '">' . $employee["name"] . '</a></li> >
|
|
<li class="crumb">Articles</li>
|
|
</ol>
|
|
</nav>' .
|
|
"<h1>Articles publiés par <a href='./" . end($url) . "'>" . $employee["name"] . "</a></h1>";
|
|
if (empty($employee["articles"])) echo '<p>Aucun article.</p>';
|
|
echo '<ul id="articles">';
|
|
foreach ($employee["articles"] as $article) {
|
|
$date = new DateTime($article['created_at']);
|
|
echo '<li><a href="../blog/' . $article["slug"] . '">' . $article["title"] . '</a><br>
|
|
Date : ' . $date->format('d/m/Y') . '<br>
|
|
Extrait : ' . $article["excerpt"] . '</li>';
|
|
}
|
|
echo '</ul>';
|
|
}
|
|
}
|
|
?>
|
|
</main>
|
|
<button onclick="topFunction()" id="backToTop" title="Revenir au début de la page">⬆️</button>
|
|
<footer>
|
|
<div class="content">
|
|
<div class="text">
|
|
© <?= date("Y") ?> Elite Solar
|
|
<a href="legal">Mentions légales</a>
|
|
<a href="sitemap">Plan du site</a>
|
|
</div>
|
|
<div class="social">
|
|
<a target="_blank" href="https://linkedin.com"><img src="../assets/img/linkedin.svg" width="25" height="25" alt="LinkedIn"></a>
|
|
<a target="_blank" href="https://instagram.com/elitesolar77"><img src="../assets/img/instagram.svg" width="25" height="25" alt="Instagram"></a>
|
|
<a target="_blank" href="https://www.facebook.com/profile.php?id=100089332237449"><img src="../assets/img/facebook.svg" width="25" height="25" alt="Facebook"></a>
|
|
<a target="_blank" href="https://twitter.com/EliteSolar77"><img src="../assets/img/twitter.svg" width="25" height="25" alt="Twitter"></a>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
<script src="../assets/js/script.js"></script>
|
|
</body>
|
|
</html>
|