<div align="center">
  <p><strong>SENARAI BILIK V-BOOKING</strong></p>
  <p>&nbsp;</p>
</div>
<div align="center">
<?php

// Open the DB connection and select the DB - creates the function getCreativePagerLyte()
//include_once('JSON.php');
include_once('configurations.php');
//session_start();
// Gets the data
$id=isset($_POST['id']) ? $_POST['id'] : '';
$search=isset($_POST['search']) ? $_POST['search'] : '';
$multiple_search=isset($_POST['multiple_search']) ? $_POST['multiple_search'] : array();
$items_per_page=isset($_POST['items_per_page']) ? $_POST['items_per_page'] : '';
$sort=isset($_POST['sort']) ? $_POST['sort'] : '';
$page=isset($_POST['page']) ? $_POST['page'] : 1;
$total_items=(isset($_POST['total_items']) and $_POST['total_items']>=0) ? $_POST['total_items'] : '';
$extra_cols=isset($_POST['extra_cols']) ? $_POST['extra_cols'] : array();

// Uses the creativeTable to build the table
include_once('creativeTable.php');


$ct=new CreativeTable();

// Data Gathering
$params['sql_query']                = "SELECT id,room_name,capacity FROM mrbs_room";
$params['search']                   = $search;
$params['multiple_search']          = $multiple_search;
$params['items_per_page']           = $items_per_page;
$params['sort']                     = $sort;
$params['page']                     = $page;
$params['total_items']              = $total_items;

// Layout Configurations
$params['header']                   = ',NAMA BILIK,KAPASITI';
$params['width']                    = ',,90,70';
$params['items_per_page_init']      = '100,200,500,1000';
$arr_extra_cols[0]                  = array(1,'<input type="checkbox" id="ct_check_all" name="ct_check_all" onclick="checkAll();" />','20','<input type="checkbox" id="ct_check" name="ct_check[]" value="#COL2#" onclick="check();" />');
$arr_extra_cols[1]          = array(9,'Actions','45','<a href="javascript: funcViewadminhmer(#COL2#);"><img src="images/view.png" title="VIEW" style="margin: 0px 5px;" /></a>');





//$arr_extra_cols[1]                  = array(6,'Actions','10','<form action="foo.php" method="submit"><input name="idme" type="text" id="idme" readonly value="#COL2#" HIDDEN="HIDDEN"> <button id="viewbtn" TYPE="submit">VIEW</button></form>');
//$arr_extra_cols[1]          = array(6,'Actions','45','<form name="myform" action="foo.php" method="submit"><input name="idme" type="text" id="idme" readonly value="#COL2#" HIDDEN="HIDDEN"><a href="javascript: submitform(#COL2#)"></form><img src="images/icon-edit.gif" title="EDIT" style="margin: 0px 5px;" />');


$params['extra_cols']               = $arr_extra_cols;
//$arr_actions[0]                     = array('','-- Actions --');
//$arr_actions[1]                     = array('publish','Publish');
//$arr_actions[2]                     = array('duplicate','Duplicate');
//$arr_actions[3]                     = array('delete','Delete');
//$params['actions']                  = $arr_actions;
$params['actions_url']              = 'ctActions(\'#ID#\')';
$params['display_cols']             = 'fttttt';   // Not showing the 2º column (ID), but you can still get its the value using #COL2#

$ct->table($params);
$ct->pager = getCreativePagerLite('ct',$page,$ct->total_items,$ct->items_per_page);

// If its an ajax call
$kosong = "";
if(isset($_POST['ajax_option'])){ $kosong = $_POST['ajax_option']; 
//if($_POST['ajax_option']!=''){
    echo json_encode($ct->display($_POST['ajax_option'],true));
    exit;
}else{
    $out=$ct->display();
}
echo $out;

?></div>
