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.1.23
<?php
function getExamName($aobj_context){
$deggrp = $aobj_context->mobj_data['deggrp'];
$query = "select concat(fdeggrp, '*', fyear, '-', fexamtype) as fexamyear,
fexamdate as fdesexam from deggrp where ifnull(fdeleted, '')<>'T'
and fdeggrp='{$deggrp}'";
$res = $aobj_context->mobj_db->GetAll($query);
if ($res) {
echo $aobj_context->mobj_output->TOJSONEnvelope($res, 0, "success");
}else{
$arr['msg'] = "failed to load exam details";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failed");
return;
}
}
function getSelectFinalQP($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$data = json_decode($aobj_context->mobj_data['data'], true);
$db = $aobj_context->mobj_data['db'];
$exam = $data["exam"];
$board = $data["board"];
$qpcode = $data["qpcode"];
$degree = $data["degree"];
$sem = $data["sem"];
$status = $data["status"];
$splitExam = explode("*", $exam);
$deggrp = $splitExam[0];
$splitYear = explode("-", $splitExam[1]);
$examYear = $splitYear[0];
$examType = $splitYear[1];
$board === "All" ? $boardCond = " " : $boardCond = "and s.fboard='{$board}'";
$qpcode === "All" ? $qpCond = " " : $qpCond = "and s.fqpcode='{$qpcode}'";
$degree === "All" ? $degreeCond = " " : $degreeCond = "and s.fdegree='{$degree}'";
$sem === "All" ? $semCond = " " : $semCond = "and s.fexamno='{$sem}'";
if($status === "All"){
$statCond = " ";
}else if($status === "selected"){
$statCond = "and q.ffinalpaper = 'T' ";
}else{
$statCond = "and ifnull(q.ffinalpaper, '') <> 'T' ";
}
$query = "select distinct q.fyear, q.fexamtype, if(ifnull(g.fexamdate, '')='', dg.fexamdate, g.fexamdate)as fexamdate, d.fdeggrp, s.fdegree, q.fteachcode, m.fteachname, q.fqpcode,
concat(s.fsubname, ' - ', s.fsubshort) as fsubname, s.fexamno,
ifnull(q.fqpfilepath, '')as fqpfilepath, ifnull(q.fmodqpupd, '')as fmodqpupd, ifnull(q.fmodanskey, '')as fmodanskey,
ifnull(q.fmodform, '')as fmodform, ifnull(q.ffinalpaper, '')as ffinalpaper, q.fset,
ifnull(ffinalqpstatus, '')as ffinalqpstatus, ifnull(q.fdeleted, '')as fdeleted,
date_format(q.ffinalpaperdate, '%d/%m/%Y %H:%i:%s')as ffinalpaperdate, q.ftype, q.fpretype
from qpseterdet q inner join masteach m on m.fteachcode = q.fteachcode
inner join subject s on s.fqpcode = q.fqpcode
inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
inner join qpset_deggrp dg on d.fdeggrp = dg.fdeggrp and dg.fdeggrp = '{$deggrp}'
left join degexam g on s.fdegree = g.fdegree and g.fexamno = s.fexamno
and q.fyear = g.fyear and q.fexamtype = g.fexamtype
where ifnull(fmodqpdate, '') <> ''
and d.fdeggrp='{$deggrp}' and q.ftype='Theory'
{$qpCond} {$degreeCond} {$semCond} {$statCond}
group by s.fqpcode,q.fset, q.fteachcode,q.fyear, q.fexamtype
order by
q.fyear desc, q.fexamtype desc";
// var_dump($query);die();
$result = $aobj_context->mobj_db->GetAll($query);
if($result){
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 saveSelectFinalQP($aobj_context){
$data = json_decode($aobj_context->mobj_data['data'], true);
$finaldata = json_decode($aobj_context->mobj_data['finaldata'], true);
$exam = $data['exam'];
$splitExam = explode("*", $exam);
$deggrp = $splitExam[0];
$splitYear = explode("-", $splitExam[1]);
$examYear = $splitYear[0];
$examType = $splitYear[1];
foreach ($finaldata as $key => $val) {
if($val['ffinalpaper'] === 'T'){
$dateCnd = "ffinalpaperdate=now()";
}else{
$dateCnd = "ffinalpaperdate=NULL";
}
$query = "update qpseterdet set ffinalpaper= '{$val['ffinalpaper']}', {$dateCnd},
fdeleted='{$val['fdeleted']}',
fusedyear = '{$val['fyear']}',
fusedexamtype = '{$val['fexamtype']}'
where fyear='{$val['fyear']}' and fexamtype='{$val['fexamtype']}' and
fqpcode='{$val['fqpcode']}' and fteachcode='{$val['fteachcode']}' and
fset='{$val['fset']}' and ifnull(fmodqpdate, '') <> ''
and ftype='{$val['ftype']}'";
$result = $aobj_context->mobj_db->Execute($query);
$qry = "update mcqqpdet set fusedyear = '{$val['fyear']}',
fusedexamtype = '{$val['fexamtype']}'
where fyear='{$val['fyear']}' and fexamtype='{$val['fexamtype']}' and
fqpcode='{$val['fqpcode']}' and fteachcode='{$val['fteachcode']}' and
fnoqp='{$val['fset']}'
and ifnull(fmodstatus,'') = 'T'";
$result1 = $aobj_context->mobj_db->Execute($qry);
}
if($result){
$arr['msg'] = "Successfully updated";
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;
}
}
function getOmrQuestionPapers($aobj_context){
$data = json_decode($aobj_context->mobj_data['data'], true);
$deggrp = $data['deggrp'];
$qpcode = $data['qpcode'];
$degree = $data['degree'];
$sem = $data['sem'];
$status = $data['status'];
// $query = "select fyear, fexamtype from deggrp where fdeggrp='{$deggrp}'";
// $result = $aobj_context->mobj_db->GetRow($query);
// $year = $result['fyear'];
// $examtype = $result['fexamtype'];
$qpcode === "All" ? $qpCond = "" : $qpCond = "and m.fqpcode='{$qpcode}'";
$degree === "All" ? $degreeCond = "" : $degreeCond = "and d.fdegree='{$degree}'";
$sem === "All" ? $semCond = "" : $semCond = "and d.fexamno='{$sem}'";
if($status === "All"){
$statusCnd = "";
}else if($status === "selected"){
$statusCnd = "and ifnull(ffinalpaper, '') = 'T'";
}else if($status === "not_selected"){
$statusCnd = "and ifnull(ffinalpaper, '') <> 'T'";
}
$query = "select m.fqpcode, s.fsubname, m.fyear, m.fexamtype, m.fexamdate, m.fteachcode, m.fnoqp, m.fmaxmarks,
m.fversions, m.fdate, m.ffinalpaper, m.ffinaldate
from mcqqp m inner join subject s on s.fqpcode = m.fqpcode
#and s.fcsubcode = m.fcsubcode
inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
inner join qpseterdet q on q.fqpcode = m.fqpcode and q.fteachcode = m.fteachcode
and m.fnoqp = q.fset
where d.fdeggrp='{$deggrp}' {$qpCond} {$degreeCond} {$semCond} {$statusCnd}
and m.fyear = '2222' and m.fexamtype='2' and ifnull(s.fonlineqp, 'F') = 'T'
and ifnull(fmodqpdate, '') <> ''
group by fqpcode, fyear, fexamtype, m.fcsubcode, fteachcode, fnoqp ";
// var_dump($query);die();
$result=$aobj_context->mobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "succcess");
return;
}else{
$arr['msg'] = 'Failed to get the MCQ details';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function saveOMRFinalPaper($aobj_context){
$data = json_decode($aobj_context->mobj_data["data"], true);
foreach($data as $val){
$query = "update mcqqp set ffinalpaper='{$val['ffinalpaper']}', ffinaldate=now(), fversions='{$val['fversions']}'
where fqpcode='{$val['fqpcode']}' and fyear='{$val['fyear']}'
and fexamtype='{$val['fexamtype']}'
and fteachcode='{$val['fteachcode']}' and fnoqp='{$val['fnoqp']}'";
$result=$aobj_context->mobj_db->Execute($query);
}
if($result){
$arr['msg'] = 'updated successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "succcess");
return;
}else{
$arr['msg'] = 'Failed to update';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
?>
|