<?php
include_once("embedded/functions/site_functions.php");
if ((isset($_SESSION) && !empty($_SESSION)))
{
db_open();
$language=$_SESSION['language'];
if ($language==1)
	{
	$head1="Αισθητήρες";
	$head4="Αισθητήρας:";
	$head3="Όλοι";
	$head33="Όλες";
	$head5="Θερμοκρασία";
	$head6="Υγρασία";
	$head7="Έδαφος";
	$head8="Φωτισμός";
	$head2="Περίοδος";
	$head9="Ημερήσια";
	$head10="Εβδομαδιαία";
	$head11="Μηνιαία";
	$head12="Ετήσια";
	$head13="Συσκευές";
	$head14="Εμφάνιση";
	$head15="Συσκευή";
	$head16="Αέρας";
	$head17="Νερό";
	$head18="Φώς";
	$head19="Κάντε κλικ για καλύτερη εμφάνιση!";
	$title="SmartGreenhouse - Διαγράμματα";
	}
else
	{
	$head1="Sensors";
	$head4="Sensor:";
	$head33=$head3="All";
	$head5="Temperature";
	$head6="Humidity";
	$head7="Soil moisture";
	$head8="Indoor lighting";
	$head2="Period";
	$head9="Daιly";
	$head10="Weekly";
	$head11="Monthly";
	$head12="Annualy";
	$head13="Devices";
	$head14="Show";
	$head15="Device";
	$head16="Fan";
	$head17="Watering";
	$head18="Lighting";
	$head19="Click into charts for better view!";
	$title="SmartGreenhouse - Overview";
	}
$time=time();
$a=password($option=4,$_SESSION['userlevel'],$_SESSION['email'],$_SESSION['password'],$_SESSION['device_id'],$time);
$script='<script type="text/javascript" src="scripts/formfunctions_overview.js"></script>';
$css='<link href = "css/index.css" rel = "stylesheet" type = "text/css" />';
heder_js($title,$script,$css);
main_things();

echo<<<n
<div id ="main_window">
<fieldset id='sensor_chart'>
<legend class='legend' >$head1</legend>
<form id="s_chart" >
<select id='sensors_list' name='s'>
<option value=''>$head4</option>
<option value='all'>$head3</option>
<option value='temperature'>$head5</option>
<option value='humidity'>$head6</option>
<option value='soilmoisture'>$head7</option>
<option value='indoorlighting'>$head8</option>
</select>
<select id='period_list' onchange="date_select(this.value);" name='p'>
<option value=''>$head2</option>
<option value='day'>$head9</option>
<option value='week'>$head10</option>
<option value='month'>$head11</option>
<option value='year'>$head12</option> 
</select>
<a id='date_out'></a>
<input type="button" value="$head14" class="show_button" onclick="sensors_chart();" ></input>
</form>
<div id='chart_s' class='chart'>
</div>
</fieldset>

<fieldset id='devices_chart'>
<legend class='legend'>$head13</legend>
<form id="s_chart" method="post" action = "" enctype="multipart/form-data" >
<select id='device_list'>
<option value=''>$head15</option>
<option value='all'>$head33</option>
<option value='fan'>$head16</option>
<option value='watering'>$head17</option>
<option value='lighting'>$head18</option>
</select>
<select id='period_list_d' onchange="date_select_d(this.value);" >
<option value=''>$head2</option>
<option value='day'>$head9</option>
<option value='week'>$head10</option>
<option value='month'>$head11</option>
<option value='year'>$head12</option> 
</select>
<a id='date_out_d'></a>
<input type="button" value="$head14" class="show_button" onclick="device_chart();" ></input>
</form>
<div id='chart_d' class='chart'>
</div>
</fieldset>
<div id="overview_notice"> $head19</div>
n;

echo"</div>";
footer();
db_close();
}
else
{
require("index.php");
die();
}
?>