Browse Source

Added documentation to some functions and updates the integration list to show materialized views beofre chado tables (with default chado table integration this list is really long and made finding materialized views difficult)

Lacey Sanderson 13 years ago
parent
commit
6bb61aa9e9

+ 7 - 0
base/tripal_views/tripal_views.api.inc

@@ -55,6 +55,13 @@ function tripal_views_is_integrated($table_name, $priority = NULL) {
 
 /**
  * Checks if you are dealing with the lightest priority setup for a given table
+ *
+ * @param $setup_id
+ *   The ID of the setup to check (is this setup the lightest one?)
+ * @param $table_name
+ *   The name of the table associated with this setup
+ *
+ * @return TRUE is this is the lightest priority; FALSE otherwise
  */
 function tripal_views_is_lightest_priority_setup ($setup_id, $table_name) {
   $lightest_priority_setup_id = tripal_views_get_lightest_priority_setup ($table_name);

+ 40 - 12
base/tripal_views/tripal_views_integration.inc

@@ -64,31 +64,59 @@ function tripal_views_description_page() {
  * @ingroup tripal_views_integration
  */
 function tripal_views_integration_setup_list(){
+   $output = '';
+
+   $output .= '<p>The following tables list the views integration setups available. If '
+    .'there is more then one setup for a given table, then the setup with the lightest ' 
+    .'priority will be used. For example, if you have created a custom setup for the '
+    .'feature chado table and your setup has a priority of -5 then your setup will be '
+    .'used instead of the default feature integration because -5 is lighter then 10.'
+    .'Priorities use the Drupal -10 to +10 scale where a record with -10 has a '
+    .'greater priority then one with 0 and both have a greater priority then one with +10.</p>';
+       
+   $output .= '<p>'.l('Add a new entry',"admin/tripal/views/integration/new") . " | " .
+                         l("Create View",'admin/build/views/add').'</p>';
+   
+   // Start with materialized views           
+   $output .= '<br /><h3>Materialized Views</h3>';           
+   $header = array('', 'Drupal Views Type Name', 'Table Name', 'Priority', 'Comment','');
+   $rows = array();
+
+   // get the list of materialized views
+   $tviews = db_query('SELECT * FROM {tripal_views} WHERE mview_id IS NOT NULL ORDER BY table_name ASC, priority ASC');
+   while($tview = db_fetch_object($tviews)){
+         $rows[] = array(
+            l('Edit',"admin/tripal/views/integration/edit/".$tview->setup_id) ,
+            $tview->name, 
+            $tview->table_name,  
+            $tview->priority,
+            $tview->comment,
+            l('Delete',"admin/tripal/views/integration/delete/".$tview->setup_id),
+         );         
+   }
+   
+   $output .= theme('table', $header, $rows);
 
-   $header = array('', 'Drupal Views Type Name', 'Table Name', 'Is Mview', 'Priority', 'Comment','');
+   // Now list chado tables
+   $output .= '<br /><h3>Chado Tables</h3>';           
+   $header = array('', 'Drupal Views Type Name', 'Table Name', 'Priority', 'Comment','');
    $rows = array();
 
    // get the list of materialized views
-   $tviews = db_query('SELECT * FROM {tripal_views} ORDER BY table_name, priority');
+   $tviews = db_query('SELECT * FROM {tripal_views} WHERE mview_id IS NULL ORDER BY table_name ASC, priority ASC');
    while($tview = db_fetch_object($tviews)){
          $rows[] = array(
             l('Edit',"admin/tripal/views/integration/edit/".$tview->setup_id) ,
             $tview->name, 
-            $tview->table_name, 
-            ($tview->mview_id) ? 'Yes' : 'No', 
+            $tview->table_name,  
             $tview->priority,
             $tview->comment,
             l('Delete',"admin/tripal/views/integration/delete/".$tview->setup_id),
          );         
    }
-   $rows[] = array(
-      'data' => array( 
-         array('data' => l('Add a new entry',"admin/tripal/views/integration/new") . " | " .
-                         l("Create View",'admin/build/views/add'), 
-               'colspan' => 7),
-         )
-   );
-   return theme('table', $header, $rows);
+   
+   $output .= theme('table', $header, $rows);
+   return $output;
 }
 
 /**