diff options
| author | polo <ordipolo@gmx.fr> | 2025-10-28 10:11:08 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-10-28 10:11:08 +0100 |
| commit | 0ac8f8d12f117e458271c961b303d3c47f4ead9d (patch) | |
| tree | 30dcd78bef194c4366f8e70c4bf85d3eba3609b9 /src/view | |
| parent | 959527bb712fcd05351d8b4b52ff17786baad454 (diff) | |
| download | cms-0ac8f8d12f117e458271c961b303d3c47f4ead9d.zip | |
classes Input plus adaptables, séparation des rôles
Diffstat (limited to 'src/view')
| -rw-r--r-- | src/view/HeaderBuilder.php | 17 | ||||
| -rw-r--r-- | src/view/templates/footer.php | 2 | ||||
| -rw-r--r-- | src/view/templates/header.php | 18 |
3 files changed, 25 insertions, 12 deletions
diff --git a/src/view/HeaderBuilder.php b/src/view/HeaderBuilder.php index ae9a888..7e3c363 100644 --- a/src/view/HeaderBuilder.php +++ b/src/view/HeaderBuilder.php | |||
| @@ -43,6 +43,7 @@ class HeaderBuilder extends AbstractBuilder | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // réseaux sociaux + logo dans l'entête | 45 | // réseaux sociaux + logo dans l'entête |
| 46 | // ?-> est l'opérateur de chainage optionnel | ||
| 46 | $header_logo = Asset::USER_PATH . $node_data->getAssetByRole('header_logo')?->getFileName() ?? ''; | 47 | $header_logo = Asset::USER_PATH . $node_data->getAssetByRole('header_logo')?->getFileName() ?? ''; |
| 47 | $header_background = Asset::USER_PATH . $node_data->getAssetByRole('header_background')?->getFileName() ?? ''; | 48 | $header_background = Asset::USER_PATH . $node_data->getAssetByRole('header_background')?->getFileName() ?? ''; |
| 48 | 49 | ||
| @@ -55,8 +56,7 @@ class HeaderBuilder extends AbstractBuilder | |||
| 55 | 56 | ||
| 56 | // boutons mode admin | 57 | // boutons mode admin |
| 57 | if($_SESSION['admin']){ | 58 | if($_SESSION['admin']){ |
| 58 | // assets dans classe editing_zone | 59 | // assets dans classe header_additional_inputs |
| 59 | $editing_zone_margin = '5px'; | ||
| 60 | $admin_favicon = '<input type="file" id="head_favicon_input" class="hidden" accept="image/png, image/jpeg, image/gif, image/webp, image/tiff, image/x-icon, image/bmp"> | 60 | $admin_favicon = '<input type="file" id="head_favicon_input" class="hidden" accept="image/png, image/jpeg, image/gif, image/webp, image/tiff, image/x-icon, image/bmp"> |
| 61 | <button id="head_favicon_open" onclick="head_favicon.open()"><img id="head_favicon_content" class="action_icon"> Favicon</button> | 61 | <button id="head_favicon_open" onclick="head_favicon.open()"><img id="head_favicon_content" class="action_icon"> Favicon</button> |
| 62 | <script>document.getElementById(\'head_favicon_content\').src = window.Config.favicon;</script> | 62 | <script>document.getElementById(\'head_favicon_content\').src = window.Config.favicon;</script> |
| @@ -83,10 +83,21 @@ class HeaderBuilder extends AbstractBuilder | |||
| 83 | <img id="header_description_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_description.cancel()">'; | 83 | <img id="header_description_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_description.cancel()">'; |
| 84 | 84 | ||
| 85 | // icônes réseaux sociaux | 85 | // icônes réseaux sociaux |
| 86 | $social_networks_inputs = '<div id="header_social_input" class="hidden">'; | ||
| 87 | foreach($keys as $one_key){ | ||
| 88 | $social_networks_inputs .= '<div> | ||
| 89 | <input type="text" placeholder="nom du réseau social"> | ||
| 90 | <input type="text" placeholder="lien https://..."> | ||
| 91 | <input type="file"> | ||
| 92 | </div>'; | ||
| 93 | } | ||
| 94 | $social_networks_inputs .= '</div>'; | ||
| 95 | /*$admin_social_networks = $social_networks_inputs . '<img id="header_social_open" class="action_icon" src="assets/edit.svg" onclick="header_social.open()"> | ||
| 96 | <div id="header_social_submit" class="hidden"></div> | ||
| 97 | <img id="header_social_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_social.cancel()">';*/ | ||
| 86 | $admin_social_networks = ''; | 98 | $admin_social_networks = ''; |
| 87 | } | 99 | } |
| 88 | else{ | 100 | else{ |
| 89 | $editing_zone_margin = '0'; | ||
| 90 | $admin_favicon = ''; | 101 | $admin_favicon = ''; |
| 91 | $admin_background = ''; | 102 | $admin_background = ''; |
| 92 | $admin_header_logo = ''; | 103 | $admin_header_logo = ''; |
diff --git a/src/view/templates/footer.php b/src/view/templates/footer.php index dc1c6cb..0bc85f5 100644 --- a/src/view/templates/footer.php +++ b/src/view/templates/footer.php | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | </div> | 17 | </div> |
| 18 | </div> | 18 | </div> |
| 19 | <div id="footer_logo"> | 19 | <div id="footer_logo"> |
| 20 | <a id="footer_logo_content" href="<?= new URL ?>"><img src="<?= $footer_logo ?? '' ?>" alt="logo_alt"></a> | 20 | <a href="<?= new URL ?>"><img id="footer_logo_content" src="<?= $footer_logo ?? '' ?>" alt="logo_alt"></a> |
| 21 | <?= $admin_footer_logo ?> | 21 | <?= $admin_footer_logo ?> |
| 22 | </div> | 22 | </div> |
| 23 | <?php if($_SESSION['admin']){ ?> | 23 | <?php if($_SESSION['admin']){ ?> |
diff --git a/src/view/templates/header.php b/src/view/templates/header.php index 4d3b323..9c74f9b 100644 --- a/src/view/templates/header.php +++ b/src/view/templates/header.php | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | <div id="nav_zone"> | 5 | <div id="nav_zone"> |
| 6 | <?= $nav ?> | 6 | <?= $nav ?> |
| 7 | </div> | 7 | </div> |
| 8 | <div> | 8 | <div class="header_additional_inputs"> |
| 9 | <div id="head_favicon" style="margin: <?= $editing_zone_margin ?>;"> | 9 | <div id="head_favicon"> |
| 10 | <?= $admin_favicon ?> | 10 | <?= $admin_favicon ?> |
| 11 | </div> | 11 | </div> |
| 12 | <div id="header_background"> | 12 | <div id="header_background"> |
| @@ -16,7 +16,7 @@ | |||
| 16 | <div class="header_content"> | 16 | <div class="header_content"> |
| 17 | <div class="header_left_col"> | 17 | <div class="header_left_col"> |
| 18 | <div id="header_logo"> | 18 | <div id="header_logo"> |
| 19 | <a id="header_logo_content" href="<?= new URL ?>"><img src="<?= $header_logo ?? '' ?>" alt="header_logo"></a> | 19 | <a href="<?= new URL ?>"><img id="header_logo_content" src="<?= $header_logo ?? '' ?>" alt="header_logo"></a> |
| 20 | <?= $admin_header_logo ?> | 20 | <?= $admin_header_logo ?> |
| 21 | </div> | 21 | </div> |
| 22 | </div> | 22 | </div> |
| @@ -25,7 +25,7 @@ | |||
| 25 | </div> | 25 | </div> |
| 26 | <div class="header_center_col"> | 26 | <div class="header_center_col"> |
| 27 | <h1 id="header_title"> | 27 | <h1 id="header_title"> |
| 28 | <a id="header_title_content" href="<?= new URL ?>"><?= htmlspecialchars($title ?? '') ?></a></span> | 28 | <a id="header_title_content" href="<?= new URL ?>"><?= htmlspecialchars($title ?? '') ?></a> |
| 29 | <?= $admin_header_title ?> | 29 | <?= $admin_header_title ?> |
| 30 | </h1> | 30 | </h1> |
| 31 | <h2 id="header_description"> | 31 | <h2 id="header_description"> |
| @@ -35,7 +35,9 @@ | |||
| 35 | </div> | 35 | </div> |
| 36 | <div class="header_right_col"> | 36 | <div class="header_right_col"> |
| 37 | <div id="header_social"> | 37 | <div id="header_social"> |
| 38 | <?= $social_networks ?> | 38 | <div id="header_social_content"> |
| 39 | <?= $social_networks ?> | ||
| 40 | </div> | ||
| 39 | <?= $admin_social_networks ?> | 41 | <?= $admin_social_networks ?> |
| 40 | </div> | 42 | </div> |
| 41 | <?= $breadcrumb ?? '' ?> | 43 | <?= $breadcrumb ?? '' ?> |
| @@ -43,12 +45,12 @@ | |||
| 43 | </div> | 45 | </div> |
| 44 | <?php if($_SESSION['admin']){ ?> | 46 | <?php if($_SESSION['admin']){ ?> |
| 45 | <script> | 47 | <script> |
| 46 | let head_favicon = new InputFile('head_favicon'); | 48 | let head_favicon = new InputFileFavicon('head_favicon'); |
| 47 | let header_background = new InputFile('header_background'); | 49 | let header_background = new InputFileHeaderBackground('header_background'); |
| 48 | let header_logo = new InputFile('header_logo'); | 50 | let header_logo = new InputFile('header_logo'); |
| 49 | let header_title = new InputText('header_title'); | 51 | let header_title = new InputText('header_title'); |
| 50 | let header_description = new InputText('header_description'); | 52 | let header_description = new InputText('header_description'); |
| 51 | let header_social = new InputFile('header_social'); | 53 | let header_social = new InputToggler('header_social'); |
| 52 | </script> | 54 | </script> |
| 53 | <?php } ?> | 55 | <?php } ?> |
| 54 | </header> \ No newline at end of file | 56 | </header> \ No newline at end of file |
