Utils.php (1132B)
1 <?php 2 3 class Utils 4 { 5 public static function missing_fields($post, $not_nullable) 6 { 7 $missing = []; 8 foreach($not_nullable as $column) { 9 if($post[$column] == null || $post[$column] == "") { 10 $missing[$column] = "This field cannot be empty!"; 11 } 12 } 13 return $missing; 14 } 15 16 public function create_permission_radials(): string 17 { 18 $db = new Lollipop\SQLDatabase("86.92.67.21", "friedel", "hailiwa", "lollipop"); 19 //select the available permissions from the database 20 $all_p = $db->all(Permissions::class); 21 $radials = ""; 22 foreach($all_p as $db_permission) { 23 $radials .= "<div class=\"mb-3 form-check\"> 24 <input type=\"checkbox\" class=\"form-check-input\" name=\"permissions[]\" value=" . $db_permission->id . "\"> 25 <input type='hidden' value='-1' name='{$db_permission->name}'> 26 <label class=\"form-check-label\" for=" . $db_permission->name . ">" . $db_permission->name . "</label> 27 </div> "; 28 } 29 return $radials; 30 } 31 }