<?php
require_once '../../../config.php';
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
	$table = 'gambar_produk';
	$primaryKey = 'id';

	
	$columns = array(
		array( 'db' => 'img', 'dt' => 1, function($i){
		    return "<img src='<?= base_url('$i');?>' width='40' style='border-radius:10px;'>";
		}),
		array( 'db' => 'nama_gambar', 'dt' => 2),	
	);
	require_once '../../../system/helpers/ssp.class.php';
	$sql_details = array(
		'user' => $_CONFIG['db']['username'],
		'pass' => $_CONFIG['db']['password'],
		'db'   => $_CONFIG['db']['name'],
		'host' => $_CONFIG['db']['host']
	);
	$joinQuery = null;
	$extraWhere = '';
	$groupBy = '';
	$having = '';
	print(json_encode(
		SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery, $extraWhere, $groupBy, $having )
	));
} else {
	exit("No direct script access allowed!");
}