From 513c1891eb60f4e40a0ac49c2d20432836f20c22 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Thu, 11 Oct 2018 14:48:18 +0200
Subject: [PATCH] FIX 8526 add structure DOM if v2

---
 apps/maarch_entreprise/index.php    |  2 +-
 src/core/models/CoreConfigModel.php | 36 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/apps/maarch_entreprise/index.php b/apps/maarch_entreprise/index.php
index 7809299dd05..abb911e3d80 100755
--- a/apps/maarch_entreprise/index.php
+++ b/apps/maarch_entreprise/index.php
@@ -355,7 +355,7 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) {
     $user = \User\models\UserModel::getByUserId(['userId' => $cookie['userId'], 'select' => ['password_modification_date', 'change_password', 'status']]);
 
     //HTML CONTENT OF ANGULAR
-    echo '<body></body>';
+    echo \SrcCore\models\CoreConfigModel::initAngularStructure();
 
     if ($user['status'] == 'ABS') {
         $_REQUEST['triggerAngular'] = 'activateUser';
diff --git a/src/core/models/CoreConfigModel.php b/src/core/models/CoreConfigModel.php
index 4c501b43a04..7a6c7f8b84c 100644
--- a/src/core/models/CoreConfigModel.php
+++ b/src/core/models/CoreConfigModel.php
@@ -203,4 +203,40 @@ class CoreConfigModel
 
         return $xmlfile;
     }
+
+    public static function getFavIcon(array $aArgs)
+    {
+        ValidatorModel::notEmpty($aArgs, ['path']);
+        ValidatorModel::stringType($aArgs, ['path']);
+
+        $customId = CoreConfigModel::getCustomId();
+
+        if (file_exists("custom/{$customId}/{$aArgs['path']}")) {
+            $path = "custom/{$customId}/{$aArgs['path']}";
+        } else {
+            $path = $aArgs['path'];
+        }
+
+        return $path;
+    }
+
+    public static function initAngularStructure()
+    {
+        $lang = CoreConfigModel::getLanguage();
+        $appName = CoreConfigModel::getApplicationName();
+        $favIconPath = CoreConfigModel::getFavIcon(["path" => "apps/maarch_entreprise/img/logo_only.svg"]);
+
+        $structure = '<!doctype html>';
+        $structure = "<html lang='{$lang}'>";
+        $structure .= '<head>';
+        $structure .= "<meta charset='utf-8'>";
+        $structure .= "<title>{$appName}</title>";
+        $structure .= "<link rel='icon' href='../../{$favIconPath}' />";
+        $structure .= '</head>';
+        $structure .= '<body>';
+        $structure .= '</body>';
+        $structure .= '</html>';
+
+        return $structure;
+    }
 }
-- 
GitLab