<?php

$table_name67="Aprocess2";
$table_name100="signin2";
$table_name101="sig_map";
$table_name102="sig_map_text";
include("../../../admin/GoTool/cat.inc");
$connection = @mysqli_connect($host,$user,$password) or die(mysqli_error($connection));
$db = @mysqli_select_db($connection,$db_name) or die(mysqli_error($connection));
     
//$survey_idR=$_POST['survey_id'];
$stringSS=$_POST['stringSS'];
$stringMS=$_POST['stringMS'];
//echo "$stringSS & $stringMS";

    $pic88a=$_POST['pic88'];
    $firstn=$_POST['first'];
    $lastn=$_POST['last'];

    $pic88a=$_POST['pic88'];
    $firstn=$_POST['first'];
    $lastn=$_POST['last'];
 $MIT=$_POST['MIT'];

$printQ2H=$_POST['printQ2H'];
$printQ2H1=$_POST['printQ2H1'];
$printQ2H0=$_POST['printQ2H0'];
$PrintApp1=$_POST['PrintApp1'];
$printQ2Extra=$_POST['printQ2Extra'];

$display_title="$printQ2H";

    $pic88="../../../MIT/GoSlider/$pic88a";
$Report7=$_POST['report7'];

if ($Report7==$blink){
$Report7="Report";
}

$dataxS=explode(',', $stringSS);
$dataxM=explode(',', $stringMS);

//$dataxS[0]=22;
//$dataxM[0]=327;


$pic1=$_POST['pic1'];
$sig1=$_POST['sig1'];

$myname=date("Ymshis");
$myFile = "$myname.txt";
$fh = fopen("$myFile", 'w') or die("can't open file");
//$stringData = "Raw Score for this Application: $Ascore out of $maxpoints - $PerT% <br /><br/>";
//fwrite($fh, $stringData);
fclose($fh);

$myname2="bobby";
$myFile2 = "$myname2.txt";
$fh1 = fopen("../../../power/pdf3/documents/$myFile2", 'w') or die("can't open file");
$stringData = "Raw Score for this Application: $Ascore out of $maxpoints - $PerT% <br /><br/> \n";
fwrite($fh1, $stringData);
fclose($fh1);

