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 : 18.226.17.3


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

<?php

 function getGeneralUserSchemaDetails($aobj_context)
{

$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
			$schema_name = $aobj_context->mobj_data["schema_name"];	 
			$is_multiple = $aobj_context->mobj_data["is_multiple"];	
			$login_cnt = $aobj_context->mobj_data["login_cnt"];	
			$is_module_for_new_or_edit= $aobj_context->mobj_data["is_module_for_new_or_edit"];
			 session_start();
			$user_id=$_SESSION['user_id'];
			$user_type=$_SESSION['user_type'];
			$get_file_id="select s.internal_code,t.value as system_menu_name,module_type
			from s_user_schema s inner join s_ref_type t on t.internal_code=s.module_type
			WHERE module_name='{$schema_name}'";
		 $lobj_get_file_id = $aobj_context->mobj_db->GetRow($get_file_id);
		 $schema_id=$lobj_get_file_id[internal_code];
		 $module_type=$lobj_get_file_id[module_type];
		 $system_menu_name=$lobj_get_file_id[system_menu_name];
			$_SESSION['g_file_id'] =$lobj_get_file_id[internal_code];
			$add_right=1;
		if(strtolower($user_type)!='admin')
			{
				$add_rights_data="select is_add from user_rights where 
					     	module_id='{$schema_id}' and module_type='{$module_type}' and ref_s_sysdb_code='{$user_id}'";
				$lobj_add_rights_data = $aobj_context->mobj_db->GetRow($add_rights_data);
			 
				$add_right=$lobj_add_rights_data[is_add];
				 
			}
			if($is_multiple==0)
			$order_by="order by ifnull(ug.sequence,0),ue.sequence,ue.internal_code";
			else 
				$order_by= "group by group_name";
			//ifnull(is_right_exstis,0) as
				$lstr_qry = "select a.*,ifnull(doc_root,0) as doc_root,ifnull(doc_root_mapped_id,0) as doc_root_mapped_id,
				1 is_right_exstis,1 as is_module_for_new_or_edit from (select 
				ue.internal_code,ifnull(u.grid_type,'Normal') as grid_type ,
				ue.name as element_name,ifnull(s2.value,'none') as module_parent_menu,
				s.value as Type,	ifnull(js_path,'') as js_path,
				ifnull(ug.name,'0None') as group_name,system_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(ue.is_ref_module_code_lov,0) as is_ref_module_code_lov,
				optional,list_of_values,
				u.internal_code as ref_s_user_schema_code,
				ue.ref_module_code ,is_read_only,
				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
			 	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_ref_type s2 on s2.internal_code=u.main_menu
				where u.module_name= '".$schema_name."' and  is_multiple_group={$is_multiple}
				and (ug.parent_group_code is null or  ug.parent_group_code=0)
				and is_visible=1 and ifnull(ue.is_defined,1)=1
				{$order_by} )a
			 	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={$schema_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={$schema_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);
  $grid_type= $lobj_schema_details[0]['grid_type'];
	 $get_html_ids="select t.value as data_type,su.internal_code,
				concat('details_',su.internal_code) as id,su.system_name,
					ifnull(su.is_visible,1) as is_visible,su.source_field,
					ifnull(ug.name,'None') as group_name,
					ifnull(su.is_defined,1) as is_defined,ref_module_code,
					su.db_field,
					default_value,
					case when default_value='today'
					then date_format(current_date(),'%d/%m/%Y')
					when default_value='yesterday'
					then date_format(date_add(current_date(),interval -1 day),'%d/%m/%Y')
					when default_value='tomarrow'
					then date_format(date_add(current_date(),interval 1 day),'%d/%m/%Y')
					when default_value='bom'
					then date_format(current_date(),'%01/%m/%Y')
					else '00/00/0000'
					end as dates,
					date_format(current_date(),'%Y') as curr_year,
					date_format(current_date(),'%m') as curr_month,
					ifnull(su.is_ref_module_code_lov,0) as is_ref_module_code_lov
					from s_user_schema_elements  su 
					inner join s_ref_type t on 
					t.internal_code=su.data_type 
						left join s_user_schema_group ug on ug.internal_code=su.ref_s_user_schema_group_code 
					  where 
					su.ref_s_user_schema_code={$schema_id}";
	$lobj_get_html_ids = $aobj_context->mobj_db->GetAll($get_html_ids);	
 
	$system_date=date("d/m/Y");
	 
	$html_id_arr=array();	
	$html_id_criteria_arr=array();	
	$html_id_data_type_arr=array();	
	$visible_defined_arr=array();	
	$is_ref_module_code_lov_flag=0;
	$is_update_visible_field=0;
	$is_image_flag=0;
	$employee_list_flag=0;
	$is_date_field_exists=0;
	$is_auto_increment_update_flag=0;
	 $date_fields_date_array=array();
	 $grid_fields_array=array();
	 
	 $d=0;
	 $a=0;
	for($h=0;$h<count($lobj_get_html_ids);$h++)
	{
		 $system_name=$lobj_get_html_ids[$h][system_name];
		 $db_field=$lobj_get_html_ids[$h][db_field];
		 $grid_fields_array[$system_name]=$db_field;
		 $internal_code=$lobj_get_html_ids[$h][internal_code];
		 if(strtolower($lobj_get_html_ids[$h][group_name])!='criteria')
		$html_id_arr[$lobj_get_html_ids[$h][system_name]]=$lobj_get_html_ids[$h][id];
		 else
		$html_id_criteria_arr[$lobj_get_html_ids[$h][system_name]]=$lobj_get_html_ids[$h][id];
		
		$html_id_data_type_arr[$lobj_get_html_ids[$h][system_name]]=$lobj_get_html_ids[$h][data_type];
		if($lobj_get_html_ids[$h][is_ref_module_code_lov]=='1') $is_ref_module_code_lov_flag=1;
		if($lobj_get_html_ids[$h][is_visible]=='0') $is_update_visible_field=1;
		if($lobj_get_html_ids[$h][Type]=='Image') $is_image_flag=1;
		if($lobj_get_html_ids[$h][data_type]=='Date') 
		{
			if(strtolower($lobj_get_html_ids[$h][default_value]!='eom'))
			{
				$date_fields_date_array[$d]['id']=$internal_code;
				$date_fields_date_array[$d]['val']=$lobj_get_html_ids[$h][dates];
			}
			else
			{	
				$curr_month=$lobj_get_html_ids[$h][curr_month];
				$curr_year=$lobj_get_html_ids[$h][curr_year];
				$days_in_a_month=cal_days_in_month(CAL_GREGORIAN, $curr_month, $curr_year);
				$date_val="{$days_in_a_month}/{$curr_month}/{$curr_year}";
				$date_fields_date_array[$d]['id']=$internal_code;
				$date_fields_date_array[$d]['val']=$date_val;
			}			
			$d++;
		}
		else if($lobj_get_html_ids[$h][data_type]=='Reference Data' &&!empty($lobj_get_html_ids[$h][default_value])) 
		{
			$def_val=$lobj_get_html_ids[$h][default_value]; 	
			$ref_module_code=$lobj_get_html_ids[$h][ref_module_code]; 	
			$select_module_ids="select table_name,field_id1,field_id2 from module_meta_columns where module_id={$ref_module_code}"; 
			$lobj_select_module_ids = $aobj_context->mobj_db->GetRow($select_module_ids);	
			$field_id1=$lobj_select_module_ids[field_id1];
			$field_id2=$lobj_select_module_ids[field_id2];
			$field_id2_val=(!empty($field_id2))?"  or {$field_id2}='{$def_val}'  ":"";
			$table_name=$lobj_select_module_ids[table_name];
			$get_ref_data="select internal_code from {$table_name} 
						where {$field_id1}='{$def_val}' {$field_id2_val} limit 1";
					 
			$lobj_get_ref_data = $aobj_context->mobj_db->GetRow($get_ref_data);	
			if(!empty($lobj_get_ref_data))
			{	
				$ref_data_default_val[$internal_code]['default_val']=$def_val;
				$ref_data_default_val[$internal_code]['int_code']=$lobj_get_ref_data[internal_code];
			}
			$d++;
			 
		}
		if($lobj_get_html_ids[$h][source_field]>0) 
		{
			$is_auto_increment_update_flag=1;
		}
		if($lobj_get_html_ids[$h][is_visible]=='1')
		array_push($visible_defined_arr,$lobj_get_html_ids[$h][internal_code]);
		if($lobj_get_html_ids[$h][data_type]=='Employee List') 
		{
		$employee_list_flag=1;
		}
		
	}
	 
	 
	 $select_distinct_group_names="select internal_code,name,ifnull(multiple,0) as multiple,
								concat('user_schema_',ref_s_user_schema_code,'_entry_',internal_code) as 
								table_name,
								ifnull(is_grid_edit,0) as is_grid_edit,
								ifnull(multiple,0) as  multiple,
								ifnull(parent_group_code,0) as parent_group_code 
								from s_user_schema_group 
							where ref_s_user_schema_code={$schema_id}
							 ";
		 $lobj_select_distinct_group_names = $aobj_context->mobj_db->GetAll($select_distinct_group_names);	
		 $g=0;
		 $m=0;
		foreach($lobj_select_distinct_group_names as $gk=>$gv)
		{
			$table_name =$gv["table_name"];	
			$group_name =$gv["name"];
			if($gv[multiple]=='1')
			{
				$is_child_exists=0;
				$is_child_multiple_group=0;
					
				$parent_group =$gv["parent_group_code"];	
				$str_desc = "desc $table_name";
				$obj_desc=$aobj_context->mobj_db->GetAll($str_desc);
				$chek_child_exstis="select * from s_user_schema_group 
									where parent_group_code={$gv[internal_code]}";
				 $lobj_chek_child_exstis = $aobj_context->mobj_db->GetRow($chek_child_exstis);
				 if($lobj_chek_child_exstis[internal_code])
				 $is_child_exists=1;
				 if($lobj_chek_child_exstis[multiple])
				 $is_child_multiple_group=1;
				$ref_s_ref_data_code=0;
				//popudating insert command
				$insert_qry="insert into $table_name(internal_code,login_cnt,group_int_code,ref_s_user_schema_code,ref_s_user_schema_group_code,ref_s_ref_data_code,";
				$id='';
				$i=-5;
							foreach ($obj_desc as $key=>$value)
							{
								if($value['Field']!='internal_code' && $value['Field']!='ref_s_user_schema_code' &&
								$value['Field']!='ref_s_user_schema_group_code' && $value['Field']!='ref_s_ref_data_code' &&
								$value['Field']!='login_cnt' &&
								$value['Field']!='created_by' && $value['Field']!='created_date' &&
								$value['Field']!='modified_by' && $value['Field']!='modified_date')
								{
								$ele_id=explode('ele_',$value['Field']);
								if(!in_array($ele_id[1],$visible_defined_arr)) continue;
								$id.=$ele_id[1].",";
								$insert_qry.=$value['Field'].",";
								}
								$i++;
							}
					
						$insert_qry.="created_by,created_date,modified_by,modified_date) values (";
						
						$schema_code=explode('user_schema_',$table_name);
						$all_code=explode('_entry_',$schema_code[1]);
						$insert_qry.=$all_code[0].",".$all_code[1].",";
						$id= substr($id,0,strlen($id) - 1);
						$get_name="select su.internal_code,name,system_name,
							value as Type,is_visible,ifnull(su.is_defined,1) as is_defined,
							is_read_only,
							case when s.value='Date' and  default_value='today'
							then date_format(current_date(),'%d/%m/%Y')
							when s.value='Date' and  default_value='yesterday'
							then date_format(date_add(current_date(),interval -1 day),'%d/%m/%Y')
							when s.value='Date' and  default_value='tomarrow'
							then date_format(date_add(current_date(),interval 1 day),'%d/%m/%Y')

							else  default_value
							end as default_value,ifnull(is_ref_module_code_lov,0) as is_ref_module_code_lov,
							optional,su.ref_module_code,list_of_values,db_field,
							linked_field,source_field,suffix,width*9 as width from 
								s_user_schema_elements su left join  s_ref_type s on s.internal_code=su.data_type
								where su.internal_code in (".$id.")
								and ifnull(is_visible,1)=1  and ifnull(is_defined,1)=1
								order by su.internal_code";
							 
				  		 $lobj_get_name =  $aobj_context->mobj_db->GetAll($get_name);
				 $all_multi_groups[$g]['group_id']=$gv[internal_code];
				 $all_multi_groups[$g]['group_name']=$gv[name];
				 $all_multi_groups[$g]['group_table_name']=$table_name;
				 
				$multi_group[$table_name]['table_name'] = $table_name;
				$multi_group[$table_name]['group_name'] = $group_name;
				$multi_group[$table_name]['insert_qry'] = $insert_qry;
				$multi_group[$table_name]['elements'] = $lobj_get_name;
				$multi_group[$table_name]['ref_s_ref_data_code'] = $ref_s_ref_data_code;
				$multi_group[$table_name]['parent_group'] = $parent_group;
				$multi_group[$table_name]['is_child_exists'] =  $is_child_exists;
				$multi_group[$table_name]['group_id'] =  $gv[internal_code];
				$multi_group[$table_name]['is_grid_edit'] =  $gv[is_grid_edit];
				$multi_group[$table_name]['is_child_multiple_group'] =  $is_child_multiple_group;
			 
				if($is_module_for_new_or_edit=='Add')
				{
				$delete_from_group_table="delete from {$table_name} where login_cnt={$login_cnt}";
				 $lobj_delete_from_group_table =  $aobj_context->mobj_db->Execute($delete_from_group_table);
				 }
				$g++;
			}
			else
			{
				 $all_non_multi_groups[$m]['group_id']=$gv[internal_code];
				 $all_non_multi_groups[$m]['group_name']=$gv[name];
				 $m++;
			}
		}
		$get_rights="";
			 $arr[1]=$lobj_schema_details;
			 $arr['multi_group']=$multi_group;
			 $arr['add_right']=$add_right;
			 $arr['schema_name']=$schema_name;
			 $arr['module_id']=$schema_id;
			 $arr['grid_type']=$grid_type;
			 $arr['all_multi_groups']=$all_multi_groups;
			 $arr['all_non_multi_groups']=$all_non_multi_groups;
			 $arr['links_data']= getLinks($aobj_context,$schema_name);
			 $arr['html_id_arr']= $html_id_arr;
			 $arr['html_id_criteria_arr']= $html_id_criteria_arr;
			 $arr['html_id_data_type_arr']= $html_id_data_type_arr;
			 $arr['is_ref_module_code_lov_flag']= $is_ref_module_code_lov_flag;
			 $arr['is_image_flag']= $is_image_flag;
			 $arr['is_update_visible_field']= $is_update_visible_field;
			 $arr['system_date']= $system_date;
			 $arr['date_fields_date_array']= $date_fields_date_array;
			 $arr['system_menu_name']= $system_menu_name;
			 $arr['is_auto_increment_update_flag']= $is_auto_increment_update_flag;
			 $arr['ref_data_default_val']= $ref_data_default_val;
			 $arr['grid_fields_array']= $grid_fields_array;
			 $arr['employee_list_flag']= $employee_list_flag;
			  
			
	    if(!empty($lobj_schema_details))
		{
		
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		
		}
		 else
		{	
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		
		}
}

function getLinks($aobj_context,$schema_name)
{
$get_links_from_module="select 
						ifnull(include_save,1) as include_save,
						ifnull(include_clear,1) as include_clear,
						ifnull(include_download,1) as include_download,
						ifnull(include_view,1) as include_view,
						ifnull(include_generate,0) as include_generate,
						ifnull(include_help,0) as include_help,
						ifnull(include_close,0) as include_close,
						ifnull(custom_links,'') as custom_links
						from s_user_schema where module_name='{$schema_name}'";
			
									
			$lobj_get_links_from_module =  $aobj_context->mobj_db->GetRow($get_links_from_module);
			//print_r($lobj_get_links_from_module);
			 foreach($lobj_get_links_from_module as $k=>$v)
			 {
				if($k!='custom_links')
				{
				if($v=='1')
				 $link_arr[$k]=$v;
				}
			 }
			 if(!empty($lobj_get_links_from_module['custom_links']))
			 $link_arr['custom_links']=$lobj_get_links_from_module['custom_links'];
			// print_r($link_arr);
			$link_details_arr['include_save']['header']="<a href='#' class='anchor-header-footer' id='header_finish_row' onclick='javascript:saveRecords();'>Save";
			$link_details_arr['include_save']['footer']="<a href='#' class='anchor-header-footer' id='footer_finish_row' onclick='javascript:saveRecords();'>Save";
			
			$link_details_arr['include_clear']['header']=" <a href='#' class='anchor-header-footer' id='header_clear_row' onclick='javascript:Clearfields();'>Clear";
			$link_details_arr['include_clear']['footer']=" <a href='#' class='anchor-header-footer' id='footer_clear_row' onclick='javascript:Clearfields();'>Clear";
			
			$link_details_arr['include_download']['header']=" <a href='#' class='anchor-header-footer' id='header_upload_row' onclick='javascript:UploadRecords();'>Download";
			$link_details_arr['include_download']['footer']="  <a href='#' class='anchor-header-footer' id='footer_upload_row' onclick='javascript:UploadRecords();'>Download";
			
			$link_details_arr['include_view']['header']=" <a href='#' class='anchor-header-footer' id='header_view_row' onclick='javascript:view_records();'>View";
			$link_details_arr['include_view']['footer']="<a href='#' class='anchor-header-footer' id='footer_view_row' onclick='javascript:view_records();'>View";
			
			$link_details_arr['include_generate']['header']="<a href='#' class='anchor-header-footer' id='header_generate_row' onclick='javascript:GenerateFiles();'>Generate";
			$link_details_arr['include_generate']['footer']="<a href='#' class='anchor-header-footer' id='footer_generate_row' onclick='javascript:GenerateFiles();'>Generate";
			
			$link_details_arr['include_help']['header']="<a href='#' class='anchor-header-footer' id='header_help_row' onclick='javascript:GetModuleHelpText();'>Help";
			$link_details_arr['include_help']['footer']="<a href='#' class='anchor-header-footer' id='footer_help_row' onclick='javascript:GetModuleHelpText();'>Help";
			
			$link_details_arr['include_close']['header']="<a href='#' class='anchor-header-footer' id='header_close_row' onclick='javascript:home();'>Close";
			$link_details_arr['include_close']['footer']="<a href='#' class='anchor-header-footer' id='footer_close_row' onclick='javascript:home();'>Close";
			
			$i=1;
			 

			foreach($link_arr as $ak=>$av)
			{
			$header_link.=$link_details_arr[$ak]['header'];
			$footer_link.=$link_details_arr[$ak]['footer'];
				if($i!=count($link_arr)) 
				{
				$header_link.=" |</a> ";
				$footer_link.=" |</a> ";
				}
				else
				{
				$header_link.=" </a>";
				$footer_link.=" </a>";
				}
				$i++;
			}
			
 		$link_id="";

			if(!empty($lobj_get_links_from_module[custom_links]))
			{
				$split_by_pipe=explode("|",$lobj_get_links_from_module[custom_links]);
				//print_r($split_by_pipe);
				//echo count($split_by_pipe);
				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];
					
					if($split==count($split_by_pipe)-1)
					$pipe="";
					else
					$pipe=" | ";
				$header_link.=" <a href='#'  class='anchor-header-footer ElementCount' id='header_{$id}' onclick=\"javascript:{$fun};\">{$name}{$pipe}</a>";
				$footer_link.=" <a href='#'  class='anchor-header-footer ElementCount' id='footer_{$id}' onclick= \"javascript:{$fun};\">{$name}{$pipe}</a>";
				}
				 
			}
			 
	 $arr['header_link']=$header_link;		
	 $arr['footer_link']=$footer_link;		
	 $arr['link_data']=$lobj_get_links_from_module;		
	 $arr['link_id']=$link_id;		
	  
	 return $arr;	
}
function getViewLinks($aobj_context,$schema_name)
{
$get_links_from_module="select 
						0 as include_save,
						ifnull(include_clear,1) as include_clear,
						ifnull(include_download,1) as include_download,
						0 as include_view,
						ifnull(include_generate,0) as include_generate,
						ifnull(custom_links,'') as custom_links
						from s_user_schema where module_name='{$schema_name}'";
			
									
			$lobj_get_links_from_module =  $aobj_context->mobj_db->GetRow($get_links_from_module);
			//print_r($lobj_get_links_from_module);
			 foreach($lobj_get_links_from_module as $k=>$v)
			 {
				if($k!='custom_links')
				{
				if($v=='1')
				 $link_arr[$k]=$v;
				}
			 }
			 if(!empty($lobj_get_links_from_module['custom_links']))
			 $link_arr['custom_links']=$lobj_get_links_from_module['custom_links'];
			// print_r($link_arr);
			$link_details_arr['include_save']['header']="<a href='#' class='anchor-header-footer' id='header_finish_row' onclick='javascript:saveRecords();'>Save";
			$link_details_arr['include_save']['footer']="<a href='#' class='anchor-header-footer' id='footer_finish_row' onclick='javascript:saveRecords();'>Save";
			
			$link_details_arr['include_clear']['header']=" <a href='#' class='anchor-header-footer' id='header_clear_row' onclick='javascript:Clearfields();'>New";
			$link_details_arr['include_clear']['footer']=" <a href='#' class='anchor-header-footer' id='footer_clear_row' onclick='javascript:Clearfields();'>New";
			
			$link_details_arr['include_download']['header']=" <a href='#' class='anchor-header-footer' id='header_upload_row' onclick='javascript:UploadRecords();'>Download";
			$link_details_arr['include_download']['footer']="  <a href='#' class='anchor-header-footer' id='footer_upload_row' onclick='javascript:UploadRecords();'>Download";
			
			$link_details_arr['include_view']['header']=" <a href='#' class='anchor-header-footer' id='header_view_row' onclick='javascript:view_records();'>View";
			$link_details_arr['include_view']['footer']="<a href='#' class='anchor-header-footer' id='footer_view_row' onclick='javascript:view_records();'>View";
			
			$link_details_arr['include_generate']['header']="<a href='#' class='anchor-header-footer' id='header_generate_row' onclick='javascript:GenerateFiles();'>Generate";
			$link_details_arr['include_generate']['footer']="<a href='#' class='anchor-header-footer' id='footer_generate_row' onclick='javascript:GenerateFiles();'>Generate";
			
			$link_details_arr['include_help']['header']="<a href='#' class='anchor-header-footer' id='header_help_row' onclick='javascript:GetModuleHelpText();'>Help";
			$link_details_arr['include_help']['footer']="<a href='#' class='anchor-header-footer' id='footer_help_row' onclick='javascript:GetModuleHelpText();'>Help";
			
			$i=1;
			 

			foreach($link_arr as $ak=>$av)
			{
			$header_link.=$link_details_arr[$ak]['header'];
			$footer_link.=$link_details_arr[$ak]['footer'];
				if($i!=count($link_arr)) 
				{
				$header_link.=" |</a> ";
				$footer_link.=" |</a> ";
				}
				else
				{
				$header_link.=" </a>";
				$footer_link.=" </a>";
				}
				$i++;
			}
			
 		$link_id="";

			if(!empty($lobj_get_links_from_module[custom_links]))
			{
				$split_by_pipe=explode("|",$lobj_get_links_from_module[custom_links]);
				//print_r($split_by_pipe);
				//echo count($split_by_pipe);
				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];
					
					if($split==count($split_by_pipe)-1)
					$pipe="";
					else
					$pipe=" | ";
				$header_link.=" <a href='#' class='anchor-header-footer' id='header_{$id}' onclick=\"javascript:{$fun};\">{$name}{$pipe}</a>";
				$footer_link.=" <a href='#' class='anchor-header-footer' id='footer_{$id}' onclick= \"javascript:{$fun};\">{$name}{$pipe}</a>";
				}
				 
			}
			 
	 $arr['header_link']=$header_link;		
	 $arr['footer_link']=$footer_link;		
	 $arr['link_data']=$lobj_get_links_from_module;		
	 $arr['link_id']=$link_id;		
	  
	 return $arr;	
}
function getlinkId($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ",".");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}
 function getDefaultHeadFooterLinks($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	 include_once($aobj_context->main_src."//src/getmoduledetails.php");
	 $module_name=$aobj_context->mobj_data["module_name"];
	 $arr['links_data']= getLinks($aobj_context,$module_name);
	 echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
?>