2 grid_col_span4-sm grid_col_span4-md' style='background-image: url(\"".make_link()."imgs/sekacka.jpg\");'> Soil sonda

".$msg['mower_api']."

".$msg['mower_description']."
"; return array($cont,""); } function tempoitzig_content_actual(){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $tableCont = performQuery("SELECT * FROM `TeplotyIoTZig` ORDER BY `reading_time` DESC LIMIT 1",1); $nums = array("0","1","2"); $nums_cont = ""; foreach($nums as $sv){ if($tableCont[0]['name'.$sv] != ""){ $nums_cont.= "
".camel_split($tableCont[0]['name'.$sv])."
".mb_ucfirst_exceptions(str_replace("#","",$msg['temp#']))." ".$tableCont[0][str_replace("#",$sv,'temp#')]." {$units['temp#']}
".mb_ucfirst_exceptions(str_replace("#","",$msg['hum#']))." ".$tableCont[0][str_replace("#",$sv,'hum#')]." {$units['hum#']}
".mb_ucfirst_exceptions(str_replace("#","",$msg['rosbod#']))." ".$tableCont[0][str_replace("#",$sv,'rosbod#')]." {$units['rosbod#']}
".mb_ucfirst_exceptions(str_replace("#","",$msg['bat#']))." ".$tableCont[0][str_replace("#",$sv,'bat#')]." {$units['bat#']}
".mb_ucfirst_exceptions(str_replace("#","",$msg['link#']))." ".$tableCont[0][str_replace("#",$sv,'link#')]." {$units['link#']}
"; } } $cont = "

TeplotyIoTZig

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

{$nums_cont} "; return $cont; } function techmovement_content_actual(){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $tableCont = performQuery("SELECT * FROM `TechPohyb` ORDER BY `reading_time` DESC LIMIT 1",1); $nums = array("0","1","2"); $nums_cont = ""; foreach($nums as $sv){ if($tableCont[0]['name'.$sv] != ""){ $nums_cont.= "
".camel_split($tableCont[0]['name'.$sv])."
".mb_ucfirst_exceptions(str_replace("#","",$msg['narus#']))." ".$tableCont[0][str_replace("#",$sv,'narus#')]." {$units['narus#']}
".mb_ucfirst_exceptions(str_replace("#","",$msg['bat#']))." ".$tableCont[0][str_replace("#",$sv,'bat#')]." {$units['bat#']}
".mb_ucfirst_exceptions(str_replace("#","",$msg['ilu#']))." ".$tableCont[0][str_replace("#",$sv,'ilu#')]." {$units['ilu#']}
".mb_ucfirst_exceptions(str_replace("#","",$msg['link#']))." ".$tableCont[0][str_replace("#",$sv,'link#')]." {$units['link#']}
"; } } $cont = "

TechPohyb

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

{$nums_cont} "; return $cont; } function techdata_content_actual(){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $tableCont = performQuery("SELECT * FROM `TechData` ORDER BY `reading_time` DESC LIMIT 1",1); $cont = "

TechData

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

".camel_split($tableCont[0]['name0'])."
".mb_ucfirst_exceptions($msg['CERBOusage'])." ".$tableCont[0]['CERBOusage']." {$units['CERBOusage']}
".mb_ucfirst_exceptions($msg['CERBOtemp'])." ".$tableCont[0]['CERBOtemp']." {$units['CERBOtemp']}
".mb_ucfirst_exceptions($msg['BOXchladON'])." ".$tableCont[0]['BOXchladON']." {$units['BOXchladON']}
".mb_ucfirst_exceptions($msg['tempBox'])." ".$tableCont[0]['tempBox']." {$units['tempBox']}
".mb_ucfirst_exceptions($msg['tempVen'])." ".$tableCont[0]['tempVen']." {$units['tempVen']}
".camel_split($tableCont[0]['name1'])."
".mb_ucfirst_exceptions($msg['cena'])." ".$tableCont[0]['cena']." {$units['cena']}
".mb_ucfirst_exceptions($msg['prodej'])." ".$tableCont[0]['prodej']." {$units['prodej']}
".camel_split($tableCont[0]['name2'])."
".mb_ucfirst_exceptions($msg['proud'])." ".$tableCont[0]['proud']." {$units['proud']}
"; return $cont; } function soillachps01_content_actual(){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $tableCont = performQuery("SELECT * FROM `ZeminaLaCHpS01` ORDER BY `reading_time` DESC LIMIT 1",1); $cont = "

{$msg['soil_la_c_hp_s01']}

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

".mb_ucfirst_exceptions($msg['Ubat'])." ".$tableCont[0]['Ubat']." {$units['Ubat']}
".mb_ucfirst_exceptions($msg['Upanel'])." ".$tableCont[0]['Upanel']." {$units['Upanel']}
".mb_ucfirst_exceptions($msg['Cbat'])." ".$tableCont[0]['Cbat']." {$units['Cbat']}
".mb_ucfirst_exceptions($msg['temp'])." ".$tableCont[0]['temp']." {$units['temp']}
".mb_ucfirst_exceptions($msg['hum'])." ".$tableCont[0]['hum']." {$units['hum']}
".mb_ucfirst_exceptions($msg['Nko'])." ".$tableCont[0]['Nko']." {$units['Nko']}
".mb_ucfirst_exceptions($msg['Pko'])." ".$tableCont[0]['Pko']." {$units['Pko']}
".mb_ucfirst_exceptions($msg['Kko'])." ".$tableCont[0]['Kko']." {$units['Kko']}
".mb_ucfirst_exceptions($msg['vodivost'])." ".$tableCont[0]['vodivost']." {$units['vodivost']}
".mb_ucfirst_exceptions($msg['pH'])." ".$tableCont[0]['pH']." {$units['pH']}
".mb_ucfirst_exceptions($msg['salin'])." ".$tableCont[0]['salin']." {$units['salin']}
".mb_ucfirst_exceptions($msg['TDS'])." ".$tableCont[0]['TDS']." {$units['TDS']}
".mb_ucfirst_exceptions($msg['chyba'])." ".$tableCont[0]['chyba']." {$units['chyba']}
".mb_ucfirst_exceptions($msg['stav'])." ".$tableCont[0]['stav']." {$units['stav']}
".mb_ucfirst_exceptions($msg['RSSI'])." ".$tableCont[0]['RSSI']." {$units['RSSI']}
"; return $cont; } function soil_content_actual($graph_range="last_24h"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "ZeminaLaCHpS04v2_2"; $graphs_js=""; $k = 0; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $sensors = array("70 mm", "170 mm", "270 mm", "370 mm"); $g1 = array("moist1","moist2","moist3","moist4"); $graph1 = get_graphx("moist-chart",$db_table, $g1, $graph_range, $force_title = $sensors,$msg['moist']); $graphs_js.= $graph1[1]; $g2 = array("temp1","temp2","temp3","temp4"); $graph2 = get_graphx("temp-chart",$db_table, $g2, $graph_range, $force_title = $sensors,$msg['temp']); $graphs_js.= $graph2[1]; $g3 = array("Nko1","Nko2","Nko3","Nko4"); $graph3 = get_graphx("n-chart",$db_table, $g3, $graph_range, $force_title = $sensors,$msg['Nko']); $graphs_js.= $graph3[1]; $g4 = array("Pko1","Pko2","Pko3","Pko4"); $graph4 = get_graphx("p-chart",$db_table, $g4, $graph_range, $force_title = $sensors,$msg['Pko']); $graphs_js.= $graph4[1]; $g5 = array("Kko1","Kko2","Kko3","Kko4"); $graph5 = get_graphx("k-chart",$db_table, $g5, $graph_range, $force_title = $sensors,$msg['Kko']); $graphs_js.= $graph5[1]; $cont = "

{$msg['soil']}

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

".$msg['soil_motivation']."

".$msg['soil_description']."

".mb_ucfirst_exceptions($msg['Ubat'])." ".$tableCont[0]['Ubat']." {$units['Ubat']}
".mb_ucfirst_exceptions($msg['Upanel'])." ".$tableCont[0]['Upanel']." {$units['Upanel']}
".mb_ucfirst_exceptions($msg['Cbat'])." ".$tableCont[0]['Cbat']." {$units['Cbat']}
".mb_ucfirst_exceptions($msg['Tbat'])." ".$tableCont[0]['Tbat']." {$units['Tbat']}
".mb_ucfirst_exceptions($msg['Fotorezistor'])." ".$tableCont[0]['Fotorezistor']." {$units['Fotorezistor']}
".mb_ucfirst_exceptions($msg['RSSI'])." ".$tableCont[0]['RSSI']." {$units['RSSI']}
Soil
"; $cont.= "
"; for($i=1;$i<=4;$i++){ $cont.= "

".$sensors[$i-1]."

".mb_ucfirst_exceptions($msg['temp'])." ".$tableCont[0]["temp{$i}"]." {$units['temp']}
".mb_ucfirst_exceptions($msg['moist'])." ".$tableCont[0]["moist{$i}"]." {$units['moist']}
".mb_ucfirst_exceptions($msg['Nko'])." ".$tableCont[0]["Nko{$i}"]." {$units['Nko']}
".mb_ucfirst_exceptions($msg['Pko'])." ".$tableCont[0]["Pko{$i}"]." {$units['Pko']}
".mb_ucfirst_exceptions($msg['Kko'])." ".$tableCont[0]["Kko{$i}"]." {$units['Kko']}
".mb_ucfirst_exceptions($msg['vodivost'])." ".$tableCont[0]["vodivost{$i}"]." {$units['vodivost']}
".mb_ucfirst_exceptions($msg['pH'])." ".$tableCont[0]["pH{$i}"]." {$units['pH']}
".mb_ucfirst_exceptions($msg['salin'])." ".$tableCont[0]["salin{$i}"]." {$units['salin']}
".mb_ucfirst_exceptions($msg['TDS'])." ".$tableCont[0]["TDS{$i}"]." {$units['TDS']}
"; } $cont.= "
"; $cont.= "
".$graph1[0]." ".$msg['graph_detail']."
".$graph2[0]." ".$msg['graph_detail']."
".$graph3[0]." ".$msg['graph_detail']."
".$graph4[0]." ".$msg['graph_detail']."
".$graph5[0]." ".$msg['graph_detail']."
"; return array($cont,$graphs_js); } function rasp_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "ZeminaLaCHpS01"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $graph1 = get_graphx("hum-chart",$db_table, "hum", $graph_range, $force_title = "", ""); $graph2 = get_graphx("npk-chart",$db_table, array("Nko","Pko","Kko"), $graph_range, $force_title = "", ""); $graph3 = get_graphx("temp-chart",$db_table, "temp", $graph_range, $force_title = "", ""); $graph4 = get_graphx("ph-chart",$db_table, "pH", $graph_range, $force_title = "", ""); $cont = "

{$msg['raspberries']}

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

".$msg['rasp_motivation']."
".mb_ucfirst_exceptions($msg['Ubat'])." ".$tableCont[0]['Ubat']." {$units['Ubat']}
".mb_ucfirst_exceptions($msg['Upanel'])." ".$tableCont[0]['Upanel']." {$units['Upanel']}
".mb_ucfirst_exceptions($msg['Cbat'])." ".$tableCont[0]['Cbat']." {$units['Cbat']}
".mb_ucfirst_exceptions($msg['temp'])." ".$tableCont[0]['temp']." {$units['temp']}
".mb_ucfirst_exceptions($msg['moist'])." ".$tableCont[0]['hum']." {$units['moist']}
".mb_ucfirst_exceptions($msg['Nko'])." ".$tableCont[0]['Nko']." {$units['Nko']}
".mb_ucfirst_exceptions($msg['Pko'])." ".$tableCont[0]['Pko']." {$units['Pko']}
".mb_ucfirst_exceptions($msg['Kko'])." ".$tableCont[0]['Kko']." {$units['Kko']}
".mb_ucfirst_exceptions($msg['vodivost'])." ".$tableCont[0]['vodivost']." {$units['vodivost']}
".mb_ucfirst_exceptions($msg['pH'])." ".$tableCont[0]['pH']." {$units['pH']}
".mb_ucfirst_exceptions($msg['salin'])." ".$tableCont[0]['salin']." {$units['salin']}
".mb_ucfirst_exceptions($msg['TDS'])." ".$tableCont[0]['TDS']." {$units['TDS']}
".mb_ucfirst_exceptions($msg['chyba'])." ".$tableCont[0]['chyba']." {$units['chyba']}
".mb_ucfirst_exceptions($msg['stav'])." ".$tableCont[0]['stav']." {$units['stav']}
".mb_ucfirst_exceptions($msg['RSSI'])." ".$tableCont[0]['RSSI']." {$units['RSSI']}
Soil sonda
Soil foto
Soil foto
".$msg['rasp_description']."
{$graph1[0]}
{$graph2[0]}
{$graph3[0]}
{$graph4[0]}
"; return array($cont,$graph1[1].$graph2[1].$graph3[1].$graph4[1]); } function crops_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = stripslashes($udv['unit']); } $tables = array("Malina1", "Malina2", "Malina3", "Malina4", "Malina5", "Malina6", "Boruvka1", "Boruvka2", "Jablone1"); $graph1 = get_graphx("maltemp-chart", $tables, "temp", $graph_range, $force_title = "", ""); $graph2 = get_graphx("malhum-chart", $tables, "hum", $graph_range, $force_title = "", ""); $svg = ""; $data_table = ""; $tableCont = array(); foreach($tables as $table){ $tableCont[$table] = performQuery("SELECT * FROM `{$table}` ORDER BY `reading_time` DESC LIMIT 1",1); $data_table .= " {$table} ".$tableCont[$table][0]['temp']." {$units['temp']} ".$tableCont[$table][0]['hum']." {$units['hum']} "; } $tableCont["Light1"] = performQuery("SELECT * FROM `Light1` ORDER BY `reading_time` DESC LIMIT 1",1); $svg = ""; $basic_x = 80; $basic_y = 100; $oval_width = 100; $radius = 10; $font_size = 10; $svg .= svgRect('frame', 0, 0, 400, 250, 'none', '#000000', 0.5, 'lt'); $svg .= svgRect('frame_boruvka_tsr', $basic_x + $oval_width + $radius/2 - 5, $basic_y - 30, 70, 15, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('frame_boruvka_tsr_t', $tableCont['Light1'][0]['TSR']." ".htmlToSvgText(stripslashes($units['TSR']), $font_size), $basic_x + $oval_width + $radius/2 + 2, $basic_y - 19, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('boruvka1_t', 'B1', $basic_x + $oval_width + 5 + $radius/2, $basic_y - $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('boruvka2_t', 'B2', $basic_x + $oval_width + 40 + $radius/2, $basic_y - $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('boruvka2_t_2', 'B2', $basic_x + $oval_width + 55 + $oval_width + $radius*2, $basic_y - $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgOval('malina1', $basic_x, $basic_y, $oval_width, $radius*2, 'none', '#000000', 0.5, 'lt'); $svg .= svgCircle('boruvka1_1', $basic_x + $oval_width + 5, $basic_y, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('malina1_t', 'M1', $basic_x + $radius/2, $basic_y + $font_size*6/7 + $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('malina1_t-temp', $tableCont['Malina1'][0]['temp']." ".$units['temp'], $basic_x + $radius/2 + 25, $basic_y + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('malina1_t-hum', $tableCont['Malina1'][0]['hum']." ".$units['hum'], $basic_x + $radius/2 + 60, $basic_y + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('boruvka1_1_t-temp', $tableCont['Boruvka1'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + $radius - 3, $basic_y + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka1_1_t-hum', $tableCont['Boruvka1'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + $radius - 3, $basic_y + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgOval('malina2', $basic_x, $basic_y + $radius*2 + 10, $oval_width, $radius*2, 'none', '#000000', 0.5, 'lt'); $svg .= svgCircle('boruvka1_2', $basic_x + $oval_width + 5, $basic_y + $radius*2 + 10, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('malina2_t', 'M2', $basic_x + $radius/2, $basic_y + $radius*2 + 10 + $font_size*6/7 + $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('malina2_t-temp', $tableCont['Malina2'][0]['temp']." ".$units['temp'], $basic_x + $radius/2 + 25, $basic_y + $radius*2 + 10 + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('malina2_t-hum', $tableCont['Malina2'][0]['hum']." ".$units['hum'], $basic_x + $radius/2 + 60, $basic_y + $radius*2 + 10 + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('boruvka1_2_t-temp', $tableCont['Boruvka1'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + $radius - 3, $basic_y + $radius*2 + 10 + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka1_2_t-hum', $tableCont['Boruvka1'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + $radius - 3, $basic_y + $radius*2 + 10 + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgOval('malina3', $basic_x, $basic_y + ($radius*2 + 10)*2, $oval_width, $radius*2, 'none', '#000000', 0.5, 'lt'); $svg .= svgCircle('boruvka1_3', $basic_x + $oval_width + 5, $basic_y + ($radius*2 + 10)*2, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('malina3_t', 'M3', $basic_x + $radius/2, $basic_y + ($radius*2 + 10)*2 + $font_size*6/7 + $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('malina3_t-temp', $tableCont['Malina3'][0]['temp']." ".$units['temp'], $basic_x + $radius/2 + 25, $basic_y + ($radius*2 + 10)*2 + 5 + ($font_size-2), 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('malina3_t-hum', $tableCont['Malina3'][0]['hum']." ".$units['hum'], $basic_x + $radius/2 + 60, $basic_y + ($radius*2 + 10)*2 + 5 + ($font_size-2), 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('boruvka1_3_t-temp', $tableCont['Boruvka1'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + $radius - 3, $basic_y + ($radius*2 + 10)*2 + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka1_3_t-hum', $tableCont['Boruvka1'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + $radius - 3, $basic_y + ($radius*2 + 10)*2 + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgCircle('boruvka2_1', $basic_x + $oval_width + 40, $basic_y, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgOval('malina4', $basic_x + $oval_width + $radius*2 + 45, $basic_y, $oval_width, $radius*2, 'none', '#000000', 0.5, 'lt'); $svg .= svgCircle('boruvka2_2', $basic_x + $oval_width + $radius*2 + $oval_width + 50, $basic_y, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('malina4_t', 'M4', $basic_x + $oval_width + 60 + $radius, $basic_y + $font_size*6/7 + $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('malina4_t-temp', $tableCont['Malina4'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + 60 + $radius/2 + 28, $basic_y + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('malina4_t-hum', $tableCont['Malina4'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + 60 + $radius/2 + 63, $basic_y + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('boruvka2_1_t-temp', $tableCont['Boruvka2'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + 40 + $radius/2 - 3, $basic_y + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka2_1_t-hum', $tableCont['Boruvka2'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + 40 + $radius/2 - 3, $basic_y + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka2_2_t-temp', $tableCont['Boruvka2'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + $radius*2 + $oval_width + 50 + $radius/2 - 3, $basic_y + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka1_2_t-hum', $tableCont['Boruvka2'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + $radius*2 + $oval_width + 50 + $radius/2 - 3, $basic_y + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgCircle('boruvka2_3', $basic_x + $oval_width + 40, $basic_y + $radius*2 + 10, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgOval('malina5', $basic_x + $oval_width + $radius*2 + 45, $basic_y + $radius*2 + 10, $oval_width, $radius*2, 'none', '#000000', 0.5, 'lt'); $svg .= svgCircle('boruvka2_4', $basic_x + $oval_width + $radius*2 + $oval_width + 50, $basic_y + $radius*2 + 10, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('malina5_t', 'M5', $basic_x + $oval_width + 60 + $radius, $basic_y + $radius*2 + 10 + $font_size*6/7 + $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('malina5_t-temp', $tableCont['Malina5'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + 60 + $radius/2 + 28, $basic_y + $radius*2 + 10 + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('malina5_t-hum', $tableCont['Malina5'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + 60 + $radius/2 + 63, $basic_y + $radius*2 + 10 + ($font_size-2) + $radius/2, 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('boruvka2_3_t-temp', $tableCont['Boruvka2'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + 40 + $radius/2 - 3, $basic_y + $radius*2 + 10 + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka2_3_t-hum', $tableCont['Boruvka2'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + 40 + $radius/2 - 3, $basic_y + $radius*2 + 10 + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka2_4_t-temp', $tableCont['Boruvka2'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + $radius*2 + $oval_width + 50 + $radius/2 - 3, $basic_y + $radius*2 + 10 + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka1_4_t-hum', $tableCont['Boruvka2'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + $radius*2 + $oval_width + 50 + $radius/2 - 3, $basic_y + $radius*2 + 10 + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgCircle('boruvka2_5', $basic_x + $oval_width + 40, $basic_y + ($radius*2 + 10)*2, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgOval('malina6', $basic_x + $oval_width + $radius*2 + 45, $basic_y + ($radius*2 + 10)*2, $oval_width, $radius*2, 'none', '#000000', 0.5, 'lt'); $svg .= svgCircle('boruvka2_6', $basic_x + $oval_width + $radius*2 + $oval_width + 50, $basic_y + ($radius*2 + 10)*2, $radius, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('malina6_t', 'M6', $basic_x + $oval_width + 60 + $radius, $basic_y + ($radius*2 + 10)*2 + $font_size*6/7 + $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('malina6_t-temp', $tableCont['Malina6'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + 60 + $radius/2 + 28, $basic_y + ($radius*2 + 10)*2 + 5 + ($font_size-2), 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('malina6_t-hum', $tableCont['Malina6'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + 60 + $radius/2 + 63, $basic_y + ($radius*2 + 10)*2 + 5 + ($font_size-2), 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('boruvka2_3_t-temp', $tableCont['Boruvka2'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + 40 + $radius/2 - 3, $basic_y + ($radius*2 + 10)*2 + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka2_3_t-hum', $tableCont['Boruvka2'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + 40 + $radius/2 - 3, $basic_y + ($radius*2 + 10)*2 + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka2_4_t-temp', $tableCont['Boruvka2'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + $radius*2 + $oval_width + 50 + $radius/2 - 3, $basic_y + ($radius*2 + 10)*2 + ($font_size-6) + $radius/2, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgText('boruvka1_4_t-hum', $tableCont['Boruvka2'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + $radius*2 + $oval_width + 50 + $radius/2 - 3, $basic_y + ($radius*2 + 10)*2 + ($font_size-6) + $radius, 'none', 'black', $font_size-6, 'Arial'); $svg .= svgOval('jablon1', $basic_x + $oval_width + $radius*2 + 45, $basic_y + ($radius*2 + 10)*3, $oval_width, $radius*2, 'none', '#000000', 0.5, 'lt'); $svg .= svgText('jablon1_t', 'J1', $basic_x + $oval_width + 60 + $radius, $basic_y + ($radius*2 + 10)*3 + $font_size*6/7 + $radius/2, 'none', 'black', $font_size, 'Arial'); $svg .= svgText('malina3_t-temp', $tableCont['Jablone1'][0]['temp']." ".$units['temp'], $basic_x + $oval_width + 60 + $radius/2 + 28, $basic_y + ($radius*2 + 10)*3 + 5 + ($font_size-2), 'none', 'black', $font_size-2, 'Arial'); $svg .= svgText('malina3_t-hum', $tableCont['Jablone1'][0]['hum']." ".$units['hum'], $basic_x + $oval_width + 60 + $radius/2 + 63, $basic_y + ($radius*2 + 10)*3 + 5 + ($font_size-2), 'none', 'black', $font_size-2, 'Arial'); $svg = svgTag($svg, '400', '250'); $cont = "

{$msg['crops']}

".date("d.m.Y H:i:s",strtotime($tableCont[$tables[0]][0]['reading_time']))."

".$msg['rasp_motivation']."
Soil foto
Soil sonda
Soil foto
".$msg['rasp_description']."
{$svg}
"; $cont.= "
"; foreach($tables as $table) { $cont.= "

".$table."

".mb_ucfirst_exceptions($msg['temp'])." ".$tableCont[$table][0]["temp"]." {$units['temp']}
".mb_ucfirst_exceptions($msg['hum'])." ".$tableCont[$table][0]["hum"]." {$units['hum']}
".mb_ucfirst_exceptions($msg['Nko'])." ".$tableCont[$table][0]["Nko"]." {$units['Nko']}
".mb_ucfirst_exceptions($msg['Pko'])." ".$tableCont[$table][0]["Pko"]." {$units['Pko']}
".mb_ucfirst_exceptions($msg['Kko'])." ".$tableCont[$table][0]["Kko"]." {$units['Kko']}
".mb_ucfirst_exceptions($msg['vodivost'])." ".$tableCont[$table][0]["vodivost"]." {$units['vodivost']}
".mb_ucfirst_exceptions($msg['pH'])." ".$tableCont[$table][0]["pH"]." {$units['pH']}
".mb_ucfirst_exceptions($msg['salin'])." ".$tableCont[$table][0]["salin"]." {$units['salin']}
".mb_ucfirst_exceptions($msg['TDS'])." ".$tableCont[$table][0]["TDS"]." {$units['TDS']}
".mb_ucfirst_exceptions($msg['foto'])." ".$tableCont[$table][0]["foto"]." {$units['foto']}
".mb_ucfirst_exceptions($msg['Ubat'])." ".$tableCont[$table][0]["Ubat"]." {$units['Ubat']}
".mb_ucfirst_exceptions($msg['Upanel'])." ".$tableCont[$table][0]["Upanel"]." {$units['Upanel']}
".mb_ucfirst_exceptions($msg['Cbat'])." ".$tableCont[$table][0]["Cbat"]." {$units['Cbat']}
".mb_ucfirst_exceptions($msg['RSSI'])." ".$tableCont[$table][0]["RSSI"]." {$units['RSSI']}
"; } $cont.= "
"; $cont.="
{$graph1[0]}
{$graph2[0]}
"; return array($cont,$graph1[1].$graph2[1]); } function lawn_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "ZeminaLaCHpS01_2"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $graph1 = get_graphx("hum-chart",$db_table, "hum", $graph_range, $force_title = "", ""); $graph2 = get_graphx("npk-chart",$db_table, array("Nko","Pko","Kko"), $graph_range, $force_title = "", ""); $graph3 = get_graphx("temp-chart",$db_table, "temp", $graph_range, $force_title = "", ""); $graph4 = get_graphx("ph-chart",$db_table, "pH", $graph_range, $force_title = "", ""); $cont = "

{$msg['lawn']}

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

".$msg['lawn_motivation']."
".mb_ucfirst_exceptions($msg['Ubat'])." ".$tableCont[0]['Ubat']." {$units['Ubat']}
".mb_ucfirst_exceptions($msg['Upanel'])." ".$tableCont[0]['Upanel']." {$units['Upanel']}
".mb_ucfirst_exceptions($msg['Cbat'])." ".$tableCont[0]['Cbat']." {$units['Cbat']}
".mb_ucfirst_exceptions($msg['temp'])." ".$tableCont[0]['temp']." {$units['temp']}
".mb_ucfirst_exceptions($msg['hum'])." ".$tableCont[0]['hum']." {$units['hum']}
".mb_ucfirst_exceptions($msg['Nko'])." ".$tableCont[0]['Nko']." {$units['Nko']}
".mb_ucfirst_exceptions($msg['Pko'])." ".$tableCont[0]['Pko']." {$units['Pko']}
".mb_ucfirst_exceptions($msg['Kko'])." ".$tableCont[0]['Kko']." {$units['Kko']}
".mb_ucfirst_exceptions($msg['vodivost'])." ".$tableCont[0]['vodivost']." {$units['vodivost']}
".mb_ucfirst_exceptions($msg['pH'])." ".$tableCont[0]['pH']." {$units['pH']}
".mb_ucfirst_exceptions($msg['salin'])." ".$tableCont[0]['salin']." {$units['salin']}
".mb_ucfirst_exceptions($msg['TDS'])." ".$tableCont[0]['TDS']." {$units['TDS']}
".mb_ucfirst_exceptions($msg['chyba'])." ".$tableCont[0]['chyba']." {$units['chyba']}
".mb_ucfirst_exceptions($msg['stav'])." ".$tableCont[0]['stav']." {$units['stav']}
".mb_ucfirst_exceptions($msg['RSSI'])." ".$tableCont[0]['RSSI']." {$units['RSSI']}
Soil sonda
Soil foto
".$msg['lawn_description']."
{$graph1[0]}
{$graph2[0]}
{$graph3[0]}
{$graph4[0]}
"; return array($cont,$graph1[1].$graph2[1].$graph3[1].$graph4[1]); } function PV_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "FVAtrium"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $graph1 = get_graphx("soc-chart",$db_table, "SoC", $graph_range, $force_title = "", ""); $graph2 = get_graphx("ubat-chart",$db_table, "Ubat", $graph_range, $force_title = "", ""); $graph3 = get_graphx("ibat-chart",$db_table, "Ibat", $graph_range, $force_title = "", ""); $graph4 = get_graphx("vykona-chart",$db_table, "vykonA", $graph_range, $force_title = "", ""); $graph5 = get_graphx("ustringa-chart",$db_table, "UpanelA", $graph_range, $force_title = "", ""); $graph6 = get_graphx("vykonb-chart",$db_table, "vykonB", $graph_range, $force_title = "", ""); $graph7 = get_graphx("ustringb-chart",$db_table, "UpanelB", $graph_range, $force_title = "", ""); $stringy = array('A','B'); $stringy_html = ""; foreach($stringy as $string){ $stringy_html.= str_replace("|", $string, " ".mb_ucfirst_exceptions($msg['vykon|'])." ".$tableCont[0]['vykon'.$string]." {$units['vykon|']} ".mb_ucfirst_exceptions($msg['Upanel|'])." ".$tableCont[0]['Upanel'.$string]." {$units['Upanel|']} ".mb_ucfirst_exceptions($msg['Inabijecka|'])." ".$tableCont[0]['Inabijecka'.$string]." {$units['Inabijecka|']} "); } $cont = "

{$msg['photovoltaics']}

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

{$msg[
{$stringy_html}
".mb_ucfirst_exceptions($msg['SoC'])." ".$tableCont[0]['SoC']." {$units['SoC']}
".mb_ucfirst_exceptions($msg['vykon'])." ".$tableCont[0]['vykon']." {$units['vykon']}
".mb_ucfirst_exceptions($msg['procvykon'])." ".$tableCont[0]['procvykon']." {$units['procvykon']}
".mb_ucfirst_exceptions($msg['capacita'])." ".$tableCont[0]['capacita']." {$units['capacita']}
".mb_ucfirst_exceptions($msg['Ubat'])." ".$tableCont[0]['Ubat']." {$units['Ubat']}
".mb_ucfirst_exceptions($msg['Ibat'])." ".$tableCont[0]['Ibat']." {$units['Ibat']}
".mb_ucfirst_exceptions($msg['TboxC'])." ".$tableCont[0]['TboxC']." {$units['TboxC']}
".mb_ucfirst_exceptions($msg['TbatC'])." ".$tableCont[0]['TbatC']." {$units['TbatC']}
".mb_ucfirst_exceptions($msg['ToutC'])." ".$tableCont[0]['ToutC']." {$units['ToutC']}
".$msg['pv_description']."
{$msg[
{$graph1[0]}
{$graph2[0]}
{$graph3[0]}
{$graph4[0]}
{$graph5[0]}
{$graph6[0]}
{$graph7[0]}
"; return array($cont,$graph1[1].$graph2[1].$graph3[1].$graph4[1].$graph5[1].$graph6[1].$graph7[1]); } function temps_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "TempMeter1LaCHpS01v1"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $teploty = array('1','2','3','4','5','6'); $teploty_html = ""; $teploty_table=""; $g1 = array(); $sensors = array(); foreach($teploty as $teplota){ $g1[] = "stm_1_temp_".$teplota; $sensors[] = $msg['temp']." ".$teplota; $teploty_table.= str_replace("|", $teplota, " ".mb_ucfirst_exceptions(str_replace("#",$teplota,$msg['stm_1_temp_#']))." ".$tableCont[0]["stm_1_temp_".$teplota]." {$units['stm_1_temp_#']} "); } $graph1 = get_graphx("temp-chart",$db_table, $g1, $graph_range, $msg['temp'],$msg['temp'],$msg['temp']." [".$units['temp']."]"); $graphs_js = $graph1[1]; $cont = "

".mb_ucfirst_exceptions($msg['temperatures'])."

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

{$teploty_table}
".$msg['temperatures_description']."
".$graph1[0]." ".$msg['graph_detail']."
"; return array($cont,$graphs_js); } function meteo_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "MeteoStaniceLaCHpS02"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $graph1 = get_graphx("temp-chart",$db_table, "bmx_teplota", $graph_range, $force_title = "", ""); $graph2 = get_graphx("press-chart",$db_table, "bmx_tlak", $graph_range, $force_title = "", ""); $graph3 = get_graphx("hum-chart",$db_table, "si7021_vlhkost", $graph_range, $force_title = "", ""); $graph4 = get_graphx("rain-chart",$db_table, "se_srazky_den", $graph_range, $force_title = "", ""); $cont = "

{$msg['meteostation']}

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

{$msg[
{$msg[
".mb_ucfirst_exceptions($msg['bat_napeti'])." ".$tableCont[0]['bat_napeti']." {$units['bat_napeti']}
".mb_ucfirst_exceptions($msg['bat_stav'])." ".$tableCont[0]['bat_stav']." {$units['bat_stav']}
".mb_ucfirst_exceptions($msg['bmx_teplota'])." ".$tableCont[0]['bmx_teplota']." {$units['bmx_teplota']}
".mb_ucfirst_exceptions($msg['bmx_tlak'])." ".$tableCont[0]['bmx_tlak']." {$units['bmx_tlak']}
".mb_ucfirst_exceptions($msg['bmx_vyska'])." ".$tableCont[0]['bmx_vyska']." {$units['bmx_vyska']}
".mb_ucfirst_exceptions($msg['si7021_teplota'])." ".$tableCont[0]['si7021_teplota']." {$units['si7021_teplota']}
".mb_ucfirst_exceptions($msg['si7021_vlhkost'])." ".$tableCont[0]['si7021_vlhkost']." {$units['si7021_vlhkost']}
".mb_ucfirst_exceptions($msg['uv_intenzita'])." ".$tableCont[0]['uv_intenzita']." {$units['uv_intenzita']}
".mb_ucfirst_exceptions($msg['WindSpeed'])." ".$tableCont[0]['WindSpeed']." {$units['WindSpeed']}
".mb_ucfirst_exceptions($msg['wind_dir_angle'])." ".$tableCont[0]['wind_dir_angle']." {$units['wind_dir_angle']}
".mb_ucfirst_exceptions($msg['wind_dir'])." ".$tableCont[0]['wind_dir']." {$units['wind_dir']}
".mb_ucfirst_exceptions($msg['lightning_d'])." ".$tableCont[0]['lightning_d']." {$units['lightning_d']}
".mb_ucfirst_exceptions($msg['lightning_dist'])." ".$tableCont[0]['lightning_dist']." {$units['lightning_dist']}
".mb_ucfirst_exceptions($msg['se_srazky_den'])." ".$tableCont[0]['se_srazky_den']." {$units['se_srazky_den']}
".$msg['meteo_description']."
{$graph1[0]}
{$graph2[0]}
{$graph3[0]}
{$graph4[0]}
"; return array($cont,$graph1[1].$graph2[1].$graph3[1].$graph4[1]); } function irrigation_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "Zavlaha"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $graph1 = get_graphx("levelA-chart",$db_table, "hladinaA", $graph_range, $force_title = "", "", "", array(0, 100)); $graph2 = get_graphx("levelB-chart",$db_table, "hladinaB", $graph_range, $force_title = "", "", "", array(0, 100)); $cont = "

".mb_ucfirst_exceptions($msg['irrigation_title'])."

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

".mb_ucfirst_exceptions($msg['level'])." A ".$tableCont[0]['hladinaA']." {$units['level']}
".mb_ucfirst_exceptions($msg['level'])." B ".$tableCont[0]['hladinaB']." {$units['level']}
{$graph1[0]}
{$graph2[0]}
"; return array($cont,$graph1[1].$graph2[1]); } function hydroponics_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "ZeminaLaCHpS04v2_4_2"; $graphs_js=""; $k = 0; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $sensors = array("70 mm", "170 mm", "270 mm", "370 mm"); $sensors = array("sensor 1", "sensor 2", "sensor 3"); $g1 = array("moist1","moist2","moist3"); $graph1 = get_graphx("moist-chart",$db_table, $g1, $graph_range, $force_title = $sensors,$msg['moist']); $graphs_js.= $graph1[1]; $g2 = array("temp1","temp2","temp3"); $graph2 = get_graphx("temp-chart",$db_table, $g2, $graph_range, $force_title = $sensors,$msg['temp']); $graphs_js.= $graph2[1]; // $g3 = array("Nko1","Nko2","Nko3","Nko4"); // $graph3 = get_graphx("n-chart",$db_table, $g3, $graph_range, $force_title = $sensors,$msg['Nko']); // $graphs_js.= $graph3[1]; // $g4 = array("Pko1","Pko2","Pko3","Pko4"); // $graph4 = get_graphx("p-chart",$db_table, $g4, $graph_range, $force_title = $sensors,$msg['Pko']); // $graphs_js.= $graph4[1]; // $g5 = array("Kko1","Kko2","Kko3","Kko4"); // $graph5 = get_graphx("k-chart",$db_table, $g5, $graph_range, $force_title = $sensors,$msg['Kko']); // $graphs_js.= $graph5[1]; $cont = "

".mb_ucfirst_exceptions($msg['hydroponics'])."

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

".mb_ucfirst_exceptions($msg['hydroponics_moisture'])."
"; // $cont.= " //
//
//
// ".$msg['soil_motivation']." //

// ".$msg['soil_description']." //

// // // // // // // // // // // // // // // // // // // // // // // // // //
".mb_ucfirst_exceptions($msg['Ubat'])."".$tableCont[0]['Ubat']." {$units['Ubat']}
".mb_ucfirst_exceptions($msg['Upanel'])."".$tableCont[0]['Upanel']." {$units['Upanel']}
".mb_ucfirst_exceptions($msg['Cbat'])."".$tableCont[0]['Cbat']." {$units['Cbat']}
".mb_ucfirst_exceptions($msg['Tbat'])."".$tableCont[0]['Tbat']." {$units['Tbat']}
".mb_ucfirst_exceptions($msg['Fotorezistor'])."".$tableCont[0]['Fotorezistor']." {$units['Fotorezistor']}
".mb_ucfirst_exceptions($msg['RSSI'])."".$tableCont[0]['RSSI']." {$units['RSSI']}
//
//
// Soil //
//
"; $cont.= "
"; for($i=1;$i<=3;$i++){ $cont.= "

".$sensors[$i-1]."

"; // $cont.=" // // // // // // // // // // // // // // // // // // // // // // // // // // // // // "; $cont.="
".mb_ucfirst_exceptions($msg['temp'])." ".$tableCont[0]["temp{$i}"]." {$units['temp']}
".mb_ucfirst_exceptions($msg['moist'])." ".$tableCont[0]["moist{$i}"]." {$units['moist']}
".mb_ucfirst_exceptions($msg['Nko'])."".$tableCont[0]["Nko{$i}"]." {$units['Nko']}
".mb_ucfirst_exceptions($msg['Pko'])."".$tableCont[0]["Pko{$i}"]." {$units['Pko']}
".mb_ucfirst_exceptions($msg['Kko'])."".$tableCont[0]["Kko{$i}"]." {$units['Kko']}
".mb_ucfirst_exceptions($msg['vodivost'])."".$tableCont[0]["vodivost{$i}"]." {$units['vodivost']}
".mb_ucfirst_exceptions($msg['pH'])."".$tableCont[0]["pH{$i}"]." {$units['pH']}
".mb_ucfirst_exceptions($msg['salin'])."".$tableCont[0]["salin{$i}"]." {$units['salin']}
".mb_ucfirst_exceptions($msg['TDS'])."".$tableCont[0]["TDS{$i}"]." {$units['TDS']}
"; } $cont.= "
"; $cont.= "
".$graph1[0]." ".$msg['graph_detail']."
".$graph2[0]." ".$msg['graph_detail']."
"; // $cont.= " //
//
// ".$graph3[0]." // ".$msg['graph_detail']." //
//
// ".$graph4[0]." // ".$msg['graph_detail']." //
//
// ".$graph5[0]." // ".$msg['graph_detail']." //
//
//
// "; $db_table = "TempMeter2LaCHpS01v1"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $teploty = array('1','2','3','4','5','6'); $teploty_html = ""; $teploty_table=""; $g7 = array(); $sensors = array(); foreach($teploty as $teplota){ $g7[] = "stm_2_temp_".$teplota; $sensors[] = $msg['temp']." ".$teplota; $teploty_table.= str_replace("|", $teplota, " ".mb_ucfirst_exceptions(str_replace("#",$teplota,$msg['stm_2_temp_#']))." ".$tableCont[0]["stm_2_temp_".$teplota]." {$units['stm_2_temp_#']} "); } $graph7 = get_graphx("temp2-chart",$db_table, $g7, $graph_range, $msg['temp'],$msg['temp'],$msg['temp']." [".$units['temp']."]"); $graphs_js.= $graph7[1]; $cont .= "
".mb_ucfirst_exceptions($msg['hydroponics_temp'])."
{$teploty_table}
".$graph7[0]." ".$msg['graph_detail']."
"; return array($cont,$graphs_js); } function compost_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "ThermMeter_v1_Kompost"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $graph1 = get_graphx("t1-chart",$db_table, "T1_thermMeter_v1", $graph_range, $force_title = "tempK1", "tempK1", "tempK1"." [".$units['temp']."]"); $cont_tab = ""; foreach($tableCont[0] as $tck => $tcv){ if(!strstr($tck,"_thermMeter_v1")){ continue; } if($th = $msg[str_replace("_thermMeter_v1","", $tck)]){ } else { $th = str_replace("_thermMeter_v1","", $tck); } if($unit = $units[str_replace("_thermMeter_v1","", $tck)]){ } else { if(substr($tck,0,1) == "T"){ $unit = $units['temp']; } } $cont_tab.= " ".mb_ucfirst_exceptions($th)." ".$tcv." ".$unit." "; } $cont = "

".mb_ucfirst_exceptions($msg['compost_title'])."

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

{$cont_tab}
{$graph1[0]}
"; return array($cont,$graph1[1]); } function exchanger_content_actual($graph_range="last_24"){ global $msg; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } $db_table = "NadrzVymenik"; $tableCont = performQuery("SELECT * FROM `{$db_table}` ORDER BY `reading_time` DESC LIMIT 1",1); if($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-1 month"))){ $graph_range = "year"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-7 days"))){ $graph_range = "month"; } elseif($tableCont[0]['reading_time'] < date("Y-m-d H:i:s",strtotime("-24 hours"))){ $graph_range = "week"; } $exchanger_cols = array( VymToZem_Temp, VymToZem_Prutok, VymFromZem_Temp, VymFromZem_Prutok, VymToKomp_Temp, VymToKomp_Prutok, VymFromKomp_Temp, VymFromKomp_Prutok ); $graph1 = get_graphx("exchanger",$db_table, $exchanger_cols, $graph_range, $force_title = "", "", ""); $exchanger_table = " "; foreach($exchanger_cols as $v){ $col = explode("_", $v); $col_title = $msg[$col[0]]." ".$msg[$col[1]]; $exchanger_table.= " "; } $exchanger_table.= "
".mb_ucfirst_exceptions($col_title)." A ".$tableCont[0][$v]." {$units[$col[1]]}
"; $cont = "

".mb_ucfirst_exceptions($msg['irrigation_title'])."

".date("d.m.Y H:i:s",strtotime($tableCont[0]['reading_time']))."

{$exchanger_table}
{$graph1[0]}
{$graph2[0]}
"; return array($cont,$graph1[1].$graph2[1]); } function get_graphx($graph_div_id, $type, $v, $range = "last_24", $force_title = "", $overwrite_title = "", $overwrite_y = "", $y_range=array()){ global $set, $msg; $cont = ""; $f_title = $force_title; $x_axis_title = $msg['time']; $units_data = performQuery("SELECT * FROM `units`"); $units = array(); foreach($units_data as $udv){ $units[$udv['title']] = $udv['unit']; } if(is_array($v)){ $var = $v[0]; } else { $var = $v; } $var_name = $var; $var_num = ""; foreach(array('0','1','2','3','4','5','6','7','8','9') as $num){ foreach($msg as $msk => $msv){ if(strstr($msk, '#')){ if(str_replace("#",$num,$msk) == $var){ $var_name = $msk; $var_num = $num; break 2; } } } } foreach(array('A','B','C','D','E','F') as $num){ foreach($msg as $msk => $msv){ if(strstr($msk, '|')){ if(str_replace("|",$num,$msk) == $var){ $var_name = $msk; $var_num = $num; break 2; } } } } if($units[$var_name] != ""){ $gunits = "[".$units[$var_name]."]"; } else { $gunits = ""; } if($range == ""){$range = 'last_24';} switch($range){ case "all": $range_sql = "WHERE `reading_time`>'0000-00-00 00:00:00'"; $min_sql = ",MIN(`reading_time`)"; $group_sql = "GROUP BY DATE(`reading_time`)"; break; case "year": $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 year"))."'"; $min_sql = ",MIN(`reading_time`)"; $group_sql = "GROUP BY DATE(`reading_time`),HOUR(`reading_time`)"; break; case "month": $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 month"))."'"; $min_sql = ",MIN(`reading_time`)"; $group_sql = "GROUP BY DATE(`reading_time`),HOUR(`reading_time`)"; break; case "week": $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 week"))."'"; $min_sql = ""; $group_sql = ""; break; case "this_year": $range_sql = "WHERE `reading_time`>='".date("Y-01-01 00:00:00")."'"; $min_sql = ",MIN(`reading_time`)"; $group_sql = "GROUP BY DATE(`reading_time`),HOUR(`reading_time`)"; break; case "this_month": $range_sql = "WHERE `reading_time`>='".date("Y-m-01 00:00:00")."'"; $min_sql = ",MIN(`reading_time`)"; $group_sql = "GROUP BY DATE(`reading_time`),HOUR(`reading_time`)"; break; case "this_week": $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("monday this week"))."'"; $min_sql = ""; $group_sql = ""; break; case "today": $range_sql = "WHERE `reading_time`>='".date("Y-m-d 00:00:00")."'"; $min_sql = ""; $group_sql = ""; break; case "yesterday": $range_sql = "WHERE `reading_time`>='".date("Y-m-d 00:00:00",strtotime("yesterday"))."' AND `reading_time`<'".date("Y-m-d 00:00:00")."'"; $min_sql = ""; $group_sql = ""; break; //last 24 hours default: $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 day"))."'"; break; } if(is_array($type)){ $tables = $type; } else { $tables = array($type); } $series = array(); $traces = array(); $vi = 0; foreach($tables as $table){ $tableCont = performQuery("SELECT `$var`,`reading_time`{$min_sql} FROM `{$table}` {$range_sql} {$group_sql} ORDER BY `reading_time` ",1); if(is_array($force_title)){ $f_title = $force_title; if($overwrite_title != ""){ $force_title = ""; } } elseif($force_title != ""){ $force_title = camel_split($force_title)." - "; } if($overwrite_title != ""){ if($overwrite_title != "||"){ $title = "

{$force_title}{$overwrite_title}

"; $tit = $force_title.$overwrite_title; } else { $title = ""; $tit = ""; } } else { if(sizeof($tables) > 1){ $title = "

{$force_title}{$type}

"; $tit = $force_title.$table; } else { $title = "

{$force_title}{$type}

"; $tit = $force_title.$type; } } $var_titles = array(); $var_legend = array(); if(is_array($v)){ foreach($v as $var){ $var_name = $var; $var_num = ""; foreach(array('0','1','2','3','4','5','6','7','8','9') as $num){ foreach($msg as $msk => $msv){ if(strstr($msk, '#')){ if(str_replace("#",$num,$msk) == $var){ $var_name = $msk; $var_num = $num; break 2; } } } } foreach(array('A','B','C','D','E','F') as $num){ foreach($msg as $msk => $msv){ if(strstr($msk, '|')){ if(str_replace("|",$num,$msk) == $var){ $var_name = $msk; $var_num = $num; break 2; } } } } if(strstr($type,"Zemina")){ $var_name = str_replace("hum","moist",$var_name); } if(is_array($f_title)){ $var_titles[0] = $overwrite_title; $var_legend = $f_title; } else { if(sizeof($tables) > 1){ $var_titles[] = $table; $var_legend[] = $table; } else { $var_titles[] = mb_ucfirst_exceptions(str_replace("|", $var_num, str_replace("#",$var_num,$msg[$var_name]))); $var_legend[] = mb_ucfirst_exceptions(str_replace("|", $var_num, str_replace("#",$var_num,$msg[$var_name]))); } } } if($units[str_replace($var_num,"",$var)] != ""){ $gunits = "[".$units[str_replace($var_num,"",$var)]."]"; } else { $gunits = ""; } $sub_title = $force_title.implode(", ",$var_titles)." {$gunits}"; } else { if(strstr($type,"Zemina")){ $var_name = str_replace("hum","moist",$var_name); } $sub_title = $force_title.mb_ucfirst_exceptions(str_replace("|", $var_num, str_replace("#",$var_num,$msg[$var_name])))." {$gunits}"; } // $cont = " // {$title} //
// "; $cont.= "
"; $data = array(); $labes = array(); $labesx = array(); $bar_chart = false; $last_val = "0000-00-00 00:00:00"; $l = 0; foreach($tableCont as $tCv){ $zero_lab = ""; switch($range){ case "this_year": $zero_lab = date("m.Y",strtotime($tableCont[0]['reading_time'])); $date_format = "%m"; $x_axis_title = $msg['month']; case "all": case "year": $this_val = date("Y-m",strtotime($tCv['reading_time'])); $this_lab = date("m",strtotime($tCv['reading_time'])); $date_format = "%m"; $x_axis_title = $msg['month']; break; case "this_month": case "this_week": $zero_lab = date("d.m.",strtotime($tableCont[0]['reading_time'])); $date_format = "%d.%m."; $x_axis_title = $msg['date']; case "month": case "week": $this_val = date("Y-m-d",strtotime($tCv['reading_time'])); $this_lab = date("d.m.",strtotime($tCv['reading_time'])); $date_format = "%d.%m."; $x_axis_title = $msg['date']; break; case "today": case "yesterday": $zero_lab = date("H:00",strtotime($tableCont[0]['reading_time'])); default: $this_val = date("Y-m-d H",strtotime($tCv['reading_time'])); $this_lab = date("H:00",strtotime($tCv['reading_time'])); $date_format = "%H:%M"; break; } $labesx[] = "'".$tCv['reading_time']."'"; if(strstr($tCv[$var],":")){ $hm = explode(":",$tCv[$var]); $tCv[$var] = $hm[0] + $hm[1]/60; $tCv[$var] = round($tCv[$var],2); } if($tCv[$var]=='true' || $tCv[$var]=='false'){$bar_chart = true;} if($tCv[$var] == 'false'){ $data[] = 0; } elseif($tCv[$var] == 'true'){ $data[] = 1; } elseif($tCv[$var] == 'nan'){ $data[] = 0; } else { $data[] = $tCv[$var]; } } if(is_array($v)){ $ser = array(); $leg_lab = array(); // print_r($v); foreach($v as $vk => $var){ $data = array(); $tableCont = performQuery("SELECT `$var`,`reading_time` FROM `$table` {$range_sql} ORDER BY `reading_time`",1); foreach($tableCont as $tCv){ if(strstr($tCv[$var],":")){ $hm = explode(":",$tCv[$var]); $tCv[$var] = $hm[0] + $hm[1]/60; $tCv[$var] = round($tCv[$var],2); } if($tCv[$var]=='true' || $tCv[$var]=='false'){$bar_chart = true;} if($tCv[$var] == 'false'){ $data[] = 0; } elseif($tCv[$var] == 'true'){ $data[] = 1; } elseif($tCv[$var] == 'nan'){ $data[] = 0; } else { $data[] = $tCv[$var]; } } $ser[] = "{data: [".implode(",",$data)."],name:'".$var_titles[$vk]."'}"; $series[] = "trace{$vi}"; $traces[] = " var trace{$vi} = { x: [".implode(",",$labesx)."], y: [".implode(",",$data)."], mode: 'markers+lines', type: 'scatter', name: '".$var_legend[$vk]."', marker: { size: 5 } } "; $js_ser[] = implode(",",$data); if(sizeof($tables) == 1){ $vi++; } } $js_labels = implode(",",$labes); $js_data = implode(";",$js_ser); foreach($var_titles as $vt){ $leg_lab[] = "'{$vt}'"; } } else { $js_labels = implode(",",$labes); $js_data = implode(",",$data); $series[] = "trace{$vi}"; $traces[] = " var trace{$vi} = { x: [".implode(",",$labesx)."], y: [".implode(",",$data)."], mode: 'markers+lines', type: 'scatter', name: '{$tit}', marker: { size: 5 } } "; } if($overwrite_y != ""){ $sub_title = $overwrite_y; } if(sizeof($tables) > 1){ $vi++; } } $add_script=" "; return array($cont, $add_script, $js_labels, $js_data, $sub_title); } function clientIpAddress(){ global $_SERVER; if(!empty($_SERVER['HTTP_CLIENT_IP'])){ $address = $_SERVER['HTTP_CLIENT_IP']; } elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ $address = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $address = $_SERVER['REMOTE_ADDR']; } return $address; } function clientDetalis($ip){ $details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json")); $result = array(); $result['ip'] = $ip; $result['hostname'] = $details->hostname; $result['loc'] = $details->loc; $result['org'] = $details->org; $result['city'] = $details->city; $result['region'] = $details->region; $result['country'] = $details->country; $result['phone'] = $details->phone; return $result; } function setVisit(){ global $set; $ip = clientIpAddress(); switch($set['visits_frequency']){ case 'h': case 'H': $frequency_string = date("Y-m-d H")."%"; break; case 'i': case 'I': $frequency_string = date("Y-m-d H:i")."%"; break; case 'm': case 'M': $frequency_string = date("Y-m")."%"; break; case 'd': case 'D': default: $frequency_string = date("Y-m-d ")."%"; break; } if(performQuery("SELECT id FROM `visits` WHERE `ip`='{$ip}' AND `dt` LIKE '{$frequency_string}'")){ // already recorded } else { $details = clientDetalis($ip); $insert_sql = "INSERT INTO `visits` SET `dt`='".date("Y-m-d H:i:s")."', `ip`='{$ip}', `hostname`='{$details['hostname']}', `loc`='{$details['loc']}', `org`='{$details['org']}', `city`='{$details['city']}', `region`='{$details['region']}', `country`='{$details['country']}', `phone`='{$details['phone']}' "; performQuery($insert_sql); } } function doLog(){ global $param1,$_SERVER; $ip = clientIpAddress(); $details = clientDetalis($ip); $actual_link = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $insert_sql = "INSERT INTO `log` SET `dt`='".date("Y-m-d H:i:s")."', `ip`='{$ip}', `hostname`='{$details['hostname']}', `loc`='{$details['loc']}', `org`='{$details['org']}', `city`='{$details['city']}', `region`='{$details['region']}', `country`='{$details['country']}', `phone`='{$details['phone']}', `page`='".$param1."', `url`='".$actual_link."' "; performQuery($insert_sql); } function createDeviceSelect($selected_device){ global $set,$msg; $devices = performQuery("SELECT * FROM `commands_devices` ORDER BY `position` ASC"); $devices_select = ""; $devices_select = str_replace("value='{$selected_device}'","value='{$selected_device}' selected='selected'",$devices_select); return $devices_select; } function createCommandSelect($selected_command, $selected_device){ global $set,$msg; $command_select = "-"; $device = performQuery("SELECT * FROM `commands_devices` WHERE `short`='{$selected_device}'"); if($available_commands = performQuery("SELECT c.* FROM `commands_types` AS c, `commands_devices_commands` AS d WHERE c.id = d.id_command AND d.id_device='{$device[0]['id']}' ORDER BY c.position")){ $command_select = ""; $command_select = str_replace("value='{$selected_command}'","value='{$selected_command}' selected='selected'",$command_select); } else { $command_select = ""; } return $command_select; } function createValueSelect($selected_value, $selected_command){ global $set,$msg; $new_value = ""; $value_select = ""; $val_toggle = 1; if($available_values = performQuery("SELECT v.*,c.values_num FROM `commands_values` AS v, `commands_types` AS c WHERE c.command = v.type AND c.command='{$selected_command}' ORDER BY c.position")){ if($available_values[0]['values_num'] == 0){ $val_toggle = 0; $value_select = " {$available_values[0]['min_val']}-{$available_values[0]['max_val']} {$available_values[0]['units']}"; } elseif($available_values[0]['values_num'] == 1){ $value_select = ""; } elseif($available_values[0]['values_num'] == -1){ $value_select = ""; } elseif($available_values[0]['values_num'] == 2){ $value_select = ""; $value_select = str_replace("value='{$selected_value}'","value='{$selected_value}' selected='selected'",$value_select); } $value_select.=" "; } return $value_select; } function mb_ucfirst_exceptions($str, $add_exceptions = array(), $overwrite_exceptions = array(),$encoding = 'UTF-8') { global $ucfirst_exceptions; if (empty($overwrite_exceptions)) { $exceptions = $ucfirst_exceptions; } else { $exceptions = $overwrite_exceptions; } $exceptions = array_merge($exceptions, $add_exceptions); if(in_array($str, $exceptions)) { return $str; } $firstChar = mb_substr($str, 0, 1, $encoding); if (in_array($firstChar, $exceptions)) { $firstChar = mb_strtoupper($firstChar, $encoding); } else { $firstChar = mb_ucfirst($firstChar, $encoding); } return $firstChar.mb_substr($str, 1, null, $encoding); } // function get_graph($graph_div_id, $type, $v, $range = "last_24", $force_title = "", $overwrite_title = ""){ // global $set, $msg; // $units_data = performQuery("SELECT * FROM `units`"); // $units = array(); // foreach($units_data as $udv){ // $units[$udv['title']] = $udv['unit']; // } // if(is_array($v)){ // $var = $v[0]; // } else { // $var = $v; // } // $var_name = $var; // $var_num = ""; // foreach(array('0','1','2','3','4','5','6','7','8','9') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '#')){ // if(str_replace("#",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // foreach(array('A','B','C','D','E','F') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '|')){ // if(str_replace("|",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // if($units[$var_name] != ""){ // $gunits = "[".$units[$var_name]."]"; // } else { // $gunits = ""; // } // if($range == ""){$range = 'last_24';} // switch($range){ // case "all": // $range_sql = "WHERE `reading_time`>'0000-00-00 00:00:00'"; // break; // case "year": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 year"))."'"; // break; // case "month": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 month"))."'"; // break; // case "week": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 week"))."'"; // break; // case "this_year": // $range_sql = "WHERE `reading_time`>='".date("Y-01-01 00:00:00")."'"; // break; // case "this_month": // $range_sql = "WHERE `reading_time`>='".date("Y-m-01 00:00:00")."'"; // break; // case "this_week": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("monday this week"))."'"; // break; // case "today": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d 00:00:00")."'"; // break; // case "yesterday": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d 00:00:00",strtotime("yesterday"))."' AND `reading_time`<'".date("Y-m-d 00:00:00")."'"; // break; // //last 24 hours // default: // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 day"))."'"; // break; // } // $tableCont = performQuery("SELECT `$var`,`reading_time` FROM `$type` {$range_sql} ORDER BY `reading_time`",1); // if($force_title != ""){ // $force_title = camel_split($force_title)." - "; // } // if($overwrite_title != ""){ // if($overwrite_title != "||"){ // $title = "

{$overwrite_title}

"; // } else { // $title = ""; // } // } else { // $title = "

{$type}

"; // } // $var_titles = array(); // if(is_array($v)){ // foreach($v as $var){ // $var_name = $var; // $var_num = ""; // foreach(array('0','1','2','3','4','5','6','7','8','9') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '#')){ // if(str_replace("#",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // foreach(array('A','B','C','D','E','F') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '|')){ // if(str_replace("|",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // $var_titles[] = mb_ucfirst_exceptions(str_replace("|", $var_num, str_replace("#",$var_num,$msg[$var_name]))); // } // $sub_title = $force_title.implode(", ",$var_titles)." {$gunits}"; // } else { // $sub_title = $force_title.mb_ucfirst_exceptions(str_replace("|", $var_num, str_replace("#",$var_num,$msg[$var_name])))." {$gunits}"; // } // $cont = " // {$title} //

".$sub_title."

//
// "; // $data = array(); // $labes = array(); // $bar_chart = false; // $last_val = "0000-00-00 00:00:00"; // $l = 0; // foreach($tableCont as $tCv){ // $zero_lab = ""; // switch($range){ // case "this_year": // $zero_lab = date("m",strtotime($tableCont[0]['reading_time'])); // case "all": // case "year": // $this_val = date("Y-m",strtotime($tCv['reading_time'])); // $this_lab = date("m",strtotime($tCv['reading_time'])); // break; // case "this_month": // case "this_week": // $zero_lab = date("d.",strtotime($tableCont[0]['reading_time'])); // case "month": // case "week": // $this_val = date("Y-m-d",strtotime($tCv['reading_time'])); // $this_lab = date("d.",strtotime($tCv['reading_time'])); // break; // case "today": // case "yesterday": // $zero_lab = date("H:00",strtotime($tableCont[0]['reading_time'])); // default: // $this_val = date("Y-m-d H",strtotime($tCv['reading_time'])); // $this_lab = date("H:00",strtotime($tCv['reading_time'])); // break; // } // if($last_val != $this_val){ // if($last_val != "0000-00-00 00:00:00"){ // $labes[] = "'{$this_lab}'"; // } else { // if($zero_lab == ""){ // $labes[] = "''"; // } else { // $labes[] = "'{$zero_lab}'"; // } // } // $last_val = $this_val; // $l++; // } else { // $labes[] = "''"; // } // if(strstr($tCv[$var],":")){ // $hm = explode(":",$tCv[$var]); // $tCv[$var] = $hm[0] + $hm[1]/60; // $tCv[$var] = round($tCv[$var],2); // } // if($tCv[$var]=='true' || $tCv[$var]=='false'){$bar_chart = true;} // if($tCv[$var] == 'false'){ // $data[] = 0; // } elseif($tCv[$var] == 'true'){ // $data[] = 1; // } elseif($tCv[$var] == 'nan'){ // $data[] = 0; // } else { // $data[] = $tCv[$var]; // } // } // if(is_array($v)){ // $ser = array(); // $leg_lab = array(); // foreach($v as $var){ // $data = array(); // $tableCont = performQuery("SELECT `$var`,`reading_time` FROM `$type` {$range_sql} ORDER BY `reading_time`",1); // foreach($tableCont as $tCv){ // if(strstr($tCv[$var],":")){ // $hm = explode(":",$tCv[$var]); // $tCv[$var] = $hm[0] + $hm[1]/60; // $tCv[$var] = round($tCv[$var],2); // } // if($tCv[$var]=='true' || $tCv[$var]=='false'){$bar_chart = true;} // if($tCv[$var] == 'false'){ // $data[] = 0; // } elseif($tCv[$var] == 'true'){ // $data[] = 1; // } elseif($tCv[$var] == 'nan'){ // $data[] = 0; // } else { // $data[] = $tCv[$var]; // } // } // $ser[] = "{data: [".implode(",",$data)."]}"; // $js_ser[] = implode(",",$data); // } // $series = implode(",",$ser); // $js_labels = implode(",",$labes); // $js_data = implode(";",$js_ser); // foreach($var_titles as $vt){ // $leg_lab[] = "'{$vt}'"; // } // $js_opt = " // ,plugins: [ // Chartist.plugins.legend({ // legendNames: [".implode(",", $leg_lab)."], // }) // ] // "; // $js_opt = ""; // } else { // $js_labels = implode(",",$labes); // $js_data = implode(",",$data); // $series = " // { // data: [".implode(",",$data)."] // } // "; // } // $add_script=" // // "; // return array($cont, $add_script, $js_labels, $js_data); // } // function get_graphs($graph_div_id, $type, $v, $range = "last_24", $force_title = "", $overwrite_title = ""){ // global $set, $msg; // $units_data = performQuery("SELECT * FROM `units`"); // $units = array(); // foreach($units_data as $udv){ // $units[$udv['title']] = $udv['unit']; // } // if(is_array($v)){ // $var = $v[0]; // } else { // $var = $v; // } // $var_name = $var; // $var_num = ""; // foreach(array('0','1','2','3','4','5','6','7','8','9') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '#')){ // if(str_replace("#",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // foreach(array('A','B','C','D','E','F') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '|')){ // if(str_replace("|",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // if($units[$var_name] != ""){ // $gunits = "[".$units[$var_name]."]"; // } else { // $gunits = ""; // } // if($range == ""){$range = 'last_24';} // switch($range){ // case "all": // $range_sql = "WHERE `reading_time`>'0000-00-00 00:00:00'"; // break; // case "year": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 year"))."'"; // break; // case "month": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 month"))."'"; // break; // case "week": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 week"))."'"; // break; // case "this_year": // $range_sql = "WHERE `reading_time`>='".date("Y-01-01 00:00:00")."'"; // break; // case "this_month": // $range_sql = "WHERE `reading_time`>='".date("Y-m-01 00:00:00")."'"; // break; // case "this_week": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("monday this week"))."'"; // break; // case "today": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d 00:00:00")."'"; // break; // case "yesterday": // $range_sql = "WHERE `reading_time`>='".date("Y-m-d 00:00:00",strtotime("yesterday"))."' AND `reading_time`<'".date("Y-m-d 00:00:00")."'"; // break; // //last 24 hours // default: // $range_sql = "WHERE `reading_time`>='".date("Y-m-d H:i:s",strtotime("-1 day"))."'"; // break; // } // $tableCont = performQuery("SELECT `$var`,`reading_time` FROM `$type` {$range_sql} ORDER BY `reading_time`",1); // if($force_title != ""){ // $force_title = camel_split($force_title)." - "; // } // if($overwrite_title != ""){ // if($overwrite_title != "||"){ // $title = "

{$overwrite_title}

"; // $tit = $overwrite_title; // } else { // $title = ""; // $tit = ""; // } // } else { // $title = "

{$type}

"; // $tit = $type; // } // $var_titles = array(); // if(is_array($v)){ // foreach($v as $var){ // $var_name = $var; // $var_num = ""; // foreach(array('0','1','2','3','4','5','6','7','8','9') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '#')){ // if(str_replace("#",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // foreach(array('A','B','C','D','E','F') as $num){ // foreach($msg as $msk => $msv){ // if(strstr($msk, '|')){ // if(str_replace("|",$num,$msk) == $var){ // $var_name = $msk; // $var_num = $num; // break 2; // } // } // } // } // $var_titles[] = mb_ucfirst_exceptions(str_replace("|", $var_num, str_replace("#",$var_num,$msg[$var_name]))); // } // $sub_title = $force_title.implode(", ",$var_titles)." {$gunits}"; // } else { // $sub_title = $force_title.mb_ucfirst_exceptions(str_replace("|", $var_num, str_replace("#",$var_num,$msg[$var_name])))." {$gunits}"; // } // $cont = " // {$title} //

".$sub_title."

//
// "; // $data = array(); // $labes = array(); // $bar_chart = false; // $last_val = "0000-00-00 00:00:00"; // $l = 0; // foreach($tableCont as $tCv){ // $zero_lab = ""; // switch($range){ // case "this_year": // $zero_lab = date("m.Y",strtotime($tableCont[0]['reading_time'])); // case "all": // case "year": // $this_val = date("Y-m",strtotime($tCv['reading_time'])); // $this_lab = date("m",strtotime($tCv['reading_time'])); // break; // case "this_month": // case "this_week": // $zero_lab = date("d.m.",strtotime($tableCont[0]['reading_time'])); // case "month": // case "week": // $this_val = date("Y-m-d",strtotime($tCv['reading_time'])); // $this_lab = date("d.m.",strtotime($tCv['reading_time'])); // break; // case "today": // case "yesterday": // $zero_lab = date("H:00",strtotime($tableCont[0]['reading_time'])); // default: // $this_val = date("Y-m-d H",strtotime($tCv['reading_time'])); // $this_lab = date("H:00",strtotime($tCv['reading_time'])); // break; // } // if($last_val != $this_val){ // if($last_val != "0000-00-00 00:00:00"){ // $labes[] = "'{$this_lab}'"; // } else { // if($zero_lab == ""){ // $labes[] = "''"; // } else { // $labes[] = "'{$zero_lab}'"; // } // } // $last_val = $this_val; // $l++; // } else { // $labes[] = "''"; // } // if(strstr($tCv[$var],":")){ // $hm = explode(":",$tCv[$var]); // $tCv[$var] = $hm[0] + $hm[1]/60; // $tCv[$var] = round($tCv[$var],2); // } // if($tCv[$var]=='true' || $tCv[$var]=='false'){$bar_chart = true;} // if($tCv[$var] == 'false'){ // $data[] = 0; // } elseif($tCv[$var] == 'true'){ // $data[] = 1; // } elseif($tCv[$var] == 'nan'){ // $data[] = 0; // } else { // $data[] = $tCv[$var]; // } // } // if(is_array($v)){ // $ser = array(); // $leg_lab = array(); // foreach($v as $vk => $var){ // $data = array(); // $tableCont = performQuery("SELECT `$var`,`reading_time` FROM `$type` {$range_sql} ORDER BY `reading_time`",1); // foreach($tableCont as $tCv){ // if(strstr($tCv[$var],":")){ // $hm = explode(":",$tCv[$var]); // $tCv[$var] = $hm[0] + $hm[1]/60; // $tCv[$var] = round($tCv[$var],2); // } // if($tCv[$var]=='true' || $tCv[$var]=='false'){$bar_chart = true;} // if($tCv[$var] == 'false'){ // $data[] = 0; // } elseif($tCv[$var] == 'true'){ // $data[] = 1; // } elseif($tCv[$var] == 'nan'){ // $data[] = 0; // } else { // $data[] = $tCv[$var]; // } // } // $ser[] = "{data: [".implode(",",$data)."],name:'".$var_titles[$vk]."'}"; // $js_ser[] = implode(",",$data); // } // $series = implode(",",$ser); // $js_labels = implode(",",$labes); // $js_data = implode(";",$js_ser); // foreach($var_titles as $vt){ // $leg_lab[] = "'{$vt}'"; // } // } else { // $js_labels = implode(",",$labes); // $js_data = implode(",",$data); // $series = " // { // data: [".implode(",",$data)."], name: '{$tit}' // } // "; // } // $add_script=" // // "; // return array($cont, $add_script, $js_labels, $js_data); // } ?>
Warning: session_start(): Cannot start session when headers already sent in /home/agrivoltaicstfcz/public_html/incs/settings.inc on line 6

Fatal error: Uncaught Error: Call to undefined function performQuery() in /home/agrivoltaicstfcz/public_html/incs/settings.inc:29 Stack trace: #0 /home/agrivoltaicstfcz/public_html/show_chartx.php(16): include() #1 {main} thrown in /home/agrivoltaicstfcz/public_html/incs/settings.inc on line 29