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.145.69.185
<?php
function loaddayteachcode($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'];
$cnd = '';
//var_dump($usertype);
if(strtolower($usertype) == 'user' && $super_wiser != 'T')
{
$cnd = "and m.fteachcode = '{$usr}'";
}
$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}";
$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'];
$usr = $_SESSION['usr'];
$cnd = '';
//var_dump($usertype);
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);
// //var_dump($query);
// $teachcode = $res['fteachcode'];
$cnd = "and m.fteachcode = '{$usr}'";
}
$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}";
$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 = '';
//var_dump($usertype);
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);
// //var_dump($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'];
$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"];
$cnd = "and d.FEXAMNO = a.FEXAMNO";
if($mode == 'Improvement')
{
$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'];
$query = "select ifnull(s.FCSUBCODE,'') as fsubcode,
concat(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'
group by s.FSUBCODE";
$result = $aobj_context->mobj_db->GetAll($query);
$query1 = "select distinct ifnull(FSECTION,'') as fsection
from student
where fcollcode = '{$collcode}' and FDEGREE = '{$degreecode}' and ifnull(FSECTION,'') <> ''";
$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"];
if($section == 'All'){
$cnd = "";
}else{
$cnd = "and s.fsection = '{$section}'";
}
$cnd1 = "";
$cnd2 = "";
if($mode == 'Improvement')
{
$cnd1 = "inner join regfee r on s.fregno = r.fregno and r.FSUBCODE = '{$sub}'";
}
$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
order by s.fname";
//var_dump($query);
$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 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);
$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'];
$qryGetElement = "select distinct felement, fqpcode from tdvs_qpcopo where fdegree='{$degreecode}'
and fexamno='{$sem}'";
$resGetElement = $aobj_context->mobj_db->GetAll($qryGetElement);
foreach($resGetElement as $value){
$subcode = $value['fqpcode'];
$element = $value['felement'];
foreach($data as $key => $val){
$regno = $val['regno'];
if($val['classid'] == 'T'){
$str = "ADD STUDENTS TO CLASS: CLASSID : $fclassid, THEACHERCODE : $teachcode, REGNO: $regno,SUBJECT : $subcode";
$remark = $str;
$enttype = "ATTA";
$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
$Insertquery = "insert ignore into tdvs_copomarks (fclassid,fteachcode,fcollcode,fdegree,fexamno,fsubcode,fclassname,fregno,fyear,fexamtype,fsection,fmode, fvalno, felement)
values('{$fclassid}','{$teachcode}','{$collcode}','{$degreecode}','{$sem}','{$subcode}','{$classname}','{$val['regno']}','{$fyear}','{$fexamtype}','{$section}','{$mode}', '1', '{$element}')";
$resupdquery = $aobj_context->mobj_db->Execute($Insertquery);
$Insertquery1 = "insert ignore into attendsum (fclassid,fcreatedate,fteachcode,fcollcode,fdegree,fexamno,fsubcode,fclassname,fregno,fyear,fexamtype,fsection,fmode, fvalno, felement)
values('{$fclassid}',now(),'{$teachcode}','{$collcode}','{$degreecode}','{$sem}','{$subcode}','{$classname}','{$val['regno']}','{$fyear}','{$fexamtype}','{$section}','{$mode}', '1', '{$element}')";
$resupdquery1 = $aobj_context->mobj_db->Execute($Insertquery1);
}else{
$str = "DELETE STUDENTS TO CLASS: CLASSID : $fclassid, THEACHERCODE : $teachcode, REGNO : $regno,SUBJECT : $subcode";
$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 = '{$subcode}'
and fclassname = '{$classname}'
and fsection = '{$section}'";
$updquery = "DELETE FROM tdvs_copomarks
WHERE fregno='{$val['regno']}'
and fclassid = '{$fclassid}'
and fteachcode = '{$teachcode}'
and fcollcode = '{$collcode}'
and fdegree = '{$degreecode}'
and fexamno = '{$sem}'
and fsubcode = '{$subcode}'
and fclassname = '{$classname}'
and fsection = '{$section}'";
$resupdquery = $aobj_context->mobj_db->Execute($updquery);
}
}
}
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')
{
$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
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')
{
$cnd = "and a.fteachcode = '{$usr}'";
}
$query = "select ifnull(a.fclassid,'') as fclassid ,ifnull(a.fregno,'') as fregno,ifnull(s.FNAME,'') as fname
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");
}
}
?>
|