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.141.192.174
<?php
function getLevel($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$fcurtype = $aobj_context->mobj_data["fcurtype"];
$query = "select distinct `FLEVEL`,FLEVNAME as FLELNAME from usertype
where fusertype > '{$fcurtype}'
and ifnull(flevname,'') <>''";
$result = $aobj_context->mobj_db->GetAll($query);
if ($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
} else {
$arr['msg'] = 'Something Went wrong';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
return;
}
function getDegGrpColl($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$fdeggrp = $aobj_context->mobj_data["fdeggrp"];
$fdegree = $aobj_context->req_body['fdegree'];
// $fdegree = implode("','",$fdegree);
$flevel = $aobj_context->req_body['flevel'];
$fcurtype = $aobj_context->req_body['fcurtype'];
$fuserid = $aobj_context->req_body['fuserid'];
$fcollcode = $aobj_context->req_body['fcollcode'];
$cnd = "";
if($fcurtype == '600' || $fcurtype == '500')
$cnd = "and c.fcollcode = '{$fcollcode}'";
$query = "select distinct c.fcollcode,concat(c.fcollname,', ',c.ftown) as college_name
from college c
inner join student s on c.fcollcode = s.fcollcode
where s.fdegree in('$fdegree')
{$cnd}";
$result = $aobj_context->pobj_db->GetAll($query);
if($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
} else {
$arr['msg'] = 'Something Went wrong';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
return;
}
function getDegreeGrps($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$deggrp = $aobj_context->mobj_data["deggrp"];
$flevel = $aobj_context->mobj_data["flevel"];
$fcurtype = $aobj_context->mobj_data["fcurtype"];
$fuserid = $aobj_context->mobj_data["fuserid"];
$fcollcode = $aobj_context->mobj_data["fcollcode"];
$cnd = "";
if($fcurtype == '600' || $fcurtype == '500')
$cnd = "and s.fcollcode = '{$fcollcode}'";
$query = "select distinct d.fdegree, concat(d.fdegree,' - ',d.fdescpn) as fdescpn from degree d
inner join student s on d.fdegree = s.fdegree and d.fexamno = 'A'
where ifnull(s.fdeleted,'') <> 'T'
and d.fdeggrp ='{$deggrp}'
{$cnd}";
// var_dump($query);
$result = $aobj_context->pobj_db->GetAll($query);
if ($result)
{
$arr['degrees'] = $result;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
} else {
$arr['msg'] = 'Something Went wrong';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
}
function submitFromData($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$funivcode = $aobj_context->mobj_data["univcode"];
$flevel = $aobj_context->req_body['flevel'];
$fgrptype = $aobj_context->req_body['fgrptype'];
$fdeggrp = $aobj_context->req_body['fdeggrp'];
$fdegree = $aobj_context->req_body['fdegree'];
// $fdegree = implode("','",$fdegree);
// var_dump($fdegree);
$fcollcode = $aobj_context->req_body['fcollcode'];
// $fcollcode = implode("','",$fcollcode);
// var_dump($fcollcode);
if($flevel == 'Student')
{
$cnd1 = "and s.fcollcode in('$fcollcode')";
if($fcollcode == 'All')
{
$cnd1 = "";
}
$cnd2 = "and s.fdegree in('$fdegree')";
if($fdegree == 'All')
{
$cnd2 = "";
}
$query = "select s.fregno as fcode ,s.fcollcode,s.fdegree,s.fname from student s
where ifnull(s.fdeleted,'') <> 'T'
and fregno in(select distinct fregno from logisys3_comexam.masuser
where funivcode = '{$funivcode}' and factive = 'T'
and instr(fusertype,'900*'))
{$cnd1}
{$cnd2}
order by s.fregno,s.fcollcode,s.fdegree,s.fname";
// var_dump($query);
}else if($flevel =='Teacher')
{
$cnd1 = "and s.fcollcode in('$fcollcode')";
if($fcollcode == 'All')
{
$cnd1 = "";
}
$query = "select distinct s.fteachcode as fcode,s.fcollcode,s.fteachname as fname from masteach s
where ifnull(s.fdeleted,'') <> 'T'
and s.fteachcode in(select distinct fregno from logisys3_comexam.masuser
where funivcode = '{$funivcode}' and factive = 'T'
and instr(fusertype,'600*'))
{$cnd1}
order by s.fcollcode,s.fteachcode,s.fteachname";
}else if($flevel =='Principal')
{
$query = "select s.fteachcode as fcode,s.fcollcode,s.fteachname as fname from masteach s
where ifnull(s.fdeleted,'') <> 'T'
and s.fteachcode in(select distinct fregno from logisys3_comexam.masuser
where funivcode = '{$funivcode}' and factive = 'T'
and instr(fusertype,'500*'))
order by s.fcollcode,s.fteachcode,s.fteachname";
}else if($flevel =='Statutory')
{
}
// var_dump($query);
// return;
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($result);
if ($result)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
} else {
$arr['msg'] = 'Something Went wrong';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
}
return;
}
function addMembersToGroup($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$funivcode = $aobj_context->mobj_data["univcode"];
$flevel = $aobj_context->req_body['flevel'];
$fgrptype = $aobj_context->req_body['fgrptype'];
$fdeggrp = $aobj_context->req_body['fdeggrp'];
$groupId = $aobj_context->req_body['groupId'];
$fdegree = $aobj_context->req_body['fdegree'];
$fcollcode = $aobj_context->req_body['fcollcode'];
$members = $aobj_context->req_body['members'];
// var_dump($members);
if($fgrptype == 'C') {
$str = [];
foreach($members as $key => $value){
if($value['checked'] == "T"){
array_push($str, $value['fcode']);
}
}
$mem = implode("','", $str);
$query = "update logisys3_comexam.masuser
set fgrp = if(instr(ifnull(fgrp,'*'), '{$groupId}*') > 0, fgrp, concat(ifnull(fgrp,'*'), '{$groupId}*'))
where fregno in ('{$mem}') and funivcode = '{$funivcode}'";
} else {
// $fcollcode = implode("','",$fcollcode);
$query = "";
if($flevel == 'Student') {
$cnd1 = "and s.fcollcode in('$fcollcode')";
if($fcollcode == 'All')
{
$cnd1 = "";
}
$cnd2 = "and s.fdegree in('$fdegree')";
if($fdegree == 'All')
{
$cnd2 = "";
}
$query = "update logisys3_comexam.masuser m, student s
set m.fgrp = if(instr(ifnull(fgrp,'*'), '{$groupId}*') > 0, fgrp, concat(ifnull(fgrp,'*'), '{$groupId}*'))
where m.fregno = s.fregno
{$cnd1}
{$cnd2}
and m.funivcode = '{$funivcode}'
and instr(m.fusertype,'900*')";
} else if( $flevel == 'Teacher') {
$cnd1 = "and s.fcollcode in('$fcollcode')";
if($fcollcode == 'All')
{
$cnd1 = "";
}
$query = "update logisys3_comexam.masuser m, masteach s
set m.fgrp = if(instr(ifnull(fgrp,'*'), '{$groupId}*') > 0, fgrp, concat(ifnull(fgrp,'*'), '{$groupId}*'))
where m.fregno = s.fteachcode
{$cnd1}
and m.funivcode = '{$funivcode}'
and instr(m.fusertype,'600*')";
}
else if($flevel =='Principal')
{
$cnd1 = "and s.fcollcode in('$fcollcode')";
if($fcollcode == 'All')
{
$cnd1 = "";
}
$query = "update logisys3_comexam.masuser m, masteach s
set m.fgrp = if(instr(ifnull(fgrp,'*'), '{$groupId}*') > 0, fgrp, concat(ifnull(fgrp,'*'), '{$groupId}*'))
where m.fregno = s.fteachcode
{$cnd1}
and m.funivcode = '{$funivcode}'
and instr(m.fusertype,'500*')";
}
}
$result = $aobj_context->pobj_db->Execute($query);
if (!$result && gettype($result) == 'boolean') {
$arr['msg'] = "Error while adding members to the group";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "Failure");
return;
}
// var_dump($result);
if ($result) {
$rows = $aobj_context->pobj_db->affected_rows();
$arr['msg'] = "$rows Members added to the group successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
return;
} else {
$arr['msg'] = "Error while adding members to the group";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
}
?>
|