<?php
include_once("_dirinfo.php");
include_once (PATH_TO_ROOT."init.php");
include_once(PATH_TO_ROOT."config.php");


class Qpanels 
{
	public function generateGridOldAction($db)
	{
		$centerPanel=" new Ext.TabPanel({
			id:'centerPanel_old',
			xtype: 'tabpanel',
			title: 'Compose panel',
			flex:1,
			items:[]
			})";
		
		return $centerPanel;
	}
	
	public function getViewAction($db)
	{
		$id_user=$_POST['id_user'];
		
		$sql=" SELECT view FROM ".DB_WARPIT_MAIN."._user WHERE id=".$id_user;
		$res= $db->SQLexecute($sql);
		$result=  $db->fetchAssoc($res);
		
		$_SESSION['user_view']=$result['view'];
		
		echo $result['view'];
	}
	
	public function setViewAction($db)
	{		
		$sql="UPDATE ".DB_WARPIT_WEBCATI_BASE."._userProperties SET view='".$_POST['view']."' WHERE id_user=".$_POST['id_user'];
		$res= $db->SQLexecute($sql);
		
		echo "true";
		
	}
	
	public function getOldViewAction($db)
	{
		
	
		echo "true";
	
	}

}

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