$firstname=$_POST['first'];
$lastname=$_POST['last'];
$dateD=$_POST['createD'];
//$map_id='';
//$map_id55='';

 for ($hhh=0;$hhh<=4; $hhh++){

  $sq112asst="SELECT * FROM $table_name80 WHERE survey_id = '$dataxS[$hhh]'";
    $result33st = @mysqli_query($connection,$sq112asst) or die(mysqli_error($connection));
  $num33st = mysqli_num_rows($result33st);

            if ($num33st>0){


$sq112ass="SELECT * FROM $table_name80 WHERE survey_id = '$dataxS[$hhh]' AND map_id ='$dataxM[$hhh]' ";

$map_id=$dataxM[$hhh];
$map_id55=$dataxM[0];
$survey_idR=$dataxS[$hhh];
$survey_num=$survey_idR;

$result222 = @mysqli_query($connection,$sq112ass) or die(mysqli_error($connection));
while ($row1 = mysqli_fetch_array($result222)) {
$survey_id=  $row1['survey_id'];
//$map_id=  $row1['map_id'];
//$map_id55=  $row1['test_type'];          //for the new survey
  //$firstname=   stripslashes($row1['firstname']);
  // $lastname=   stripslashes($row1['lastname']);
$lastnamez=$lastname;
   $firstnamez=$firstname;

  $company=  stripslashes($row1['company']);
  $email=  stripslashes($row1['email']);
   $van5=  stripslashes($row1['van5']);
   $country=$van5;
   $van6=  stripslashes($row1['van6']);
   $state=$van6;
  $van7=  stripslashes($row1['van7']);
  $answerT[7]=$van7;
  $van8=  stripslashes($row1['van8']);
  $answerT[8]=$van8;
  $Ccreate_dateR= $row1['create_date'];
  $Ccreate_dateR=strtotime("$Ccreate_dateR");
  $Ccreate_dateR=date("n-j-Y","$Ccreate_dateR");
  $Ascore= $row1['Ascore'];

      include("../../../admin/GoTool/survey/survey-row1-variables.php");
}                              //end wh


//$map_id55=$dataxM[$hhh];
$sq112bb="SELECT * FROM $table_name82 WHERE map_id = '$map_id55' ";

$result222aa = @mysqli_query($connection,$sq112bb) or die(mysqli_error($connection));
      while ($row1dd = mysqli_fetch_array($result222aa)) {
$val_fname=  stripslashes($row1dd['firstname']);
$val_lname=  stripslashes($row1dd['lastname']);
$val_email=  stripslashes($row1dd['email']);
$val_phoneW=  stripslashes($row1dd['telephone']);
$val_phoneF=  stripslashes($row1dd['fax']);
$val_phoneC=  stripslashes($row1dd['cell']);
$val_phoneH=  stripslashes($row1dd['homeP']);
$val_addressH=  stripslashes($row1dd['addressH']);
$stateH=  stripslashes($row1dd['stateH']);
$val_cityH=  stripslashes($row1dd['cityH']);
$countryH=  stripslashes($row1dd['countryH']);
$ipH=  $row1dd['ip'];
$val_zipH=  stripslashes($row1dd['zip']);
$webH=  stripslashes($row1dd['web']);
$company=  stripslashes($row1dd['company']);

$agent_idH=  stripslashes($row1dd['agent_id']);


      }         //      end while

$sq112ab="SELECT * FROM $table_name81 WHERE survey_id = '$dataxS[$hhh]'";
 //$sq112ab="SELECT * FROM $table_name81 WHERE survey_id = '$survey_idR'";
//$survey_idR=$dataxS[$hhh];
//$map_id=$dataxM[$hhh];
//$map_id55=$map_id;

$result222a = @mysqli_query($connection,$sq112ab) or die(mysqli_error($connection));
while ($row1ab = mysqli_fetch_array($result222a)) {
$survey_id=  $row1ab['survey_id'];
  $stitle=   stripslashes($row1ab['name']);
          }       //end while

$survey_num=$survey_id;

//  $stitle=stripslashes($_POST['stitle77']);


$summary77="$Report7: $firstname $lastname submitted: $dateD";
$summary77a="$Report7: $firstname $lastname";

$summary77="$printQ2H";
$summary771="$printQ2H0: $firstname $lastname ";
$summary77a="$printQ2H1 - Applicant: $firstname $lastname";

$author1="GalliumGroup";
$title1 ="Sample PDF Document";
$subj1="Public Document";
$key1="Keywords, PDF, User Docs";
$today = date("Y-m-d h:i:s");
$Rtoday=$today;
$map_title=date("Ymshis");

//$map_id=$_GET['map_id'];
//if ($map_id==$blink){
//$map_id=$_POST['map_id'];
//}

$laddy="<h1>$stitle</h1> <br/> ID:$map_id <br/>Assessment:$survey_num<br/>";
$utf8text .=$laddy;
$survey_idR=$dataxS[$hhh];
$sq112a="SELECT * FROM $table_name76 WHERE survey_id ='$survey_idR' Order By surveyQ_id ";

//$map_id55=$dataxM[$hhh];
include("../../../admin/GoTool/survey/surv_display2a.php");
//include("../../../admin/GoTool/survey/surv_display2.php");

$utf8text2 =$display_blockAdminB;

///echo $utf8text2;

//$myname=date("Ymshis");
//$myFile = "$myname.txt";


$fh = fopen("$myFile", 'a') or die("can't open file");

$stringData=$utf8text2 ;
fwrite($fh, $stringData);
fclose($fh);

$display_blockAdminB='';
//$l='';
//$i='';

}    //end if num
}           //end if

 $sack=stripslashes($_POST['sack']);
   //$good1=$_POST['good1'];
   // $pic88=$_POST['pic88'];
   // $pic88="../../../admin/GoTool/survey_MIT/$pic88";
 //    $stuff88="$good1.txt";
  //$sack=1;

 $a312="Assessment";
//$a312=date("Ymshis");


    




//============================================================+
//
//
//
//string   	$name   	The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
//string   	$dest   	Destination where to send the document. It can take one of the following values:

//    I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
//    D: send to the browser and force a file download with the name given by name.
//    F: save to a local server file with the name given by name.
//    S: return the document as a string. name is ignored.
//    FI: equivalent to F + I option
//    FD: equivalent to F + D option
//============================================================+



//require_once('../config/lang/eng.php');
//require_once('../tcpdf.php');
//require_once('tcpdf_include.php');    

// create new PDF document
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information



// get esternal file content
//$utf8text = file_get_contents("$stuff88", false);
$utf8text = file_get_contents("$myFile");
//echo "$utf8text"; ’
$prob55="’";
$fix55="'";
//$utf8text=str_replace($prob55,$fix55,$utf8text);
//echo "$utf8text";

