function tripal_custom_table_view
2.x tripal_core.custom_tables.inc | tripal_custom_table_view($table_id) |
3.x tripal_chado.custom_tables.inc | tripal_custom_table_view($table_id) |
1.x custom_tables.inc | tripal_custom_table_view($table_id) |
A template function which returns markup to display details for the custom table
Parameters
$table_id: The unique ID of the custom table
Related topics
1 string reference to 'tripal_custom_table_view'
- tripal_core_menu in tripal_core/
tripal_core.module - Implements hook_menu(). Defines all menu items needed by Tripal Core
File
- tripal_core/
includes/ custom_tables.inc, line 19 - Contains functions for creating, editing and deleting custom tables on the Tripal website.
Code
function tripal_custom_table_view($table_id) {
// get this custom_table details
$sql = "SELECT * FROM {tripal_custom_tables} WHERE table_id = %d";
$custom_table = db_fetch_object(db_query($sql, $table_id));
// create a table with each row containig stats for
// an individual job in the results set.
$return_url = url("admin/tripal/custom_tables/");
$output .= "<p><a href=\"$return_url\">" . t("Return to list of custom tables") . "</a></p>";
$output .= "<br />";
$output .= "<p>Details for <b>$custom_table->table_name</b>:</p>";
$output .= "<br />";
$output .= "<table class=\"border-table\">";
if ($custom_table->table_name) {
$output .= " <tr>" .
" <th>Table Name</th>" .
" <td>$custom_table->table_name</td>" .
" </tr>";
}
if ($custom_table->schema) {
$output .= " <tr>" .
" <th>Table Field Definitions</th>" .
" <td><pre>" . var_export(unserialize($custom_table->schema), 1) . "</pre></td>" .
" </tr>";
}
// build the URLs using the url function so we can handle installations where
// clean URLs are or are not used
$delete_url = url("admin/tripal/custom_tables/action/delete/$custom_table->table_id");
$edit_url = url("admin/tripal/custom_tables/edit/$custom_table->table_id");
$output .= "<tr><th>Actions</th>" .
"<td>" .
" <a href='$edit_url'>Edit</a>, " .
" <a href='$delete_url'>Delete</a></td></tr>";
$output .= "</table>";
return $output;
}