{assign var="title" value="show report"}
{include file="header.html"}
{include file="error.inc.html"}
{include_php file="Includes/FusionCharts.php"}
 
<div id="content">		
        <div class="indent-main">
            <div class="container">
                <div class="col-1 maxheight">
                	<div class="box maxheight">
                        <div class="border-top maxheight">
                            <div class="border-bottom maxheight">
                                <div class="border-right maxheight">
                                    <div class="border-left maxheight">
                                        <div class="corner-top-right maxheight">
                                            <div class="corner-top-left maxheight">
                                                <div class="corner-bottom-left maxheight">
                                                    <div class="corner-bottom-right maxheight"> 
                                                        <div class="indent-box">
                                                            <img alt="" src="{$config.root_surl}/templates/images//1page_title1.gif" class="title" /><br />
                    <div class="container tail">
                                                            	
       <table><tr><td><!-- right top links -->
<a href="{$config.root_url}/logout.php">#_TPL_MEMBER_LOGOUT#</a></td>
<td><a href="{$config.root_url}/profile.php">#_TPL_MEMBER_CH_PSWD#</a></td>
<td><a href="{$config.root_url}/checks.php?id={$smarty.session._amember_id}">Checks</a></td>
<td><a href="{$config.root_url}/contacts.php?id={$smarty.session._amember_id}">Contacts</a></td>
<td><a href="{$config.root_url}/report.php?id={$smarty.session._amember_id}">Report</a></td>
{foreach from=$member_links item=t key=u}
<a href="{$u|escape}">{$t}</a><br />
{/foreach}
</td></tr></table>
 <table class="vedit" width="80%">
        <tr>
            <td>
           {php}

function connectToDB( $dbName="" ) {
    // These four parameters must be changed dependent on your MySQL settings
    $hostdb = 'localhost';   // MySQl host
    $userdb = 'root';    // MySQL username
    $passdb = 'root';    // MySQL password
    $namedb =  $dbName ? $dbName : 'amember'; // MySQL database name

  	$link = mysql_connect ($hostdb, $userdb, $passdb);

    if (!$link) {
        // we should have connected, but if any of the above parameters
        // are incorrect or we can't access the DB for some reason,
        // then we will stop execution here
        die('Could not connect: ' . mysql_error());
    }

    $db_selected = mysql_select_db($namedb);
    if (!$db_selected) {
        die ('Can\'t use database : ' . mysql_error());
    }
    return $link;
}
{/php}
<HTML>
<HEAD>
	<TITLE>
	
	</TITLE>
	
	<SCRIPT LANGUAGE="Javascript" SRC="FusionCharts/FusionCharts.js"></SCRIPT>
	<style type="text/css">
	<!--
	body {
		font-family: Arial, Helvetica, sans-serif;
		font-size: 12px;
	}
	.text{
		font-family: Arial, Helvetica, sans-serif;
		font-size: 12px;
	}
	-->
	</style>
</HEAD>
<BODY>

<CENTER>

{php}
	
	// Connect to the DB
	$link = connectToDB();

	
	$strXML = "<chart caption='Site State Report' subCaption='' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' %'>";
        $datev=date("Y-m-d");
	
	$do=mysql_query("select * from amember_average where site_id='".$_GET['id']."'
            ");
	
		while($row = mysql_fetch_array($do)) {
			
	//if($row['result']=='N')
          //               {
                      //   $strXML .= "<set label='" . $row['time_of_check']. "' value='0' />";
            //             }
              //           elseif($row['result']=='Y')
                //         {
                          $strXML .= "<set label='" . $row['site_date']. "' value='" . $row['site_average_time'] . "'/>";
                    //     }
			
		}
	
	//Finally, close <chart> element
	$strXML .= "</chart>";

	//Create the chart - Pie 3D Chart with data from $strXML
	echo renderChart("FusionCharts/Line.swf", "", $strXML, "Time", 600,300, false, false);
{/php}
            </td>
        </tr>
        
</table>

<script type="text/javascript" src="{$config.root_surl}/includes/jquery/jquery.js?smarty"></script>
<script type="text/javascript" src="{$config.root_surl}/includes/jquery/jquery.select.js?smarty"></script>

{include file="js.country_state.js"}


                                                                <br class="clear" />
                                                            </div>
                                                            
                                                           
                                                           <!-- -->
                                                        </div>                                     
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

{include file="footer.html"}
