<?php 
// require $setting_dev_server_root_path.'vendor/autoload.php';


require __DIR__ . '/../../vendor/autoload.php';

use mikehaertl\wkhtmlto\Pdf;
function print_error($newerrormsg)
{
	array_push($GLOBALS['printerrorlist'], $newerrormsg);
	$GLOBALS['printerrorcount']++;
	print "<div>New Print Error Msg: $newerrormsg</div>";
	return 1;
}

//<cfparam name = "form.order_number" default = "none">
$GLOBALS['printerrorlist']  = array();
$GLOBALS['printerrorcount'] = 0;

$sth_game_number = $session->sth_game_num;


$load_game_query = $db->query("SELECT * FROM `aa_sth_games` WHERE `sth_game_number` = '$sth_game_number' LIMIT 1");
$num_rows = mysqli_num_rows($load_game_query);  // for testing
if ($num_rows == 0) {
	print_error("Database returns 0 rows for this sth_game_number: $sth_game_number");
}
else {

	while($row = $load_game_query->fetch_array()) {
		$db_game_id =  $row['id'];	
		$db_game_name = $row['game_name'];
		$glyph_list = explode("|", $row['glyph_list']);
		$glype_level = explode("|", $row['glyph_level']);
		$glyph_location = explode("|", $row['glyph_location']);
		$clue_list = explode("|", $row['clue_list']);
		$clue_location = explode("|", $row['clue_location']);
		$clue_level = explode("|", $row['clue_level']);
		$key_location = explode("|", $row['key_location']);
		$glyph_jpg_list = explode("|", $row['glyph_jpg_list']);
		$sth_game_state = $row['game_state'];
		$pdf_filename = $row['pdf_filename'];
	}

	
	
}


$GLOBAL['GlyphNumbersForThisClue'] = array();
/*
 * DB Table
 * game_state,
	glyph_list,
	glyph_level,
	glyph_location,
	clue_list,
	clue_level,
	clue_location,
	glyph_jpg_list,
	key_location,
	sth_game_number,
	ticket_number,
	ticket_id,
	date_created
 * 
 */

?>

<?php
// ***********************************************************
// ***********************************************************
// ***********************************************************

$pdf = new Pdf('<html>HI</html>');
// Create a new Pdf object with some global PDF options
$pdf = new Pdf(array(
    'no-outline',         // Make Chrome not complain
    'margin-top'    => 0,
    'margin-right'  => 0,
    'margin-bottom' => 0,
    'margin-left'   => 0,

    // Default page options
    'disable-smart-shrinking',
    'user-style-sheet' => '/path/to/pdf.css',
));

// Add a page. To override above page defaults, you could add
// another $options array as second argument.


$htmlpage = '<html><span style="font-size: x-large;"><div> Super Treasure Hunt Instructions </div></span>
	<span style="font-size: large;"><ol>
        <li>Print out these 24 pages.</li>
        <li>Each printed pages contains all the Clues to hide in one location.</li>
        <li>Just cut out the clues from one page at a time and place them together into the specified location.</li> 
        <li>For parties with more than 7 children, Split the group into teams (4-6 kids per team) and hide a copy of the clues for each team.  So, with 2 teams, print the Treasure Hunt twice.</li>
			
		<li>The last printed pages have the first Clue the kids get to start the game (written in plain english) and the final Congratulations Message which goes into the Treasure Chest.  Lock the Treasure Chestwith the combination lock after you put in the treasure and also the Congratulations Message.</li>
                
                <li>You can <strong>print from any internet computer</strong> for the next 30 days You just need your order number, which was emailed to you.</li>
                </ol></span></html>';   


$pdf->addPage($htmlpage);

$pdf->send();




?>




		

