runQuery($sqlKK);
$dataKK = array();
while ($kk = $db->dbFetch()) {
$idKK = $kk['idKK'];
$namaKK = $kk['namaKK'];
$warnaLabel = $kk['warnaLabel'];
$dataKK[$idKK] = array('nama' => $namaKK, 'label' => $warnaLabel);
}
$sQuery0 = "
SELECT distinct(tr.idpraoutline),tp.*,
(SELECT nmLengkap FROM tbmhs WHERE nim=tp.nim LIMIT 1) as nm_mhs
FROM $sTable
$sWhere
$where2
$sOrder
";
//echo $sQuery0;
$db->runQuery($sQuery0);
$iFilteredTotal = $db->dbRows();
$result = $db->runQuery($sQuery0.$sLimit);
/* Total data set length */
$sQuery2 = "
SELECT COUNT(tp.id) as total FROM $sTable $sWhere $where2
";
$db->runQuery($sQuery2);
$aResultTotal = $db->dbFetch();
$iTotal = $aResultTotal['total'];
/*$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
$aResultTotal = mysql_fetch_array($rResultTotal);
$iTotal = $aResultTotal[0];*/
/*
* Output
*/
$output = array(
'sEcho' => intval($_GET['sEcho']),
'iTotalRecords' => $iTotal,
'iTotalDisplayRecords' => $iFilteredTotal,
'aaData' => array(),
);
while ($aRow = $db->dbFetch($result)) {
//print_r($aRow);
$kelompokKeahlian = ' - Tidak Ada Kelompok Keahlian';
$idKelompokKeahlian = $aRow['kelompokKeahlian'];
if (isset($dataKK[$idKelompokKeahlian])) {
$kelompokKeahlian = ' - '.$dataKK[$idKelompokKeahlian]['nama'].'';
}
$row = array();
switch ($aRow['status_usulan']) {
case '0':
$status = 'Dalam Proses';
break;
case '1':
$status = 'Judul Diterima';
break;
case '2':
$status = 'Judul Ditolak';
break;
case '3':
$status = 'Judul Gugur';
break;
}
$row[0] = $aRow['nm_mhs'].'
NIM: '.$aRow['nim'];
$row[1] = ''.$aRow['judul'].''.$badge.$kelompokKeahlian;
$row[2] = $aRow['thn_ajaran'].' - '.$aRow['semester'];
$row[3] = tanggalIndo($aRow['tgl_upload'], 'j F Y, H:i');
$row[4] = $status;
$output['aaData'][] = $row;
// print_r($row);
}
echo json_encode($output);