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 : 18.223.238.150
<?php
function eligibleQpSetter($aobj_context){
$deggrp = $aobj_context->mobj_data["deggrp"];
$board = $aobj_context->mobj_data["board"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$type = $aobj_context->mobj_data["type"];
$selected = $aobj_context->mobj_data["selected"];
$qry = "select fyear, fexamtype from deggrp where fdeggrp='{$deggrp}'";
$row = $aobj_context->mobj_db->GetRow($qry);
$year = $row["fyear"];
$examtype = $row["fexamtype"];
if($board === "All"){
$cnd = "";
}else{
$cnd = "and qp.fboard = '{$board}'";
}
if($selected === "selected"){
$cnd1 = "inner";
}else{
$cnd1 = "left";
}
$query = "select ifnull(m.fteachcode,'') as fteachcode, ifnull(m.fteachname,'') as fteachname,
concat(ifnull(m.fteachcode,'') ,' - ', ifnull(m.fteachname,'')) as fteach,
ifnull(m.fmobile,'') as fmobile,ifnull(m.femail,'') as femail,
ifnull(qp.fstatus, 'F') as status
from masteach m {$cnd1} join qpseter qp on m.fteachcode = qp.fteachcode
and qp.fqpcode='{$qpcode}' and qp.fyear = '2222' and qp.fexamtype = '2'
and qp.fqpcode in(select distinct s.fqpcode from subject s inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
where d.fdeggrp = '{$deggrp}')
$cnd and qp.ftype = '{$type}' and ifnull(m.fteachcode, '')<>''
group by m.fteachcode";
$result = $aobj_context->mobj_db->GetAll($query);
if(count($result) > 0){
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
}else{
$arr['msg'] = 'No data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
}
function saveQpSetters($aobj_context){
$deggrp = $aobj_context->mobj_data["deggrp"];
$board = $aobj_context->mobj_data["board"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$type = $aobj_context->mobj_data["type"];
$userid = $aobj_context->mobj_data["userid"];
$data = json_decode($aobj_context->mobj_data["data"], true);
// $query = "select fyear, fexamtype from deggrp where fdeggrp = '{$deggrp}'";
// $result = $aobj_context->mobj_db->GetRow($query);
// $year = $result['fyear'];
// $examtype = $result['fexamtype'];
foreach($data as $val){
$qry = "select * from qpseter where fteachcode='{$val['fteachcode']}'
and fqpcode = '{$qpcode}' and fboard = '{$board}'
and fyear = '2222' and fexamtype = '2'
and ftype='{$type}'";
$res = $aobj_context->mobj_db->GetRow($qry);
if($res['fteachcode'] == $val['fteachcode']){
$query = "update qpseter set fstatus='{$val['status']}' where
fteachcode='{$val['fteachcode']}'
and fqpcode = '{$qpcode}' and fboard = '{$board}'
and fyear = '2222' and fexamtype = '2'
and ftype='{$type}'";
}else{
// var_dump($val['status']);
if($val['status'] === 'T'){
$query = "insert into qpseter (fyear, fexamtype, fboard, fqpcode, fteachcode, fcreated, fcreateduser, ftype, fstatus)
value('2222', '2', '{$board}', '{$qpcode}', '{$val['fteachcode']}', now(), '{$userid}', '{$type}', 'T')";
}
}
// var_dump($query);die();
$result = $aobj_context->mobj_db->Execute($query);
}
if($result){
$arr['msg'] = 'Selection updated successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, 'success');
} else {
$arr['msg'] = 'Failed to update';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
?>
|