0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.146.178.220


Current Path : /proc/thread-self/root/var/www/html/gcg/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/gcg/src/create_html_files.php


<?php
function CreateModuleHtmlFiles($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$schema_id = $aobj_context->mobj_data["schema_id"];
$schema_cond=($schema_id=='0')?" ":" and internal_code={$schema_id}";

		$get_schema_names="select internal_code,module_name,menu_function,
							ifnull(display_type,'Next Line') as display_type,
							ifnull(grid_type,'Normal') as grid_type, 
							ifnull(s_grid_custom_links,'') as s_grid_custom_links 
							from s_user_schema 
							where (menu_function is null or menu_function='') 
							{$schema_cond}  
							 
							";
		 $lobj_get_schema_names = $aobj_context->mobj_db->GetAll($get_schema_names);
 	 
		foreach($lobj_get_schema_names as $k=>$v)	 
		{
			$g_grid_flag=0;
			$schema_name=$v['module_name'];
			$module_id= $v[internal_code];
			$active_field_arr=getRefModuleActiveField($aobj_context,$module_id);
			$is_module_for_new_or_edit= $module_id;
			$rights=($is_module_for_new_or_edit>=1)?" is_edit=1 ":" is_add=1 ";
			$_SESSION['g_file_id'] =$lobj_get_file_id[internal_code];
		 	$filename =  $aobj_context->main_src."//html_modules//modules/module_".$module_id.".html";	
				$lstr_qry = "select a.*,ifnull(doc_root,0) as doc_root,ifnull(doc_root_mapped_id,0) as doc_root_mapped_id,
				ifnull(is_right_exstis,0) as is_right_exstis,{$is_module_for_new_or_edit} as is_module_for_new_or_edit from 
				(select ifnull(is_grid_edit,0) as is_grid_edit,
				ue.internal_code,REPLACE(ur.module_name,' ','~') as ref_module_name,
				ue.name as element_name,ue.system_name,ifnull(ue.field_position,'Next Line') as field_position,
				s.value as Type,ifnull(ug.on_click_event,'') as  on_click_event,
				ifnull(ug.name,'0None') as group_name,
				ifnull(ug.inline_div,'0') as inline_div,
				if(ug.internal_code is null,u.internal_code,concat(u.internal_code,'_',ug.internal_code)) as user_right_group,
				ue.description,s1.value as meta_data,ue.decimals,
				if(s1.value='Meta',concat('m_',u.internal_code,'_ele_',ue.internal_code),'') as meta_field,
				ue.default_value,
				ifnull(ue.ref_module_code_ref_field,0) as ref_module_code_ref_field,
				ifnull(s_ref.db_field,0) as ref_module_code_ref_field_db_field,
				ifnull(ue.ref_module_code_ref_field_on,0) as ref_module_code_ref_field_on,
				ifnull(ue.ref_module_code_ref_field_const,0) as ref_module_code_ref_field_const,
				ue.optional,ue.list_of_values,u.module_name,
				u.internal_code as ref_s_user_schema_code,
				ue.ref_module_code ,ue.is_read_only,ifnull(ue.padding,2)*8 as padding,
				IFNULL(ug.internal_code,0) as ref_s_user_schema_group_code,ifnull(multiple,0) as multiple,
				concat('user_schema_',u.internal_code ,'_group_',IFNULL(ug.internal_code,0)) as table_id,
				ifnull(ue.suffix,'None') as suffix,ue.width*9 as width,ue.linked_field,ue.source_field,
				Replace(if(ue.on_enter='',0,ifnull(ue.on_enter,0)),' ','~') as on_enter
				,Replace(if(ue.on_exit='',0,ifnull(ue.on_exit,0)),' ','~') as on_exit 
				,ifnull(ue.is_ref_module_code_lov,0) as is_ref_module_code_lov 
				,ifnull(ue.text_area_rows,2) as text_area_rows
			 	from s_user_schema_elements ue
				inner join s_user_schema u on u.internal_code=ue.ref_s_user_schema_code
				left join s_user_schema_group ug on ug.internal_code=ref_s_user_schema_group_code
				left join s_ref_type s on s.internal_code=ue.data_type
				left join s_ref_type s1 on s1.internal_code=ue.s_ref_type_meta
				left join s_user_schema_elements s_ref on  s_ref.internal_code=ue.ref_module_code_ref_field
				left join s_user_schema ur on ur.internal_code=ue.ref_module_code
				where u.internal_code= {$module_id}
				and ue.is_visible=1	and ifnull(parent_group_code,0)=0
				and ifnull(ue.is_defined,1)=1	
				order by ifnull(ug.sequence,-1),ue.sequence,ue.internal_code   )a
				left join # for User rights
				(select module_id  as is_right_exstis from user_rights where module_id={$module_id}
				and ref_s_sysdb_code=".$_SESSION["user_id"]." and {$rights} ) b on b.is_right_exstis=a.user_right_group 
				left join # for Auto Increment Values
				(select internal_code as doc_root,GROUP_CONCAT(ele_id) as doc_root_mapped_id  from (select su.internal_code,su.name as value
				from s_user_schema_elements su 
				inner join s_ref_type st1 on st1.internal_code=data_type
				where su.ref_s_user_schema_code={$module_id} and st1.value='Date')a
				inner JOIN
				(select su.internal_code as ele_id,su.name,source_field  
				from s_user_schema_elements su 
				inner join s_ref_type st1 on st1.internal_code=data_type
				where su.ref_s_user_schema_code={$module_id} and st1.value='Auto Increment' and source_field>0)b 
				on a.internal_code=b.source_field
				group by internal_code) c on  c.doc_root=a.internal_code  ";
 
		$lobj_schema_details = $aobj_context->mobj_db->GetAll($lstr_qry);
		 //echo $lstr_qry; 
$ul_main_group_inline_array=array();
$ul_main_group_array=array();
$ul_main_group_id_array=array();
$ul_main_group_onclick_array=array();
	  
			foreach($lobj_schema_details as $key=>$val)
			{
			$general_div_not_closed=0;
			$tab_group_name=str_replace("0None","General",$val[group_name]);
				if(!in_array($tab_group_name,$ul_main_group_array) && $val[inline_div]=='0')
				{
				array_push($ul_main_group_array,$tab_group_name);
				$ul_main_group_id_array[$tab_group_name]=$val[ref_s_user_schema_group_code];
				$ul_main_group_onclick_array[$tab_group_name]=$val[on_click_event];
				}
				$ul_main_group_inline_array[$val[ref_s_user_schema_group_code]]=$val[inline_div];
			 
			}
			 //print_r($ul_main_group_id_array);
			 
	   //$get_subgroup_id="select internal_code,group_name,";
		 $group_name= str_replace("0None","General",$lobj_schema_details[0][group_name]);
		 $group_id= $lobj_schema_details[0][ref_s_user_schema_group_code];
			$html_content=" <script type='text/javascript'>\$(function() {\$('#tabs').tabs();});\$(function() {\$('#sub_tabs').tabs();});</script> ";
			$html_content.="<div id='tabs'>\n<ul>";	
			for($u=0;$u<count($ul_main_group_array);$u++)
				{
				$html_content.="<li id='li_{$ul_main_group_id_array[$ul_main_group_array[$u]]}'><a id='li_a_{$ul_main_group_id_array[$ul_main_group_array[$u]]}' href='#group_div_{$ul_main_group_id_array[$ul_main_group_array[$u]]}' onclick=\" {$ul_main_group_onclick_array[$ul_main_group_array[$u]]}\" >{$ul_main_group_array[$u]}</a></li>\n";
				}	
				$html_content.="</ul>";
		
		$html_content.="\n <div id='group_div_{$group_id}'  align='center' style='padding-top:8px;'>\n";
		//print_r(array_flip($ul_main_group_id_array));
		//echo (in_array("Criteria",array_flip($ul_main_group_id_array)));
		if($v['grid_type']=='Ggrid' && (!in_array("Criteria",array_flip($ul_main_group_id_array))))
			{
			$g_grid_custom_link="";
				if(!empty($v['s_grid_custom_links']))
						{
							$split_by_pipe=explode("|",$v['s_grid_custom_links']);
							 
							for($split=0;$split<count($split_by_pipe);$split++)
							{
								$function_split=explode("~",$split_by_pipe[$split]);
							
								$name=$function_split[0];	
								$fun=$function_split[1];
								$g_grid_custom_link.="<a   class='anchor-class' style='color:#2B65EC;' onclick=\"javascript: {$fun};\" > | {$name}</a>";
 							}
							 
						}	
				$html_content.="\n <div id='ggrid_module_{$module_id}'  align='center' style='padding-top:5px; padding-bottom:10px;'> </div>\n";			
				/* $html_content.="<div align='left' class='anchor-div'>";
				$html_content.="<a   class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:UpdateGGridRowModuleDetails({$module_id});\" >Update</a> {$g_grid_custom_link}";
				$html_content.="</div>"; */		
			}
		$html_content.=	"\t<table id ='tbl_menu' class='content-tbl' align='center'  cellpadding='2' cellspacing='0' border='0' >\n";
		$html_content.=	"\t <input    type='text'   value='' style='display:none;' /> \n";// Avoid Refresh adding for AutoComplete Key Refresh
		$label_tr="";
		$text_tr="";
		$actual_data="";
		$html_label_tr=array(); 
		$html_text_tr=array(); 
		 
	 	for ($i=0;$i<count($lobj_schema_details);$i++)
		{
			$actual_data="";
			$display_type=$v[display_type];
			$actual_data_arr=getActualData($lobj_schema_details[$i],$display_type,$active_field_arr);
			//if($lobj_schema_details[$i][is_grid_edit]==0)
			{
			$actual_data=$actual_data_arr['actual_data']; }
			$padding_width=$actual_data_arr['padding_width'];
			$width_auto=($lobj_schema_details[$i][width]+20).'Px';
			$padding_value=$lobj_schema_details[$i][padding];
			if($lobj_schema_details[$i+1][field_position]=='Next Line')
			$padding_value=0;
			
			if($lobj_schema_details[$i]['Type']=='Month' &&  ($lobj_schema_details[$i+1][field_position]=='Next Column'))
			{
				 $padding_value+=3;
			}
			$padding=$padding_value.'Px';
			$width_value=$lobj_schema_details[$i][width];
			if($v[display_type]=="Left Right")
			{
				$lable_data="";
				if($lobj_schema_details[$i][is_grid_edit]==0)
				{
				$lable_data=getLeftRightLabelData($lobj_schema_details[$i]);
				}
				// Forming Of Elements Ends	
					if($lobj_schema_details[$i][ref_s_user_schema_group_code]==$group_id)	
					{
						if($lobj_schema_details[$i][is_grid_edit]==0)
						{
						$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
						$html_content.= "<tr> {$lable_data} \n <td align='left'   colspan=2 >" .$actual_data."</td>\n</tr>\n";		
						}
					}
					else
					{
					$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
					$group_name= str_replace("0None","General",$lobj_schema_details[$i][group_name]);
					 
						 if($lobj_schema_details[$i-1][multiple]==1)
						 {
						 $div_group_id=$lobj_schema_details[$i-1][ref_s_user_schema_group_code];
						 $table_name=$lobj_schema_details[$i-1][table_id];
							 if($lobj_schema_details[$i-1][is_grid_edit]==0)
							{
							 $entry_table_name=str_ireplace("group","entry",$table_name);
							 $html_content.=" </table> \n";
							$html_content.= getSubGroupHTMLQuery($aobj_context,$module_id,$lobj_schema_details[$i-1][ref_s_user_schema_group_code],$v[display_type],$active_field_arr);
							$html_content.="<div align='left' class='anchor-div'><a  class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" >Add&nbsp;|&nbsp;</a>";
							$html_content.="<a  class='anchor-class'  style='color:#2B65EC;' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\">Clear&nbsp;</a>";
							$html_content.=getGroupLinks($aobj_context ,$div_group_id);
							$html_content.="</div>";
							}	
						$html_content.=" <div align='center' style=\"height:auto; width:811px; overflow:auto;\" id='main_group_grid_{$div_group_id}'></div>";
						//$html_content.="<div id='multi_group_ad_search_{$div_group_id}' class='scroll-div' style='overflow: hidden; text-align: left; width: 690px; display: block;'><span id='mult_grid_a_search_name_id_{$div_group_id}'>Search: </span><input type='text' style='height:13px;' name='search' id='mult_group_grid_ad_search_id_{$div_group_id}' ></div>";
						$html_content.="<script> displayUserSchemaModuleGroupDetails('{$table_name}',0,{$div_group_id},'main_group_grid_{$div_group_id}') </script>";
								
						}
						 else
						  { $html_content.="\n</table>"; }
						  
						  $html_content.="\n</div>\n";
						 // $html_content.="\n<h1></h1>\n";	
						  
						 if($lobj_schema_details[$i-1][is_grid_edit]==0)
						$html_content.=" \n<div id='group_div_{$group_id}'  align='center' style='padding-top:8px;'>
						<table id ='tbl_menu' class='content-tbl' align='center'  cellpadding='2' cellspacing='0' border='0' >";
						 $html_content.= "\n <tr> {$lable_data} \n <td align='left' colspan=2>" .$actual_data."</td>\n</tr>\n";	
						 
					}
			}
			else  // Top Bottom
			{
				 $label_width=($lobj_schema_details[$i][optional]==0)?($width_value+$padding_width+2) :($width_value+$padding_width+2) ;
				 $label_width =($lobj_schema_details[$i][Type]=='Auto Increment')?($label_width+71):($label_width);			
				if($lobj_schema_details[$i][optional]=='0')
				$lable_data="\n<div class='paddlabel' style='width:{$label_width}Px;padding-top:5px; float:left;' id='label_{$lobj_schema_details[$i][internal_code]}'><font color='red'>*&nbsp</font>{$lobj_schema_details[$i][element_name]}</div><div id='label_padding_{$lobj_schema_details[$i][internal_code]}' style='width:{$padding};height:20px;float:left'></div>\n";
				else
				$lable_data="\n<div class='paddlabel' style='width:{$label_width}Px;padding-top:5px;  float:left;' id='label_{$lobj_schema_details[$i][internal_code]}'>{$lobj_schema_details[$i][element_name]}</div><div id='label_padding_{$lobj_schema_details[$i][internal_code]}' style='width:{$padding};float:left;height:20px;'></div>\n";		
				if($i==0)
				{
				if($lobj_schema_details[$i][is_grid_edit]==0){
				$label_tr.="<tr><td align='left' style=' padding-left:30px;'>{$lable_data}";
				$text_tr.="<tr><td align='left' style=' padding-left:30px;'>{$actual_data} <div id='div_padding_{$lobj_schema_details[$i][internal_code]}' style='width:{$padding};float:left;height:20px;'></div>"; }
				}
				
				else 
				{   
						if($lobj_schema_details[$i][field_position]=='Next Line')
						{
							$label_tr.="</td></tr>";
							$text_tr.="</td></tr>";
							$html_content.=$label_tr.$text_tr;
							$label_tr="";
							$text_tr="";
							if($lobj_schema_details[$i][is_grid_edit]=="0") 
							{
							$label_tr.="<tr><td align='left' style='padding-left:30px;'>{$lable_data}";
							$text_tr.="<tr><td align='left' style='padding-left:30px;'>{$actual_data} <div id='div_padding_{$lobj_schema_details[$i][internal_code]}'  style='width:{$padding};float:left;height:20px;'></div>";
							}
						}
						else if($lobj_schema_details[$i][is_grid_edit]=="0") 
						{
						$label_tr.="{$lable_data}\n  ";
						$text_tr.=" {$actual_data}  <div id='div_padding_{$lobj_schema_details[$i][internal_code]}'  style='width:{$padding};float:left;height:20px;'></div>";
						}
						
				}
			 
			// Forming Of Elements Ends	
					if($lobj_schema_details[$i][ref_s_user_schema_group_code]==$group_id)	
					{
					$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
					}
					else   
					{
					$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
					$group_name= str_replace("0None","General",$lobj_schema_details[$i][group_name]);
					// For Applieng Gndi Grid after the Crietiria
					if($v['grid_type']=='Ggrid' && (in_array("Criteria",array_flip($ul_main_group_id_array))) && $g_grid_flag==0)
						{
						  
						$g_grid_custom_link="";
							if(!empty($v['s_grid_custom_links']))
									{
										$split_by_pipe=explode("|",$v[s_grid_custom_links]);
										
										for($split=0;$split<count($split_by_pipe);$split++)
										{
											$function_split=explode("~",$split_by_pipe[$split]);
											$name=$function_split[0];	
											$fun=$function_split[1];
											$g_grid_custom_link.="<a   class='anchor-class' style='color:#2B65EC;' onclick=\"javascript: {$fun};\" > | {$name}</a>";
									 
										}
										 
									}	
							$html_content.="</table>\n";	
							$html_content.="<div align='left' id='g_grid_fetch_id' class='anchor-div'>";
							$html_content.="<a   class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:FetchGGridRecordsBasedOnConditions({$module_id});\" >Fetch</a> {$g_grid_custom_link} ";
							$html_content.="</div>";							
							$html_content.="\n <div id='ggrid_module_{$module_id}'  align='center' style=''> </div>\n";		
							$g_grid_flag=1;							
							 
						}
					
					 else if($lobj_schema_details[$i-1][multiple]==1)
						 {
						 $div_group_id=$lobj_schema_details[$i-1][ref_s_user_schema_group_code];
						 $table_name=$lobj_schema_details[$i-1][table_id];
						 $html_content.=" </table>\n";
						 if($lobj_schema_details[$i-1][is_grid_edit]=="0")
						 {						 
						 $entry_table_name=str_ireplace("group","entry",$table_name);
						 $html_content.= getSubGroupHTMLQuery($aobj_context,$module_id,$lobj_schema_details[$i-1][ref_s_user_schema_group_code],$v[display_type],$active_field_arr);						
						 $html_content.="<div align='left' class='anchor-div-main'><a  class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\"  >Add&nbsp;|&nbsp;</a>";
						 $html_content.="<a  class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" >Clear</a>";	
						 $html_content.=getGroupLinks($aobj_context ,$div_group_id);
						 $html_content.="</div>";						
						 }
						$html_content.=" <div align='center' style=\"height:auto; width:811px; overflow:auto;\" id='main_group_grid_{$div_group_id}'></div>";
						//$html_content.="<div id='multi_group_ad_search_{$div_group_id}' class='scroll-div' style='overflow: hidden; text-align: left;width: 690px; display: block;'><span id='mult_grid_a_search_name_id_{$div_group_id}'>Search: </span><input type='text' style='height:13px;' name='search' id='mult_group_grid_ad_search_id_{$div_group_id}' ></div>";
						 $html_content.="<script> displayUserSchemaModuleGroupDetails('{$table_name}',0,{$div_group_id},'main_group_grid_{$div_group_id}') </script>";
						}
						 else
						  $html_content.="\n</table>";
						  
						  // For Inline Grid
						  if($lobj_schema_details[$i][inline_div]=='1' && $lobj_schema_details[$i-1][ref_s_user_schema_group_code]==0)
						  {
						  $general_div_not_closed=1;
						  }
						  else 	$html_content.="\n</div>\n";	
						  
						  if($lobj_schema_details[$i][inline_div]=='0' && $general_div_not_closed=='1')
						  { 
						  // Closing General Div 
						  $html_content.="\n</div>\n";	 $general_div_not_closed=0;
						  }
						   				 
						  $html_content.="\n\n";
						if($lobj_schema_details[$i][inline_div]=='1' && $v['grid_type']!='ssdfGgrid')
						{						
							$html_content.="<div  align='center' style='padding-top:5px;'></div>\n";
							$html_content.="<div id='group_div_{$group_id}' class='ui-tabs ui-widget ui-widget-content ui-corner-all'  align='center' style='padding-top:2px;'>\n";
							$html_content.="<div class='ui-widget-header ui-corner-all sub-tab-header'  align='left' style='font-size:1.4em;height:15px;padding:2px;'>&nbsp;{$group_name}</div>\n";
						}
						else
						{
							$html_content.="<div id='group_div_{$group_id}'  align='center'  >\n";
						}
							$html_content.="\t<table id ='tbl_menu' class='content-tbl' align='center'  cellpadding='2' cellspacing='0' border='0' >";
					}  	
				 
			}
		} 
			if(!empty($label_tr))
			{
		   	$html_content.=$label_tr."</tr>".$text_tr."</tr></table>\n";
			}
			else
			$html_content.="</table>\n";
		if($lobj_schema_details[$i-1][multiple]==1 )
		 {
		 $div_group_id=$lobj_schema_details[$i-1][ref_s_user_schema_group_code];
		 $table_name=$lobj_schema_details[$i-1][table_id];
		  $html_content.="</table>\n ";
		 if($lobj_schema_details[$i-1][is_grid_edit]=="0")
		 {
		 $entry_table_name=str_ireplace("group","entry",$table_name);
		 $html_content.= getSubGroupHTMLQuery($aobj_context,$module_id,$lobj_schema_details[$i-1][ref_s_user_schema_group_code],$v[display_type],$active_field_arr);
		 $html_content.="<div align='left' class='anchor-div'>";
		  $html_content.="<a   class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" >Add&nbsp;|&nbsp;</a>";
		 $html_content.="<a  class='anchor-class'  style='color:#2B65EC;' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" >Clear</a>";	
		 $html_content.=getGroupLinks($aobj_context ,$div_group_id);
		 $html_content.="</div>";
		}
		$html_content.="<div align='center' style=\"height:auto; width:811px; overflow:auto;\" id='main_group_grid_{$div_group_id}'></div>";
		//$html_content.="<div id='multi_group_ad_search_{$div_group_id}' class='scroll-div' style='overflow: hidden; text-align: left;width: 690px; display: block;'><span id='mult_grid_a_search_name_id_{$div_group_id}'>Search: </span><input type='text' style='height:13px;' name='search' id='mult_group_grid_ad_search_id_{$div_group_id}' ></div>";
		$html_content.="<script> displayUserSchemaModuleGroupDetails('{$table_name}',0,{$div_group_id},'main_group_grid_{$div_group_id}') </script>";
		 }
		  
			{
		 	$html_content.="&nbsp;</div>";
			}
			if($v['grid_type']=='Ggrid') // Putting Update Button For Gandi Grid
			{
				$html_content.="<div align='left' class='anchor-div' id='ggrid_update_anchor_div'>";
				$html_content.="<a   class='anchor-class' style='color:#2B65EC;padding-bottom:0px;' onclick=\"javascript:UpdateGGridRowModuleDetails({$module_id});\" >Update</a> {$g_grid_custom_link}";
				$html_content.="</div>";
			}
			$html_content.=" </div>";// Closing tabs Div
			 
			
		if (!$handle = fopen($filename, 'w')) {
		    echo "Cannot open file ($filename)";
	        exit;
			}
	 
	    if (fwrite($handle, $html_content) === FALSE) {
	       echo "Cannot write to file ($filename)";
	       exit;
	   }
	   
	   fclose($handle); 
	   }
	 
	   if(($schema_id=='0'))
	   {
	   $data="Files Created Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");   
		}
}		
function getLeftRightLabelData($lobj_schema_details)
{
if($lobj_schema_details[optional]=='0')
$lable_data="\n <td style='vertical-align:center;width:150px;'  align='right'><font color='red'>*&nbsp</font>{$lobj_schema_details[element_name]}:</td>\n ";
else
$lable_data="\n <td style='vertical-align:center;width:150px;'   align='right'> {$lobj_schema_details[element_name]}:</td>\n";
return $lable_data;
}	
 						
