<?php /** * Manually Developed CI View - accesslogreport_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 accesslog as gridview report * * @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 Accesslogreport_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; var test; function createdataGrid(griddiv) { dataGrid = new dhtmlXGridObject(griddiv);//CreateGrid(dataGrid); //dataGrid.setColSorting("na,na,na,na"); //column sorting featur disabling dataGrid.setImagePath("<?php echo base_url('public/img/common/imgs/'),'/' ;?>"); //if record empty this column headings with show dataGrid.setHeader("No,Staff Name,Total Time spent on filling TS (min:sec),Total Time spent on filling TS (hr:min),Total TS added,Average time spent for a TS (min:sec)"); dataGrid.setInitWidths("50,200,100,100,100,100"); dataGrid.setColAlign("center,center,center,center,center,center"); 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 }); //Attachching Row Double clicked event to grid rows dataGrid.attachEvent("onRowDblClicked", function(rId,cInd){ if (debug) console.log('Edit grid row id : :-',rId); //getting calender input box values calendar1 = document.getElementById('startDate').value; calendar2 = document.getElementById('endDate').value; qvar = calendar1+'/'+calendar2; var url = '<?php echo site_url()?>/accesslog_controller/accessReport/accesslogdetail_wb/?startDate='+calendar1+'&endDate='+calendar2+'&staffName='+rId; if (debug) console.log('Edit form URL :-',url); var myLayout = wb.getFormLayout(); myLayout.expand(); myLayout.attachURL(url); wb.workBench.progressOn(); return true; }); //changeing tooltip in grid cell dataGrid.attachEvent("onXLE", function() { var ids = dataGrid.getAllRowIds('.'); ids = ids.split('.'); for(x=0; x<ids.length; x++){ for(y=0;y<6; y++){ dataGrid.cellById(ids[x],y).setAttribute("title","Double Click a row to see details"); } } wb.workBench.progressOff(); }); //adding search error msg to empty search result var val dataGrid.attachEvent("onFilterEnd", function(elements){ val = []; dataGrid.forEachRowA(function(id){ val[val.length] = id; }) if(val.length=="0"){ //console.log("empty"); dataGrid.addRow(dataGrid.uid(),['','No Result Found!.','',''],1); } }); //adding time sorting for columns with type time //ind -> column index //type -> sorting type (int, str, date, time) //direction -> sorting type (asc) dataGrid.attachEvent("onBeforeSorting", function(ind,type,direction){ if(type=='time'){ //a -> top cell text //b -> bottom cell text //order -> sorting type (asc) function sort_custom(a,b,order){ var n = a.split(":"); var m = b.split(":"); var nd = new Date(); nd.setMinutes(n[0]); nd.setSeconds(n[1]); var md = new Date(); md.setMinutes(m[0]); md.setSeconds(m[1]); if(order=="asc") return nd>md?1:-1; else return nd<md?1:-1; } //sort_custom -> custom sorting function //ind -> index of column dataGrid.setCustomSorting(sort_custom,ind); } return true; }); dataGrid.attachEvent("onXLE", function(grid_obj,count) { if(dhtmlToggleState){ dhtmlToggleState = !dhtmlToggleState; wb.toolBarVar.setItemImage('dhtmlSearch', 'find.png'); } wb.workBench.progressOff(); grid_obj.setSizes() }); 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>