소스 검색

progress1

alexgl 13 년 전
부모
커밋
32c0ad9b94

+ 29 - 46
base/tripal_views_setup/includes/tripal_views_setup.admin.inc

@@ -1,16 +1,12 @@
 <?php 
 
-function tripal_views_setup_admin(){
+// function tripal_views_setup_admin(){
 	// $add_url = url('admin/tripal/tripal_views_setup/new');
 	// $output = "<div id='add-new-search'><a href=\"$add_url\">Add New Search</a><div>";
 	// $output .= drupal_get_form('tripal_views_setup_admin_form');
-// 	
-	
-// 	
-	
-
-	return $rows;
-}
+// 
+	// return $rows;
+// }
 
 
 function tripal_views_setup_admin_form(){
@@ -22,19 +18,24 @@ function tripal_views_setup_admin_form(){
 	
 	$records = array();
 	while($record = db_fetch_object($query_resulst)){
-		dpm($record, 'record' . (string)$int_i);
-		
-		$item_name = 'tripal_views_setup_config_query_record_' . (string)$int_i;
-		
-		$form[$item_name] = array(
-			'#type' => 'checkbox',
-			'#title' => t($record->name),
-			'#description' => t('Search of mview ' . $record->mview_id . ' and ' . $record->base_table_name),
-			'#required' => TRUE,
-		);
-		
-	 	$int_i++;	
+		$records[] = $record;
 	}
+
+	dpm($records, 'records');
+
+		// dpm($record, 'record' . (string)$int_i);
+// 		
+		// $item_name = 'tripal_views_setup_config_query_record_' . (string)$int_i;
+// 		
+		// $form[$item_name] = array(
+			// '#type' => 'checkbox',
+			// '#title' => t($record->name),
+			// '#description' => t('Search of mview ' . $record->mview_id . ' and ' . $record->base_table_name),
+			// '#required' => TRUE,
+		// );
+// 		
+	 	// $int_i++;	
+	// }
 	
 	$form['featured'] = array(
 		'#type' => 'checkboxes',
@@ -47,35 +48,17 @@ function tripal_views_setup_admin_form(){
 	//return system_settings_form($form);
 }
 
-function tripal_views_setup_new_search_form(){
-	$form = array();
-		$form['tripal_views_setup_config_mview'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Materialized View'),
-		'#description' => t('Select which materialized view needs to be used for this search'),
-		'#required' => TRUE,
-	);
+
+function tripal_views_setup_form_submit($form_id, $form){
+	$form_values = $form['values'];
+	$featured = $form_values['featured'];
 	
-	/*
-	$form['tripal_views_setup_config_mview'] = array(
-		'#type' => 'select',
-		'#title' => t('Materialized View'),
-		'#options' => tripal_views_setup_mview_list(),
-		'#description' => t('Select which materialized view needs to be used for this search'),
-		'#required' => TRUE,
-	);
+	
+}
 
-	$form['tripal_views_setup_config_btable'] = array(
-		'#type' => 'select',
-		'#title' => t('Chado base table'),
-		'#options' => tripal_views_setup_btable_list(),
-		'#description' => t('Select which chado table needs to be used for this earch'),
-		'#required' => TRUE,
-	);
 
-	dpm($form, 'tripal_views_setup_admin form');
-	 */
-	
+function tripal_views_setup_new_search_form(){
+	$form = array();
 	
 	return $form;
 }

+ 0 - 7
base/tripal_views_setup/tripal_views_setup.install

@@ -22,13 +22,6 @@ function tripal_views_setup_schema(){
 				'not null' => TRUE,
 				'default' => '',
 			),
-			'status' => array(
-				'description' => 'Weather this setup will be used: 0 = inactive, 1 = active.',
-				'type' => 'int',
-				'unsigned' => TRUE,
-				'not null' => TRUE,
-				'default' => '0',
-			),
 			'name' => array(
 				'description' => 'Human readable name of this setup',
 				'type' => 'varchar',

+ 6 - 6
base/tripal_views_setup/tripal_views_setup.module

@@ -7,17 +7,17 @@ function tripal_views_setup_menu(){
 	
 	//parents admin page TODO: figure out what to do here: add / remove searches
 	$items['admin/tripal/tripal_views_setup'] = array(
-	  'title' => t('Tripal Views Search settings'),
-	  'description' => t('Tripal Views Search settings page, allows you to select and create materialized views and chado tables to use for searches.'),
+	  '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'),
+	  '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 Search',
+		 '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
@@ -51,6 +51,6 @@ function tripal_views_setup_theme(){
 }
 
 
-function theme_tripal_views_setup_theme($form){
-	return theme_tripal_helper_form_form($form);
+function theme_tripal_views_setup_form($form){
+	// return tripal_helper_form_themeform($form, array('name', 'setup_id', 'mview_id', 'base_table_name', 'description'));
 }

+ 12 - 7
tripal_helpers/tripal_helper_form/tripal_helper_form.module

@@ -1,4 +1,4 @@
-<? php
+<?php
 
 
 /**
@@ -7,7 +7,8 @@
  * 
  * to be run as a regular function, within a module's theme function implementation
  */
-function tripal_helper_form_theme_form($form, $field_keys){
+
+function tripal_helper_form_themeform(&$form, $field_keys){
 	$rows = array();
 	foreach (element_children($form) as $key) {
 		$row = array();
@@ -23,7 +24,7 @@ function tripal_helper_form_theme_form($form, $field_keys){
 					$bool_first = FALSE;
 				}
 				else{
-					$row[] = array(’data’ => drupal_render($form[$key][$field_keys[$field_key]]);
+					$row[] = array(’data’ => drupal_render($form[$key][$field_keys[$field_key]]),);
 				}
 			}
  
@@ -34,13 +35,17 @@ function tripal_helper_form_theme_form($form, $field_keys){
 	// Individual table headers.
 	$header = array();
 	$header[] = array(’data’ => t(’Featured’), ‘class’ => ‘checkbox’);
-	$header[] = t(’Name’);
-	$header[] = t(’Category’);
-	$header[] = t(’Discount’);
-	$header[] = t(’Created on’);
+	
+	foreach ($field_keys as $key => $value) {
+		$header[] = t($key);
+	}
  
 	$output = theme(’table’, $header, $rows);
 	$output .= drupal_render($form);
 	return $output;
 }
 
+// function tripal_helper_form_createformdata
+
+
+