diff options
Diffstat (limited to 'src/view/HeaderBuilder.php')
| -rw-r--r-- | src/view/HeaderBuilder.php | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/src/view/HeaderBuilder.php b/src/view/HeaderBuilder.php index 1c82368..4651418 100644 --- a/src/view/HeaderBuilder.php +++ b/src/view/HeaderBuilder.php | |||
| @@ -43,8 +43,10 @@ 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_name = $node_data->getAssetByRole('header_background')?->getFileName(); |
| 49 | $header_background = $header_background_name ? Asset::USER_PATH . $header_background_name : ''; | ||
| 48 | 50 | ||
| 49 | $keys = array_keys($social); | 51 | $keys = array_keys($social); |
| 50 | $social_networks = ''; | 52 | $social_networks = ''; |
| @@ -55,39 +57,54 @@ class HeaderBuilder extends AbstractBuilder | |||
| 55 | 57 | ||
| 56 | // boutons mode admin | 58 | // boutons mode admin |
| 57 | if($_SESSION['admin']){ | 59 | if($_SESSION['admin']){ |
| 58 | // assets dans classe editing_zone | 60 | // assets dans classe header_additional_inputs |
| 59 | $editing_zone_margin = '5px'; | 61 | $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 | $buttons_favicon = '<button id="head_favicon_open" onclick="head_favicon.open()"><img id="head_favicon_img" class="action_icon"> Favicon</button> | 62 | <button id="head_favicon_open" onclick="head_favicon.open()"><img id="head_favicon_content" class="action_icon"> Favicon</button> |
| 61 | <script>document.getElementById(\'head_favicon_img\').src = window.Config.favicon;</script> | 63 | <script>document.getElementById("head_favicon_content").src = window.Config.favicon;</script> |
| 62 | <img id="head_favicon_submit" class="action_icon hidden" src="assets/save.svg" onclick="head_favicon.submit()"> | 64 | <img id="head_favicon_submit" class="action_icon hidden" src="assets/save.svg" onclick="head_favicon.submit()"> |
| 63 | <img id="head_favicon_cancel" class="action_icon hidden" src="assets/close.svg" onclick="head_favicon.cancel()">'; | 65 | <img id="head_favicon_cancel" class="action_icon hidden" src="assets/close.svg" onclick="head_favicon.cancel()">'; |
| 64 | $buttons_background = '<button id="header_background_open" onclick="header_background.open()"><img id="header_background_img" class="background_button" src="' . $header_background . '"> Image de fond</button> | 66 | $admin_background = '<input type="file" id="header_background_input" class="hidden" accept="image/png, image/jpeg, image/gif, image/webp, image/tiff"> |
| 67 | <button id="header_background_open" onclick="header_background.open()"><img id="header_background_content" class="background_button" src="' . $header_background . '"> Image de fond</button> | ||
| 65 | <img id="header_background_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_background.submit()"> | 68 | <img id="header_background_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_background.submit()"> |
| 66 | <img id="header_background_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_background.cancel()">'; | 69 | <img id="header_background_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_background.cancel()">'; |
| 67 | 70 | ||
| 68 | // asset dans classe header_content | 71 | // asset dans classe header_content |
| 69 | $buttons_header_logo = '<img id="header_logo_open" class="action_icon" src="assets/edit.svg" onclick="header_logo.open()"> | 72 | $admin_header_logo = '<input type="file" id="header_logo_input" class="hidden" accept="image/png, image/jpeg, image/gif, image/webp, image/tiff"> |
| 73 | <img id="header_logo_open" class="action_icon" src="assets/edit.svg" onclick="header_logo.open()"> | ||
| 70 | <img id="header_logo_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_logo.submit()"> | 74 | <img id="header_logo_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_logo.submit()"> |
| 71 | <img id="header_logo_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_logo.cancel()">'; | 75 | <img id="header_logo_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_logo.cancel()">'; |
| 72 | // texte dans classe header_content | 76 | // texte dans classe header_content |
| 73 | $buttons_header_title = '<img id="header_title_open" class="action_icon" src="assets/edit.svg" onclick="header_title.open()"> | 77 | $admin_header_title = '<input type="text" id="header_title_input" class="hidden" value="' . htmlspecialchars($title ?? '') . '" size="30"> |
| 78 | <img id="header_title_open" class="action_icon" src="assets/edit.svg" onclick="header_title.open()"> | ||
| 74 | <img id="header_title_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_title.submit()"> | 79 | <img id="header_title_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_title.submit()"> |
| 75 | <img id="header_title_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_title.cancel()">'; | 80 | <img id="header_title_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_title.cancel()">'; |
| 76 | $buttons_header_description = '<img id="header_description_open" class="action_icon" src="assets/edit.svg" onclick="header_description.open()"> | 81 | $admin_header_description = '<input type="text" id="header_description_input" class="hidden" value="' . htmlspecialchars($description ?? '') . '" size="30"> |
| 82 | <img id="header_description_open" class="action_icon" src="assets/edit.svg" onclick="header_description.open()"> | ||
| 77 | <img id="header_description_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_description.submit()"> | 83 | <img id="header_description_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_description.submit()"> |
| 78 | <img id="header_description_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_description.cancel()">'; | 84 | <img id="header_description_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_description.cancel()">'; |
| 79 | 85 | ||
| 80 | //$buttons_social_networks = '<img class="action_icon" src="assets/edit.svg" onclick="editSocialNetworks()">'; | 86 | // icônes réseaux sociaux |
| 81 | $buttons_social_networks = ''; | 87 | $social_networks_inputs = '<div id="header_social_input" class="hidden">'; |
| 88 | foreach($keys as $one_key){ | ||
| 89 | $social_networks_inputs .= '<div> | ||
| 90 | <input type="text" placeholder="nom du réseau social"> | ||
| 91 | <input type="text" placeholder="lien https://..."> | ||
| 92 | <input type="file"> | ||
| 93 | </div>'; | ||
| 94 | } | ||
| 95 | $social_networks_inputs .= '</div>'; | ||
| 96 | /*$admin_social_networks = $social_networks_inputs . '<img id="header_social_open" class="action_icon" src="assets/edit.svg" onclick="header_social.open()"> | ||
| 97 | <div id="header_social_submit" class="hidden"></div> | ||
| 98 | <img id="header_social_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_social.cancel()">';*/ | ||
| 99 | $admin_social_networks = ''; | ||
| 82 | } | 100 | } |
| 83 | else{ | 101 | else{ |
| 84 | $editing_zone_margin = '0'; | 102 | $admin_favicon = ''; |
| 85 | $buttons_favicon = ''; | 103 | $admin_background = ''; |
| 86 | $buttons_background = ''; | 104 | $admin_header_logo = ''; |
| 87 | $buttons_header_logo = ''; | 105 | $admin_header_title = ''; |
| 88 | $buttons_header_title = ''; | 106 | $admin_header_description = ''; |
| 89 | $buttons_header_description = ''; | 107 | $admin_social_networks = ''; |
| 90 | $buttons_social_networks = ''; | ||
| 91 | } | 108 | } |
| 92 | 109 | ||
| 93 | ob_start(); | 110 | ob_start(); |
