function printTOC($book) { if (count($book) == 0) { echo "<center><p><i>No entries have been made in the lab notebook.</i></p></center>\n"; } else { echo "<table border='0' width='100%'>\n"; foreach ($book as $num => $entry) { $title = $entry['title']; if ($title == "") { $title = "(no title)"; } echo "<tr><td width='30'><img src='img/{$entry['thumbnail']}' border='0' width='20' height='20'></td>"; echo "<td><a href='#entry{$num}'>{$title}</a></td>"; echo "<td align='right'><i>" . formatDayTimeBrief($entry['modtime']) . "</i></td></tr>\n"; } echo "</table>\n"; } }
function displayEntries($context, $labbook) { // FUNKY: We use this URL to take us to the lab notebook page, and each // header below appends an anchor (#entry123) onto the end of it... // To get back here, the user must manually return to the welcome page. // [This describes the old, commented out code.] $url = makeEventURL("onGoto", "notebook_main.php"); $modelID = $_SESSION['lastUsedModelID']; if (isset($_SESSION['ensembles'][$_SESSION['lastUsedModelID']])) { $model = $_SESSION['ensembles'][$modelID]; } else { $model = $_SESSION['models'][$modelID]; } //$labbook = openLabbook(); $labbook = array_reverse($labbook, true); // make reverse chronological echo "<h5 class='welcome'>Recently Generated Results (<a href='{$url}'>all results</a>)</h5>\n"; //echo "<h5 class='welcome'>Recently Generated Results</h5>\n"; echo "<div class='indent'>\n"; echo "<table border='0' width='100%'>\n"; $entry_count = 0; foreach ($labbook as $num => $entry) { if (++$entry_count > 2) { break; } $title = $entry['title']; if ($title == "") { $title = "(no title)"; } echo "<tr><td width='50'><img src='img/{$entry['thumbnail']}' border='0' width='40' height='40'></td>"; //echo "<td><a href='$url#entry$num'>$title</a></td>"; echo "<td><a href='viewentry.php?{$_SESSION['sessTag']}&entry_num={$num}' target='_blank'>{$title}</a></td>"; echo "<td align='right'><i>" . formatDayTimeBrief($entry['modtime']) . "</i></td></tr>\n"; } echo "<tr><td colspan='3'><!-- vertical spacer --></td></tr>\n"; echo "<tr><td></td>"; if ($entry_count > 2) { echo "<td><small><a href='{$url}'>[... more results ...]</a></small></td>"; } else { echo "<td></td>"; } echo "<td align='right'><small><a href='{$url}'>[set time zone]</a></small></td></tr>\n"; echo "</table>\n</div>\n"; }