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 : 52.14.204.52
<?php
function get_deggrp($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "SELECT fdbname FROM dbname WHERE funivcode = $univcode";
$result = $aobj_context->mobj_db->GetRow($query);
$db = $result['fdbname'];
$query = "SELECT DISTINCT fdeggrp FROM {$db}.masqp WHERE IFNULL(fdeggrp,'') <> ''";
// var_dump($query);
$result = $aobj_context->mobj_db->GetAll($query);
// var_dump($result);
if ($result) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = 'Degree group not found for the selected university';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getfboard($aobj_context)
{
$Degree = $aobj_context->mobj_data["deggrp"];
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "select DISTINCT fboardcode, fboardname
FROM masboard mb, masqp mq
WHERE mb.fboardcode=mq.fboard AND mq.fdeggrp= '{$Degree}' order by fboardcode";
$result = $aobj_context->pobj_db->GetAll($query);
if ($result) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = 'No Boards for selected University or Degree grp';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getscript($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$Degree = $aobj_context->mobj_data["deggrp"];
$fboard = $aobj_context->mobj_data["fboard"];
$fexamno = $aobj_context->mobj_data["fexamno"];
$examnoStr = strtoupper($fexamno);
$splitexamno = str_split($examnoStr);
$examno = implode("','", $splitexamno);
$query = "SELECT fqpcode, fsubname, IFNULL(fspresent,0) AS fspresent,
IFNULL(fapresent,0) AS fapresent, IFNULL(fcodecount,0) AS fcodecount,
IFNULL(ftotpkt1,0) AS ftotpkt1, IFNULL(fvalpkt1,0) AS fvalpkt1,
ifnull(ftotpkt2,0) as ftotpkt2, ifnull(fvalpkt2,0) as fvalpkt2,
ifnull(ftotpkt3,0) as ftotpkt3, ifnull(fvalpkt3,0) as fvalpkt3
FROM masqp m, control c WHERE m.fboard = '{$fboard}' AND m.fdeggrp = '{$Degree}'
and fexamno in ('{$examno}')";
// var_dump($query);
$result = $aobj_context->pobj_db->GetAll($query);
if (!$result && gettype($result) == 'boolean') {
$arr['msg'] = "Error while fetching data";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
return;
}
if (count($result) > 0) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = 'No data found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
function getscriptSummary($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$Degree = $aobj_context->mobj_data["deggrp"];
$fexamno = $aobj_context->mobj_data["fexamno"];
$examnoStr = strtoupper($fexamno);
$splitexamno = str_split($examnoStr);
$examno = implode("','", $splitexamno);
$query = "select m.fboard, b.fboardname, sum(ifnull(fapresent,0)) as fapresent,
sum(ifnull(fcodecount,0)) as fcodecount,
if((sum(ifnull(fapresent,0)) - sum(ifnull(fcodecount,0))) < 0, 0,
(sum(ifnull(fapresent,0)) - sum(ifnull(fcodecount,0)))) as fcodepend,
sum(ifnull(ftotpkt1,0)) as ftotpkt,
sum(ifnull(fvalpkt1,0)) as fvalpkt,
(sum(ifnull(ftotpkt1,0))- sum(ifnull(fvalpkt1,0)) ) as fpend,
sum(ifnull(ftotpkt2,0)) as ftotpkt1,
sum(ifnull(fvalpkt2,0)) as fvalpkt1,
(sum(ifnull(ftotpkt2,0))- sum(ifnull(fvalpkt2,0)) ) as fpend1,
sum(ifnull(ftotpkt3,0)) as ftotpkt3,
sum(ifnull(fvalpkt3,0)) as fvalpkt3,
(sum(ifnull(ftotpkt3,0))- sum(ifnull(fvalpkt3,0)) ) as fpend3
from masqp m inner join masboard b on m.fboard = b.fboardcode
where fexamno in ('{$examno}') and fdeggrp = '{$Degree}'
group by m.fboard
having ftotpkt >0
order by m.fboard";
$result = $aobj_context->pobj_db->GetAll($query);
if (!$result && gettype($result) == 'boolean') {
$arr['msg'] = "Error while fetching data";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
return;
}
if (count($result) > 0) {
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
return;
} else {
$arr['msg'] = 'No data found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
|