<?php
include_once ("_dirinfo.php");

include_once (PATH_TO_ROOT."init.php");
include_once (PATH_TO_ROOT."_ajaxManipulators/_class/class.gridData.php");
include_once(PATH_TO_ROOT.'_class/createQuestion/Question.php');


class DataMapManipulator extends GridDataManipulator
{
	public function selectAction()
	{
		$_POST['groupBy'] = '';
		unset($_POST['groupBy']);
		return parent::selectAction();	
	}
    
    public function exportAction()
    {
        //$_POST['cols'] = 'sys_name';
        //$_POST['variable'] = 'System';
        $expCol = json_decode(stripslashes($_POST['cols']));
       // $expCol[] = 'sys_name';
        
        if($_POST['RMtable'] == '_DatamapAscii')
        {
            $expCol[] = 'var_type';
        }
        else
        {
            //$expCol[] = 'field_cnt';
        }

        $_POST['cols'] = json_encode(($expCol));
        $_POST['heads'] = json_encode(($expCol));
        
        return parent::exportAction();
    }
}

$db->ChangeDatabase(DB_WARPIT_WEBCATI_BASE);
$manipulator = new DataMapManipulator($db,$_POST['RMtable']);


$comm = $_POST['action'].'Action';
if(method_exists($manipulator,$comm))
	echo $manipulator->$comm();
else 
{
	
	Echo '{success:false,error:"Unknown action!"}';	
	
}



?>