function getActualData($lobj_schema_details,$type,$active_field_arr)		
{
			$internal_code=$lobj_schema_details[internal_code];
			$system_name=$lobj_schema_details[system_name];
			$suffix=($lobj_schema_details[suffix]=='None')?' ':" ".$lobj_schema_details[suffix].' ';
			$diabled=($lobj_schema_details[is_read_only]=='1')? " readonly='readonly'":" ";
			$diabled_color=($lobj_schema_details[is_read_only]=='1')? "  ; background-color:#F7F7F7;":" ";
			$width=$lobj_schema_details[width].'Px';
			$width_auto=($lobj_schema_details[width]).'Px';
			$padding=$lobj_schema_details[padding].'Px';
			$width_value=$lobj_schema_details[width];
			$default_value=$lobj_schema_details[default_value];
			$on_focus=($lobj_schema_details[on_enter]!='0')? " onFocus={$lobj_schema_details[on_enter]};":" ";
			$on_blur=($lobj_schema_details[on_exit]!='0')? " onBlur={$lobj_schema_details[on_exit]};":" ";
			$on_change=($lobj_schema_details[on_exit]!='0')? " onChange={$lobj_schema_details[on_exit]};":" ";
			$imageInputWrapperwidth=$width_value-25;	
			$imageInputWrapperwidthDate=$width_value-17;	
			$actual_data="";
			$padding_width=0;
			$view_image="";
			if($lobj_schema_details[multiple])
			$view_image=" viewGroupImage('{$lobj_schema_details[ref_s_user_schema_group_code]}','{$lobj_schema_details[internal_code]}') ";
			else
			$view_image=" viewModuleImage('{$lobj_schema_details[internal_code]}') " ;
			$image_wrapper_class=($type=='Left Right')?" LRimageInputWrapper ":"imageInputDateMonth";
			$date_image_wrapper_class=($type=='Left Right')?" LRimageInputWrapperDate ":" imageInputWrapperDate ";
					if($lobj_schema_details[Type]=='Date')
						{
						//$date_default_value=$lobj_schema_details[default_value];
							 //if(empty($date_default_value) or $date_default_value=='00/00/0000')
							 $date_default_value="00/00/0000";
								if($lobj_schema_details[doc_root_mapped_id]=='0')
								{
								$actual_data.="<div id='input_div_{$internal_code}' class='{$date_image_wrapper_class}' style='width:{$width_value}px;{$diabled_color}float:left;'>";
								$actual_data.="<input   {$diabled}  {$on_focus} {$on_blur}   id='details_{$lobj_schema_details[internal_code]}' class='inputWithImge ElementCount'  type='text' style='width:{$imageInputWrapperwidthDate}px;{$diabled_color}' value='{$date_default_value}' />";
								$actual_data.="<script>$('#details_{$lobj_schema_details[internal_code]}').datepicker({showOn: 'button',showButtonPanel: true, changeMonth: true,	changeYear: true,dateFormat:'dd/mm/yy',buttonImage: 'images/date.gif', buttonImageOnly: true});</script>";
								$actual_data.="</div>";
								}
								else
								{
								$actual_data.="<div id='input_div_{$internal_code}' class='{$date_image_wrapper_class}' style='width:{$width_value}px;{$diabled_color} float:left;'>";
								$actual_data.="<input   {$diabled}  {$on_focus} {$on_blur}   id='details_{$lobj_schema_details[internal_code]}' class='inputWithImge ElementCount'  type='text' style='width:{$imageInputWrapperwidthDate}px;{$diabled_color}' value='{$date_default_value}'  onblur=getDocRootPrefix({$lobj_schema_details[ref_s_user_schema_code]},'{$lobj_schema_details[doc_root_mapped_id]}',{$lobj_schema_details[internal_code]}); onchange=getDocRootPrefix({$lobj_schema_details[ref_s_user_schema_code]},'{$lobj_schema_details[doc_root_mapped_id]}',{$lobj_schema_details[internal_code]}); />";
								$actual_data.="<script>$('#details_{$lobj_schema_details[internal_code]}').datepicker({showOn: 'button', showButtonPanel: true,changeMonth: true,	changeYear: true,dateFormat:'dd/mm/yy',buttonImage: 'images/date.gif', buttonImageOnly: true});</script>";
								$actual_data.="</div>";
								}
							$actual_data.=$suffix;//."<a href='javascript:;' id='date_{$lobj_schema_details[internal_code]}'> <img onclick=calender_popup('details_{$lobj_schema_details[internal_code]}','date_{$lobj_schema_details[internal_code]}'); src='../images/cal.jpg' border='0'></img></a>";
							}
					else if($lobj_schema_details[Type]=='Month')
						{
							  $actual_data.="<div id='input_div_{$internal_code}' class='{$image_wrapper_class}' style='width:{$width_value}px;{$diabled_color} float:left'> ";
							$actual_data.=" <input   {$diabled}  {$on_focus} {$on_blur}   id='details_{$lobj_schema_details[internal_code]}' class='inputWithImge ElementCount'  type='text' style='width:{$imageInputWrapperwidth}px;{$diabled_color}' value='{$lobj_schema_details[default_value]}'/> ";
							$actual_data.="<script>$('#details_{$lobj_schema_details[internal_code]}').Monthpicker({showOn:
							'button',showButtonPanel: true,buttonImage: 'images/date.gif', buttonImageOnly:
							true});</script>";
							//$actual_data.="<img src='images/date.gif' id='date_{$lobj_schema_details[internal_code]}' alt='' class='img' onclick=\"showYearMonthCalendar('{$lobj_schema_details[internal_code]}');\"  />";
							$actual_data.="<div align='right' id='sub_div_year_calander' style='position: absolute; visibility: visible;padding-top:8px; width:374px; display:none'></div>";
							$actual_data.=$suffix;//."<a href='javascript:;' id='date_{$lobj_schema_details[internal_code]}'> <img onclick=calender_popup('details_{$lobj_schema_details[internal_code]}','date_{$lobj_schema_details[internal_code]}'); src='../images/cal.jpg' border='0'></img></a>";
							$actual_data.="</div>";	  					
							
						}
					else if($lobj_schema_details[Type]=='Number')
						{
							$default_value=(empty($default_value))?0.00:$default_value;
													 
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><input    {$diabled}  {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}'   type='text' style='width:{$width};text-align:right;{$diabled_color}' value='{$default_value}' onkeypress='return acceptNumbersOnlyForModule(event);' class='ElementCount'/></div>\n";
							$actual_data.=$suffix;
							 
						}
					else if($lobj_schema_details[Type]=='Large Text')
						{
							$default_value = trim($default_value);
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><textarea  {$diabled}  {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}'    style='width:{$width};{$diabled_color}' value='{$default_value}' cols='1' rows='{$lobj_schema_details[text_area_rows]}' class='ElementCount'></textarea></div>\n";
							$actual_data.=$suffix;	
						}
					else if($lobj_schema_details[Type]=='Image')
						{
							$file_size=($width_value/9)+2;
							$module_name=getlinkId($lobj_schema_details['module_name']);
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><input type='hidden' id='details_{$lobj_schema_details[internal_code]}' /><input class='content-tbl-upload' type='file' style='width:{$width};' size={$file_size} id='image_details_{$lobj_schema_details[internal_code]}' name='image_details_{$lobj_schema_details[internal_code]}'/></div>";
							$actual_data.="<a class ='anchor-class' onclick=\"{$view_image};\">view</a>\n";
							$actual_data.=$suffix;	
						}
					else if($lobj_schema_details[Type]=='List Of Values')
						{
							$width_value+=2;
							$width=$width_value.'Px';
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><select  {$diabled}  {$on_focus} {$on_change} id='details_{$lobj_schema_details[internal_code]}'    style='width:{$width};' class='ElementCount'>\n";
							$split_options=explode('|',$lobj_schema_details[list_of_values]);
							  for($op_count=0;$op_count<count($split_options);$op_count++)
								{
								$value=($split_options[$op_count]=='Select One')? '':$split_options[$op_count];
								$actual_data.="\n <option value='{$value}' id='{$split_options[$op_count]}'>{$split_options[$op_count]}</option>";
								}
							$actual_data.="</select></div>\n ";
							$actual_data.=$suffix ;	
						}
						else if($lobj_schema_details[Type]=='Auto Increment')
						{
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><select    id='auto_inc_{$lobj_schema_details[internal_code]}'  onchange='getSerieslastNo(this.value,{$lobj_schema_details[ref_s_user_schema_code]},{$lobj_schema_details[internal_code]});'";
							$actual_data.= "style='width:65px;' class='ElementCount'> <option value='0'>Select</option></select>&nbsp;";
							$actual_data.=" <input  {$diabled} readonly='readonly' id='details_{$lobj_schema_details[internal_code]}' {$on_focus} {$on_blur}  type='text' style='width:{$width};' value='{$default_value}' /> </div>  \n";
							if($lobj_schema_details[source_field]=='0')
							{
							//getAutoIncrementDefaultPrefix($lobj_schema_details[internal_code],$lobj_schema_details[ref_s_user_schema_code]);
							}
						}
					else if($lobj_schema_details[ref_module_code]!=0 && $lobj_schema_details[is_ref_module_code_lov]=='0')
						{
						$ref_mofule_code_active_field=$active_field_arr[$lobj_schema_details[ref_module_code]];
							$ref_m_ref_db_field=0;
							$ref_m_ref_val=0;
							// For Ref Display
							if($lobj_schema_details[ref_module_code_ref_field]!=0)
							{
								$ref_m_ref_db_field=$lobj_schema_details[ref_module_code_ref_field_db_field];
								if($lobj_schema_details[ref_module_code_ref_field_on]!=0)
								{
								$ref_m_ref_val="$('#details_{$lobj_schema_details[ref_module_code_ref_field_on]}').val()";
								}
								else
								{
								$ref_m_ref_val="'".str_ireplace(" ","~",$lobj_schema_details[ref_module_code_ref_field_const])."'";
								}
							}
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><input  {$diabled} id='details_{$lobj_schema_details[internal_code]}'   type='hidden'  name='{$lobj_schema_details[ref_module_code]}' value='0' /></div> \n";
							 $actual_data.="<div id='input_div_{$internal_code}'style='float:left;{$diabled_color}' class='{$image_wrapper_class}' style='width:{$width_value}px;'>";
							// $actual_data.="<input  {$on_focus}   {$diabled} class='inputWithImge' id='txt_ref_schema_{$lobj_schema_details[internal_code]}'   type='text' style='width:{$imageInputWrapperwidth}px;' value='{$default_value}'  onKeyUp=\"Javascript:if (event.keyCode != 38 || event.keyCode != 40 || event.keyCode != 13) loadAutoCompleteData(this, event,'select_auto_complete_{$lobj_schema_details[internal_code]}','search_div_{$lobj_schema_details[internal_code]}',{$lobj_schema_details[ref_module_code]},'{$ref_m_ref_db_field}',{$ref_m_ref_val}); else $('#select_auto_complete_{$lobj_schema_details[internal_code]}').focus();\"  /> \n";
							 $actual_data.="<input  {$on_focus}   {$diabled} class='inputWithImge ElementCount' id='txt_ref_schema_{$lobj_schema_details[internal_code]}'   type='text' style='width:{$imageInputWrapperwidth}px;{$diabled_color}' value='{$default_value}'  
							 onKeyUp=\"Javascript:PopupKeyEvent('{$system_name}',this, event,'select_auto_complete_{$lobj_schema_details[internal_code]}','search_div_{$lobj_schema_details[internal_code]}',{$lobj_schema_details[ref_module_code]},'{$ref_m_ref_db_field}',{$ref_m_ref_val},'{$lobj_schema_details[ref_module_name]}','{$ref_mofule_code_active_field}'); \"  /> \n";
	                         
							 $actual_data.="<a onFocus= showIndex('txt_ref_schema_{$lobj_schema_details[internal_code]}','details_{$lobj_schema_details[internal_code]}','select_auto_complete_{$lobj_schema_details[internal_code]}',13); href='javascript:;'  style='text-decoration:none' id='pop_up_{$lobj_schema_details[internal_code]}'>";
							 $actual_data.="<img src='images/search-glass.gif' class='img' border = '0' onclick=\"assignSrefDataValue('{$lobj_schema_details[internal_code]}','{$lobj_schema_details[ref_module_code]}');calingScript('{$lobj_schema_details[ref_module_code]}','{$lobj_schema_details[internal_code]}','{$lobj_schema_details[ref_module_name]}');
											\"> </a> </div>"; 										
							 $actual_data.=$suffix;
							 $actual_data.="<div id='search_div_{$lobj_schema_details[internal_code]}'  style=\"position:absolute; display:none; z-index:10000;\" onMouseOver=\"javascript:oOverMenu='search_div_{$lobj_schema_details[internal_code]}';\"  onMouseOut=\"javascript:oOverMenu=false;\">";
							 $actual_data.=" <select class='mainlink'  size='10' id='select_auto_complete_{$lobj_schema_details[internal_code]}'  style='width:{$width_auto};height:145px;  border-style: none;background-color:#EEF5F9;;' onclick=\"JavaScript:autoCompleteSelectText('txt_ref_schema_{$lobj_schema_details[internal_code]}','details_{$lobj_schema_details[internal_code]}',this.id,this.value,{$lobj_schema_details[ref_module_code]})\"";
							 $actual_data.="onkeydown=\"JavaScript:if(event.keyCode == 13)autoCompleteSelectTextByEnterKey('txt_ref_schema_{$lobj_schema_details[internal_code]}','details_{$lobj_schema_details[internal_code]}',this.id,this.value,{$lobj_schema_details[ref_module_code]});\" />";
							 $actual_data.="<option value=''></option></select>	</div>";
							  
						}
						else if($lobj_schema_details[ref_module_code]!=0 && $lobj_schema_details[is_ref_module_code_lov]=='1')
						{
						$width_value+=2;
							$width=$width_value.'Px';
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><select  {$diabled}  {$on_focus} {$on_change} id='details_{$lobj_schema_details[internal_code]}'    style='width:{$width};{$diabled_color}' class='ElementCount' >  \n";
							$actual_data.="</select></div>\n ";
							$actual_data.=$suffix ;	
						}
						else if($lobj_schema_details[Type]=='Employee List')
						{
							$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'>";
							$actual_data.="<input  {$diabled} id='details_{$lobj_schema_details[internal_code]}'  onKeyUp='Javascript:if (event.keyCode != 38 && event.keyCode != 40 && event.keyCode != 13) getFWEmployeeList(this.value);' type='text' style='width:{$width};{$diabled_color}' value='{$default_value}' class='ElementCount'/>";
							$actual_data.="<input type='checkbox' class='vertical_align' style='border:0px solid #C5DBEC;' id='fw_employee_list' onclick='CheckAllFwEmpList();'></div><br><br>";
							$actual_data.="<div style='width:260px; height:250px;' id='fw_emp_list_div'></div>";
						}					
					else
						{	
						$actual_data.="<div id='input_div_{$internal_code}' style='float:left;{$diabled_color}'><input  {$diabled} id='details_{$lobj_schema_details[internal_code]}' {$on_focus} {$on_blur}  type='text' style='width:{$width};{$diabled_color}' value='{$default_value}' class='ElementCount'/></div> \n";
						}
	 	$arr['actual_data']=$actual_data;		
	 	$arr['padding_width']=$padding_width;		
