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.191.14.62
<?php
function loadTeaherList($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'];
$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 fteachcode,fteachname from masteach
where fcollcode = '{$collcode}'
{$cnd}
order by fteachcode";
// 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 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 = '';
//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 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);
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");
}
}
?>
|