stany.ferer преди 5 месеца
родител
ревизия
a11244dae2
променени са 7 файла, в които са добавени 45 реда и са изтрити 34 реда
  1. 16 0
      core/class/banque.class.php
  2. 16 16
      core/class/core.class.php
  3. 3 3
      core/class/debug.class.php
  4. 1 1
      core/class/git.class.php
  5. 3 9
      core/class/icon.class.php
  6. 1 4
      core/views/_cms.menu.php
  7. 5 1
      maj/sql/maj.sql

+ 16 - 0
core/class/banque.class.php

@@ -3,6 +3,22 @@
 class banque
 {
 
+    public static function getAll()
+    {
+        db::query("SELECT "
+            . "* "
+            . "FROM " . DB_T_BANQUE_COMPTES );
+            return db::resultset();
+    }
+
+    public static function menu()
+    {
+        banque::getAll();
+        foreach (self::getAll() as $value) {
+            core::elementMenu("compte-" . $value["id"], "/compte-" . $value["id"] . ".html", $value["label"], NULL, $value["icon"]);
+        }
+    }
+    
     public static function lastArrayRecord(int $_id)
     {
         db::query("SELECT "

+ 16 - 16
core/class/core.class.php

@@ -2,7 +2,7 @@
 
 class core
 {
-    public static function ifGet(string $_string = NULL)
+    public static function ifGet(?string $_string = NULL)
     {
         if($_string == NULL){
             return (empty($_GET)) ? FALSE : TRUE;
@@ -15,7 +15,7 @@ class core
         }
     }
 
-    public static function ifPost(string $_string = NULL)
+    public static function ifPost(?string $_string = NULL)
     {
         if($_string == NULL){
             return (empty($_POST)) ? FALSE : TRUE;
@@ -28,7 +28,7 @@ class core
         }
     }
 
-    public static function ifFiles(string $_string = NULL)
+    public static function ifFiles(?string $_string = NULL)
     {
         if ($_string == NULL) {
             return (empty($_FILES)) ? FALSE : TRUE;
@@ -41,7 +41,7 @@ class core
         }
     }
 
-    public static function getGet(string $_string = NULL)
+    public static function getGet(?string $_string = NULL)
     {
         if ($_string == NULL) {
             return $_GET;
@@ -54,7 +54,7 @@ class core
         }
     }
 
-    public static function getPost(string $_string = NULL)
+    public static function getPost(?string $_string = NULL)
     {
         if ($_string == NULL) {
             return $_POST;
@@ -67,7 +67,7 @@ class core
         }
     }
 
-    public static function getFiles(string $_string = NULL)
+    public static function getFiles(?string $_string = NULL)
     {
         if ($_string == NULL) {
             return $_FILES;
@@ -80,7 +80,7 @@ class core
         }
     }
 
-    public static function isInArrayString(array $_array, string $_string, int $_exact = NULL)
+    public static function isInArrayString(array $_array, string $_string, ?int $_exact = NULL)
     {
         foreach ($_array as $value) {
             if (strripos($_string, $value) !== FALSE and $_exact == NULL) {
@@ -156,7 +156,7 @@ class core
         }
     }
 
-    public static function dateFr(string $_timestampMysql = NULL)
+    public static function dateFr(?string $_timestampMysql = NULL)
     {
         if ($_timestampMysql == NULL) {
             $Now = new DateTime('now', new DateTimeZone(TIME_ZONE));
@@ -166,7 +166,7 @@ class core
         }
     }
 
-    public static function dateFromTimestamp(int $_timestamp = NULL)
+    public static function dateFromTimestamp(?int $_timestamp = NULL)
     {
         if ($_timestamp == NULL) {
             return NULL;
@@ -205,17 +205,17 @@ class core
         }
     }
 
-    public static function elementMenu(string $_id, string $_href, string $_titre, string $_style = NULL)
+    public static function elementMenu(string $_id, string $_href, string $_titre, ?string $_style = NULL, ?string $_icon = NULL)
     {
         if (access::ifAccesss($_id)) {
             ($_style != NULL) ? $_style = ' style="' . $_style . '"' : NULL;
             echo '<li class="nav-item" style="margin:5px 0;"><a style="display:unset;" class="nav-link' . get::currentPage($_id) . '" aria-current="page"  href="' . $_href . '"' . $_style . '>';
-            echo icon::getFont(["type" => $_id, "size" => "18px"]);
+            echo (preg_match('/^compte-\d+$/', $_id)) ? icon::getFont(["type" => $_icon, "size" => "18px"]) : icon::getFont(["type" => $_id, "size" => "18px"]);
             echo ' ' . $_titre . '</a></li>';
         }
     }
 
-    public static function elementMenuLink(string $_id, string $_href, string $_titre, string $_style = NULL, string $_target = "_blank")
+    public static function elementMenuLink(string $_id, string $_href, string $_titre, ?string $_style = NULL, string $_target = "_blank")
     {
         if (access::ifAccesss($_id)) {
             ($_style != NULL) ? $_style = ' style="' . $_style . '"' : NULL;
@@ -225,7 +225,7 @@ class core
         }
     }
 
-    public static function elementMenuH6(string $_id, string $_titre, string $_style = NULL, string $_collapse = NULL)
+    public static function elementMenuH6(string $_id, string $_titre, ?string $_style = NULL, ?string $_collapse = NULL)
     {
         if (access::ifAccesss($_id)) {
             ($_style != NULL) ? $_style = $_style : NULL;
@@ -340,21 +340,21 @@ class core
         }
     }
 
-    public static function printFormSelectOption(string $_string = NULL, $_value)
+    public static function printFormSelectOption(?string $_string = NULL, $_value)
     {
         if ($_string != NULL and $_string == $_value) {
             echo " selected";
         }
     }
 
-    public static function getFormValue(string $_string = NULL)
+    public static function getFormValue(?string $_string = NULL)
     {
         if ($_string != NULL) {
             return $_string;
         }
     }
 
-    public static function printFormValue(string $_string = NULL)
+    public static function printFormValue(?string $_string = NULL)
     {
         if ($_string != NULL) {
             echo $_string;

+ 3 - 3
core/class/debug.class.php

@@ -20,7 +20,7 @@ class debug
         }
     }
     
-    public static function addFile(string $_string = NULL)
+    public static function addFile(?string $_string = NULL)
     {
         if($_string != NULL){
             $myfile = fopen(DOCUMENT_ROOT . self::typeFile($_string), "w");
@@ -28,14 +28,14 @@ class debug
         }
     }
 
-    public static function removeFile(string $_string = NULL)
+    public static function removeFile(?string $_string = NULL)
     {
         if($_string != NULL){
             unlink(DOCUMENT_ROOT . self::typeFile($_string));
         }
     }
 
-    public static function isFile(string $_string = NULL)
+    public static function isFile(?string $_string = NULL)
     {
         return file_exists(DOCUMENT_ROOT . self::typeFile($_string)) ? TRUE : FALSE;
     }

+ 1 - 1
core/class/git.class.php

@@ -2,7 +2,7 @@
 
 class git
 {   
-    public static function checkError(string $_string = NULL){
+    public static function checkError(?string $_string = NULL){
         $return = NULL;
         if($_string != NULL){
             if(strpos($_string, '-// SUCCESS //-') === TRUE){

+ 3 - 9
core/class/icon.class.php

@@ -38,16 +38,10 @@ class icon
                     return "bi bi-upload";
                     break;
             // Menu Comptes bancaires
-            case 'compte-1':
-                    return "bi bi-safe2";
-                    break;
-            case 'compte-2':
+            case 'courant':
                 return "bi bi-safe2";
-                break;
-            case 'compte-3':
-                return "bi bi-piggy-bank";
-                break;
-            case 'compte-4':
+                    break;
+            case 'epargne':
                 return "bi bi-piggy-bank";
                 break;
             case 'compte-historique-csv':

+ 1 - 4
core/views/_cms.menu.php

@@ -25,10 +25,7 @@
             (in_array(core::getGet("p"), $temp_accordion) or get::isDefautMenu($temp_accordion)) ? $_show = "show" : $_show = NULL;
             core::elementMenuH6("compte", "Comptes bancaires", NULL, "col-banque");
             echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-banque" data-parent="#accordion">';
-                core::elementMenu("compte-1", "/compte-1.html", "Banque : Compte Courant ASC");
-                core::elementMenu("compte-2", "/compte-2.html", "Banque : Compte Courant AEP");
-                core::elementMenu("compte-3", "/compte-3.html", "Banque : Livret OBNL TRIPLEX");
-                core::elementMenu("compte-4", "/compte-4.html", "Banque : Épargne financière");
+                banque::menu();
                 core::elementMenu("compte-historique-csv", "/compte-historique-csv.html", "Banque : Historique des CSV");
             echo '</ul>';
 

+ 5 - 1
maj/sql/maj.sql

@@ -1,2 +1,6 @@
 
-UPDATE `access` SET `access` = 'parametre*\r\nparametres*\r\nparametres\r\nadd-user' WHERE `access`.`id` = 3; 
+ALTER TABLE `banque_comptes` ADD `icon` TINYTEXT NULL AFTER `solde_date`; 
+UPDATE `banque_comptes` SET `icon` = 'courant' WHERE `banque_comptes`.`id` = 1; 
+UPDATE `banque_comptes` SET `icon` = 'courant' WHERE `banque_comptes`.`id` = 2; 
+UPDATE `banque_comptes` SET `icon` = 'epargne' WHERE `banque_comptes`.`id` = 3; 
+UPDATE `banque_comptes` SET `icon` = 'epargne' WHERE `banque_comptes`.`id` = 4;