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.142.55.138
<?php
function loadtempcode($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$user_type = $_SESSION['user_code'];
$user = $_SESSION['usr'];
$qry = 'select distinct CONCAT(ftempcode, " - ", ftempdesc) as tcode , ftempcode from tdvs_qptemphead_copo';
$lobj_get_data = $aobj_context->mobj_db->GetAll($qry);
if($user_type == '14' || $user_type == '40')
{
$qry1 = "select distinct ifnull(d.FDEGREE , '') as fdegree, concat(d.fdegree,' - ',ifnull(d.FDESCPN , '')) as fdescpn
from degree d
inner join subject s on d.fdegree = s.fdegree
and d.fexamno = s.fexamno
inner join tdvs_copomarks m on s.fdegree = m.fdegree
and m.fexamno = d.fexamno
where ifnull(d.FDEGREE , '') <> ''
group by d.fdegree";
}else
{
// $qry1 = "select distinct ifnull(d.FDEGREE , '') as fdegree, concat(d.fdegree,' - ',ifnull(d.FDESCPN , '')) as fdescpn from degree d
// inner join subject s on d.fdegree = s.fdegree
// and d.fexamno = s.fexamno
// inner join tdvs_copomarks m on s.fqpcode = m.fsubcode
// where ifnull(d.FDEGREE , '') <> ''
// and m.fteachcode = right('{$user}',4)
// group by d.fdegree";
// $qry1 = "select distinct ifnull(d.FDEGREE , '') as fdegree, concat(d.fdegree,' - ',ifnull(d.FDESCPN , '')) as fdescpn
// from degree d
// inner join subject s on d.fdegree = s.fdegree
// and d.fexamno = s.fexamno
// inner join tdvs_copomarks m on s.fdegree = m.fdegree
// and m.fexamno = d.fexamno
// where ifnull(d.FDEGREE , '') <> ''
// group by d.fdegree";
$qry1 = "select distinct ifnull(d.FDEGREE , '') as fdegree,
concat(d.fdegree,' - ',ifnull(d.FDESCPN , '')) as fdescpn
from degree d inner join colldeg c on c.fdegree = d.fdegree
where c.fcollcode = '{$collcode }'";
}
$lobj1 = $aobj_context->mobj_db->GetAll($qry1);
// var_dump($qry1);
// die();
if($lobj_get_data){
$arr['tempcode'] = $lobj_get_data;
$arr['degree'] = $lobj1;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function loadexamno($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$user_type = $_SESSION['user_code'];
$user = $_SESSION['usr'];
$degree = $aobj_context->mobj_data["degree"];
if($user_type == '14' || $user_type == '40')
{
$qry1 = "select distinct ifnull(FEXAMNO , '') as fexamno,ifnull(FEXAMNAME , '') as fexamname from degree
where FDEGREE = '{$degree}'";
}else
{
// $qry1 = "select distinct ifnull(d.FEXAMNO , '') as fexamno,ifnull(d.FEXAMNAME , '') as fexamname from degree d
// inner join subject s on d.fdegree = s.fdegree
// and d.fexamno = s.fexamno
// inner join tdvs_copomarks m on s.fqpcode = m.fsubcode
// where s.FDEGREE = '{$degree}'
// and m.fteachcode = right('{$user}',4)
// group by d.FEXAMNO";
$qry1 = "select distinct ifnull(FEXAMNO , '') as fexamno,ifnull(FEXAMNAME , '') as fexamname from degree
where FDEGREE = '{$degree}'";
}
$lob = $aobj_context->mobj_db->GetAll($qry1);
if($lob){
echo $aobj_context->mobj_output->ToJSONEnvelope($lob,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function loadqpcodetemp($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$user_type = $_SESSION['user_code'];
$user = $_SESSION['usr'];
$degree = $aobj_context->mobj_data["degree"];
$examno = $aobj_context->mobj_data["examno"];
$element = $aobj_context->mobj_data["element"];
// if($user_type == '14' || $user_type == '40')
// {
if($element == 'theory'){
$qry1 = "select distinct ifnull(FQPCODE , '') as fqpcode,concat(s.fqpcode,' - ',ifnull(s.FSUBNAME, '')) as fsubname from subject s
where FDEGREE = '{$degree}' and FEXAMNO = '{$examno}'
and FQPCODE <> ''";
}else if($element == 'IA' || $element == 'IA1' || $element == 'IA2' || $element == 'assignment' || $element == "seminar-quiz"){
$qry1 = "select distinct ifnull(FCSUBCODE , '') as fcsubcode, concat(ifnull(FSUBNAME, ''),' - ',fssubname) as fsubname from subject s
where FDEGREE = '{$degree}' and FEXAMNO = '{$examno}'
and fretain = 'T'";
}
// }else
// {
// if($element == 'theory'){
// $qry1 = "select distinct ifnull(s.FQPCODE , '') as fqpcode,concat(s.fqpcode,' - ',ifnull(s.FSUBNAME, '')) as fsubname
// from subject s inner join tdvs_copomarks m on s.fqpcode = m.fsubcode
// where s.FDEGREE = '{$degree}' and s.FEXAMNO = '{$examno}' and s.FQPCODE <> ''
// and m.fteachcode = right('{$user}',4)";
// }else if($element == 'IA'){
// $qry1 = "select distinct ifnull(FCSUBCODE , '') as fcsubcode, concat(ifnull(FSUBNAME, ''),' - ',fssubname) as fsubname from subject s
// inner join tdvs_copomarks m on s.fcsubcode = m.fsubcode
// and m.fdegree = s.fdegree and m.fexamno = s.fexamno
// where s.FDEGREE = '{$degree}' and s.FEXAMNO = '{$examno}'
// and m.fteachcode = right('{$user}',4)
// and fretain = 'T'";
// }
// }
// var_dump($qry1);
// die();
$lob = $aobj_context->mobj_db->GetAll($qry1);
if($lob){
echo $aobj_context->mobj_output->ToJSONEnvelope($lob,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function loadpcopotable($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$tempcode = $aobj_context->mobj_data["tempcode"];
$qry = "select ifnull(ftempcode,'') as ftempcode, ifnull(fpartcode,'') as fpartcode,
ifnull(fmaxmarks,'') as fmaxmarks, ifnull(fqnno,'') as fqnno,ifnull(fqncode,'') as fqncode,
ifnull(fpo,'') as fpo,ifnull(fco,'') as fco,
ifnull(fpso,'') as fpso from tdvs_qptempdetl_copo where ftempcode = '{$tempcode}'";
$lobj = $aobj_context->mobj_db->GetAll($qry);
if($lobj){
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function viewtemplatecodetab($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$tempcode = $aobj_context->mobj_data["tempcode"];
$examno = $aobj_context->mobj_data["examno"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$degree = $aobj_context->mobj_data["degree"];
$element = $aobj_context->mobj_data["element"];
$qry = "select ifnull(td.ftempcode,'') as ftempcode,
ifnull(td.fpartcode,'') as fpartcode,
ifnull(td.fmaxmarks,'') as fmaxmarks,
ifnull(td.fqnno,'') as fqnno,
ifnull(td.fqncode,'') as fqncode,
ifnull(tc.fpo,'') as fpo,
ifnull(tc.fco,'') as fco,
ifnull(tc.fpso,'') as fpso,
ifnull(tc.fmaxmarks,'') as fmaxmarks
from tdvs_qptempdetl_copo td
left join tdvs_qpcopo tc on
td.ftempcode = tc.ftempcode and
td.fpartcode = tc.fpartcode and
td.fqncode = tc.fqncode
and tc.fdegree = '{$degree}' and tc.fexamno = '{$examno}'
and tc.fqpcode = '{$qpcode}' and tc.felement = '{$element}'
where td.ftempcode = '{$tempcode}' and td.fsubqp <> 'T'";
$lobj = $aobj_context->mobj_db->GetAll($qry);
if($lobj){
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function savecopopso($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$tempcode = $aobj_context->mobj_data["tempcode"];
$degree = $aobj_context->mobj_data["degree"];
$examno = $aobj_context->mobj_data["examno"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$element = $aobj_context->mobj_data["element"];
$target = $aobj_context->mobj_data["target"];
$fnarr = $aobj_context->mobj_data["fnarr"];
$array = json_decode($fnarr, true);
foreach($array as $key => $value){
$qry = "INSERT INTO tdvs_qpcopo(ftempcode,fpartcode,fqncode,fpo,fco,fpso,fdegree,fexamno,fqpcode,fmaxmarks,felement,fcreatedate,ftarget)
VALUES
('{$tempcode}','{$value['partcode']}','{$value['qncode']}','{$value['po']}','{$value['co']}'
,'{$value['pso']}','{$degree}','{$examno}','{$qpcode}','{$value['maxmarks']}','{$element}',now(), '{$target}')
ON DUPLICATE KEY UPDATE fpo = '{$value['po']}', fco = '{$value['co']}', fpso = '{$value['pso']}',
fmaxmarks = '{$value['maxmarks']}',
fupddate = now(), ftarget='{$target}'";
$lobj = $aobj_context->mobj_db->Execute($qry);
}
if($lobj){
$arr['msg'] = 'Saved Successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}else{
$arr['msg'] = 'Failed to Save';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
?>
|