diff options
Diffstat (limited to 'src/view/HeaderBuilder.php')
| -rw-r--r-- | src/view/HeaderBuilder.php | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/src/view/HeaderBuilder.php b/src/view/HeaderBuilder.php index 44e244d..ae9a888 100644 --- a/src/view/HeaderBuilder.php +++ b/src/view/HeaderBuilder.php | |||
| @@ -45,34 +45,9 @@ class HeaderBuilder extends AbstractBuilder | |||
| 45 | // réseaux sociaux + logo dans l'entête | 45 | // réseaux sociaux + logo dans l'entête |
| 46 | $header_logo = Asset::USER_PATH . $node_data->getAssetByRole('header_logo')?->getFileName() ?? ''; | 46 | $header_logo = Asset::USER_PATH . $node_data->getAssetByRole('header_logo')?->getFileName() ?? ''; |
| 47 | $header_background = Asset::USER_PATH . $node_data->getAssetByRole('header_background')?->getFileName() ?? ''; | 47 | $header_background = Asset::USER_PATH . $node_data->getAssetByRole('header_background')?->getFileName() ?? ''; |
| 48 | |||
| 48 | $keys = array_keys($social); | 49 | $keys = array_keys($social); |
| 49 | $social_networks = ''; | 50 | $social_networks = ''; |
| 50 | |||
| 51 | // nécéssite des entrées dans la table node_asset | ||
| 52 | /*foreach($node->getNodeData()->getAssets() as $asset) | ||
| 53 | { | ||
| 54 | for($i = 0; $i < count($keys); $i++) | ||
| 55 | { | ||
| 56 | // réseaux sociaux | ||
| 57 | if(str_contains($asset->getFileName(), $keys[$i])){ | ||
| 58 | $social_networks .= '<a href="' . $social[$keys[$i]] . '" target="_blank" rel="noopener noreferrer"> | ||
| 59 | <img src="' . rtrim($asset->getFilePathMini(), '/') . '" alt="' . $keys[$i] . '_alt"></a>'; | ||
| 60 | break; | ||
| 61 | } | ||
| 62 | // logo en-tête | ||
| 63 | //if(str_contains($asset->getFileName(), 'header_logo')){ | ||
| 64 | //$header_logo = rtrim($asset->getFilePathMini(), '/'); | ||
| 65 | //break; | ||
| 66 | //} | ||
| 67 | // image de fond | ||
| 68 | //if(str_contains($asset->getFileName(), 'header_background')){ | ||
| 69 | //$header_background = rtrim($asset->getFilePath(), '/'); | ||
| 70 | //break; | ||
| 71 | //} | ||
| 72 | } | ||
| 73 | }*/ | ||
| 74 | |||
| 75 | // réseaux sociaux, chemin du ficher dans node_data à déplacer dans asset | ||
| 76 | foreach($keys as $one_key){ | 51 | foreach($keys as $one_key){ |
| 77 | $social_networks .= '<a href="' . $social[$one_key] . '" target="_blank" rel="noopener noreferrer"> | 52 | $social_networks .= '<a href="' . $social[$one_key] . '" target="_blank" rel="noopener noreferrer"> |
| 78 | <img src="assets/' . $one_key . '.svg" alt="' . $one_key . '_alt"></a>'; | 53 | <img src="assets/' . $one_key . '.svg" alt="' . $one_key . '_alt"></a>'; |
| @@ -82,37 +57,42 @@ class HeaderBuilder extends AbstractBuilder | |||
| 82 | if($_SESSION['admin']){ | 57 | if($_SESSION['admin']){ |
| 83 | // assets dans classe editing_zone | 58 | // assets dans classe editing_zone |
| 84 | $editing_zone_margin = '5px'; | 59 | $editing_zone_margin = '5px'; |
| 85 | $buttons_favicon = '<button id="head_favicon_open" onclick="head_favicon.open()"><img id="head_favicon_img" class="action_icon"> Favicon</button> | 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"> |
| 86 | <script>document.getElementById(\'head_favicon_img\').src = window.Config.favicon;</script> | 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> | ||
| 87 | <img id="head_favicon_submit" class="action_icon hidden" src="assets/save.svg" onclick="head_favicon.submit()"> | 63 | <img id="head_favicon_submit" class="action_icon hidden" src="assets/save.svg" onclick="head_favicon.submit()"> |
| 88 | <img id="head_favicon_cancel" class="action_icon hidden" src="assets/close.svg" onclick="head_favicon.cancel()">'; | 64 | <img id="head_favicon_cancel" class="action_icon hidden" src="assets/close.svg" onclick="head_favicon.cancel()">'; |
| 89 | $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> | 65 | $admin_background = '<input type="file" id="header_background_input" class="hidden" accept="image/png, image/jpeg, image/gif, image/webp, image/tiff"> |
| 66 | <button id="header_background_open" onclick="header_background.open()"><img id="header_background_content" class="background_button" src="' . $header_background . '"> Image de fond</button> | ||
| 90 | <img id="header_background_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_background.submit()"> | 67 | <img id="header_background_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_background.submit()"> |
| 91 | <img id="header_background_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_background.cancel()">'; | 68 | <img id="header_background_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_background.cancel()">'; |
| 92 | 69 | ||
| 93 | // asset dans classe header_content | 70 | // asset dans classe header_content |
| 94 | $buttons_header_logo = '<img id="header_logo_open" class="action_icon" src="assets/edit.svg" onclick="header_logo.open()"> | 71 | $admin_header_logo = '<input type="file" id="header_logo_input" class="hidden" accept="image/png, image/jpeg, image/gif, image/webp, image/tiff"> |
| 72 | <img id="header_logo_open" class="action_icon" src="assets/edit.svg" onclick="header_logo.open()"> | ||
| 95 | <img id="header_logo_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_logo.submit()"> | 73 | <img id="header_logo_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_logo.submit()"> |
| 96 | <img id="header_logo_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_logo.cancel()">'; | 74 | <img id="header_logo_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_logo.cancel()">'; |
| 97 | // texte dans classe header_content | 75 | // texte dans classe header_content |
| 98 | $buttons_header_title = '<img id="header_title_open" class="action_icon" src="assets/edit.svg" onclick="header_title.open()"> | 76 | $admin_header_title = '<input type="text" id="header_title_input" class="hidden" value="' . htmlspecialchars($title ?? '') . '" size="30"> |
| 77 | <img id="header_title_open" class="action_icon" src="assets/edit.svg" onclick="header_title.open()"> | ||
| 99 | <img id="header_title_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_title.submit()"> | 78 | <img id="header_title_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_title.submit()"> |
| 100 | <img id="header_title_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_title.cancel()">'; | 79 | <img id="header_title_cancel" class="action_icon hidden" src="assets/close.svg" onclick="header_title.cancel()">'; |
| 101 | $buttons_header_description = '<img id="header_description_open" class="action_icon" src="assets/edit.svg" onclick="header_description.open()"> | 80 | $admin_header_description = '<input type="text" id="header_description_input" class="hidden" value="' . htmlspecialchars($description ?? '') . '" size="30"> |
| 81 | <img id="header_description_open" class="action_icon" src="assets/edit.svg" onclick="header_description.open()"> | ||
| 102 | <img id="header_description_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_description.submit()"> | 82 | <img id="header_description_submit" class="action_icon hidden" src="assets/save.svg" onclick="header_description.submit()"> |
| 103 | <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()">'; |
| 104 | 84 | ||
| 105 | //$buttons_social_networks = '<img class="action_icon" src="assets/edit.svg" onclick="editSocialNetworks()">'; | 85 | // icônes réseaux sociaux |
| 106 | $buttons_social_networks = ''; | 86 | $admin_social_networks = ''; |
| 107 | } | 87 | } |
| 108 | else{ | 88 | else{ |
| 109 | $editing_zone_margin = '0'; | 89 | $editing_zone_margin = '0'; |
| 110 | $buttons_favicon = ''; | 90 | $admin_favicon = ''; |
| 111 | $buttons_background = ''; | 91 | $admin_background = ''; |
| 112 | $buttons_header_logo = ''; | 92 | $admin_header_logo = ''; |
| 113 | $buttons_header_title = ''; | 93 | $admin_header_title = ''; |
| 114 | $buttons_header_description = ''; | 94 | $admin_header_description = ''; |
| 115 | $buttons_social_networks = ''; | 95 | $admin_social_networks = ''; |
| 116 | } | 96 | } |
| 117 | 97 | ||
| 118 | ob_start(); | 98 | ob_start(); |