return	$arr;	
}
function getSubGroupHTMLQuery($aobj_context,$module_id,$group_id,$type,$active_field_arr)
{
 
				$lstr_qry = "select a.*,ifnull(doc_root,0) as doc_root,ifnull(doc_root_mapped_id,0) as doc_root_mapped_id,
				ifnull(is_right_exstis,0) as is_right_exstis,1 as is_module_for_new_or_edit from 
				(select 
				ue.internal_code,ifnull(is_grid_edit,0) as is_grid_edit,
				ue.name as element_name,ifnull(ue.field_position,'Next Line') as field_position,
				s.value as Type,
				REPLACE(ur.module_name,' ','~') as ref_module_name,
				ifnull(ug.name,'0None') as group_name,
				if(ug.internal_code is null,u.internal_code,concat(u.internal_code,'_',ug.internal_code)) as user_right_group,
				description,s1.value as meta_data,decimals,
				if(s1.value='Meta',concat('m_',u.internal_code,'_ele_',ue.internal_code),'') as meta_field,
				default_value,ifnull(ug.on_click_event,'') as  on_click_event,
				optional,list_of_values,
				u.internal_code as ref_s_user_schema_code,
				ue.ref_module_code ,is_read_only,ifnull(padding,2)*8 as padding,
				IFNULL(ug.internal_code,0) as ref_s_user_schema_group_code,ifnull(multiple,0) as multiple,
				concat('user_schema_',u.internal_code ,'_group_',IFNULL(ug.internal_code,0)) as table_id,
				ifnull(suffix,'None') as suffix,width*9 as width,linked_field,source_field,
				Replace(if(on_enter='',0,ifnull(on_enter,0)),' ','~') as on_enter
				,Replace(if(on_exit='',0,ifnull(on_exit,0)),' ','~') as on_exit,
				ifnull(ue.is_ref_module_code_lov,0) as is_ref_module_code_lov,
				parent_group_code
			 	from s_user_schema_elements ue
				inner join s_user_schema u on u.internal_code=ue.ref_s_user_schema_code
				left join s_user_schema_group ug on ug.internal_code=ref_s_user_schema_group_code
				left join s_ref_type s on s.internal_code=ue.data_type
				left join s_ref_type s1 on s1.internal_code=ue.s_ref_type_meta
				left join s_user_schema ur on ur.internal_code=ue.ref_module_code
				where u.internal_code= {$module_id} and ifnull(ue.is_defined,1)=1
				and ue.is_visible=1	and IFNULL(ug.parent_group_code,0)={$group_id}
				order by ifnull(ug.sequence,-1),ue.sequence,ue.internal_code   )a
				left join # for User rights
				(select module_id  as is_right_exstis from user_rights where module_id={$module_id}
				and ref_s_sysdb_code=".$_SESSION["user_id"]."  ) b on b.is_right_exstis=a.user_right_group 
				left join # for Auto Increment Values
				(select internal_code as doc_root,GROUP_CONCAT(ele_id) as doc_root_mapped_id  from (select su.internal_code,su.name as value
				from s_user_schema_elements su 
				inner join s_ref_type st1 on st1.internal_code=data_type
				where su.ref_s_user_schema_code={$module_id} and st1.value='Date')a
				inner JOIN
				(select su.internal_code as ele_id,su.name,source_field  
				from s_user_schema_elements su 
				inner join s_ref_type st1 on st1.internal_code=data_type
				where su.ref_s_user_schema_code={$module_id} and st1.value='Auto Increment' and source_field>0)b 
				on a.internal_code=b.source_field
				group by internal_code) c on  c.doc_root=a.internal_code  ";
 
		$lobj_schema_details = $aobj_context->mobj_db->GetAll($lstr_qry);
 
$ul_subgroup_array=array();
$ul_subgroup_id_array=array();
$ul_subgroup_click_array=array();
	
	 
		$group_name= str_replace("0None","General",$lobj_schema_details[0][group_name]);
		 $group_id= $lobj_schema_details[0][ref_s_user_schema_group_code];
		$html_content='';
		if($lobj_schema_details)
		{
			$html_content.="<br>";
			$html_content.="<div id='sub_tabs'>\n<ul>";
			foreach($lobj_schema_details as $key=>$val)
			{
				if(!in_array($val[group_name],$ul_subgroup_array))
				{
				array_push($ul_subgroup_array,$val[group_name]);
				$ul_subgroup_id_array[$val[group_name]]=$val[ref_s_user_schema_group_code];
				$ul_subgroup_click_array[$val[group_name]]=$val[on_click_event];
				}
			}
 		
			for($u=0;$u<count($ul_subgroup_array);$u++)
				{
				$html_content.="<li id='li_{$ul_subgroup_id_array[$ul_subgroup_array[$u]]}'><a id='li_a_{$ul_subgroup_id_array[$ul_subgroup_array[$u]]}' href='#group_div_{$ul_subgroup_id_array[$ul_subgroup_array[$u]]}' onclick=\" {$ul_subgroup_click_array[$ul_subgroup_array[$u]]}\" >{$ul_subgroup_array[$u]}</a></li>\n";
				}	
				$html_content.="</ul>";
					 
					$html_content.="\n <div id='group_div_{$group_id}'  align='center' style='padding-top:8px;'>\n";
					$html_content.=	"\t<table id ='tbl_menu' style='padding-left:2px; width:790px;' class='content-tbl' align='center'  cellpadding='2' cellspacing='0' border='0' >\n";
					$label_tr="";
					$text_tr="";
					$actual_data="";
					$html_label_tr=array(); 
					$html_text_tr=array(); 
		//$html_text_tr="";	
					for ($i=0;$i<count($lobj_schema_details);$i++)
					{
						$actual_data="";
						if($lobj_schema_details[$i][is_grid_edit]==0)
						{
						$actual_data_arr=getActualData($lobj_schema_details[$i],$type,$active_field_arr);
						}
						$actual_data=$actual_data_arr['actual_data'];
						$padding_value=$lobj_schema_details[$i][padding];
						if($lobj_schema_details[$i+1][field_position]=='Next Line') $padding_value=0;
						
						if($lobj_schema_details[$i]['Type']=='Month' &&  ($lobj_schema_details[$i+1][field_position]=='Next Column'))
						{
							 $padding_value+=3;
						}
						$padding=$padding_value.'Px';
						$padding_width=$actual_data_arr['padding_width'];
						$width_auto=($lobj_schema_details[$i][width]+20).'Px';
						$width_value=$lobj_schema_details[$i][width];
						if($type=="Left Right")
						{
							$lable_data="";
							if($lobj_schema_details[$i][is_grid_edit]==0)
							{
							$lable_data=getLeftRightLabelData($lobj_schema_details[$i]);}
							// Forming Of Elements Ends	
								if($lobj_schema_details[$i][ref_s_user_schema_group_code]==$group_id )	
								{
							 
									if($lobj_schema_details[$i][is_grid_edit]==0)
									{
									$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
									$html_content.= "<tr> {$lable_data} \n <td align='left'   colspan=2 >" .$actual_data."</td>\n</tr>\n";		
									}
								}
								else
								{
									$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
									$group_name= str_replace("0None","General",$lobj_schema_details[$i][group_name]);
								 	if($lobj_schema_details[$i-1][multiple]==1)
									{
										
										 $div_group_id=$lobj_schema_details[$i-1][ref_s_user_schema_group_code];
										 $table_name=$lobj_schema_details[$i-1][table_id];
										 if($lobj_schema_details[$i-1][is_grid_edit]==0)
										 {
											 $entry_table_name=str_ireplace("group","entry",$table_name);
											 $html_content.=" </table> \n";
											 $html_content.="<div align='left' class='anchor-div'><a style='color:#2B65EC;' class='anchor-class'  onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\"  >Add&nbsp;|&nbsp;</a>";
											 $html_content.="<a  class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\"  >Clear</a> ";		
											 $html_content.=getGroupLinks($aobj_context ,$div_group_id);
											$html_content.="</div>";
										 }
									 $html_content.=" <div  align='center' style=\"width:792px;padding-bottom:6px;\">";
									 $html_content.=" <div align='center' style=\"height:auto; width:791px; padding-right:2px; overflow:auto;\" id='main_group_grid_{$div_group_id}'></div>";
									//$html_content.="<div id='multi_group_ad_search_{$div_group_id}' class='scroll-div' style='overflow: hidden; text-align: left; width: 630px; display: block;'><span id='mult_grid_a_search_name_id_{$div_group_id}'>Search: </span><input style='height:10px;' type='text' name='search' id='mult_group_grid_ad_search_id_{$div_group_id}' ></div>";		                            
									$html_content.="<script> displayUserSchemaModuleGroupDetails('{$table_name}',0,{$div_group_id},'main_group_grid_{$div_group_id}') </script>";
											
									}
									 else
									  { $html_content.="\n</table>"; }
									  
									  $html_content.="\n</div></div>\n";
									 
									$html_content.=" \n<div id='group_div_{$group_id}'  align='center' style='padding-top:8px;'>
										<table id ='tbl_menu' style='padding-left:2px; width:790px;' class='content-tbl' align='center'  cellpadding='2' cellspacing='0' border='0'>";
									$html_content.= "\n <tr> {$lable_data} \n <td align='left' colspan=2>" .$actual_data."</td>\n</tr>\n";	
								
								}
						}
						else 
							{
							 $label_width=($lobj_schema_details[$i][optional]==0)?($width_value+$padding_width+2) :($width_value+$padding_width+2) ;
							 $label_width =($lobj_schema_details[$i][Type]=='Auto Increment')?($label_width+71):($label_width);			
				
							 
								if($lobj_schema_details[$i][optional]=='0')
								$lable_data="\n<div style='width:{$label_width}Px; padding-top:5px; float:left;' id='label_{$lobj_schema_details[$i][internal_code]}'><font color='red'>*&nbsp</font>{$lobj_schema_details[$i][element_name]}</div><div style='width:{$padding};float:left;height:20px;'></div>\n";
								else
								$lable_data="\n<div style='width:{$label_width}Px; padding-top:5px;  float:left;' id='label_{$lobj_schema_details[$i][internal_code]}'>{$lobj_schema_details[$i][element_name]}</div><div style='width:{$padding};float:left;height:20px;'></div>\n" ;
								if($i==0)
								{
								if($lobj_schema_details[$i][is_grid_edit]==0){
								$label_tr.="<tr><td align='left' style='padding-left:30px;'>{$lable_data}";
								$text_tr.="<tr><td align='left' style='padding-left:30px;'>{$actual_data} <div style='width:{$padding};float:left;height:20px;'></div>";} 
								}
								
								else 
								{ 
									if($lobj_schema_details[$i][field_position]=='Next Line')
									{
										$label_tr.="</td></tr>";
										$text_tr.="</td></tr>";
										$html_content.=$label_tr.$text_tr;
										$label_tr="";
										$text_tr="";
										if($lobj_schema_details[$i][is_grid_edit]=="0") 
										{
										$label_tr.="<tr><td align='left' style='padding-left:30px;'>{$lable_data}";
										$text_tr.="<tr><td align='left' style='padding-left:30px;'>{$actual_data} <div style='width:{$padding};float:left;height:20px;'></div>\n";
										}
									}
									else if($lobj_schema_details[$i][is_grid_edit]=="0") 
									{
									$label_tr.="{$lable_data}\n  ";
									$text_tr.=" {$actual_data}  <div style='width:{$padding};float:left;height:20px;'></div>\n ";
									}
								}
							 
							// Forming Of Elements Ends	
									if($lobj_schema_details[$i][ref_s_user_schema_group_code]==$group_id)	
									{
									$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
									}
									else
									{
									$group_id=$lobj_schema_details[$i][ref_s_user_schema_group_code];
									$group_name= str_replace("0None","General",$lobj_schema_details[$i][group_name]);
									 if($lobj_schema_details[$i-1][multiple]==1)
										 {
										 $div_group_id=$lobj_schema_details[$i-1][ref_s_user_schema_group_code];
										 $table_name=$lobj_schema_details[$i-1][table_id];
										  $html_content.=" </table> \n";
											 if($lobj_schema_details[$i-1][is_grid_edit]==0)
											 {
											 $entry_table_name=str_ireplace("group","entry",$table_name);
											 $html_content.="<div align='left' class='anchor-div'><a  style='color:#2B65EC;' class='anchor-class' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" >Add&nbsp;|&nbsp;</a>";
											 $html_content.="<a  class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\"  >Clear</a>";
											 $html_content.=getGroupLinks($aobj_context ,$div_group_id);
											$html_content.="</div>";	
											 }
										 $html_content.=" <div  align='center' style=\"width:792px;padding-bottom:6px;\">"; 
										 $html_content.=" <div align='center' style=\"height:auto; width:791px; overflow:auto;\" id='main_group_grid_{$div_group_id}'></div>";
										 $html_content.="<script> displayUserSchemaModuleGroupDetails('{$table_name}',0,{$div_group_id},'main_group_grid_{$div_group_id}') </script>";						
										 }
										 else
										 {
										  $html_content.="\n</table>";
										    } 
											 $html_content.="\n</div>";
										    if($lobj_schema_details[$i-1][multiple]==1)  $html_content.="\n</div>";
											
										 //if($lobj_schema_details[$i-1][is_grid_edit]==0)	 $html_content.="\n</div>";
											 
										  
									$html_content.="<div id='group_div_{$group_id}'  align='center' style='padding-top:8px;'>\n";
									$html_content.="\t<table id ='tbl_menu' style='padding-left:2px; width:790px;' class='content-tbl'  align='center'  cellpadding='2' cellspacing='0' border='0'  >";
									}  	
								 
							}
					}
				$html_content.=$label_tr."</tr>".$text_tr."</tr></table>\n";
		
			   if($lobj_schema_details[$i-1][multiple]==1)
				 {
				 $div_group_id=$lobj_schema_details[$i-1][ref_s_user_schema_group_code];
				 $table_name=$lobj_schema_details[$i-1][table_id];
				 $html_content.="</table>\n ";
				 if($lobj_schema_details[$i-1][is_grid_edit]==0)
				{
				 $entry_table_name=str_ireplace("group","entry",$table_name);
				
				 $html_content.="<div align='left' class='anchor-div'>";
				 $html_content.="<a   class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\">Add |</a>";
				 $html_content.="<a   class='anchor-class' style='color:#2B65EC;' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" >Clear</a>";	
				$html_content.=getGroupLinks($aobj_context ,$div_group_id);
				$html_content.="</div>";
				}
				 //echo $html_content;
				 $html_content.=" <div align='center' style=\"width:792px;padding-bottom:6px;\">"; 
				 $html_content.="<div align='center' style=\"height:auto; width:791px;  overflow:auto;\" id='main_group_grid_{$div_group_id}'></div>";
				 //$html_content.="<div id='multi_group_ad_search_{$div_group_id}' class='scroll-div' style='overflow: hidden; text-align: left;width: 630px; display: block;'><span id='mult_grid_a_search_name_id_{$div_group_id}'>Search: </span><input type='text' style='height:13px;' name='search' id='mult_group_grid_ad_search_id_{$div_group_id}' ></div>";
				 $html_content.="<script> displayUserSchemaModuleGroupDetails('{$table_name}',0,{$div_group_id},'main_group_grid_{$div_group_id}') </script>";
				 }
		 	$html_content.="</div>";
			 if($lobj_schema_details[$i-1][multiple]==1) {$html_content.="</div>";}
		 	$html_content.="</div>";// Closing Sub Div
		}	
		 
			return 	$html_content;
}

