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.139.234.68
Current Path : /var/www/oasis/src_old/ |
| Current File : /var/www/oasis/src_old/create_all_popup_files.php |
<?php
function populateAllPopupGridFiles($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$schema_id =$aobj_context->mobj_data["schema_id"];
$schema_cond='';
if(!($schema_id==0 or $schema_id=='0'))
{
$schema_cond=" and s.ref_s_user_schema_code={$schema_id} ";
}
$get_schema_id="select ref_module_code as schema_id,module_name,ref_s_user_schema_code as base_schema_id from s_user_schema_elements s
inner join s_user_schema ss on ss.internal_code=s.ref_module_code
where ref_module_code<>0 {$schema_cond}
group by ref_module_code ";
$lobj_get_schema_id = $aobj_context->mobj_db->GetAll($get_schema_id);
foreach($lobj_get_schema_id as $key1=>$schema_value)
{
$get_display_cols="(select table_name,name,field_name from
(select concat('module_',s.internal_code) as table_name ,su.name,ifnull(multiple,0) as multiple,
ifnull(ug.name,'0None') as group_name,
concat('m_',s.internal_code,'_ele_',su.internal_code) as field_name
from s_user_schema s inner join s_user_schema_elements su on
su.ref_s_user_schema_code=s.internal_code
inner join s_ref_type t on t.internal_code=su.s_ref_type_meta
left join s_user_schema_group ug on ug.internal_code=su.ref_s_user_schema_group_code
where s.internal_code={$schema_value[schema_id]}
and t.value='Meta' and include_in_popup=1
and ifnull(su.is_defined,1)=1
and ifnull(su.is_visible,1)=1
and (ug.parent_group_code is null or ug.parent_group_code=0)
order by ifnull(ug.sequence,0),su.sequence,su.internal_code
) l
)";
$active_field=""; //where multiple=0
$get_active_field="select db_field from s_user_schema_elements
where ref_s_user_schema_code={$schema_value[schema_id]} and system_name='active'";
$lobj_get_active_field = $aobj_context->mobj_db->GetRow($get_active_field);
$active_field=$lobj_get_active_field[db_field];
$module_name=$schema_value['module_name'];
$module_id=$schema_value['schema_id'];
$base_schema_id=$schema_value['base_schema_id'];
$lobj_get_display_cols = $aobj_context->mobj_db->GetAll($get_display_cols);
$grid_header='';
$grid_header_val='';
$grid_table_name=$lobj_get_display_cols[0][table_name];
$first_id =$lobj_get_display_cols[0][field_name];
$field_name='';
$m=1;
$details_arr='';
foreach($lobj_get_display_cols as $key=>$value11)
{
if($m!=count($lobj_get_display_cols)) {
if($m==1) $lable_field_name=$lobj_get_display_cols[$key]['name'];
$grid_header.="'".$lobj_get_display_cols[$key]['name']."',";
$grid_header_val.="{name:'".$lobj_get_display_cols[$key]['field_name']."',index:'".$lobj_get_display_cols[$key][field_name]."' , width:85} ,";
$field_name.=$lobj_get_display_cols[$key]['field_name'].",";
}
else {
$grid_header.="'".$lobj_get_display_cols[$key]['name']."'";
$grid_header_val.="{name:'".$lobj_get_display_cols[$key]['field_name']."',index:'".$lobj_get_display_cols[$key][field_name]."' , width:85}";
$field_name.=$lobj_get_display_cols[$key]['field_name'];
}
$m++;
}
$grid_header.=",'By'";
$grid_header_val.=",{name:'created_by',index:'created_by' , width:85}";
$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
$main_src=$main_src_obj[1];
$filename = $_SERVER["DOCUMENT_ROOT"]."\\{$main_src}\\grid_display_files\\pop_up_".$grid_table_name.".js";
$somecontent = "var pop_up_{$module_id}=jQuery('#table_grid1').jqGrid(
{
url:\$host_url+\"viewUserSchemaSrefDataDetails.demo&table_name={$grid_table_name}&active_field={$active_field}&field_name={$field_name}&search_ref_module_db_field=\"+\$search_ref_module_db_field+\"&search_ref_module_value=\"+\$search_ref_module_value+\"&clicked_id_system_name=\"+\$g_clicked_id_system_name+\"&base_module_id=\"+\$g_str_module_id+\"&all_data_obj=\"+\$all_data_obj,
datatype: 'json',
colNames:[{$grid_header}],
colModel:[{$grid_header_val}],
rowNum:5,
rowList:[5,10,15,20,25,30],
imgpath:\$img_path,
pager: jQuery('#sub_grid_div1'),
sortname: 'id',
height:'120',
viewrecords: true,
sortorder: 'desc',
multiselect: false,
cellEdit: true,
forceFit : true,
cellsubmit: 'clientArray',
width:'520',
onSelectCell: function (id,name,val,iRow,iCol)
{
DisplayPopUpDetailsValues(id);
}
}
).navGrid('#sub_grid_div1',{edit:false,add:false,del:false,search:false},{},{},{},{multipleSearch:true}).
navButtonAdd('#sub_grid_div1',{caption:'',
buttonicon :'ui-icon-search', onClickButton:function(){pop_up_{$module_id}[0].toggleToolbar() } }).
navButtonAdd('#sub_grid_div1',{caption:\"Select\",buttonicon :'ui-icon ui-icon-document',
onClickButton:function()
{ GetPopUpelementValue(); }
}).navButtonAdd('#sub_grid_div1',{caption:'Add', buttonicon :'ui-icon ui-icon-plus',
onClickButton:function()
{openNewWindow(\$g_ref_module_code,\$g_ref_module_name);}
});; \n
pop_up_{$module_id}.filterToolbar();
$(\"#gs_{$first_id}\").focus();
$('.ui-search-toolbar').bind('keydown',function(evt)
{
var kC = (evt.which) ? evt.which : evt.keyCode;
if(kC==40)
jQuery('#table_grid1').editCell(0,0,false);
} );
";
// Let's make sure the file exists and is writable first.
// ECHO $filename; DIE();
// pop_up_{$module_id}.filterToolbar();
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
//echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
}
$data['details']=$lobj_details;
if(($schema_id==0 or $schema_id=='0'))
{
$data="PopUp Files Generated Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
return;
}
}
?>
|