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.15.34.105
<?php
function saveDegSemDet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$fdeggrp = $aobj_context->mobj_data['fdeggrp'];
$req = $aobj_context->req_body;
$req_data = $req['data'];
if (!array_key_exists('degsem', $req_data) || !array_key_exists('degclass', $req_data) ) {
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
// var_dump($req_data['degclass']);
$degclass = $req_data['degclass'];
$degsem = $req_data['degsem'];
$query = "select fdegree, fexamno from tdegree
where fdegree = '{$degsem['FDEGREE']}' and fexamno = '{$degsem['FEXAMNO']}'";
$result = $aobj_context->pobj_db->GetRow($query);
if(count($result) == 0) {
$query = "insert into tdegree (FDEGREE, FDESCPN, FEXAMNO,
FEXAMNAME, FNEXTEXAM, FDEGDESCPN,
FBRANCHDESCPN, FCMAXTERMS, FTOTSUB,
FMINTOT, FSUBCHOICE, FSUBEX,
FVARSUB, FGRACEPER, FTOTGRACE,
FSUBGRPER, FSUBGRMARK, FGRACESUB,
FSEPREPGR, FREPGRMARK, FMRPGRMARK,
FEXAMGRACE, FTHAGONLY, FPRGRACE,
FREDGRACE, FCLGRPER, FCLGRSEP,
FGIVEGRACE2, FSUBFAIL, FSUBSIFAIL,
FLEASTEXAM, FLEASTAPP, FMINBLK,
FBLKPASS, FNOVAL, FDEVPER,
FDEVMARK, FDEVINCL, FAGGRMIN,
FAGMINSUB, FCUMRESULT, FCUMAGMIN,
FEXAMPASS, FTHPRACSEP, FCLASS,
FCUMCLASS, FATTALL, FRANKATT,
FINITQP, FCLOSEMC, FSPLITEXAM,
FFACULTY, FPERSET, FMCTYPE,
FCOLLDEPT, FALTDEG, FMAXTYPE,
FCONTMARKS, FDEGGRP, FSKIPFAIL,
FABSZERO, FSGLENTRY, FSNINLED,
FCREDIT, FTHPRCR, FBLK1CLASS,
FDISTPER, FCRCC, FREGREFNO,
FGRREFNO, FMODREFNO, FNOTERMS,
FMAXACTIVE, FMAXTERMS, FMAXATT,
FMAXAPP, FELIGREM01, FELIGREM02,
FBLKNAME01, FBLKNAME02, FBLKNAME03,
FBLKNAME04, FBLKNAME05, FBLKNAME06,
FBLKNAME07, FBLKNAME08, FBLKSUB01,
FBLKSUB02, FBLKSUB03, FBLKSUB04,
FBLKSUB05, FBLKSUB06, FBLKSUB07,
FBLKSUB08, FMAXMARK01, FMAXMARK02,
FMAXMARK03, FMAXMARK04, FMAXMARK05,
FMAXMARK06, FMAXMARK07, FMAXMARK08,
FMINMARK01, FMINMARK02, FMINMARK03,
FMINMARK04, FMINMARK05, FMINMARK06,
FMINMARK07, FMINMARK08, FMINPASS01,
FMINPASS02, FMINPASS03, FMINPASS04,
FMINPASS05, FMINPASS06, FMINPASS07,
FMINPASS08)
values ('{$degsem['FDEGREE']}', '{$degsem['FDESCPN']}', '{$degsem['FEXAMNO']}',
'{$degsem['FEXAMNAME']}', '{$degsem['FNEXTEXAM']}', '{$degsem['FDEGDESCPN']}',
'{$degsem['FBRANCHDESCPN']}', '{$degsem['FCMAXTERMS']}', '{$degsem['FTOTSUB']}',
'{$degsem['FMINTOT']}', '{$degsem['FSUBCHOICE']}', '{$degsem['FSUBEX']}',
'{$degsem['FVARSUB']}', '{$degsem['FGRACEPER']}', '{$degsem['FTOTGRACE']}',
'{$degsem['FSUBGRPER']}', '{$degsem['FSUBGRMARK']}', '{$degsem['FGRACESUB']}',
'{$degsem['FSEPREPGR']}', '{$degsem['FREPGRMARK']}', '{$degsem['FMRPGRMARK']}',
'{$degsem['FEXAMGRACE']}', '{$degsem['FTHAGONLY']}', '{$degsem['FPRGRACE']}',
'{$degsem['FREDGRACE']}', '{$degsem['FCLGRPER']}', '{$degsem['FCLGRSEP']}',
'{$degsem['FGIVEGRACE2']}', '{$degsem['FSUBFAIL']}', '{$degsem['FSUBSIFAIL']}',
'{$degsem['FLEASTEXAM']}', '{$degsem['FLEASTAPP']}', '{$degsem['FMINBLK']}',
'{$degsem['FBLKPASS']}', '{$degsem['FNOVAL']}', '{$degsem['FDEVPER']}',
'{$degsem['FDEVMARK']}', '{$degsem['FDEVINCL']}', '{$degsem['FAGGRMIN']}',
'{$degsem['FAGMINSUB']}', '{$degsem['FCUMRESULT']}', '{$degsem['FCUMAGMIN']}',
'{$degsem['FEXAMPASS']}', '{$degsem['FTHPRACSEP']}', '{$degsem['FCLASS']}',
'{$degsem['FCUMCLASS']}', '{$degsem['FATTALL']}', '{$degsem['FRANKATT']}',
'{$degsem['FINITQP']}', '{$degsem['FCLOSEMC']}', '{$degsem['FSPLITEXAM']}',
'{$degsem['FFACULTY']}', '{$degsem['FPERSET']}', '{$degsem['FMCTYPE']}',
'{$degsem['FCOLLDEPT']}', '{$degsem['FALTDEG']}', '{$degsem['FMAXTYPE']}',
'{$degsem['FCONTMARKS']}', '{$degsem['FDEGGRP']}', '{$degsem['FSKIPFAIL']}',
'{$degsem['FABSZERO']}', '{$degsem['FSGLENTRY']}', '{$degsem['FSNINLED']}',
'{$degsem['FCREDIT']}', '{$degsem['FTHPRCR']}', '{$degsem['FBLK1CLASS']}',
'{$degsem['FDISTPER']}', '{$degsem['FCRCC']}', '{$degsem['FREGREFNO']}',
'{$degsem['FGRREFNO']}', '{$degsem['FMODREFNO']}', '{$degsem['FNOTERMS']}',
'{$degsem['FMAXACTIVE']}', '{$degsem['FMAXTERMS']}', '{$degsem['FMAXATT']}',
'{$degsem['FMAXAPP']}', '{$degsem['FELIGREM01']}', '{$degsem['FELIGREM02']}',
'{$degsem['FBLKNAME01']}', '{$degsem['FBLKNAME02']}', '{$degsem['FBLKNAME03']}',
'{$degsem['FBLKNAME04']}', '{$degsem['FBLKNAME05']}', '{$degsem['FBLKNAME06']}',
'{$degsem['FBLKNAME07']}', '{$degsem['FBLKNAME08']}', '{$degsem['FBLKSUB01']}',
'{$degsem['FBLKSUB02']}', '{$degsem['FBLKSUB03']}', '{$degsem['FBLKSUB04']}',
'{$degsem['FBLKSUB05']}', '{$degsem['FBLKSUB06']}', '{$degsem['FBLKSUB07']}',
'{$degsem['FBLKSUB08']}', '{$degsem['FMAXMARK01']}', '{$degsem['FMAXMARK02']}',
'{$degsem['FMAXMARK03']}', '{$degsem['FMAXMARK04']}', '{$degsem['FMAXMARK05']}',
'{$degsem['FMAXMARK06']}', '{$degsem['FMAXMARK07']}', '{$degsem['FMAXMARK08']}',
'{$degsem['FMINMARK01']}', '{$degsem['FMINMARK02']}', '{$degsem['FMINMARK03']}',
'{$degsem['FMINMARK04']}', '{$degsem['FMINMARK05']}', '{$degsem['FMINMARK06']}',
'{$degsem['FMINMARK07']}', '{$degsem['FMINMARK08']}', '{$degsem['FMINPASS01']}',
'{$degsem['FMINPASS02']}', '{$degsem['FMINPASS03']}', '{$degsem['FMINPASS04']}',
'{$degsem['FMINPASS05']}', '{$degsem['FMINPASS06']}', '{$degsem['FMINPASS07']}',
'{$degsem['FMINPASS08']}')";
$result = $aobj_context->pobj_db->Execute($query);
if(!$result){
$arr['msg'] = "Error While inserting degree details...!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
foreach ($degclass as $k => $v) {
// $deleted = $v['fdeleted'] == 'true' ? 'T' : 'F';
$values .= "('{$degsem['FDEGREE']}','{$degsem['FEXAMNO']}', '{$v['FSLNO']}',
'{$v['FFROMATT']}', '{$v['FTOATT']}', '{$v['FFROMPER']}', '{$v['FTOPER']}', '{$degsem['FCLSGRADE']}', '{$v['FCLASS']}', '{$v['FCLSGROUP']}'),";
}
$values = rtrim($values, ',');
$degclass_insert = "insert into degclass(FDEGREE, FEXAMNO, FSLNO,
FFROMATT, FTOATT, FFROMPER, FTOPER, FCLSGRADE, FCLASS, FCLSGROUP)
VALUES $values ";
$result = $aobj_context->pobj_db->Execute($degclass_insert);
if($result){
$arr['msg'] = "Degree created successfully.";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else{
$arr['msg'] = "Error While inserting class details...!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
else {
$query = "update tdegree set FDESCPN = '{$degsem['FDESCPN']}', FEXAMNAME = '{$degsem['FEXAMNAME']}',
FNEXTEXAM = '{$degsem['FNEXTEXAM']}', FDEGDESCPN = '{$degsem['FDEGDESCPN']}',
FBRANCHDESCPN = '{$degsem['FBRANCHDESCPN']}', FCMAXTERMS = '{$degsem['FCMAXTERMS']}',
FTOTSUB = '{$degsem['FTOTSUB']}', FMINTOT = '{$degsem['FMINTOT']}',
FSUBCHOICE = '{$degsem['FSUBCHOICE']}', FSUBEX = '{$degsem['FSUBEX']}',
FVARSUB = '{$degsem['FVARSUB']}', FGRACEPER = '{$degsem['FGRACEPER']}',
FTOTGRACE = '{$degsem['FTOTGRACE']}', FSUBGRPER = '{$degsem['FSUBGRPER']}',
FSUBGRMARK = '{$degsem['FSUBGRMARK']}', FGRACESUB = '{$degsem['FGRACESUB']}',
FSEPREPGR = '{$degsem['FSEPREPGR']}', FREPGRMARK = '{$degsem['FREPGRMARK']}',
FMRPGRMARK = '{$degsem['FMRPGRMARK']}', FEXAMGRACE = '{$degsem['FEXAMGRACE']}',
FTHAGONLY = '{$degsem['FTHAGONLY']}', FPRGRACE = '{$degsem['FPRGRACE']}',
FREDGRACE = '{$degsem['FREDGRACE']}', FCLGRPER = '{$degsem['FCLGRPER']}',
FCLGRSEP = '{$degsem['FCLGRSEP']}', FGIVEGRACE2 = '{$degsem['FGIVEGRACE2']}',
FSUBFAIL = '{$degsem['FSUBFAIL']}', FSUBSIFAIL = '{$degsem['FSUBSIFAIL']}',
FLEASTEXAM = '{$degsem['FLEASTEXAM']}', FLEASTAPP = '{$degsem['FLEASTAPP']}',
FMINBLK = '{$degsem['FMINBLK']}', FBLKPASS = '{$degsem['FBLKPASS']}',
FNOVAL = '{$degsem['FNOVAL']}', FDEVPER = '{$degsem['FDEVPER']}',
FDEVMARK = '{$degsem['FDEVMARK']}', FDEVINCL = '{$degsem['FDEVINCL']}',
FAGGRMIN = '{$degsem['FAGGRMIN']}', FAGMINSUB = '{$degsem['FAGMINSUB']}',
FCUMRESULT = '{$degsem['FCUMRESULT']}', FCUMAGMIN = '{$degsem['FCUMAGMIN']}',
FEXAMPASS = '{$degsem['FEXAMPASS']}', FTHPRACSEP = '{$degsem['FTHPRACSEP']}',
FCLASS = '{$degsem['FCLASS']}', FCUMCLASS = '{$degsem['FCUMCLASS']}',
FATTALL = '{$degsem['FATTALL']}', FRANKATT = '{$degsem['FRANKATT']}',
FINITQP = '{$degsem['FINITQP']}', FCLOSEMC = '{$degsem['FCLOSEMC']}',
FSPLITEXAM = '{$degsem['FSPLITEXAM']}', FFACULTY = '{$degsem['FFACULTY']}',
FPERSET = '{$degsem['FPERSET']}', FMCTYPE = '{$degsem['FMCTYPE']}',
FCOLLDEPT = '{$degsem['FCOLLDEPT']}', FALTDEG = '{$degsem['FALTDEG']}',
FMAXTYPE = '{$degsem['FMAXTYPE']}', FCONTMARKS = '{$degsem['FCONTMARKS']}',
FDEGGRP = '{$degsem['FDEGGRP']}', FSKIPFAIL = '{$degsem['FSKIPFAIL']}',
FABSZERO = '{$degsem['FABSZERO']}', FSGLENTRY = '{$degsem['FSGLENTRY']}',
FSNINLED = '{$degsem['FSNINLED']}', FCREDIT = '{$degsem['FCREDIT']}',
FTHPRCR = '{$degsem['FTHPRCR']}', FBLK1CLASS = '{$degsem['FBLK1CLASS']}',
FDISTPER = '{$degsem['FDISTPER']}', FCRCC = '{$degsem['FCRCC']}',
FREGREFNO = '{$degsem['FREGREFNO']}', FGRREFNO = '{$degsem['FGRREFNO']}',
FMODREFNO = '{$degsem['FMODREFNO']}', FNOTERMS = '{$degsem['FNOTERMS']}',
FMAXACTIVE = '{$degsem['FMAXACTIVE']}', FMAXTERMS = '{$degsem['FMAXTERMS']}',
FMAXATT = '{$degsem['FMAXATT']}', FMAXAPP = '{$degsem['FMAXAPP']}',
FELIGREM01 = '{$degsem['FELIGREM01']}', FELIGREM02 = '{$degsem['FELIGREM02']}',
FBLKNAME01 = '{$degsem['FBLKNAME01']}', FBLKNAME02 = '{$degsem['FBLKNAME02']}',
FBLKNAME03 = '{$degsem['FBLKNAME03']}', FBLKNAME04 = '{$degsem['FBLKNAME04']}',
FBLKNAME05 = '{$degsem['FBLKNAME05']}', FBLKNAME06 = '{$degsem['FBLKNAME06']}',
FBLKNAME07 = '{$degsem['FBLKNAME07']}', FBLKNAME08 = '{$degsem['FBLKNAME08']}',
FBLKSUB01 = '{$degsem['FBLKSUB01']}', FBLKSUB02 = '{$degsem['FBLKSUB02']}',
FBLKSUB03 = '{$degsem['FBLKSUB03']}', FBLKSUB04 = '{$degsem['FBLKSUB04']}',
FBLKSUB05 = '{$degsem['FBLKSUB05']}', FBLKSUB06 = '{$degsem['FBLKSUB06']}',
FBLKSUB07 = '{$degsem['FBLKSUB07']}', FBLKSUB08 = '{$degsem['FBLKSUB08']}',
FMAXMARK01 = '{$degsem['FMAXMARK01']}', FMAXMARK02 = '{$degsem['FMAXMARK02']}',
FMAXMARK03 = '{$degsem['FMAXMARK03']}', FMAXMARK04 = '{$degsem['FMAXMARK04']}',
FMAXMARK05 = '{$degsem['FMAXMARK05']}', FMAXMARK06 = '{$degsem['FMAXMARK06']}',
FMAXMARK07 = '{$degsem['FMAXMARK07']}', FMAXMARK08 = '{$degsem['FMAXMARK08']}',
FMINMARK01 = '{$degsem['FMINMARK01']}', FMINMARK02 = '{$degsem['FMINMARK02']}',
FMINMARK03 = '{$degsem['FMINMARK03']}', FMINMARK04 = '{$degsem['FMINMARK04']}',
FMINMARK05 = '{$degsem['FMINMARK05']}', FMINMARK06 = '{$degsem['FMINMARK06']}',
FMINMARK07 = '{$degsem['FMINMARK07']}', FMINMARK08 = '{$degsem['FMINMARK08']}',
FMINPASS01 = '{$degsem['FMINPASS01']}', FMINPASS02 = '{$degsem['FMINPASS02']}',
FMINPASS03 = '{$degsem['FMINPASS03']}', FMINPASS04 = '{$degsem['FMINPASS04']}',
FMINPASS05 = '{$degsem['FMINPASS05']}', FMINPASS06 = '{$degsem['FMINPASS06']}',
FMINPASS07 = '{$degsem['FMINPASS07']}', FMINPASS08 = '{$degsem['FMINPASS08']}'
where fdegree = '{$degsem['FDEGREE']}' and fexamno = '{$degsem['FEXAMNO']}'";
$result = $aobj_context->pobj_db->Execute($query);
if(!$result){
$arr['msg'] = "Error While updating degree details...!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
foreach ($degclass as $k => $v) {
// $deleted = $v['fdeleted'] == 'true' ? 'T' : 'F';
$degclass_update = "update degclass set FFROMATT = '{$v['FFROMATT']}',
FTOATT = '{$v['FTOATT']}', FFROMPER = '{$v['FFROMPER']}',
FTOPER = '{$v['FTOPER']}', FCLSGRADE = '{$degsem['FCLSGRADE']}',
FCLASS = '{$v['FCLASS']}', FCLSGROUP = '{$v['FCLSGROUP']}'
where FDEGREE = '{$degsem['FDEGREE']}' and FEXAMNO = '{$degsem['FEXAMNO']}'
and FSLNO = '{$v['FSLNO']}'";
// var_dump($degclass_update);
$result = $aobj_context->pobj_db->Execute($degclass_update);
if(!$result) {
$arr['msg'] = "Error While updating class details...!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
$arr['msg'] = "Updation was Successfull";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
}
function deleteDegSem($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$fdeggrp = $aobj_context->mobj_data['fdeggrp'];
$req = $aobj_context->req_body;
$req_data = $req['data'];
if ( $req_data['degree'] == "" || $req_data['examno'] == "" ) {
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
$query = "select * from tdegree where fdegree = '{$req_data['degree']}'
and fexamno > '{$req_data['examno']}'";
$result = $aobj_context->pobj_db->GetAll($query);
if(count($result) > 0) {
$arr['msg'] = 'Cannot delete degree. As higher semesters exist.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 1, "failure");
return;
}
$del_query = "delete from tdegree where fdegree = '{$req_data['degree']}'
and fexamno = '{$req_data['examno']}'";
// var_dump($del_query);
$result = $aobj_context->pobj_db->Execute($del_query);
if(!$result) {
$arr['msg'] = "Error While deleting degree...!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
else {
$del_query = "delete from degclass where fdegree = '{$req_data['degree']}'
and fexamno = '{$req_data['examno']}'";
// var_dump($del_query);
$result = $aobj_context->pobj_db->Execute($del_query);
if(!$result) {
$arr['msg'] = "Error While deleting degree...!";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
else {
$arr['msg'] = "Degree delted successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
}
}
?>
|