$prev_person = fetch_val($query); if (!$prev_person) { // wrap around $query = "SELECT MAX(person_id) FROM persons"; } $prev_person = fetch_val($query); echo menu_item("./family.php?person={$prev_person}", "< {$_Previous}", get_name_and_lifespan($prev_person)); // "Next >" $query = "SELECT MIN(person_id) FROM persons WHERE person_id > {$person}"; $prev_person = fetch_val($query); if (!$prev_person) { // wrap around $query = "SELECT MIN(person_id) FROM persons"; } $next_person = fetch_val($query); echo menu_item("./family.php?person={$next_person}", "{$_Next} >", get_name_and_lifespan($next_person)); // Toggle is_public if (fetch_val("SELECT is_public({$person})") == 'f') { echo menu_item("./forms/person_toggle_pf.php?person={$person}", "{$_Mark_as} {$_Public}"); } else { echo menu_item("./forms/person_toggle_pf.php?person={$person}", "{$_Mark_as} {$_Private}"); } // Toggle dead_child if (fetch_val("SELECT dead_child({$person})") == 'f') { echo menu_item("./forms/person_toggle_dcf.php?person={$person}", "{$_Died_young}"); } else { echo menu_item("./forms/person_toggle_dcf.php?person={$person}", "{$_Not_died_young}"); } } echo "</table>\n"; echo "<!-- End of Navigation Sidebar -->\n";
function page_menu($page) { ?> <table width="100%"> <tr><td align=center><div style='padding:1px 2px 2px 2px; float: center; color: #000; font-size: 11px; font-family: verdana;'> Last page refresh<br><?php echo `date +"%Y-%m-%d %H %M %S"`; ?> </div></td></tr> <tr bgcolor="#cccccc" cellpadding=5> <td align=center> <div style='padding:1px 2px 2px 3px; float: center; color: #000; font-size: 11px; font-family: verdana;'> Last sensor read<br> <?php $sdatapath = "/var/www/mycodo/PiSensorData"; echo `tail -n 1 {$sdatapath} | cut -d' ' -f1,2,3,4,5,6`; ?> </div></td></tr> <tr bgcolor="#cccccc" cellpadding=5> <td align=right><span style='padding:1px 2px 2px 7px; display:inline; float: left; color: #000; font-size: 11px; font-family: verdana;'> <?php echo "<p>T <b>", `tail -n 1 {$sdatapath} | cut -d' ' -f9`, "°C</b> (", `tail -n 1 {$sdatapath} | cut -d' ' -f10`, "°F)<br> ( ", `/var/www/mycodo/mycodo r | cut -d' ' -f1`, " - ", `/var/www/mycodo/mycodo r | cut -d' ' -f2`, " )<p>"; echo "<p>RH <b>", `tail -n 1 {$sdatapath} | cut -d' ' -f8`, "%</b> ( ", `/var/www/mycodo/mycodo r | cut -d' ' -f3`, " - ", `/var/www/mycodo/mycodo r | cut -d' ' -f4`, ")<p>"; $dp_c = `tail -n 1 {$sdatapath} | cut -d' ' -f11`; $dp_c = ($dp_c - 32) * 5 / 9; echo "DP <b>", round($dp_c, 1); echo " °C</b> (", `tail -n 1 {$sdatapath} | cut -d' ' -f11`, "°F)"; ?> </span></td></tr> <?php menu_item('Main', 'Main', $page); ?> <?php menu_item('1 Hour', 'Past Hour', $page); ?> <?php menu_item('6 Hours', 'Past 6 Hours', $page); ?> <?php menu_item('1 Day', 'Past Day', $page); ?> <?php menu_item('1 Week', 'Past Week', $page); ?> <?php menu_item('1 Month', 'Past Month', $page); ?> <?php menu_item('1 Year', 'Past Year', $page); ?> <?php menu_item('All', 'All', $page); ?> <tr><td class=link>Legend: <a href='javascript:open_legend()'>Brief</a> - <a href='javascript:open_legend_full()'>Full</a></td></tr> <tr><td class=link>Ref (90s): <?php if ($_GET['r'] == 1) { echo "<b>On</b> / <a href='index.php?page={$page}'>Off</a>"; } else { echo "<a href='index.php?page={$page}&r=1'>On</a> / <b>Off</b>"; } ?> </td></tr> <tr><td class=link><a href='his.php' target='_blank'>Log History</a></td></tr> <tr><td class=link><a href='drawgraph.php' target='_blank'>Custom Graph</a></td></tr> <tr><td class=link><a href='javascript:open_chmode()'>Configuration</a></td></tr> <tr><td class=link><a href='index.php?page=log out'>Log Out</a></td></tr> </td></tr></table> <?php }
menu_item('Separate1w', '1 Week', $page); menu_item('Separate1m', '1 Month', $page); menu_item('Separate3m', '3 Months', $page); menu_item('Main', 'Main', $page); ?> </div> <div> <div class="Row-title">Combined</div> <?php menu_item('Combined1h', '1 Hour', $page); menu_item('Combined6h', '6 Hours', $page); menu_item('Combined1d', '1 Day', $page); menu_item('Combined3d', '3 Days', $page); menu_item('Combined1w', '1 Week', $page); menu_item('Combined1m', '1 Month', $page); menu_item('Combined3m', '3 Months', $page); ?> </div> </div> </div> <div style="clear: both;"></div> <div> <?php $ref = 0; if (isset($_GET['Refresh']) == 1) { $ref = 1; } if (!isset($_SESSION["ID"])) { $id = uniqid(); $_SESSION["ID"] = $id; $ref = 1;
$menuClass = "menu_active"; } else { $menuClass = "menu"; } if (!$url) { $url = '#'; } echo "<li class=\"{$menuClass}\">"; echo "<a href=\"{$url}\" title=\"{$title}\"><span style=\"cursor:pointer\">{$text}</span></a>"; echo "</li>"; } ?> <div id="menu_container"> <div id="menu"> <div class="tabsC"> <ul> <?php menu_item('main', 'index.php', 'Главная', ' Главная '); menu_item('library', 'library.php', 'Библиотека', 'Библиотекa'); menu_item('recommendations', 'recommendations.php', 'Рекомендации', 'Рекомендации'); menu_item('about', 'about.php', 'О сервисе', 'О сервисе '); menu_item('store', 'store.php', 'Магазин', ' Магазин '); menu_item('links', 'links.php', 'Ссылки', ' Ссылки '); menu_item('faq', 'faq.php', 'FAQ', ' FAQ '); ?> </ul> </div> </div> </div>