function getGroupLinks($aobj_context,$group_id)
{
$custom_links="";
$get_custom_links="select custom_links from s_user_schema_group where internal_code={$group_id}";
$lobj_get_links_from_module =  $aobj_context->mobj_db->GetRow($get_custom_links);
		if(!empty($lobj_get_links_from_module[custom_links]))
			{
				$split_by_pipe=explode("|",$lobj_get_links_from_module[custom_links]);
				for($split=0;$split<count($split_by_pipe);$split++)
				{
					$function_split=explode("~",$split_by_pipe[$split]);
					
					$name=$function_split[0];	
					$id=getlinkId($name);
					$link_id.=$id;
					$fun=$function_split[1];
					$custom_links.="<a  class='anchor-class' onclick=\"javascript:{$fun};\"  style='color:#2B65EC;'>&nbsp;|&nbsp;{$name}</a>";
				}
				 
			}
		 
	return 	$custom_links;	
}
function getlinkId($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ",".");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}

function getRefModuleActiveField($aobj_context,$module_id)
{

		$get_ref_module_code_ids="(select GROUP_CONCAT(ref_module_code) as ref_module_codes
							from 
							s_user_schema_elements where ref_s_user_schema_code={$module_id}
							and ref_module_code>0)";
		$lobj_get_ref_module_code_ids= $aobj_context->mobj_db->GetRow($get_ref_module_code_ids);								
		$ref_module_codes=$lobj_get_ref_module_code_ids[ref_module_codes];
		
		$get_active_field="select ref_s_user_schema_code,db_field from s_user_schema_elements 
					where ref_s_user_schema_code 
					in({$ref_module_codes}) and system_name='active'";	
		$lobj_get_active_field = $aobj_context->mobj_db->GetAll($get_active_field);	
		foreach($lobj_get_active_field as $k=>$v)
		{
		$active_field_arr[$v[ref_s_user_schema_code]]=$v[db_field];
		}
		return $active_field_arr;
}
?>