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.189.182.195
<?php
function getfreezeTimetable($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$dgp = $aobj_context->mobj_data["dgp"];
$year = $aobj_context->mobj_data["year"];
$examtype = $aobj_context->mobj_data["examtype"];
$examrange = $aobj_context->mobj_data["examrange"];
$fcurtype = $aobj_context->mobj_data["fcurtype"];
$exam = str_split($examrange);
$examrange = implode("','", $exam);
$query ="SELECT s.fexamno, a.fqpcode, s.fsubname, DATE_FORMAT(m.fdate,'%d/%m/%Y') AS fdate, r.fdescpn,ifnull(a.ffreeze,'') as ffreeze ,
ifnull(a.frelease,'') as frelease,
({$fcurtype}) as fusertype
FROM timetable a INNER JOIN (SELECT fqpcode, fsubname,fexamno FROM subject
WHERE IFNULL(fqpcode,'') <> ''
and fexamno in('{$examrange}')
GROUP BY fqpcode) s ON a.fqpcode = s.fqpcode LEFT JOIN masdate m ON a.fdatecodet = m.fdatecode
AND a.fdeggrp = m.fdeggrp AND a.fyear = m.fyear AND a.fexamtype = m.fexamtype
LEFT JOIN reason r ON a.fsessiont = r.freasoncd
WHERE a.fdeggrp = '{$dgp}' AND a.fyear = '{$year}' AND a.fexamtype = '{$examtype}' AND s.fexamno in('{$examrange}') ";
// 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 freezetimetable($aobj_context) {
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$req = $aobj_context->req_body;
$ffolder = $aobj_context->pdb['ffolder'];
$req = $req['data'];
$dgp = $req["dgp"];
$year = $req["year"];
$examtype = $req["examtype"];
$examrange = $req["examrange"];
$tabledata = $req["tabledata"];
$user = $req["user"];
// var_dump($tabledata,'exmrd');
$exam = str_split($examrange);
$examrange = implode("','", $exam);
foreach ($tabledata as $key => $value) {
$qpcode = $value['fqpcode'];
$freeze = $value['ffreeze'];
$fdate = $value['fdate'];
if($freeze != NULL && $fdate != NULL){
$query = "UPDATE timetable SET
ffreeze = '{$freeze}', ffreezeuser = '{$user}', ffreezedate=NOW()
WHERE fdeggrp = '{$dgp}' AND fyear = '{$year}' AND fexamtype = '{$examtype}'
AND fqpcode = '{$qpcode}' ";
// var_dump($query);
$result=$aobj_context->pobj_db->Execute($query);
};
}
if ($result) {
$arr['msg'] = 'Successfully Updated';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
} else {
$arr['msg'] = 'Updation Failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
|