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.147.75.217
<?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
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)
{
$schema_name=$v['module_name'];
$module_id= $v[internal_code];
$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,ifnull(ue.field_position,'Next Line') as field_position,
s.value as Type,
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,
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)*9 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
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);
//$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="<head><script type='text/javascript'>\$(function() {\$('#tabs').tabs();});</script></head>";
$html_content.="<h3>\n";
$html_content.="\t<table width='702' border='0' cellspacing='0' cellpadding='0'>
<tr><td align='left' valign='top'><span>{$group_name}</span></td>
<td align='right' valign='bottom'><span class='showhide' id='span_{$group_id}'
onclick=\"javascript:ShowHideDiv('group_div_{$group_id}','span_{$group_id}');\">Hide</span></td>
</tr>
<tr><td width='6' height='6' align='left' colspan='2' valign='top' class='content-line-repeat'>
<img src='../images/tarka_new_menu.jpg' width='15' height='7' border='0' /></td>
</tr>\n";
$html_content.="\t </table>";
$html_content.="\n</h3>\n";
$html_content.="\n <div id='group_div_{$group_id}' align='center' style='padding-top:8px;'>\n";
$html_content.= "\t<table id ='tbl_menu' 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="";
$display_type=$v[display_type];
$actual_data_arr=getActualData($lobj_schema_details[$i],$display_type);
//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']=='Date' || $lobj_schema_details[$i]['Type']=='Month' || $lobj_schema_details[$i]['Type']=='Reference Data' && ($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]);
$html_content.="<div align='left' style='padding-top:2px;padding-bottom:2px;padding-left:23px;'><a class='anchor-class' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" ><font color='blue'>Add</font></a>";
$html_content.="<a class='anchor-class' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\"><font color='blue'>Clear</font></a>";
$html_content.=getGroupLinks($aobj_context ,$div_group_id);
$html_content.="</div>";
}
$html_content.=" <div align='center' style=\"height:200px; width:690px; 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";
$html_content.= "\n<h3>\n";
$html_content.="<table width='702' border='0' cellspacing='0' cellpadding='0'>
<tr><td align='left' valign='top'><span>{$group_name}</span></td>
<td align='right' valign='bottom'><span class='showhide' id='span_{$group_id}'
onclick=\"javascript:ShowHideDiv('group_div_{$group_id}','span_{$group_id}');\">Hide</span></td>
</tr>
<tr><td width='6' height='6' align='left' colspan='2' valign='top' class='content-line-repeat'>
<img src='../images/tarka_new_menu.jpg' width='15' height='7' border='0' /></td>
</tr>
</table>\n";
$html_content.="</h3>\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-7+2) :($width_value+$padding_width+2) ;
$label_width =($lobj_schema_details[$i][Type]=='Auto Increment')?($label_width+68):($label_width);
if($lobj_schema_details[$i][optional]=='0')
$lable_data="\n <font color='red'>* </font><input tabindex=-1 type='text' readonly='readonly' style='width:{$label_width}Px;' class='inputlabel' value='{$lobj_schema_details[$i][element_name]}' />\n <input readonly='readonly' type='text' tabindex=-1 style='width:{$padding}; border:0px;' /> \n";
else
$lable_data="\n <input type='text' style='width:{$label_width}Px;'tabindex=-1 class='inputlabel' readonly='readonly' value='{$lobj_schema_details[$i][element_name]}' />\n <input readonly='readonly' type='text' tabindex=-1 style='width:{$padding}; border:0px;' /> \n";
if($i==0)
{
if($lobj_schema_details[$i][is_grid_edit]==0){
$label_tr.="<tr><td align='left' style='width:600px; padding-left:30px;'>{$lable_data}";
$text_tr.="<tr><td align='left' style='width:600px; padding-left:30px;'>{$actual_data} <input type='text' readonly='readonly' tabindex=-1 style='width:{$padding}; border:0px;' />"; }
}
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='width:600px; padding-left:30px;'>{$lable_data}";
$text_tr.="<tr><td align='left' style='width:600px; padding-left:30px;'>{$actual_data} <input readonly='readonly' type='text' tabindex=-1 style='width:{$padding}; border:0px;' />";
}
}
else if($lobj_schema_details[$i][is_grid_edit]=="0")
{
$label_tr.="{$lable_data}\n ";
$text_tr.=" {$actual_data} <input type='text' readonly='readonly' tabindex=-1 style='width:{$padding}; border:0px;' />\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.= getSubGroupHTMLQuery($aobj_context,$module_id,$lobj_schema_details[$i-1][ref_s_user_schema_group_code],$v[display_type]);
$html_content.="<div align='left' style='padding-top:2px;padding-bottom:2px;padding-left:23px;'><a class='anchor-class' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" ><font color='blue'>Add</font></a>";
$html_content.="<a class='anchor-class' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" ><font color='blue'>Clear</font></a>";
$html_content.=getGroupLinks($aobj_context ,$div_group_id);
$html_content.="</div>";
}
$html_content.=" <div align='center' style=\"height:200px; width:690px; 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";
$html_content.="\n<h3>\n";
$html_content.="<table width='702' border='0' cellspacing='0' cellpadding='0'>
<tr><td align='left' valign='top'><span>{$group_name}</span></td>
<td align='right' valign='bottom'><span class='showhide' id='span_{$group_id}'
onclick=\"javascript:ShowHideDiv('group_div_{$group_id}','span_{$group_id}');\">Hide</span></td>
</tr>
<tr><td width='6' height='6' align='left' colspan='2' valign='top' class='content-line-repeat'>
<img src='../images/tarka_new_menu.jpg' width='15' height='7' border='0' /></td>
</tr>
</table>
</h3>\n";
$html_content.="<div id='group_div_{$group_id}' align='center' style='padding-top:8px;'>\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]);
$html_content.="<div align='left' style='padding-top:2px;padding-bottom:2px;padding-left:23px;'>";
$html_content.="<a class='anchor-class' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" ><font color='blue'>Add</font></a>";
$html_content.="<a class='anchor-class' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" ><font color='blue'>Clear</font></a>";
$html_content.=getGroupLinks($aobj_context ,$div_group_id);
$html_content.="</div>";
}
$html_content.="<div align='center' style=\"height:200px; width:690px; 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.=" ";
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'>* </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)
{
$suffix=($lobj_schema_details[suffix]=='None')?' ':" ".$lobj_schema_details[suffix].' ';
$diabled=($lobj_schema_details[is_read_only]=='1')? " READONLY='true'":" ";
$width=$lobj_schema_details[width].'Px';
$width_auto=($lobj_schema_details[width]+20).'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]};":" ";
$imageInputWrapperwidth=$width_value-25;
$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 ":" imageInputWrapper ";
if($lobj_schema_details[Type]=='Date')
{
if($lobj_schema_details[doc_root_mapped_id]=='0')
{
$actual_data.="<label class='{$image_wrapper_class}' style='width:{$width_value}px;'>";
$actual_data.="<input {$diabled} {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}' class='inputWithImge' type='text' style='width:{$imageInputWrapperwidth}px;' value='{$lobj_schema_details[default_value]}' />";
$actual_data.="<a href='javascript:;' style='text-decoration:none' id='date_{$lobj_schema_details[internal_code]}'>";
$actual_data.="<img src='../images/date.gif' alt='' class='calimg' onclick=\"calender_popup('details_{$lobj_schema_details[internal_code]}','date_{$lobj_schema_details[internal_code]}');\"/> </a>";
$actual_data.="</label>";
}
else
{
$actual_data.="<label class='{$image_wrapper_class}' style='width:{$width_value}px;'>";
$actual_data.="<input {$diabled} {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}' class='inputWithImge' type='text' style='width:{$imageInputWrapperwidth}px;' value='{$lobj_schema_details[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.="<a href='javascript:;' style='text-decoration:none' id='date_{$lobj_schema_details[internal_code]}'>";
$actual_data.="<img src='../images/date.gif' alt='' class='calimg' onclick=\"calender_popup('details_{$lobj_schema_details[internal_code]}','date_{$lobj_schema_details[internal_code]}');\"/> </a>";
$actual_data.="</label>";
}
$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.="<label class='{$image_wrapper_class}' style='width:{$width_value}px;'> ";
$actual_data.=" <input {$diabled} {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}' class='inputWithImge' type='text' style='width:{$imageInputWrapperwidth}px;' value='{$lobj_schema_details[default_value]}'/> ";
$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'>";
$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.="</label>";
}
else if($lobj_schema_details[Type]=='Number')
{
$default_value=(empty($default_value))?0.00:$default_value;
$actual_data.=" <input {$diabled} {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}' type='text' style='width:{$width};text-align:right;' value='{$default_value}' onkeypress='return acceptNumbersOnlyForModule(event);' /> \n";
$actual_data.=$suffix;
}
else if($lobj_schema_details[Type]=='Large Text')
{
$actual_data.=" <textarea {$diabled} {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}' style='width:{$width};' value='{$default_value}' cols='1' rows='3' > </textarea>\n";
$actual_data.=$suffix;
}
else if($lobj_schema_details[Type]=='Image')
{
$module_name=getlinkId($lobj_schema_details['module_name']);
$actual_data.=" <input type='hidden' id='details_{$lobj_schema_details[internal_code]}' /><input class='content-tbl-upload' type='file' id='image_details_{$lobj_schema_details[internal_code]}' name='image_details_{$lobj_schema_details[internal_code]}'/>";
$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.=" <select {$diabled} {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}' style='width:{$width};' > \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> \n ";
$actual_data.=$suffix ;
}
else if($lobj_schema_details[Type]=='Auto Increment')
{
$actual_data.="<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;'> <option value='0'>Select</option></select> ";
$actual_data.=" <input {$diabled} id='details_{$lobj_schema_details[internal_code]}' {$on_focus} {$on_blur} type='text' style='width:{$width};' value='{$default_value}' /> \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_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.="<input {$diabled} id='details_{$lobj_schema_details[internal_code]}' type='hidden' value='' /> \n";
$actual_data.="<label 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' id='txt_ref_schema_{$lobj_schema_details[internal_code]}' type='text' style='width:{$imageInputWrapperwidth}px;' value='{$default_value}'
onKeyUp=\"Javascript:PopupKeyEvent(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]}'); \" /> \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> </label>";
$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}; border-style: none;background-color:#DDEFEF;;' 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='type'>type</option></select> </div>";
}
else if($lobj_schema_details[ref_module_code]!=0 && $lobj_schema_details[is_ref_module_code_lov]=='1')
{
$actual_data.=" <select {$diabled} {$on_focus} {$on_blur} id='details_{$lobj_schema_details[internal_code]}' style='width:{$width};' > \n";
$actual_data.="</select> \n ";
$actual_data.=$suffix ;
}
else
{
$actual_data.=" <input {$diabled} id='details_{$lobj_schema_details[internal_code]}' {$on_focus} {$on_blur} type='text' style='width:{$width};' value='{$default_value}' /> \n";
}
$arr['actual_data']=$actual_data;
$arr['padding_width']=$padding_width;
return $arr;
}
function getSubGroupHTMLQuery($aobj_context,$module_id,$group_id,$type)
{
$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,
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,
optional,list_of_values,
u.internal_code as ref_s_user_schema_code,
ue.ref_module_code ,is_read_only,ifnull(padding,2)*9 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
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);
//echo $lstr_qry;
$ul_subgroup_array=array();
$ul_subgroup_id_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='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];
}
}
for($u=0;$u<count($ul_subgroup_array);$u++)
{
$html_content.="<li><a href='#group_div_{$ul_subgroup_id_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:680px;' 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);
}
$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']=='Date' || $lobj_schema_details[$i]['Type']=='Month' || $lobj_schema_details[$i]['Type']=='Reference Data' && ($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' style='padding-top:2px;padding-bottom:2px;padding-left:23px;'><a class='anchor-class' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" ><font color='blue'>Add</font></a>";
$html_content.="<a class='anchor-class' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" ><font color='blue'>Clear</font></a> ";
$html_content.=getGroupLinks($aobj_context ,$div_group_id);
$html_content.="</div>";
}
$html_content.=" <div align='center' style=\"width:635px;padding-bottom:6px;\">";
$html_content.=" <div align='center' style=\"height:200px; width:628px; 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:680px;' 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-7).'Px':($width_value+$padding_width).'Px';
if($lobj_schema_details[$i][optional]=='0')
$lable_data="\n <font color='red'>* </font><input tabindex=-1 type='text' readonly='readonly' style='width:{$label_width};' class='inputlabel' value='{$lobj_schema_details[$i][element_name]}' />\n <input readonly='readonly' type='text' tabindex=-1 style='width:{$padding}; border:0px;' /> \n";
else
$lable_data="\n <input type='text' style='width:{$label_width};'tabindex=-1 class='inputlabel' readonly='readonly' value='{$lobj_schema_details[$i][element_name]}' />\n <input readonly='readonly' type='text' tabindex=-1 style='width:{$padding}; border:0px;' />\n";
if($i==0)
{
if($lobj_schema_details[$i][is_grid_edit]==0){
$label_tr.="<tr><td align='left' style='width:600px; padding-left:30px;'>{$lable_data}";
$text_tr.="<tr><td align='left' style='width:600px; padding-left:30px;'>{$actual_data} <input readonly='readonly' type='text' tabindex=-1 style='width:{$padding}; border:0px;' />";}
}
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='width:600px; padding-left:30px;'>{$lable_data}";
$text_tr.="<tr><td align='left' style='width:600px; padding-left:30px;'>{$actual_data} <input readonly='readonly' type='text' tabindex=-1 style='width:{$padding}; border:0px;' />";
}
}
else if($lobj_schema_details[$i][is_grid_edit]=="0")
{
$label_tr.="{$lable_data}\n ";
$text_tr.=" {$actual_data} <input type='text' readonly='readonly' tabindex=-1 style='width:{$padding}; border:0px;' />\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' style='padding-top:2px;padding-bottom:2px;padding-left:23px;'><a class='anchor-class' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\" ><font color='blue'>Add</font></a>";
$html_content.="<a class='anchor-class' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" ><font color='blue'>Clear</font></a>";
$html_content.=getGroupLinks($aobj_context ,$div_group_id);
$html_content.="</div>";
}
$html_content.=" <div align='center' style=\"width:635px;padding-bottom:6px;\">";
$html_content.=" <div align='center' style=\"height:200px; width:628px; 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:680px;' 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' style='padding-top:2px;padding-bottom:2px;padding-left:23px;'>";
$html_content.="<a class='anchor-class' onclick=\"javascript:saveSchemaGroupDetails('{$entry_table_name}','{$div_group_id}','{$table_name}');\"><font color='blue'>Add</font></a>";
$html_content.="<a class='anchor-class' onclick=\"javascript:ClearMultiGroupCellData('{$entry_table_name}');\" ><font color='blue'>Clear</font></a>";
$html_content.=getGroupLinks($aobj_context ,$div_group_id);
$html_content.="</div>";
}
//echo $html_content;
$html_content.=" <div align='center' style=\"width:635px;padding-bottom:6px;\">";
$html_content.="<div align='center' style=\"height:200px; width:628px; 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></div>";
$html_content.="</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};\" ><font color='blue'>{$name}</font></a>";
}
}
return $custom_links;
}
function getlinkId($name)
{
$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ",".");
$link_name = strtolower(str_replace($spl_char,"_",$name));
return str_ireplace("__","_",$link_name);
}
?>
|