function tripal_mview_report
2.x tripal_core.mviews.inc | tripal_mview_report($mview_id) |
3.x tripal_chado.mviews.inc | tripal_mview_report($mview_id) |
1.x mviews.inc | tripal_mview_report($mview_id) |
A template function which returns markup to display details for the current materialized view
Parameters
$mview_id: The unique ID of the materialized view to render
1 string reference to 'tripal_mview_report'
- tripal_chado_menu in tripal_chado/
tripal_chado.module - Implements hook_menu().
File
- tripal_chado/
includes/ tripal_chado.mviews.inc, line 47 - Contains functions for viewing and editing of Materialized Views on a Tripal website.
Code
function tripal_mview_report($mview_id) {
// set the breadcrumb
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l('Administration', 'admin');
$breadcrumb[] = l('Tripal', 'admin/tripal');
$breadcrumb[] = l('Chado Schema', 'admin/tripal/storage/chado');
$breadcrumb[] = l('Materialied Views', 'admin/tripal/storage/chado/mviews');
drupal_set_breadcrumb($breadcrumb);
// get this mview details
$sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id";
$results = db_query($sql, array(':mview_id' => $mview_id));
$mview = $results->fetchObject();
$rows = array();
// create a table with each row containig stats for
// an individual job in the results set.
$output = "<p>Details for <b>$mview->name</b>:</p>";
// build the URLs using the url function so we can handle installations where
// clean URLs are or are not used
$update_url = url("admin/tripal/storage/chado/mviews/action/update/$mview->mview_id");
$delete_url = url("admin/tripal/storage/chado/mviews/action/delete/$mview->mview_id");
$edit_url = url("admin/tripal/storage/chado/mviews/edit/$mview->mview_id");
$export_url = url("admin/tripal/storage/chado/mviews/export/$mview->mview_id");
$rows[] = array('Actions', "<a href='$update_url'>Populate</a>, <a href='$edit_url'>Edit</a>, <a href='$delete_url'>Delete</a>");
if ($mview->last_update > 0) {
$update = format_date($mview->last_update);
}
else {
$update = 'Not yet populated';
}
$rows[] = array('Last Update', $update);
if ($mview->name) {
$rows[] = array('View Name', $mview->name);
}
if ($mview->modulename) {
$rows[] = array('Module Name', $mview->modulename);
}
if ($mview->mv_table) {
$rows[] = array('Table Name', $mview->mv_table);
}
if ($mview->mv_specs) {
$rows[] = array('Table Field Definitions', $mview->mv_specs);
}
if ($mview->query) {
$rows[] = array('Query', "<textarea rows=\"15\" cols=\"120\" style=\"font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;\">" . $mview->query . "</textarea>");
}
if ($mview->indexed) {
$rows[] = array('Indexed Fields', $mview->indexed);
}
if ($mview->special_index) {
$rows[] = array('Special Indexed Fields', $mview->special_index);
}
if ($mview->mv_schema) {
$rows[] = array('Drupal Schema API Definition', "<textarea rows=\"20\" cols=\"120\" style=\"font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;\">" . $mview->mv_schema . "</textarea>");
}
$header = array('Detail', 'Value');
$table = array(
'header' => $header,
'rows' => $rows,
'attributes' => array('class' => 'tripal-data-table'),
'sticky' => FALSE,
'caption' => '',
'colgroups' => array(),
'empty' => 'There are no materialized views',
);
$table = theme_table($table);
$output .= $table;
return $output;
}