12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- require_once 'includes/tripal_views_setup.admin.inc';
- function tripal_views_setup_menu(){
- $items = array();
-
- //parents admin page TODO: figure out what to do here: add / remove searches
- $items['admin/tripal/tripal_views_setup'] = array(
- 'title' => t('Tripal Views Setups'),
- 'description' => t('Tripal Views Setups settings page, allows you to select and create materialized views and chado tables to use for searches.'),
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_views_setup_admin_form'),
- 'access arguments' => array('access administration pages'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- //page to actually create searche->mview->chado table relationships
- $items['admin/tripal/tripal_views_setup_new'] = array(
- 'title' => 'Create New Views Setup',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_views_setup_new_search_form'),
- 'access arguments' => array('access administration pages'), //TODO: figure out the proper permissions arguments
- 'type' => MENU_NORMAL_ITEM,
- );
-
- return $items;
- }
- function tripal_views_setup_theme(){
- $theme = array();
-
- $theme['tripal_views_setup_form'] = array(
- 'arguments' => array('form' => NULL,),
- );
-
- $theme['tripal_views_setup_admin_form'] = array(
- 'arguments' => array(),
- );
-
- return $theme;
- }
- function theme_tripal_views_setup_admin_form($form){
- $header = array(
- theme('table_select_header_cell'),//using previously empty field
- array('data' => t('Setup ID'), 'field' => 'setup_id', 'sort' => 'asc'),
- array('data' => t('MView ID'), 'field' => 'mview_id'),
- array('data' => t('Base Table Name'), 'field' => 'base_table_name'),
- );
-
- if(!empty($form['checkboses']['#options'])) {
- foreach (element_children($form['uid']) as $key) {
- $rows[] = array(
- drupal_render($form['checkboxes'][$key]),
- drupal_render($form['setup_id'][$key]),
- drupal_render($form['mview_id'][$key]),
- drupal_render($form['base_table_name'][$key]),
- );
- }
- }
- else {
- $row[] = array(array('data' => '<div class="error">click link above to add entries</div>', 'colspan' => 4));
- }
-
- $output .= theme('table', $header, $rows);
-
- $output .= drupal_render($form);
- return $output;
-
- }
|