From 43c962f442165327d73756c62501ff823d43f9f3 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 31 Mar 2025 18:43:53 +0200 Subject: positions dans table page, fil d'ariane en haut, logo dans footer --- public/assets/logo-nb-et-ffn.png | Bin 0 -> 61236 bytes public/css/foot.css | 16 +++++++++++----- public/css/head.css | 10 +++++++--- public/css/main.css | 6 +----- public/css/trombinoscope.css | 4 ++++ src/controller/Director.php | 2 +- src/controller/installation.php | 18 +++++++++--------- src/model/entities/Page.php | 31 ++++++++++++++++++++++++++++++- src/view/HeaderBuilder.php | 12 ++++++++---- src/view/templates/footer.php | 5 +++-- src/view/templates/header.php | 13 ++++++++----- 11 files changed, 82 insertions(+), 35 deletions(-) create mode 100644 public/assets/logo-nb-et-ffn.png create mode 100644 public/css/trombinoscope.css diff --git a/public/assets/logo-nb-et-ffn.png b/public/assets/logo-nb-et-ffn.png new file mode 100644 index 0000000..f51ac9c Binary files /dev/null and b/public/assets/logo-nb-et-ffn.png differ diff --git a/public/css/foot.css b/public/css/foot.css index ef3291d..0e454ac 100644 --- a/public/css/foot.css +++ b/public/css/foot.css @@ -32,13 +32,13 @@ footer > div border-bottom: 2px #ff1d04 solid; } - /*-- fil d'ariane --*/ .breadcrumb { - max-width: 45%; + /*max-width: 45%;*/ /*margin-right: 10px;*/ - margin: 16px 0; /* = p */ + /*margin: 16px 0;*/ /* = p */ + padding: 10px; list-style: none; /* retirer les puces */ font-size: small; text-align: right; @@ -67,6 +67,12 @@ footer > div display: block; margin: 0 3px; }*/ + +.footer_logo img +{ + max-width: 288px; +} + .breadcrumb a { color: unset; /* ne plus hériter */ @@ -101,7 +107,7 @@ footer > div { margin: 5px 0; display: flex; - justify-content: space-around; + justify-content: center; } .logged_in button { @@ -117,4 +123,4 @@ footer > div cursor: pointer; /* curseur qui touche du doigt */ background-color: #ffff00; border-radius: 4px; -} \ No newline at end of file +} diff --git a/public/css/head.css b/public/css/head.css index b8d4c93..a718a45 100644 --- a/public/css/head.css +++ b/public/css/head.css @@ -6,17 +6,21 @@ header background-image: url('../assets/fond-piscine.jpg'); background-size: cover; /* largeur du bloc_page */ } -header > div +.empty_nav_zone { /*margin: auto;*/ /*max-width: 1200px;*/ display: flex; /*align-items: center;*/ /* conflit possible avec .social align-self */ - justify-content: space-around; + justify-content: center; } + .header-content { padding: 20px 0; + display: grid; + grid-template-columns: repeat(3, 1fr); + align-items: end; } .site_title { @@ -50,7 +54,7 @@ header a { width: 25px; background-color: #ffffffb3; - border-radius: 10px; + border-radius: 50%; } .social img:hover diff --git a/public/css/main.css b/public/css/main.css index b38f8d9..a75b8cd 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -35,7 +35,7 @@ article { /*display: flex;*/ background-color: white; - margin: 15px 15px 0 15px; + margin: 15px; padding: 0 15px; /*min-height: 150px;*/ } @@ -79,10 +79,6 @@ article .action_icon:hover justify-content: space-between; font-size: small; } -.under_an_article p -{ - margin: 5px; -} .under_an_article img { width: 24px; diff --git a/public/css/trombinoscope.css b/public/css/trombinoscope.css new file mode 100644 index 0000000..f42dad8 --- /dev/null +++ b/public/css/trombinoscope.css @@ -0,0 +1,4 @@ +article img +{ + border-radius: 50%; +} \ No newline at end of file diff --git a/src/controller/Director.php b/src/controller/Director.php index 896cde1..5ff8f47 100644 --- a/src/controller/Director.php +++ b/src/controller/Director.php @@ -62,7 +62,7 @@ class Director return true; } - public function feedObjects(array $bulk_data): void // $bulk_data = tableau de Node + private function feedObjects(array $bulk_data): void // $bulk_data = tableau de Node { // puis on les range // (attention, risque de disfonctionnement si les noeuds de 1er niveau ne sont pas récupérés en 1er dans la BDD) diff --git a/src/controller/installation.php b/src/controller/installation.php index a692618..c2b38fd 100644 --- a/src/controller/installation.php +++ b/src/controller/installation.php @@ -76,13 +76,13 @@ HTACCESS; // les informations ici ne sont pas demandées à l'utilisateur pour l'instant (on verra ça plus tard) function makeStartPage(EntityManager $entityManager){ /* -- table page -- */ - // paramètres: name_page, end_of_path, reachable, in_menu, parent - $accueil = new Page('Accueil', 'accueil', true, true, NULL); - $connection = new Page('Connexion', 'connexion', true, false, NULL); - $article = new Page('Article', 'article', true, false, NULL); - $edit_page = new Page("Modification d'une page", 'modif_page', true, false, NULL); - $new_page = new Page('Nouvelle page', 'nouvelle_page', true, false, NULL); - $edit_paths = new Page("Menu et chemins", 'menu_chemins', true, false, NULL); + // paramètres: name_page, end_of_path, reachable, in_menu, position, parent + $accueil = new Page('Accueil', 'accueil', true, true, 1, NULL); + $connection = new Page('Connexion', 'connexion', true, false, NULL, NULL); + $article = new Page('Article', 'article', true, false, NULL, NULL); + $edit_page = new Page("Modification d'une page", 'modif_page', true, false, NULL, NULL); + $new_page = new Page('Nouvelle page', 'nouvelle_page', true, false, NULL, NULL); + $edit_paths = new Page("Menu et chemins", 'menu_chemins', true, false, NULL, NULL); /* -- table node -- */ // paramètres: name_node, article_timestamp, attributes, position, parent, page, article @@ -91,7 +91,7 @@ function makeStartPage(EntityManager $entityManager){ $nav = new Node('nav', NULL, [], 1, $header, NULL, NULL); $main = new Node('main', NULL, [], 3, NULL, NULL, NULL); $footer = new Node('footer', NULL, [], 4, NULL, NULL, NULL); - $breadcrumb = new Node('breadcrumb', NULL, [], 1, $footer, NULL, NULL); + $breadcrumb = new Node('breadcrumb', NULL, [], 2, $header, NULL, NULL); $head_login = new Node('head', NULL, ["stop" => true, 'css_array' => ['body', 'head', 'nav', 'main'], 'js_array' => ['main']], 1, NULL, $connection, NULL); $login = new Node('login', NULL, [], 1, $main, $connection, NULL); $head_article = new Node('head', NULL, ['css_array' => ['body', 'head', 'nav', 'main', 'foot'], 'js_array' => ['main']], 1, NULL, $article, NULL); @@ -108,7 +108,7 @@ function makeStartPage(EntityManager $entityManager){ // paramètres: data, node $head_accueil_data = new NodeData(["description" => "Club, École de natation et Perfectionnement", "title" => "Les Nageurs Bigoudens"], $head_accueil, new ArrayCollection([$favicon])); $header_data = new NodeData(["description" => "Club, École de natation et Perfectionnement", "title" => "Les Nageurs Bigoudens", "facebook_link" => "https://www.facebook.com/nageursbigoudens29120", "instagram_link" => "https://www.instagram.com/nageursbigoudens/"], $header, new ArrayCollection([$logo, $facebook, $instagram, $fond_piscine])); - $footer_data = new NodeData(["adresse" => "17, rue Raymonde Folgoas Guillou, 29120 Pont-l’Abbé", "contact_nom" => "Les Nageurs Bigoudens", "e_mail" => "nb.secretariat@orange.fr"], $footer); + $footer_data = new NodeData(["adresse" => "17, rue Raymonde Folgoas Guillou, 29120 Pont-l’Abbé", "contact_nom" => "Les Nageurs Bigoudens", "e_mail" => "nb.secretariat@orange.fr", "logo_footer" => "assets/logo-nb-et-ffn.png"], $footer); $head_login_data = new NodeData(["description" => "Connexion", "title" => "Connexion"], $head_login, new ArrayCollection([$favicon])); $head_article_data = new NodeData(["description" => "", "title" => ""], $head_article, new ArrayCollection([$favicon])); diff --git a/src/model/entities/Page.php b/src/model/entities/Page.php index d7d8098..fbf0f27 100644 --- a/src/model/entities/Page.php +++ b/src/model/entities/Page.php @@ -32,6 +32,9 @@ class Page #[ORM\Column(type: "boolean")] private bool $in_menu; + #[ORM\Column(type: "integer", nullable: true)] // null si hors menu + private ?int $position; + #[ORM\ManyToOne(targetEntity: self::class)] #[ORM\JoinColumn(name: "parent_id", referencedColumnName: "id_page", onDelete: "SET NULL", nullable: true)] private ?self $parent = null; @@ -42,12 +45,13 @@ class Page /*#[ORM\Column(type: "json", nullable: true)] private ?array $metadata = null;*/ - public function __construct(string $name, string $eop, bool $reachable, bool $in_menu, ?Page $parent) + public function __construct(string $name, string $eop, bool $reachable, bool $in_menu, ?int $position, ?Page $parent) { $this->name_page = $name; $this->end_of_path = $eop; $this->reachable = $reachable; $this->in_menu = $in_menu; + $this->position = $position; $this->parent = $parent; $this->children = new ArrayCollection(); } @@ -73,6 +77,10 @@ class Page { return $this->in_menu; } + public function getPosition(): ?int + { + return $this->position; + } public function getParent(): ?Page { return $this->parent; @@ -93,5 +101,26 @@ class Page public function addChild(self $child): void { $this->children[] = $child; + $this->sortChildren(); + } + + // utiliser $position pour afficher les éléments dans l'ordre + private function sortChildren(): void + { + $iteration = count($this->children); + while($iteration > 1) + { + for($i = 0; $i < $iteration - 1; $i++) + { + //echo '
' . $this->children[$i]->getPosition() . ' - ' . $this->children[$i + 1]->getPosition(); + if($this->children[$i]->getPosition() > $this->children[$i + 1]->getPosition()) + { + $tmp = $this->children[$i]; + $this->children[$i] = $this->children[$i + 1]; + $this->children[$i + 1] = $tmp; + } + } + $iteration--; + } } } diff --git a/src/view/HeaderBuilder.php b/src/view/HeaderBuilder.php index 252958a..eef2663 100644 --- a/src/view/HeaderBuilder.php +++ b/src/view/HeaderBuilder.php @@ -6,20 +6,24 @@ use App\Entity\Node; class HeaderBuilder extends AbstractBuilder { private ?Node $nav = null; + private ?Node $breadcrumb = null; public function __construct(Node $node) { - // nav - // n'utilise pas useChildrenBuilder, il faudrait peut-être + // pas de useChildrenBuilder, il faudrait peut-être $children = $node->getChildren(); foreach($children as $child) { - if($child->getName() === 'nav') - { + if($child->getName() === 'nav'){ $this->nav = $child; $nav_builder = new NavBuilder($this->nav); $nav = $nav_builder->render(); } + elseif($child->getName() === 'breadcrumb'){ + $this->breadcrumb = $child; + $breadcrumb_builder = new BreadcrumbBuilder($this->breadcrumb); + $breadcrumb = $breadcrumb_builder->render(); + } } $viewFile = self::VIEWS_PATH . $node->getName() . '.php'; diff --git a/src/view/templates/footer.php b/src/view/templates/footer.php index 5af7924..a4e3544 100644 --- a/src/view/templates/footer.php +++ b/src/view/templates/footer.php @@ -1,15 +1,16 @@
- \ No newline at end of file diff --git a/src/view/templates/header.php b/src/view/templates/header.php index fa55cea..0bf4396 100644 --- a/src/view/templates/header.php +++ b/src/view/templates/header.php @@ -13,11 +13,14 @@

-
- - <?= $facebook_alt ?> - - <?= $instagram_alt ?> +
+ +
\ No newline at end of file -- cgit v1.2.3