//$utf8text = iconv('UTF-8', 'ASCII//TRANSLIT', $utf8text); 
$utf8text = str_replace(chr(130), ',', $utf8text);  
$utf8text = str_replace(chr(146), "'", $utf8text);    // right single quote
$utf8text = str_replace(chr(147), '"', $utf8text);    // left double quote
$utf8text = str_replace(chr(132), '"', $utf8text);    // baseline double quote
$utf8text = str_replace(chr(133), '...', $utf8text);  // ellipsis
$utf8text = str_replace(chr(145), "'", $utf8text);    // left single quote
$utf8text = str_replace(chr(148), '"', $utf8text);    // right double quote

//$utf8text = mb_convert_encoding($utf8text, 'HTML-ENTITIES', 'UTF-8');

$display_block="$summary77

<br/><br/><table width=\400\"><thead><tr><td>$summary771</td></tr></thead>";
$display_block.="<tbody><tr><td>$utf8text</td></tr>";

$display_block.="<tr><td>$printQ2Extra</td></tr></tbody></table>";


?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<title><?PHP echo "$summary771"; ?> </title>
<base href="<?PHP echo "$loc24"; ?>" />
<STYLE type="text/css">
   H1.myclass {border-width: 1; border: solid; text-align: center}

 </STYLE>

<link rel="stylesheet" type="text/css" href="view/stylesheet/stylesheet.css" />

<script type="text/javascript" src="view/javascript/jquery/jquery-1.7.1.min.js"></script>
				<script type="text/javascript" src="view/javascript/tablePagination.min.js"></script>
<script type="text/javascript" src="view/javascript/jquery/ui/jquery-ui-1.8.16.custom.min.js"></script>
<link rel="stylesheet" type="text/css" href="view/javascript/jquery/ui/themes/ui-lightness/jquery-ui-1.8.16.custom.css" />
<script type="text/javascript" src="view/javascript/jquery/ui/external/jquery.bgiframe-2.1.2.js"></script>
<script type="text/javascript" src="view/javascript/jquery/tabs.js"></script>
<script type="text/javascript" src="view/javascript/jquery/excelexport.js"></script>

<script type="text/javascript" src="view/javascript/jquery/superfish/js/superfish.js"></script>

<script type="text/javascript"><!--
function updatesum() {
document.form.sum.value = (document.form.sum1.value -0) + (document.form.sum2.value -0) + (document.form.sum3.value -0) + (document.form.sum4.value -0); }
//--></script>









<?PHP echo "$special_code"; ?>



<script type="text/javascript" src="view/javascript/sortable.js"></script>
<script type="text/javascript" src="GoTool//mover/toggleDiv.js"></script>
<script type="text/javascript" src="GoTool/mover/table.js"></script>
<script type="text/javascript" src="GoTool/mover/table2CSV.js"></script>
<script type="text/javascript" src="view/javascript/jquery.collapsible.min.js"></script>
<link rel="stylesheet" type="text/css" href="view/stylesheet/collap.css" />

<link rel="stylesheet" type="text/css" href="GoTool/mover/table.css" media="all">

<script type="text/javascript">
function getCSVData(){
 var csv_value=$('#ReportTable').table2CSV({delivery:'value'});
 $("#csv_text").val(csv_value);
}
</script>




  <script type="text/javascript">
//-----------------------------------------
// Confirm Actions (delete, uninstall)
//-----------------------------------------
$(document).ready(function(){
    // Confirm Delete
    $('#form').submit(function(){
        if ($(this).attr('action').indexOf('delete',1) != -1) {
            if (!confirm ('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });


//collapsible management
        $('.collapsible').collapsible({
            defaultOpen: 'section1,section2,section3,section4'
        });



//toggle

   $('#clickme').click(function() {
          $('#me').animate({
               height: 'toggle'
               }, 2000
          );
     });






    // Confirm Uninstall
    $('a').click(function(){
        if ($(this).attr('href') != null && $(this).attr('href').indexOf('uninstall',1) != -1) {
            if (!confirm ('<?php echo $text_confirm; ?>')) {
                return false;
            }
        }
    });
});
</script>

<script type="text/javascript">
function toggleDiv(divId) {
   $("#"+divId).toggle();
}

function toggleAndChangeText() {
     $('#divToToggle').toggle();
     if ($('#divToToggle').css('display') == 'none') {
          $('#aTag').html('<img border=0 src="GoTool/image/add.png">');
     }
     else {
          $('#aTag').html('<img border=0 src="GoTool/image/minus.png">');
     }
}


//});

</script>

<SCRIPT LANGUAGE="JavaScript" SRC="GoTool/risk/AnimatedFader.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">

//Script submitted to and featured on
//http://www.dynamicdrive.com

/*
 * FadingText(divName, numSteps, BGColor)
 * divName : Must match the DIV names defined at the end of the BODY)
 * numSteps: The number of steps in the fading transition
 * BGColor : The background colour of the DIV or document.
 */
	FadingText('fade1', 10,"FFFFFF");

/*** The "Frame Interval" Smaller = faster ***/
	FadeInterval=30;

</SCRIPT>




<script>
$(document).ready(function() {

	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();

		//Get the A tag
		var id = $(this).attr('href');

		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();

		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});

		//transition effect
		$('#mask').fadeIn(1000);
		$('#mask').fadeTo("slow",0.8);

		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();

		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);

		//transition effect
		$(id).fadeIn(2000);

	});

	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();

		$('#mask').hide();
		$('.window').hide();
	});

	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});


	$(window).resize(function () {

 		var box = $('#boxes .window');

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set height and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        box.css('top',  winH/2 - box.height()/2);
        box.css('left', winW/2 - box.width()/2);

	});

});

