<?php
/**
 * Manually Developed CI View - access_gridview.php
 *
 * @package			AIR\views
 * @version			2.7
 * @uses
 * @see
 * @copyright		2015, BizyCorp Internal Systems Development
 * @license			private, All rights reserved
 * @author			Mohamed Roshan <roshan@ekwa.com>
 *
 */
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Manually Developed CI View
 *
 *
 * This is the main view file of accesslog which generates the grid
 *
 * @package			AIR\views
 * @version			2.7
 * @uses
 * @see
 * @copyright		2015, BizyCorp Internal Systems Development
 * @license			private, All rights reserved
 * @author			Mohamed Roshan <roshan@ekwa.com>
 * @created			Jul 18, 2014 
 * @modified		
 * @modification	
 *
*/
class Access_gridview{
	// Just a dummy clas for phpdoc to catch the doc header.
}
?>


<style>
body{ margin:0;}
</style>

<div id="toolbarObj"></div>
<div id="divGrid" style="width:100%; height:98%; "></div>
<div id="recinfoArea"></div>

<script>

var rowid;
var dataGrid;

function createdataGrid(griddiv) {
    
    dataGrid = new dhtmlXGridObject(griddiv);//CreateGrid(dataGrid);
    dataGrid.setImagePath("<?php echo base_url('public/img/common/imgs/'),'/' ;?>");
    //dataGrid.setInitWidths("25,50,200,25,100,200");
    dataGrid.enableMultiline(true); 
    dataGrid.enableAutoWidth(false);
    dataGrid.attachEvent("onXLE", function(grid_obj,count) {grid_obj.detachHeader(1);grid_obj.attachHeader(
		'#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter'
    );
    wb.workBench.progressOff();grid_obj.setSizes()});
  
    dataGrid.attachEvent("onXLS", function() {
	     
	wb.workBench.progressOn();
    });

    dataGrid.init();
    dataGrid.setSkin("<?php echo $this->config->item('dhtmlx_grid_skin')?>");
    //For pagination make sure the "codebase/ext/dhtmlxgrid_pgn.js" is loaded by
    // the index.php or what ever script that loads dhtmlx stuff
    // Following avoids pagination on the local deve environment
    <?php if (ENVIRONMENT != 'development') { ?>     
      dataGrid.enablePaging(true, 25, 3, "recinfoArea");
      dataGrid.setPagingSkin("toolbar", "<?php echo $this->config->item('dhtmlx_toolbar_skin')?>");      
    <?php } ?>
    dataGrid.loadXML(wb.gridreloadurl);
    
    parent.wb.grid=dataGrid;   //Edited by WCD
    //Late binding as above cannot be done for search object by setting the 'grid' 
    //property in the workbench as it is done at addSearch() in init(). so we
    // need to bind it manualy here as follows
    var mySearch = wb.getSearch();
    mySearch.grid = dataGrid;
    
}
//Set proper grid height dynamicaly
<?php if (ENVIRONMENT == 'development') { ?>
  document.getElementById('divGrid').style.height=wb.getGridLayout().getHeight()-(wb.toolBarVar.cont.clientHeight);
<?php }else{ ?>
  document.getElementById('divGrid').style.height=wb.getGridLayout().getHeight()-(wb.toolBarVar.cont.clientHeight * 2);
<?php } ?>
createdataGrid('divGrid');
</script>