<?php
/**
 * Manually Developed CI View - accesslogdetail_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 to view grid view of acces log details 
 *
 * @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 Accesslogdetail_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:100%; "></div>
<div id="recinfoArea"></div>

<script>

var rowid;
var dataGrid;

function createdataGrid(griddiv) {
    
    dataGrid = new dhtmlXGridObject(griddiv);//CreateGrid(dataGrid);
    dataGrid.setColSorting("na,na,na,na");
    dataGrid.setImagePath("<?php echo base_url('public/img/common/imgs/'),'/' ;?>");
    dataGrid.setHeader('Date Created','User id','Member type','IP address','Referer','Gateway','Server port','Remote port','Server name','Request method','Request uri','User agent','Mode','Data','duration');
    dataGrid.setInitWidths("150,200,200,90,300,100,90,90,120,120,300,300,70,500,100");
    dataGrid.enableMultiline(true); 
    dataGrid.enableAutoWidth(false);
    //What more should be here WCD
    
    dataGrid.attachEvent("onRowSelect", function(id,ind){ 
        rowid = id;  
        if (debug) console.log('selected grid row id in index page :-',id);
        //Following can be in a toggle function in the toolbarObj like
        //layoutBench.gridToolBar.toggleButtons('edit','deete')
        //Access control
    });
	dataGrid.attachEvent("onXLE", function() {wb.workBench.progressOff();});
	
    dataGrid.attachEvent("onXLS", function() {
		//Access control
        //showLoading(true);
        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, 10, 3, "recinfoArea");
      dataGrid.setPagingSkin("toolbar", "<?php echo $this->config->item('dhtmlx_toolbar_skin')?>");      
    <?php } ?>
    
    dataGrid.loadXML(wb.gridreloadurl);
    
    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>