<?php
session_start();
include "../../../inc/config.php";


$columns = array(
	'nama_kelas',
	'keterangan',
	'kelas_kuliah_update.id'
	);

if (isset($_POST['status_filter'])) {
	
	if ($_POST['status_filter']=='all') {
		$status = '';
	} else {
		$status = " and status_error='".$_POST['status_filter']."'";
	}


	$query = $new_table->get_custom("select kelas_kuliah_update.* from kelas_kuliah_update where kelas_kuliah_update.id is not null $status ",$columns);
} else {
	$query = $new_table->get_custom("select kelas_kuliah_update.* from kelas_kuliah_update ",$columns);

}


$data = array();
foreach ($query	as $value) {

	$ResultData = array();
	$ResultData[] = "<input type='checkbox'  class='deleteRow' value='".$value->id."'/>";
	$ResultData[] = $value->nama_kelas;
	$ResultData[] = $value->id_neo_feeder;
	if ($value->status_error==1) {
		$ResultData[] = '<button rel="tooltip" type="button" class="btn btn-xs btn-success" data-toggle="tooltip" data-placement="left" title="" data-original-title="Sukses"><i class="fa fa-info-circle"></i></button> '.$value->status_error;
	} elseif ($value->status_error==0) {
		$ResultData[] = '<button rel="tooltip" type="button" class="btn btn-xs btn-warning tips" data-toggle="tooltip" data-placement="left" title="Belum diproses" data-original-title="Belum diproses"><i class="fa fa-info-circle"></i></button> '.$value->status_error;
	} else {
		$ResultData[] = '<button rel="tooltip" type="button" class="btn btn-xs btn-danger" data-toggle="tooltip" data-placement="left" title="'.$value->keterangan.'" data-original-title="'.$value->keterangan.'"><i class="fa fa-info-circle"></i></button> '.$value->status_error;
	}
	$ResultData[] = $value->keterangan;
	$ResultData[] = $value->id;

	$data[] = $ResultData;
}
//set data
$new_table->set_data($data);
//create our json
$new_table->create_data();
