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.117.184.125
<?php
function loaddayteachcode($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$funivcode = $_SESSION['FUNIVCODE'];
$super_wiser = $_SESSION['super_wiser'];
$usertype = $_SESSION['user_type'];
$usr = $_SESSION['usr'];
$cnd = '';
if(strtolower($usertype) == 'user' && $super_wiser != 'T')
{
$cnd = "and m.fteachcode = '{$usr}'";
}
if($funivcode == "097"){
$cnd1="order by fteachname";
}else{
$cnd1="";
}
$query = "select distinct ifnull(at.fteachcode,'') as fteachcode,ifnull(m.FTEACHNAME,'') as fteachname
from attclass at
inner join masteach m on at.fteachcode = m.fteachcode
where at.fcollcode = '{$collcode}'
{$cnd} {$cnd1}";
// var_dump($query);die();
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loadteachname($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$classname = trim($aobj_context->mobj_data["classname"]);
$super_wiser = $_SESSION['super_wiser'];
$usertype = $_SESSION['user_type'];
$funivcode = $_SESSION['FUNIVCODE'];
$usr = $_SESSION['usr'];
$cnd = '';
if(strtolower($usertype) == 'user' && $super_wiser != 'T')
{
// $query = "select fteachcode from masteach where fcollcode = '{$collcode}'
// and fteachcode = '{$usr}'";
// $res = $aobj_context->mobj_db->GetRow($query);
// $teachcode = $res['fteachcode'];
$cnd = "and m.fteachcode = '{$usr}'";
}
if($funivcode == "097"){
$cnd1="order by teachname";
}else{
$cnd1="";
}
$query = "select distinct ifnull(at.fteachcode,'') as teachcode,ifnull(m.FTEACHNAME,'') as teachname
from attclass at
inner join masteach m on at.fteachcode = m.fteachcode
where at.fcollcode = '{$collcode}'
{$cnd} {$cnd1}";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loadclassname($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$techcode = trim($aobj_context->mobj_data["techcode"]);
$query = "select ifnull(fclassname,'') as fclassname,
ifnull(fclassid,'') as fclassid from
attclass where fteachcode = '{$techcode}' and fcollcode = '{$collcode}' and ifnull(fdeleted,'') <> 'T'";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loadclassnameday($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$super_wiser = $_SESSION['super_wiser'];
$usertype = $_SESSION['user_type'];
$usr = $_SESSION['usr'];
$teachcode = $aobj_context->mobj_data["teachcode"];
$cnd = '';
if(strtolower($usertype) == 'user' && $super_wiser != 'T')
{
// $query = "select fteachcode from masteach where fcollcode = '{$collcode}'
// and fmobile = '{$usr}'";
// $res = $aobj_context->mobj_db->GetRow($query);
// $teachcode = $res['fteachcode'];
$cnd = "and fteachcode = '{$usr}'";
}
$query = "select ifnull(fclassname,'') as fclassname,
ifnull(fclassid,'') as fclassid from
attclass where fteachcode = '{$teachcode}' and fcollcode = '{$collcode}' and ifnull(fdeleted,'') <> 'T'
{$cnd}";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loaddegreecreateclass($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$usrtype = $_SESSION['usrtype'];
$userId = $_SESSION['user_id'];
if($_SESSION['FUNIVCODE'] == '097')
{
if($usrtype == '17')
{
$query = "SELECT DISTINCT d.fdegree AS fdegree,
CONCAT(d.fdegree,' - ',d.fdescpn) AS fdescpn
FROM degree d
inner join student r on d.fdegree = r.fdegree
inner join usersub u on u.fdegree = r.fdegree
and u.FUSER = '{$userId}'
where r.fcollcode = '{$collcode}'
group by d.fdegree";
//var_dump($query1);
}else
{
$query = "select ifnull(d.fdegree,'') as fdegree,ifnull(d.FDESCPN,'') as fdescpn
from degree d
inner join student a on d.fdegree = a.fdegree and d.FEXAMNO = a.FEXAMNO
where fcollcode = '{$collcode}'
group by d.fdegree";
}
}else
{
$query = "select ifnull(d.fdegree,'') as fdegree,ifnull(d.FDESCPN,'') as fdescpn
from degree d
inner join student a on d.fdegree = a.fdegree and d.FEXAMNO = a.FEXAMNO
where fcollcode = '{$collcode}'
group by d.fdegree";
}
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loadsemcreateclass($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$degreecode = $aobj_context->mobj_data["degree"];
$mode = $aobj_context->mobj_data["mode"];
if($_SESSION['FUNIVCODE'] !== '021'){
$cnd = "and d.FEXAMNO = a.FEXAMNO";
if($mode == 'Improvement')
{
$cnd = "";
}
}else{
$cnd = "";
}
$query = "select ifnull(d.FEXAMNO,'') as fexamno,ifnull(d.FEXAMNAME,'') as fexamname
from degree d
inner join student a on d.fdegree = a.fdegree {$cnd}
where d.fdegree = '{$degreecode}'
group by d.FEXAMNO";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loadssubcreateclass($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$degreecode = $aobj_context->mobj_data["degree"];
$sem = $aobj_context->mobj_data["sem"];
$collcode = $_SESSION['collcode'];
$univcode = $_SESSION['FUNIVCODE'];
$fild = "concat(ifnull(s.FSUBNAME,''),' (',fsubshort, ')', ' - ', fssubname) as fsubname";
if($univcode == '052')
$fild = "concat(ifnull(s.FSUBNAME,''),' - ',s.fsubshort) as fsubname";
if($univcode == '052')
{
$query = "select ifnull(s.FCSUBCODE,'') as fsubcode,
{$fild}
from subject s
inner join student a on s.FDEGREE = a.FDEGREE
inner join subdet su on s.fdegree = su.fdegree and
s.fexamno = su.fexamno and s.fsubcode = left(su.fcsubcode,4)
where s.FDEGREE = '{$degreecode}' and s.FEXAMNO = '{$sem}'
group by s.FSUBCODE";
#and s.fretain = 'F'
#and ifnull(s.fsuspend, '')<> 'T'
#group by s.FSUBCODE
}else if($univcode == '055')
{
$query = "select ifnull(s.FCSUBCODE,'') as fsubcode,
concat(s.fsubshort,' - ',ifnull(s.FSUBNAME,''),' - ',fssubname) as fsubname
from subject s
inner join student a on s.FDEGREE = a.FDEGREE
where s.FDEGREE = '{$degreecode}' and s.FEXAMNO = '{$sem}'
#and s.fretain = 'F'
and ifnull(s.fsuspend, '')<> 'T'
group by s.FSUBCODE";
}
else
{
$query = "select ifnull(s.FCSUBCODE,'') as fsubcode,
{$fild}
from subject s
inner join student a on s.FDEGREE = a.FDEGREE
where s.FDEGREE = '{$degreecode}' and s.FEXAMNO = '{$sem}'
#and s.fretain = 'F'
and ifnull(s.fsuspend, '')<> 'T'
group by s.FSUBCODE";
}
//var_dump($query);die();
$result = $aobj_context->mobj_db->GetAll($query);
if($univcode == "052"){
$cnd = "ifnull(fsectionnew,'') as fsection";
$cnd1 = "";
}else{
$cnd = "ifnull(FSECTION,'') as fsection";
$cnd1 = "and ifnull(FSECTION,'') <> ''";
}
$query1 = "select distinct {$cnd}
from student
where fcollcode = '{$collcode}' and FDEGREE = '{$degreecode}' {$cnd1}";
$result1 = $aobj_context->mobj_db->GetAll($query1);
if($result)
{
$arr['sub'] = $result;
$arr['sec'] = $result1;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function loadteachercreateclass($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$query = "select ifnull(FTEACHCODE,'') as fteachcode,ifnull(FTEACHNAME,'') as fteachname
from masteach
where fcollcode = '{$collcode}'";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function viewcreateclass($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degreecode = $aobj_context->mobj_data["degree"];
$sem = $aobj_context->mobj_data["sem"];
$sub = $aobj_context->mobj_data["sub"];
$classname = $aobj_context->mobj_data["fclassid"];
$mode = $aobj_context->mobj_data["mode"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$fclassid = $aobj_context->mobj_data["fclassid"];
$section = $aobj_context->mobj_data["section"];
$univcode = $_SESSION['FUNIVCODE'];
if($section == 'All'){
$cnd = "";
}else{
if($univcode == '052'){
$cnd = "and s.fsection = '{$section}'";
}else{
$cnd = "and s.fsection = '{$section}'";
}
}
$cnd1 = "";
$cnd2 = "";
$cnd3 = "and s.fexamno = '{$sem}'";
if($mode == 'Improvement')
{
$cnd1 = "inner join regfee r on s.fregno = r.fregno and r.FSUBCODE = '{$sub}'";
$cnd3 = "";
}
$orderby = "order by s.fregno";
if($univcode == '049' || $univcode == '097')
$orderby = "order by s.fname";
if($univcode != '021' && $mode != 'Improvement' && $univcode != '098' && $univcode != 'P023' && $univcode != 'P005' )
{
$query = "select count(*) as cnt from regcanddet where fcollcode = '{$collcode}'
and fdegree = '{$degreecode}' and fexamno = '{$sem}' and fsubcode = left('{$sub}',4)";
$res1 = $aobj_context->mobj_db->GetRow($query);
if($res1['cnt'] > 0)
{
}else
{
$data['msg'] = 'Subjects are not attached. kindly do subject registration';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
if($univcode == '021' || $univcode == '098' || $univcode == 'P023' || $univcode == 'P005')
{
$query = "select distinct ifnull(s.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
if(ifnull(a.fregno,'') <> '' ,'T','F') as fstatus
from student s
{$cnd1}
left join attendsum a on s.fregno = a.fregno
and s.fdegree = a.fdegree
and s.fexamno = a.fexamno
and s.fcollcode = a.fcollcode
and a.fclassid = '{$classname}'
where s.fdegree = '{$degreecode}'
and s.FCOLLCODE = '{$collcode}'
and ifnull(s.fdeleted,'') <> 'T'
$cnd
$cnd3
{$orderby}";
}else if($mode == 'Improvement')
{
$query = "select distinct ifnull(s.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
if(ifnull(a.fregno,'') <> '' ,'T','F') as fstatus
from student s
{$cnd1}
left join attendsum a on s.fregno = a.fregno and s.fdegree = a.fdegree
and s.fexamno = a.fexamno
and s.fcollcode = a.fcollcode
and a.fclassid = '{$classname}'
where s.fdegree = '{$degreecode}'
and s.FCOLLCODE = '{$collcode}'
and ifnull(s.fdeleted,'') <> 'T'
$cnd
{$orderby}";
}
else
{
if($univcode == '097')
{
$query = "select distinct ifnull(s.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
if(ifnull(a.fregno,'') <> '' ,'T','F') as fstatus
from student s
inner join regcanddet cd on s.fregno = cd.fregno
and cd.fdegree = s.fdegree and cd.fcollcode = s.fcollcode
inner join regcandsum cs on cd.fregno = cs.fregno
{$cnd1}
left join attendsum a on s.fregno = a.fregno and s.fdegree = a.fdegree and s.fexamno = a.fexamno
and s.fcollcode = a.fcollcode
and a.fclassid = '{$classname}'
where s.fdegree = '{$degreecode}'
and s.FCOLLCODE = '{$collcode}'
and left(cd.fsubcode,4) = left('{$sub}',4)
and ifnull(s.fdeleted,'') <> 'T'
and ifnull(cs.ffreez,'') = 'T'
{$cnd3}
$cnd
{$orderby}";
}else
{
$query = "select distinct ifnull(s.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
if(ifnull(a.fregno,'') <> '' ,'T','F') as fstatus
from student s
inner join regcanddet cd on s.fregno = cd.fregno
and cd.fdegree = s.fdegree and cd.fcollcode = s.fcollcode
{$cnd1}
left join attendsum a on s.fregno = a.fregno and s.fdegree = a.fdegree and s.fexamno = a.fexamno
and s.fcollcode = a.fcollcode
and a.fclassid = '{$classname}'
where s.fdegree = '{$degreecode}'
and s.FCOLLCODE = '{$collcode}'
and left(cd.fsubcode,4) = left('{$sub}',4)
and ifnull(s.fdeleted,'') <> 'T'
{$cnd3}
$cnd
{$orderby}";
}
}
// var_dump($query);die();
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'No Data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function savecreateclass($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$univcode = $_SESSION['FUNIVCODE'];
include("error_log.php");
$usr = $_SESSION['usr'];
$mob = $_SESSION['FMOBILE'];
$degreecode = $aobj_context->mobj_data["degree"];
$sem = $aobj_context->mobj_data["sem"];
$sub = $aobj_context->mobj_data["sub"];
$mode = $aobj_context->mobj_data["mode"];
$classname = $aobj_context->mobj_data["classname"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$fclassid = $aobj_context->mobj_data["fclassid"];
$section = $aobj_context->mobj_data["section"];
$_data = $aobj_context->mobj_data["data"];
$data = json_decode($_data,true);
$secCond = "";
if($univcode == "049"){
if($section === "All" || $section === ""){
$data['msg'] = 'select the section';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
$secCond = "and fsection='{$section}'";
}
$qry="select distinct ifnull(fclassid, '')as fclassid from attendsum where fsubcode='{$sub}'
and fteachcode='{$teachcode}' and fdegree = '{$degreecode}'";
$res = $aobj_context->mobj_db->GetRow($qry);
// if(count($res)===1 && $res['fclassid'] != $fclassid){
// $data['msg'] = 'Subject already added to the different classnames';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// return;
// }
// and fdegree = '{$degreecode}'
$qry="select ifnull(fclassid, '')as fclassid from attendsum
where fteachcode='{$teachcode}' and fsubcode='{$sub}' and fexamno='{$sem}'
{$secCond}";
$res = $aobj_context->mobj_db->GetRow($qry);
// if(count($res)===1 && $res['fclassid'] !== $fclassid){
// $data['msg'] = 'Students already added to the different classname';
// echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
// return;
// }
$qrtype = "select ifnull(fatyear,'') as fyear,ifnull(fatexamtype,'') as fexamtype,
FMEYEAR, FMEEXAMTYP
from degree
where FDEGREE = '{$degreecode}' and FEXAMNO = '{$sem}'";
$resqrtype = $aobj_context->mobj_db->GetRow($qrtype);
$fyear = $resqrtype['fyear'];
$fexamtype = $resqrtype['fexamtype'];
$FMEYEAR = $resqrtype['FMEYEAR'];
$FMEEXAMTYP = $resqrtype['FMEEXAMTYP'];
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip_address = $_SERVER['HTTP_CLIENT_IP'];
}
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip_address = $_SERVER['REMOTE_ADDR'];
}
$univcode = $_SESSION['FUNIVCODE'];
$mob = $_SESSION['FMOBILE'];
$usr = $_SESSION['usr'];
$college_code = $_SESSION['collcode'];
foreach($data as $key => $val){
$regno = $val['regno'];
if($val['classid'] == 'T'){
$str = "ADD STUDENTS TO CLASS: CLASSID : $fclassid, THEACHERCODE : $teachcode, REGNO: $regno,SUBJECT : $sub";
$remark = $str;
$enttype = "ATTA";
$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
$Insertquery = "insert ignore into attendsum (fclassid,fcreatedate,fteachcode,fcollcode,fdegree,fexamno,fsubcode,fclassname,fregno,fyear,fexamtype,fsection,fmode,fdeleted)
values('{$fclassid}',now(),'{$teachcode}','{$collcode}','{$degreecode}','{$sem}','{$sub}','{$classname}','{$val['regno']}','{$fyear}','{$fexamtype}','{$section}','{$mode}','F')";
$resupdquery = $aobj_context->mobj_db->Execute($Insertquery);
}else{
$str = "DELETE STUDENTS TO CLASS: CLASSID : $fclassid, THEACHERCODE : $teachcode, REGNO : $regno,SUBJECT : $sub";
$remark = $str;
$enttype = "ATTD";
$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
$updquery = "DELETE FROM attendsum
WHERE fregno='{$val['regno']}'
and fclassid = '{$fclassid}'
and fteachcode = '{$teachcode}'
and fcollcode = '{$collcode}'
and fdegree = '{$degreecode}'
and fexamno = '{$sem}'
and fsubcode = '{$sub}'
and fclassname = '{$classname}'
and fsection = '{$section}'";
$resupdquery = $aobj_context->mobj_db->Execute($updquery);
// $Insertquery = "insert ignore into marksint(fcollcode,fexamno,fdegree,fregno,fsubcode,fyear,fexamtype)
// select a.fcollcode,a.fexamno,a.fdegree,a.fregno,concat(s.fcsubcode,s.fsubcode),'{$FMEYEAR}','{$FMEEXAMTYP}' from attendsum a
// inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno
// inner join subdet s on a.fdegree = s.fdegree and s.fexamno = a.fexamno
// and left(s.fcsubcode,4) = left(a.fsubcode,4)
// where d.fexamno = '{$sem}'
// and d.fdegree = '{$degreecode}'";
// $res = $aobj_context->mobj_db->Execute($Insertquery);
// $Insertquery = "INSERT IGNORE INTO attend(FDEGREE, FEXAMNO, FCOLLCODE, fregno, FSUBCODE, FYEAR, FEXAMTYPE,FCREATEDATE)
// SELECT DISTINCT a.FDEGREE, a.FEXAMNO, a.FCOLLCODE,a.fregno, s.FcSUBCODE, '{$FMEYEAR}','{$FMEEXAMTYP}',now()
// FROM subject s
// INNER JOIN attendsum a ON a.fdegree = s.fdegree
// AND a.fsubcode = s.fcsubcode
// WHERE a.fdegree LIKE '{$degreecode}'
// AND a.fexamno = '{$sem}'
// GROUP BY a.FDEGREE,a.fregno,s.FSUBCODE";
// $res = $aobj_context->mobj_db->Execute($Insertquery);
}
}
$Insertquery = "insert ignore into marksint(fcollcode,fexamno,fdegree,fregno,fsubcode,fyear,fexamtype)
select a.fcollcode,a.fexamno,a.fdegree,a.fregno,concat(s.fcsubcode,s.fsubcode),'{$FMEYEAR}','{$FMEEXAMTYP}' from attendsum a
inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno
inner join subdet s on a.fdegree = s.fdegree and s.fexamno = a.fexamno
and left(s.fcsubcode,4) = left(a.fsubcode,4)
where d.fexamno = '{$sem}'
and d.fdegree = '{$degreecode}'";
// var_dump($Insertquery);die();
$res = $aobj_context->mobj_db->Execute($Insertquery);
$Insertquery = "INSERT IGNORE INTO attend(FDEGREE, FEXAMNO, FCOLLCODE, fregno, FSUBCODE, FYEAR, FEXAMTYPE,FCREATEDATE)
SELECT DISTINCT a.FDEGREE, a.FEXAMNO, a.FCOLLCODE,a.fregno, s.Fcsubcode, '{$FMEYEAR}','{$FMEEXAMTYP}',now()
FROM subject s
INNER JOIN attendsum a ON a.fdegree = s.fdegree
AND a.fsubcode = s.fcsubcode
WHERE a.fdegree LIKE '{$degreecode}'
AND a.fexamno = '{$sem}'
GROUP BY a.FDEGREE,a.fregno,s.FSUBCODE";
$res = $aobj_context->mobj_db->Execute($Insertquery);
if($resupdquery)
{
$data['msg'] = 'Save Successfully...!';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
}
else
{
$data['msg'] = 'Faile to Save';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function viewStuds($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$usertype = $_SESSION['user_type'];
$usr = $_SESSION['usr'];
$cnd = '';
if(strtolower($usertype) == 'user' && strtolower($_SESSION['super_wiser']) !== 't')
{
$cnd = "and a.fteachcode = '{$usr}'";
}
$query = "select ifnull(a.fteachcode,'') as fteachcode,ifnull(m.fteachname,'') as fteachname,
ifnull(a.fclassid,'') as fclassid,
ifnull(ac.fclassname,'') as fclassname,
count(a.fclassid) as count from attendsum a
inner join masteach m on m.fteachcode = a.fteachcode
and m.fcollcode = a.fcollcode
left join attclass ac on a.fclassid = ac.fclassid
where a.fcollcode = '{$collcode}' $cnd
group by a.fclassid";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function viewAddClassstuds($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$teachcode = $aobj_context->mobj_data["teachcode"];
$fclassid = $aobj_context->mobj_data["fclassid"];
$usertype = $_SESSION['user_type'];
$usr = $_SESSION['usr'];
$cnd = '';
if(strtolower($usertype) == 'user' && strtolower($_SESSION['super_wiser']) !== 't')
{
$cnd = "and a.fteachcode = '{$usr}'";
}
$query = "select ifnull(a.fclassid,'') as fclassid ,
ifnull(a.fregno,'') as fregno,ifnull(s.FNAME,'') as fname,
ifnull(a.fdeleted, '')as fdeleted
from attendsum a
inner join student s on a.fregno = s.fregno
where a.fcollcode = '{$collcode}' and a.fclassid = '{$fclassid}' $cnd";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
?>
|