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.144.242.235
<?php
function uGetAllCollegeList($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query ="select fcollcode, concat(fcollname,',', ftown) as fcollname from college
where ifnull(fdeleted,'') <> 'T' order by fcollcode";
// var_dump($query);
$result=$aobj_context->pobj_db->GetAll($query);
if($result && count($result)>1){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
}
else{
$arr['msg']="Please try later";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
}
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"failure");
}
function uInsertOrUpdateCollegeDetails($aobj_context)
{
$req = $aobj_context->req_body;
$ffolder = $aobj_context->pdb['ffolder'];
$req = $req['data'];
$FCOLLCODE = $req['FCOLLCODE'];
$FCOLLNAME = $req['FCOLLNAME'];
$FTOWN = $req['FTOWN'];
$FCOLLADD1 = $req['FCOLLADD1'];
$FCOLLADD2 = $req['FCOLLADD2'];
$FCOLLADD3 = $req['FCOLLADD3'];
$FCOLLADD4 = $req['FCOLLADD4'];
$FPRINCIPALNAME = $req['FPRINCIPALNAME'];
$FPHONE = $req['FPHONE'];
$FEMAILC = $req['FEMAILC'];
$FADMSTATUS = $req['FADMSTATUS'];
$FCOLLTYPE = $req['FCOLLTYPE'];
$ffaculty = $req['ffaculty'];
$fbank = $req['fbank'];
$fbankbranch = $req['fbankbranch'];
$fbankaccno = $req['fbankaccno'];
$fifsccode = $req['fifsccode'];
$fchequefavour = $req['fchequefavour'];
$fbranchcode = $req['fbranchcode'];
$fbankplace = $req['fbankplace'];
$FMOBILE = $req['fmobile'];
$FALTMOBILE = $req['faltmobile'];
if($FCOLLCODE == '' || $FCOLLNAME == '' || $FTOWN == '') {
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$query1 = "select * from college where fcollcode = '{$FCOLLCODE}'";
$result1 = $aobj_context->pobj_db->GetRow($query1);
$query="INSERT INTO college (FCOLLCODE,FCOLLNAME,FTOWN,FCOLLADD1,FCOLLADD2,
FCOLLADD3,FCOLLADD4,FPRINCIPALNAME,FPHONE,FEMAIL,FADMSTATUS,FCOLLTYPE,ffaculty,
fbank,fbankbranch,fbankaccno,fifsccode,fchequefavour,fbranchcode,fbankplace,
FMOBILE,FALTMOBILE)
VALUES('{$FCOLLCODE}','{$FCOLLNAME}','{$FTOWN}','{$FCOLLADD1}','{$FCOLLADD2}',
'{$FCOLLADD3}','{$FCOLLADD4}','{$FPRINCIPALNAME}','{$FPHONE}','{$FEMAILC}',
'{$FADMSTATUS}','{$FCOLLTYPE}','{$ffaculty}','{$fbank}','{$fbankbranch}',
'{$fbankaccno}','{$fifsccode}','{$fchequefavour}','{$fbranchcode}','{$fbankplace}',
'{$FMOBILE}','{$FALTMOBILE}')
ON DUPLICATE KEY UPDATE
FCOLLCODE = VALUES(FCOLLCODE),
FCOLLNAME = VALUES(FCOLLNAME),
FTOWN = VALUES(FTOWN),
FCOLLADD1 = VALUES(FCOLLADD1),
FCOLLADD2 = VALUES(FCOLLADD2),
FCOLLADD3 = VALUES(FCOLLADD3),
FCOLLADD4 = VALUES(FCOLLADD4),
FPRINCIPALNAME = VALUES(FPRINCIPALNAME),
FPHONE = VALUES(FPHONE),
FEMAIL = VALUES(FEMAIL),
FADMSTATUS = VALUES(FADMSTATUS),
FCOLLTYPE = VALUES(FCOLLTYPE),
ffaculty = VALUES(ffaculty),
fbank = VALUES(fbank),
fbankbranch = VALUES(fbankbranch),
fbankaccno = VALUES(fbankaccno),
fifsccode = VALUES(fifsccode),
fchequefavour = VALUES(fchequefavour),
fbranchcode = VALUES(fbranchcode),
fbankplace = VALUES(fbankplace),
FMOBILE = VALUES(FMOBILE),
FALTMOBILE = VALUES(FALTMOBILE)";
$result = $aobj_context->pobj_db->Execute($query);
if(count($result1) == 0) {
$query2 = "select * from s_sysdb where college_code = '{$FCOLLCODE}'";
$result2 = $aobj_context->pobj_db->GetRow($query2);
if(count($result2) == 0) {
$query3 = "INSERT INTO `s_sysdb` (`college_code`, `sysusr`, `sysusrkey`,
`user_type`, `real_name`,`user_theme`, `FDELETED`)
VALUES
('{$FCOLLCODE}', 'admin', 'admin{$FCOLLCODE}', 14, 'admin','Switch Theme', 'F')";
$result3 = $aobj_context->pobj_db->Execute($query3);
$query4 = "INSERT INTO `s_sysdb` (`college_code`, `sysusr`, `sysusrkey`,
`user_type`, `real_name`,`user_theme`, `FDELETED`)
VALUES
('{$FCOLLCODE}', 'super', '{$ffolder}@124', 40, 'super','Switch Theme', 'F')";
$result4 = $aobj_context->pobj_db->Execute($query4);
}
}
if (!$result) {
$arr['msg'] = 'Insertion / Updation Failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
else {
$resultObj = "";
$resultObj->error_code=0;
$resultObj->status="success";
$resultObj->msg="Data Updated!";
echo json_encode($resultObj);
}
}
function uGetSpecificCollege($aobj_context)
{
$fcollcode = $aobj_context->mobj_data['collcode'];
$query ="select FCOLLCODE,FCOLLNAME,
ifnull(FTOWN,'') as FTOWN,
ifnull(FCOLLADD1,'') as FCOLLADD1,
ifnull(FCOLLADD2,'') as FCOLLADD2,
ifnull(FCOLLADD3,'') as FCOLLADD3,
ifnull(FCOLLADD4,'') as FCOLLADD4,
ifnull(FPRINCIPALNAME,'') as FPRINCIPALNAME,
ifnull(FPHONE,'') as FPHONE,
ifnull(FEMAIL,'') as FEMAILC,
ifnull(FADMSTATUS,'') as FADMSTATUS,
ifnull(FCOLLTYPE,'') as FCOLLTYPE,
ifnull(ffaculty,'') as ffaculty,
ifnull(fbank,'') as fbank,
ifnull(fbankbranch,'') as fbankbranch,
ifnull(fbankaccno,'') as fbankaccno,
ifnull(fifsccode,'') as fifsccode,
ifnull(fchequefavour,'') as fchequefavour,
ifnull(fbranchcode,'') as fbranchcode,
ifnull(fbankplace,'') as fbankplace,
ifnull(fmobile,'') as fmobile,
ifnull(faltmobile,'') as faltmobile
from college where fcollcode='{$fcollcode}'";
$data=$aobj_context->pobj_db->GetRow($query);
if($data)
{
$returnObj = "";
$returnObj->error_code=0;
$returnObj->status="success";
$returnObj->data= $data;
echo json_encode($returnObj);
}
else
{
$returnObj = "";
$returnObj->error_code=-1;
$returnObj->status="No data found";
$returnObj->data= $data;
echo json_encode($returnObj);
}
}
function uDeleteSpecificCollege($aobj_context)
{
$req = $aobj_context->req_body;
$FCOLLCODE = $req['FCOLLCODE'];
$query="update college set FDELETED='T' where fcollcode={$FCOLLCODE}";
$result = $aobj_context->pobj_db->Execute($query);
if (!$result) {
$arr['msg'] = 'Insertion / Updation Failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
else {
$resultObj = "";
$resultObj->error_code=0;
$resultObj->status="success";
echo json_encode($resultObj);
}
}
?>
|