public static function dumpDataCSV()
 {
     $bl = new BLogger();
     $arr = $bl->getAll();
     $arr2 = array();
     $text = '';
     foreach ($arr as $bl) {
         $new = array();
         $new['log_id'] = $bl->b_log_id;
         $new['log_time'] = $bl->b_log_time;
         $new['log_timestamp'] = $bl->b_timestamp;
         $new['user_id'] = $bl->b_log_userid;
         $new['user_name'] = $bl->b_log_username;
         $new['user_role'] = $bl->b_log_userrole;
         $new['user_ip'] = $bl->b_log_ip;
         $new['user_url'] = $bl->b_log_url;
         $exp = explode("(", $bl->b_log_user_agent);
         $new['user_device'] = $exp[0];
         $new['user_action'] = $bl->b_log_action;
         $new['user_action_note'] = $bl->b_log_keterangan;
         $arr2[] = implode(';', $new);
     }
     $fname = date("Y-m-d") . ".csv";
     $file = fopen(_PHOTOPATH . "logs/" . $fname, "w");
     foreach ($arr2 as $line) {
         fputcsv($file, explode(';', $line));
     }
     fclose($file);
 }
 public static function dumpDataJSON()
 {
     $bl = new BLogger();
     $arr = $bl->getAll();
     $arr2 = array();
     foreach ($arr as $bl) {
         $new = array();
         $new['log_id'] = $bl->b_log_id;
         $new['log_time'] = $bl->b_log_time;
         $new['log_timestamp'] = $bl->b_timestamp;
         $new['user_id'] = $bl->b_log_userid;
         $new['user_name'] = $bl->b_log_username;
         $new['user_role'] = $bl->b_log_userrole;
         $new['user_ip'] = $bl->b_log_ip;
         $new['user_url'] = $bl->b_log_url;
         $new['user_device'] = $bl->b_log_user_agent;
         $new['user_action'] = $bl->b_log_action;
         $new['user_action_note'] = $bl->b_log_keterangan;
         $arr2[] = $new;
     }
     $text = json_encode($arr2);
     $fname = date("Y-m-d") . ".json";
     $backup_file = _PHOTOPATH . "logs/" . $fname;
     $myfile = fopen($backup_file, "w") or die("Unable to open file!");
     fwrite($myfile, $text);
     fclose($myfile);
 }