<?php
ob_start();
if(!(is_readable(realpath(dirname(__FILE__).'/../').'/include/includesroutines.inc'))) {
	die('Error - Could not open or read file '.realpath(dirname(__FILE__).'/../').'/include/includesroutines.inc');
} else {
	include_once(realpath(dirname(__FILE__).'/../').'/include/includesroutines.inc');
}

$cn = db_connect();
$lng = ( isset($_REQUEST['lang']) ? 'lang='.$_REQUEST['lang'] : '');
$lngid = db_getLanguageID($cn, getLanguage());
$contlng = 'lang='.db_getLanguageShortByID($cn, $_SESSION['user_idlanguagecontent']);
$contlngid = $_SESSION['user_idlanguagecontent'];

$usr_arr = GetUserIDs();
if (!isUserAdmin() && !db_isUserAdminToPolls($cn, $usr_arr)){ 
	ob_end_flush();
	exit;
}

if (!isset($_REQUEST['r_guid']) || !isset($_REQUEST['o_guid']) || !isset($_REQUEST['skbranch'])){ 
	ob_end_flush();
	exit;
}

$r_guid = $_REQUEST['r_guid']; 
$o_guid = $_REQUEST['o_guid'];
$skbranch = $_REQUEST['skbranch'];

$version = db_getObjectFullVersion($cn, $o_guid, $skbranch, $contlngid);
$versiondescription = db_getObjectVersionDescription($cn, $o_guid, $skbranch, $contlngid);
$reportversion = db_getReportFullVersion($cn, $r_guid, $skbranch, $contlngid);

$q_st = "SELECT res_r.rft_columnname_long as reportversiondescription
			FROM `reports` 
			LEFT JOIN `resourcefromtables` res_r ON `reports`.`idreport` = res_r.`idrecord` AND res_r.`idtable` = 1102 AND res_r.idlanguage = ".$contlngid." 
			WHERE `reports`.`skbranch` = ".$skbranch." AND `reports`.`r_guid` = '".$r_guid."' 	; ";
$resarr = db_runQueryAndReturnArray($cn, $q_st);
?>
<p class="dialog-title-h2"><?php getResource("title.poll.object");?></p>
<p class="dialog-p"><?php echo /*62290 getResource("title.poll.dialog.version").': '.*/$version;?> </p>
<p class="dialog-p"><?php echo getResource("title.poll.dialog.description").': ';?> <br/>
<?php echo $versiondescription;?> </p>
<?php if ((isset($reportversion) && strlen($reportversion) > 0 ) || (isset ($resarr[ 0 ][ "reportversiondescription" ]) && strlen(trim($resarr[ 0 ][ "reportversiondescription" ])) > 0)) { ?> 
	<p class="dialog-title-h2">&nbsp;<br/></p>
	<p class="dialog-title-h2"><?php getResource("title.poll.report");?></p>
	<?php if (isset($reportversion)  && strlen($reportversion) > 0 ) { ?>
		<p class="dialog-p"><?php echo /*62290 getResource("title.poll.dialog.version").': '.*/$reportversion;?> </p>
	<?php }?>		
	<?php if (isset ($resarr[ 0 ][ "reportversiondescription" ]) && strlen(trim($resarr[ 0 ][ "reportversiondescription" ])) > 0) { ?> 
	<p class="dialog-p"><?php echo getResource("title.poll.dialog.description").': ';?> <br/>
	<?php echo $resarr[ 0 ][ "reportversiondescription" ];?> </p>
	<?php }?>		
<?php }?>	
<?php
db_disconnect($cn);
ob_end_flush();
?>