<?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');
}

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


checkUserAndRedirectToLogin();

$cn = db_connect();
$lng = ( isset($_REQUEST['lang']) ? 'lang='.$_REQUEST['lang'] : '');
$lngid = db_getLanguageID($cn, getLanguage());
$lngshort = db_getLanguageShortByID($cn, $lngid);
$contlng = $lng;
$contlngid = $lngid;
if (getSetting('portal','useRights',0) == 1){
	$contlng = 'lang='.db_getLanguageShortByID($cn, $_SESSION['user_idlanguagecontent']);
	$contlngid = $_SESSION['user_idlanguagecontent'];
}

if ( getSetting('portal','useRights',0) == 1 && !IsUserLogin()){
        header("Location: ".getCurPageURLWO()."/login.php");
        ob_end_flush();
        db_disconnect($cn);
        exit;
} else if ( GetSetting('portal','useRights',0) == 0 ) {
        header("Location: ".getCurPageURLWO()."/buisnessmodel.php");
        ob_end_flush();
        db_disconnect($cn);
        exit;
}

$id = 0;

if (!isset($_REQUEST['idpollingobjectarchive']) || !isset($_REQUEST['skpolltype']) || !is_numeric($_REQUEST['idpollingobjectarchive']) || !is_numeric($_REQUEST['skpolltype'])) {
        header("Location: ".getCurPageURLWO()."/pagenotfound.php?url=".getCurPageWithEncodeParams());
        ob_end_flush();
        $oguid = null;
        exit;
}

?>
<!doctype html>
<html>
<head>
        <title><?php echo renderTitle();?></title>
        <? 
        renderCommonMeta(renderTitle()); 
        renderCommonCSS(); 
        ?>
</head>
<body>
        <div id="container">
                <div id="content" class="ui-layout-center">
                        <form name="sendForm" id="sendForm" action="" method="post" enctype="multipart/form-data">
                        <br/>
                        <br/>
                                <?php 
                                        $uav_body = '';
                                        
                                        $usr_arr = GetUserIDs();
                                        $answer = db_getUserAnswersValuesArchive($cn, $_REQUEST['idpollingobjectarchive'], $_REQUEST['skpolltype'], $usr_arr[0] );
                                        if ($answer !== NULL && is_array($answer) && sizeof($answer) > 0 && sizeof($answer[0]) > 0 ) {
                                                $uav_body = $answer[0]['uav_body'];
                                        }
                                ?>
                                <?php echo  $uav_body;?><br/>
                        </form>
                </div>
        </div>
        <?php renderFooterTemplate(); ?>
</body>
<script src="js/libs/jquery.js"></script>
<script src="js/script.js"></script>
</html>
<?php
db_disconnect($cn);
ob_end_flush(); ?>