</script>

<script type="text/javascript" src="GoTool/risk/jquery.min.js"></script>
<script src="GoTool/risk/formwizard2.js" type="text/javascript">

/***********************************************         1.4.2 version of jQuery above
* jQuery Form to Form Wizard-
* This notice MUST stay intact for legal use
*
***********************************************/

</script>

<script type="text/javascript">

var myform=new formtowizard({
	formid: 'feedbackform',
	persistsection: true,
	revealfx: ['slide', 500]
})

var myform2=new formtowizard({
	formid: 'feedbackform2',
	persistsection: true,
	revealfx: ['fade', 1000],
	validate: ['order_username', 'order_sex', 'order_addr1', 'order_shippingmethod', 'order_feedback']
})


var myform3=new formtowizard({
 formid: 'staff_feedbackform',
 validate: ['staff_username', 'staff_sex', 'staff_addr1'],
 revealfx: ['slide', 500] //<--no comma after last setting
})


</script>






<style>




#mask {
  position:absolute;
  left:0;
  top:0;
  z-index:9000;
  background-color:#000;
  display:none;
}

#boxes .window {
  position:fixed;
  left:0;
  top:0;
  width:440px;
  height:400px;
  display:none;
  z-index:9999;
  padding:20px;
}

#boxes #dialog {
  width:375px;
  height:403px;
  padding:10px;
  background-color:#ffffff;
}

#boxes #dialog1 {
  width:375px;
  height:403px;
}

#dialog1 .d-header {
  background:url(GoTool/risk/images/login-header2.png) no-repeat 0 0 transparent;
  width:375px;
  height:200px;
}

#dialog1 .d-header1 {
  background:url(GoTool/risk/images/login-middle.png) repeat 0 0 transparent;
  width:375px;

}

#dialog1 .d-header input {
  position:relative;
  top:60px;
  left:100px;
  border:3px solid #cccccc;
  height:22px;
  width:200px;
  font-size:15px;
  padding:5px;
  margin-top:4px;
}

#dialog1 .d-blank {
  float:left;
  background:url(GoTool/risk/images/login-blank.png) no-repeat 0 0 transparent;
  width:267px;
  height:53px;
}

#dialog1 .d-login {
  float:left;
  width:108px;
  height:400px;
}

#boxes #dialog2 {
  background:url(GoTool/risk/images/notice.png) repeat 0 0 transparent;
  width:326px;
  height:400px;
  padding:50px 0 20px 25px;
}


#boxes #dialog3 {
  background:url(GoTool/risk/images/notice.png) repeat 0 0 transparent;
  width:326px;
  height:400px;
  padding:50px 0 20px 25px;
}

#boxes #dialog4 {
  background:url(GoTool/risk/images/notice.png) repeat 0 0 transparent;
  width:326px;
  height:400px;
  padding:50px 0 20px 25px;
}

#boxes #dialog5 {
  background:url(GoTool/risk/images/notice.png) repeat 0 0 transparent;
  width:326px;
  height:400px;
  padding:50px 0 20px 25px;
}

#boxes #dialog6 {
  background:url(GoTool/risk/images/notice.png) repeat 0 0 transparent;
  width:326px;
  height:400px;
  padding:50px 0 20px 25px;
}

fieldset.sectionwrap{ /*fieldset that wraps around each form "page" */
border-width:0;
margin-top: 0;
	margin-bottom: 0;

padding:2px;
}

legend{ /*title shown at top of each form page */
font:bold 16px Arial;
color: darkred;
}

div.stepsguide{ /*div that contains all the "steps" text located at top of form */
width: 320px; /*width of "steps" container*/
overflow:hidden;
margin-bottom:15px;
cursor:pointer;
}

