<?php
include_once("_dirinfo.php");
include_once(PATH_TO_ROOT."init.php");
include_once(PATH_TO_ROOT."webcati/_class/class.capiSampler.php");

$db->ChangeDatabase(DB_WARPIT_WEBCATI_BASE);
if (!$_POST['id_project']) {
	echo "{success:false,unsuccess: missing id_project";
	exit;
}
$id_proj = $_POST["id_project"];
$projName = $_POST["projName"];
$capiSampleTable = $_POST["capiSampleTable"];
$capiTable = $_POST["capiTable"];
$idCapiTable = $_POST["idCapiTable"];

$manipulator = new capiSampler($db);
$manipulator->sampleTable = $capiSampleTable;
$manipulator->idCapiTable = $idCapiTable;
$manipulator->capiTable = $capiTable;
$manipulator->id_project = $id_proj;

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

?>