} } $tableau->add_callback('display', mark_missing); // Indicate that we want to sort according to name, and in // ascending order $tableau->set_default_sort('name', 0); // We are now set and done, let's display the table component $tableau->display(); } else { if ($_GET['table'] == 'responsibilities') { print "<div class='linkbox'><span><a href=\"?table=staff\">Staff</a></span> <span><b>Responsibilities</b></span>{$linkbox_other_links}</div>"; // This is the specification for the second table, // which goes quite in the same way as previously. $tableau = new Tableau($connection, 'responsibilities'); $tableau->set_columns('id', new Tableau_IDColumn(), 'name', new Tableau_ForeignKeyColumn($connection, 'staff', 'name', 'name'), 'responsibility', new Tableau_ChoiceColumn(array('watering plants', 'making fires', 'calling fire brigade'))); $tableau->set_name('id', 'ID', 'name', 'Name', 'responsibility', 'Responsibility'); $tableau->set_comment('responsibility', 'What this guy or gal should do?'); $tableau->add_validator('name', value_required); $tableau->add_validator('responsibility', value_required); $tableau->set_default_sort('name'); // We set a default filter that shows only names containing 'c'. // The user can override this either by specifying her own filter, // or by hitting the 'Clear' button. $tableau->set_default_filters(array(array('name', 'LIKE', 'c'))); // Ok, display it. $tableau->display(); } } $end_time = microtime_float(); print "<span style='float: right; color:#aaa; font-size: 50%;'>Elapsed server time: " . ($end_time - $start_time) . " s</span>"; // And finally print the rest of the HTML