div.stepsguide .step{ /*div that wraps around each "steps" text */
width:290px; /*width of each "steps" text*/
font: bold 18px Arial;
float:left;
}

div.stepsguide .disabledstep{ /*div that wraps around each "steps" text */
color:#C4C4C4;
}

div.stepsguide .step .smalltext{ /*small footer text inside "steps" text */
font-size: 10px;
font-weight: normal;
}

div.formpaginate{ /* CSS for pagination DIV container */
width: 300px;
overflow:hidden;
font-weight:bold;
text-align:center;
margin-top:1em;
}

div.formpaginate .prev, div.formpaginate .next{ /*CSS for "prev" and "next" SPAN elements within paginate container */
border-radius:5px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
padding:2px 5px;
background:darkred;
color:white;
cursor:hand;
cursor:pointer;
}


#feedbackform2 legend{ /*title shown at top of each form page */
color: navy;
}

#feedbackform2 div.field{
margin-bottom:7px;
}


#feedbackform2 div.formpaginate .prev, #feedbackform2 div.formpaginate .next{
background:navy;
}


</style>





</head>
<body>

<div id="content">
  <div class="breadcrumb">
        <a href="http://<?PHP echo "$loc"; ?>/<?PHP echo "$dir"; ?>/admin/index.php?route=common/home&amp;token=<?PHP echo "$tok"; ?>">Home</a>
        ::<a href="http://<?PHP echo "$loc"; ?>/<?PHP echo "$dir"; ?>/admin/index.php?route=common/home&amp;token=<?PHP echo "$tok"; ?>"><?PHP echo $display_title; ?></a>

      </div>
          <?PHP echo "$mess"; ?>    <?PHP echo "$warn"; ?>   <?PHP echo "$display_back"; ?>
 <div class="box">
    <div class="heading">
      <h1><img src="view/image/report.png" alt="" /> <?PHP echo "$display_title"; ?> </h1>
    </div>
    <div class="content">



      <?PHP echo "$display_block"; ?>





      <div class="pagination"></div>
    </div>
  </div>
<!-- </div>  -->


</div>
 <?PHP echo "$string"; ?>
  <?PHP echo "$display_blockFF"; ?>

    <div style="font-size:10px;color:#ccc"></div>

<div id="boxes">

<div id="dialog" class="window">
Note Window |
<FORM METHOD=POST
   ACTION="consult.php?token=$tok&log=$logged"
   onSubmit="popupform(this, 'join')">
Name: <INPUT NAME="realname"><BR>
Email: <INPUT NAME="email"><BR>
Value: <INPUT NAME="val2"><BR>
<INPUT TYPE=SUBMIT VALUE="show me">
</FORM>
<a href="#"class="close"/>Close it</a>
</div>

<!-- Start of Login Dialog -->
<div id="dialog1" class="window">
  <div class="d-header">
  <input type="button" value="Close it" class="close"/>
    <input type="text" value="username" onclick="this.value=''"/><br/>
  </div>
  <div class="d-header1">
    <input type="text" value="username" onclick="this.value=''"/><br/>
    <input type="password" value="Password" onclick="this.value=''"/>
  </div>
  <div class="d-blank"></div>
  <div class="d-login"><input type="image" alt="Login" title="Login" src="images/login-button.png"/></div>
</div>
<!-- End of Login Dialog -->



<!-- Start of Sticky Note -->
<div id="dialog2" class="window">
<?PHP echo "$bottomNote"; ?>
<input type="button" value="Close it" class="close"/>
</div>
<!-- End of Sticky Note -->

<!-- Start of Sticky Note -->
<div id="dialog3" class="window">
<?PHP echo "$bottomReport"; ?>
<input type="button" value="Close it" class="close"/>
</div>
<!-- End of Sticky Note -->

<!-- Start of Sticky Note -->
<div id="dialog4" class="window">
<?PHP echo "$bottomDelete"; ?>
<input type="button" value="Close it" class="close"/>
</div>
<!-- End of Sticky Note -->

<!-- Start of Sticky Note -->
<div id="dialog5" class="window">
<?PHP echo "$bottomCriteria"; ?>
<input type="button" value="Close it" class="close"/>
</div>
<!-- End of Sticky Note -->

<!-- Start of Sticky Note -->
<div id="dialog6" class="window">
<?PHP echo "$bottomDate"; ?>
<input type="button" value="Close it" class="close"/>
</div>
<!-- End of Sticky Note -->

<!-- Mask to cover the whole screen -->
  <div id="mask"></div>
</div>

 </body></html>


