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 : 52.15.118.202
<?php
function eGovGetMenus($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$usertype = $aobj_context->mobj_data['usertype'];
$usermob = $aobj_context->mobj_data['usermob'];
if ($univcode == '') {
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
$query = "select ftype from masuser where fmobileno = '{$usermob}'";
$res = $aobj_context->mobj_db->GetRow($query);
$usrtype = $res['ftype'];
if($res['ftype'] == 'C'){
$con = "and ifnull(ftype,'') = 'C'";
}else{
$con = " and ifnull(ftype,'') <>'C'";
}
$menu_query = "select fmenucode, fmenuname, ficonname, ffunction,forder,
ifnull(fmainmenu,'') as fmainmenu,
ifnull(FMAINCODE,'') as FMAINCODE,
fismainmenu, fissubmenu from masmenu
where fmodtype = 'EGOV' and ifnull(factive,'') = 'T' {$con}
and instr((select fpermission from usermenu where funivcode = '{$univcode}'
and fusertype = '{$usertype}'), fmenucode)
order by forder";
// var_dump($menu_query);
// die();
$result = $aobj_context->mobj_db->GetAll($menu_query);
$arr = array();
if (count($result) > 0) {
if($usrtype == 'C')
{
foreach ($result as $value) {
if ($value['fmainmenu'] == 'M') {
$arr[$value['FMAINCODE']]['children'] = array();
$arr[$value['fmenucode']]['icon'] = $value['ficonname'];
$arr[$value['fmenucode']]['name'] = $value['fmenuname'];
$arr[$value['fmenucode']]['url'] = $value['ffunction'];
}else
{
$val['icon'] = $value['ficonname'];
$val['url'] = $value['ffunction'];
$val['name'] = $value['fmenuname'];
array_push($arr[$value['FMAINCODE']]['children'], $val);
}
}
$res = array();
$i = 0;
foreach ($arr as $value) {
$res[$i] = $value;
$i++;
}
}else
{
foreach ($result as $value) {
//var_dump($value);
if ($value['fmainmenu'] == 'C') {
$arr[$value['fmenucode']]['children'] = array();
$arr[$value['fmenucode']]['icon'] = $value['ficonname'];
$arr[$value['fmenucode']]['name'] = $value['fmenuname'];
$arr[$value['fmenucode']]['url'] = $value['ffunction'];
} else if ($value['fmainmenu'] == 'D') {
$arr[$value['fmenucode']]['icon'] = $value['ficonname'];
$arr[$value['fmenucode']]['name'] = $value['fmenuname'];
$arr[$value['fmenucode']]['url'] = $value['ffunction'];
} else if ($value['fmainmenu'] == 'S') {
$arr[$value['fmenucode']]['title'] = true;
$arr[$value['fmenucode']]['name'] = $value['fmenuname'];
$arr[$value['fmenucode']]['code'] = $value['fmenucode'];
} else {
$val['icon'] = $value['ficonname'];
$val['url'] = $value['ffunction'];
$val['name'] = $value['fmenuname'];
array_push($arr[$value['fmainmenu']]['children'], $val);
}
}
$res = array();
$i = 0;
foreach ($arr as $value) {
$res[$i] = $value;
$i++;
}
}
// var_dump($res);
echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
} else {
$arr['msg'] = 'Error while fetching menus';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
}
function getSubMenusEgov($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$code = $aobj_context->mobj_data['menucode'];
$query = "select * from masmenu where fmainmenu= '{$code}'";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$arr['msg'] = 'No Data found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
|