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 : 13.59.1.58
<?php
function getSubjectCombination($aobj_context)
{
$fcollcode = $aobj_context->mobj_data["fcollcode"];
$fdeggrp = $aobj_context->mobj_data["fdeggrp"];
$query = "select m.fdegree, d.fdescpn, fcombcode, fcombdesc from mascomb m inner join degree d
on d.fdegree = m.fdegree and d.fexamno = 'A' where d.fdeggrp = '{$fdeggrp}'
group by fdegree, fcombcode;";
$data=$aobj_context->pobj_db->GetAll($query);
$query = "select distinct m.fdegree, d.fdescpn from mascomb m inner join degree d
on d.fdegree = m.fdegree and d.fexamno = 'A' where d.fdeggrp = '{$fdeggrp}'
group by fdegree, fcombcode";
$degrees = $aobj_context->pobj_db->GetAll($query);
$query = "select fdegree,fexamno,fcombcode,fintake,
ifnull(fdeleted,'F') as fdeleted from collcomb
where fcollcode = '{$fcollcode}' and ifnull(fdeleted,'') <> 'T'";
//var_dump($query);
$particular_college_data = $aobj_context->pobj_db->GetAll($query);
$resultObj ="";
$resultObj->error_code = 0;
$resultObj->data = $data;
$resultObj->degrees = $degrees;
$resultObj->particular_college_data = $particular_college_data;
echo json_encode($resultObj);
}
function submitSubjectCombination($aobj_context)
{
$req = $aobj_context->req_body;
$fcollcode = $aobj_context->mobj_data["fcollcode"];
$submit = $req["submit"];
for($i=0;$i<count($submit);$i++)
{
$fdegree = $submit[$i]['fdegree'];
$fexamno = $submit[$i]['fexamno'];
$fcombcode = $submit[$i]['fcombcode'];
$fintake = $submit[$i]['fintake'];
$fdeleted= $submit[$i]['fdeleted'];
if( $fdeleted == 'T') {
$query = "delete from collcomb where fcollcode = '{$fcollcode}'
and fdegree = '{$fdegree}' and fexamno = '{$fexamno}' and fcombcode = '{$fcombcode}'";
$result = $aobj_context->pobj_db->Execute($query);
}else {
$query = "insert into collcomb (fcollcode,fdegree,fexamno,fcombcode,fintake,fdeleted)
VALUES('{$fcollcode}','{$fdegree}','{$fexamno}','{$fcombcode}','{$fintake}','{$fdeleted}')
on duplicate key update
fcollcode = values(fcollcode),
fdegree = values(fdegree),
fexamno = values(fexamno), fcombcode = values(fcombcode),
fintake = values(fintake), fdeleted=values(fdeleted)";
$result = $aobj_context->pobj_db->Execute($query);
}
}
$resp = "";
if($i<count($submit))
{
$resp->status =false;
$resp->error_code = -1;
$resp->msg="Update failed";
}
else
{
$resp->status =true;
$resp->error_code = 0;
$resp->msg="Update success";
}
echo json_encode($resp);
// $resp="";
// if(!$result)
// {
// $resp->status =false;
// $resp->error_code = -1;
// $resp->msg="Update failed";
// }
// else
// {
// $resp->status =true;
// $resp->error_code = 0;
// $resp->msg="Update success";
// }
// echo json_encode($resp);
}
?>
|