Location: PHPKode > projects > Basic Announce > Basic Announce Version 4.0/modules/datagrid_wizard/include/functions.inc.php
<?php

/////////////////////////////////////////////////////////////////
// datagrid wizard functions
/////////////////////////////////////////////////////////////////
function dont_retrive_view_mode_fields(&$arrEditModeFields, $selEditModeTable){
	global $db;
	$sql = "SHOW COLUMNS FROM ".$selEditModeTable;
	$db->Query($sql);
	while ($row = $db->FetchArray()){ $arrEditModeFields[] = $row['Field']; }		
}

function dont_retrive_edit_mode_fields(&$arrViewModeFields, $selViewModeTable){
	global $db;
	$sql = "SHOW COLUMNS FROM ".$selViewModeTable;
	$db->Query($sql);
	while ($row = $db->FetchArray()){ $arrViewModeFields[] = $row['Field']; }		
}

function retrive_view_edit_mode_fields(&$arrViewModeFields, $selViewModeTable, &$arrEditModeFields, $selEditModeTable){
	global $db;

	$sql = "SHOW COLUMNS FROM ".$selViewModeTable;
	$db->Query($sql);
	while ($row = $db->FetchArray()){ $arrViewModeFields[] = $row['Field']; }			

	$sql = "SHOW COLUMNS FROM ".$selEditModeTable;
	$db->Query($sql);
	while ($row = $db->FetchArray()){ $arrEditModeFields[] = $row['Field']; }
}

function retrive_foreign_key_table_fields(&$arrForeignKeysTableFields, $table){
	global $db;
	$sql = "SHOW COLUMNS FROM ".$table;
	$db->Query($sql);
	while ($row = $db->FetchArray()){ $arrForeignKeysTableFields[] = $row['Field']; }		
}

function retrive_edit_mode_fields(&$arrEditModeFields, $table){
	global $db;
	$sql = "SHOW COLUMNS FROM ".$table;
	$db->Query($sql);
	while ($row = $db->FetchArray()){ $arrEditModeFields[] = $row['Field']; }		
}

function retrive_view_mode_fields(&$arrViewModeFields, $table){
	global $db;
	$sql = "SHOW COLUMNS FROM ".$table;
	$db->Query($sql);
	while ($row = $db->FetchArray()){ $arrViewModeFields[] = $row['Field']; }		
}

function remove_item_by_value($array, $val = '', $preserve_keys = true) {
	if (empty($array) || !is_array($array)) return false;
	if (!in_array($val, $array)) return $array;

	foreach($array as $key => $value) {
		if ($value == $val) unset($array[$key]);
	}

	return ($preserve_keys === true) ? $array : array_values($array);
}

function draw_buttons(){
	global $created, $msg_width, $file_name;
	global $arrViewModeFields;
	
	$view_mode_fields_count = count($arrViewModeFields);

	echo "<table cellpadding='2' cellspacing='2' width='".$msg_width."' border=0>
	<tr valign='top'>
		<td align='left'><a href='index.php'>Back</a></td>
		<td align='right'>";
			if($created){
				echo "<input type='button' name='btnView' id='btnView' value='Go To Page' onclick='btnView_OnClick(\"".$file_name."\")' />&nbsp;&nbsp;";
				echo "<input type='button' name='btnPreview' id='btnPreview' value='Preview' onclick='btnPreview_OnClick(\"".$file_name."\")' />&nbsp;&nbsp;";
				echo "<input type='button' name='btnSubmit' id='btnSubmit' value='Re-Create DataGrid Page' onclick='btnSubmit_OnClick(\"".$view_mode_fields_count."\")' />";								
			}else{
				echo "<input type='button' name='btnCancel' id='btnCancel' value='Cancel' onclick='btnCancel_OnClick()' />&nbsp;&nbsp;";		
				echo "<input type='button' name='btnSubmit' id='btnSubmit' value='Create DataGrid Page' onclick='btnSubmit_OnClick(\"".$view_mode_fields_count."\")' />";		
			}
		echo "</td>
	</tr>    
	</table>";		
}

?>
Return current item: Basic Announce