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.85.233
<?php
function loadTeaherList($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$funivcode = $_SESSION['FUNIVCODE'];
$usertype = $_SESSION['user_type'];
$super_wiser = $_SESSION['super_wiser'];
$usr = $_SESSION['usr'];
$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);
// //var_dump($query);
// $teachcode = $res['fteachcode'];
$cnd = "and fteachcode = '{$usr}'";
}
if($funivcode == "097"){
$cnd1="fteachname";
}else{
$cnd1="fteachcode";
}
$query = "select fteachcode,fteachname from masteach
where fcollcode = '{$collcode}'
{$cnd}
order by {$cnd1}";
$result = $aobj_context->mobj_db->GetAll($query);
$query = "select FDEPTCODE,FDEPTNAME from masdept
where ifnull(fdeleted,'') <> 'T'
order by FDEPTCODE";
$res1 = $aobj_context->mobj_db->GetAll($query);
if($result)
{
$arr['masteach'] = $result;
$arr['masdept'] = $res1;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
function loadteachdept($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$usertype = $_SESSION['user_type'];
$super_wiser = $_SESSION['super_wiser'];
$usr = $_SESSION['usr'];
$dept = $aobj_context->mobj_data["dept"];
$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}'";
}
$cnd2 = "and fdeptcode = '{$dept}'";
if($dept == 'All')
$cnd2 = "";
$query = "select fteachcode,fteachname from masteach
where fcollcode = '{$collcode}'
{$cnd}
{$cnd2}
order by fteachcode";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
$arr['masteach'] = $result;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
function viewAttClassCreate($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$teachfrom = $aobj_context->mobj_data["teachfrom"];
$teachto = $aobj_context->mobj_data["teachto"];
$usertype = $_SESSION['user_type'];
$super_wiser = $_SESSION['super_wiser'];
$usr = $_SESSION['usr'];
$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);
// //var_dump($query);
// $teachcode = $res['fteachcode'];
$cnd = "and a.fteachcode = '{$usr}'";
}
$query = "select concat(a.fteachcode,' - ',m.fteachname) as fteachname,
a.fclassname, a.fclassid,a.fteachcode
from attclass a inner join masteach m on a.fteachcode = m.fteachcode
and m.fcollcode = a.fcollcode
where a.fcollcode = '{$collcode}'
{$cnd}
and a.fteachcode between '{$teachfrom}' and '{$teachto}'
and ifnull(a.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 saveAttClass($aobj_context)
{
include("error_log.php");
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$teachcode = $aobj_context->mobj_data["teachcode"];
$classname = $aobj_context->mobj_data["classname"];
$classid = $aobj_context->mobj_data["classid"];
$univcode = $_SESSION['FUNIVCODE'];
$mob = $_SESSION['FMOBILE'];
$usr = $_SESSION['usr'];
$college_code = $_SESSION['collcode'];
if($classid == '')
{
$str = "CREATE CLASS: THEACHERCODE : $teachcode, COLLCODE: $collcode, CLASSNAME : $classname";
$remark = $str;
$enttype = "ATTC";
$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
$Insertquery = "insert into attclass (fteachcode,fcollcode,fclassname)
values('{$teachcode}','{$collcode}','{$classname}')";
$result = $aobj_context->mobj_db->Execute($Insertquery);
}else
{
$str = "UPDATE CLASS: THEACHERCODE : $teachcode, COLLCODE: $collcode, CLASSNAME : $classname";
$remark = $str;
$enttype = "ATTU";
$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
$upd = "update attclass set fclassname = '{$classname}',fupddate = now()
where fteachcode = '{$teachcode}'
and fclassid = '{$classid}'
and fcollcode ='{$collcode}'";
$result = $aobj_context->mobj_db->Execute($upd);
}
if($result)
{
$data = "Updated successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
}
else
{
$data['msg'] = 'Faile to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
function deleteAttClass($aobj_context)
{
include("error_log.php");
$collcode = $_SESSION['collcode'];
$teachcode = $aobj_context->mobj_data["teachcode"];
$classid = $aobj_context->mobj_data["classid"];
$univcode = $_SESSION['FUNIVCODE'];
$mob = $_SESSION['FMOBILE'];
$usr = $_SESSION['usr'];
$college_code = $_SESSION['collcode'];
$str = "DELETE CLASS: THEACHERCODE : $teachcode, COLLCODE: $collcode, CLASSNAME : $classid";
$remark = $str;
$enttype = "ATTDC";
$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);
$upd = "update attclass set fdeleted = 'T'
where fteachcode = '{$teachcode}'
and fclassid = '{$classid}'
and fcollcode ='{$collcode}'";
$result = $aobj_context->mobj_db->Execute($upd);
$updAttsum = "update attendsum set fdeleted = 'T'
where fclassid = '{$classid}'
and fcollcode ='{$collcode}'";
$res = $aobj_context->mobj_db->Execute($updAttsum);
if($result)
{
$data = "Deleted successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
}
else
{
$data = 'try after some time';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
}
}
?>
|