Server IP : 184.154.167.98 / Your IP : 3.144.104.175 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/oficios/sis/core/controller/ |
Upload File : |
<?php // 10 de Octubre del 2014 // Model.php // @brief agrego la clase Model para reducir las lineas de los modelos class Model { public static function exists($modelname){ $fullpath = self::getFullpath($modelname); $found=false; if(file_exists($fullpath)){ $found = true; } return $found; } public static function getFullpath($modelname){ return "core/app/model/".$modelname.".php"; } public static function many($query,$aclass){ $cnt = 0; $array = array(); while($r = $query->fetch_array()){ $array[$cnt] = new $aclass; $cnt2=1; foreach ($r as $key => $v) { if($cnt2>0 && $cnt2%2==0){ $array[$cnt]->$key = $v; } $cnt2++; } $cnt++; } return $array; } ////////////////////////////////// public static function one($query,$aclass){ $cnt = 0; $found = null; $data = new $aclass; while($r = $query->fetch_array()){ $cnt=1; foreach ($r as $key => $v) { if($cnt>0 && $cnt%2==0){ $data->$key = $v; } $cnt++; } $found = $data; break; } return $found; } } ?>