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

include_once (PATH_TO_ROOT."init.php");

$projectId = $_POST['id_project'];
$tableName = $db->get('_Projects',$projectId,'proj_name',DB_WARPIT_WEBCATI_BASE);

$paths = ConfigLoader::loadConfig('paths');
$db->ChangeDatabase(DB_WARPIT_WEBCATI_BASE);

$sql = "SELECT loginSID FROM _www_externalLinks WHERE id_project =$projectId AND linkType = 3";
$res = $db->SQLexecute($sql);
while ($row = $db->fetchRow($res))
{
	
	
	$path = $paths['warpit_www']."survey/printQuestionnaire.php?loginSID=".$row[0]."&test=1";
}

		
$iframe = 'iMysteryPrint_'.$tableName;
echo "var p = new Ext.Panel({
	title:'Print - $tableName',
	id:'$tabId',
	iconCls:'RMicon_view_details',
	layout:'fit',
	tbar:[{
		text:'Refresh',
		iconCls:' x-tbar-loading'
		,handler: function(){
			var f = document.getElementById('$iframe');
			if(f)
				f.src = f.src
		}
	}],
	closable:true,
	/*autoLoad:{
		url:'survey/index.php',lalalala
		params:{tableName:'$tableName',projectId:$projectId}
	}*/
	html: '<iframe id=\"$iframe\" width=100% height=100% src=\"$path\"></iframe>'
});
mainTabPanel.add(p).show();
"

?>