stany.ferer преди 1 година
родител
ревизия
e7e08951dd
променени са 1 файла, в които са добавени 25 реда и са изтрити 0 реда
  1. 25 0
      core/class/core.class.php

+ 25 - 0
core/class/core.class.php

@@ -377,6 +377,13 @@ class core
         }
     }
 
+    public static function getFormValue(string $_string = NULL)
+    {
+        if ($_string != NULL) {
+            return $_string;
+        }
+    }
+
     public static function printFormValue(string $_string = NULL)
     {
         if ($_string != NULL) {
@@ -406,4 +413,22 @@ class core
                     WHERE TABLE_SCHEMA = '".DB_NAME."'");
         return db::single();
     }
+
+    public static function progressBarWarning(float $_num, float $_max, string $_label){
+        $pourcentage = number_format(($_num / $_max) * 100, 2);
+        if($pourcentage < 50){
+            $infos = ["color" => "bg-success"];
+        } elseif($pourcentage < 75){
+            $infos = ["color" => "bg-warning"];
+        } else {
+            $infos = ["color" => "bg-danger"];
+        }
+
+        echo '  <div class="mb-3" style="margin:10px 0;">
+                    <label class="form-label" style=""><i class="bi bi-hdd-fill" style="font-size:20px;"></i> '.$_label.' [' . core::convertBytes($_num, "o", "Go") . ' / ' . core::convertBytes($_max, "o", "Go") . ']</label>
+                    <div class="progress" role="progressbar" aria-label="Success example" aria-valuenow="'.$pourcentage.'" aria-valuemin="0" aria-valuemax="100">
+                    <div class="progress-bar '.$infos["color"].'" style="width: '.$pourcentage.'%">'.$pourcentage.'%</div>
+                    </div>
+                </div>';
+    }
 }