<?php 
include_once("_dirinfo.php");
include_once(PATH_TO_ROOT."init.php");	
include_once(PATH_TO_ROOT."_class/class.Extjs_tree.php");
include_once(PATH_TO_ROOT."_class/class.Extjs_grid.php");


$monitorGrid = new MakeGrid();
$tabId = $_POST['uniqueTabId'];
$projectId = $_POST['id_project'];
if ($projectId) $projName = $db->get('_Projects',$projectId,'proj_name',DB_WARPIT_WEBCATI_BASE);
$tableName = '_LiveUpdateLog ';


$reqUrl = 'webcati/_ajax/liveUpdate/ajax.overview.php';

$monitorGrid = new MakeGrid();

$monitorGrid->setMainTable($tableName,DB_WARPIT_LIVEUPDATE);
$monitorGrid->selectSQL = "SELECT *, CONCAT(Firstname,' ',Surname) as userName, capi_ok_records  as goodRecordsCapi, CONCAT(tableCheckType, ' - ', tableCheckText ) as tableCheck FROM _LiveUpdateLog as a LEFT JOIN ".DB_WARPIT_WEBCATI_BASE."._Interviewer  as b ON a.user_id = b.id WHERE project_id = ".$projectId;
$monitorGrid->setReqUrl($reqUrl);
if ($projectId) $monitorGrid->setTitle('Monitor ['.$projName.']'); else $monitorGrid->setTitle('Monitor [Without project selection]');
$monitorGrid->dateDisplay = "d.m.Y H:i:s";

$monitorGrid->addConfig('iconCls','\'RM_capi_overview\'');
$monitorGrid->addConfig('id','\''.$tabId.'\'');

$monitorGrid->addColumn('dateDone','Upload done')->width(150)->type('string');

$monitorGrid->addColumn('user_id','User id')->width(50);
$monitorGrid->addColumn('userName','User')->width(150);
//let's get all records
$monitorGrid->addColumn('version_start','Version start')->width(100)->type('int');
$monitorGrid->addColumn('version_stop','Version stop')->width(100)->type('int');

$monitorGrid->addColumn('uploadNumberRecords','Uploaded records')->width(100);
$monitorGrid->addColumn('goodRecordsCapi','OK records capi')->width(100);

$monitorGrid->addColumn('tableCheck','Table check')->width(100);
$monitorGrid->addColumn('browser','Browser type')->width(300);

$monitorGrid->addColumn('fileData','')->width(0)->hidden(true);

//$monitorGrid->setExpander("<div style=\"border-width:1px; border-color:#cccccc; border-top-style:solid \"><xmp>{fileData}</xmp></div>");

echo $monitorGrid->createGrid();
echo "mainTabPanel.add($monitorGrid).show();";

?>