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.216.208.243
Current Path : /var/www/oasis/src/ |
| Current File : /var/www/oasis/src/updatetimetable.php |
<?php
function loadtimetabledegree($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$query = "select distinct ifnull(d.FDEGREE,'') as fdegree,
ifnull(d.FDESCPN,'') as fdescpn
from degree d inner join colldeg c on d.fdegree = c.fdegree
where ifnull(c.FDELETED,'') <> 'T'
and c.fcollcode = '{$collcode}'";
$result = $aobj_context->mobj_db->GetAll($query);
$qry = "select ifnull(FSUBCODE,'') as fsubcode,ifnull(FSUBNAME,'') as fsubname
from subject
group by FSUBCODE";
$result1 = $aobj_context->mobj_db->GetAll($qry);
$qry1 = "select ifnull(fteachcode,'') as fteachcode,ifnull(fteachname,'') as fteachname from
masteach
where fcollcode = '{$collcode}'";
$result2 = $aobj_context->mobj_db->GetAll($qry1);
$qry3 = "select ifnull(c.fdegree,'') as fdegree,ifnull(c.fsem,'') as fsem,
ifnull(c.fsection,'') as fsection,ifnull(c.fday,'') as fday,
ifnull(c.fperiod,'') as fperiod,ifnull(c.fnoclass,'') as fnoclass,
ifnull(c.fsubcode,'') as fsubcode,ifnull(c.fteachcode,'') as fteachcode,
ifnull(m.fteachname,'') as fteachname,ifnull(s.fsubname,'') as fsubname
from calsstimetable c
inner join subject s on s.fsubcode = c.fsubcode
inner join masteach m on m.fteachcode = c.fteachcode
group by c.fteachcode";
$result3 = $aobj_context->mobj_db->GetAll($qry3);
$arr['deg'] = $result;
$arr['teach'] = $result2;
$arr['tab'] = $result3;
if($result){
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"));
return $result;
}else{
$arr['msg'] = "No data found..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return $arr;
}
}
function loadtimetablesemname($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degree = $aobj_context->mobj_data['degree'];
$query = "select ifnull(FEXAMNO,'') as fexamno,ifnull(FEXAMNAME,'') as fexamname
from degree
where FDEGREE = '{$degree}'";
$result = $aobj_context->mobj_db->GetAll($query);
if($result){
echo($aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"));
return $result;
}else{
$arr['msg'] = "No data found..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return $arr;
}
}
function loadtimetablesection($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degree = $aobj_context->mobj_data['degree'];
$sem = $aobj_context->mobj_data['sem'];
$query = "select distinct ifnull(FSECTION,'') as fsection
from student
where fcollcode = '{$collcode}' and FDEGREE = '{$degree}' and FEXAMNO = '{$sem}' and ifnull(FSECTION,'') <> ''";
$result = $aobj_context->mobj_db->GetAll($query);
if($result){
echo($aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"));
return $result;
}else{
$arr['msg'] = "No data found..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return $arr;
}
}
function saveClassTimeTable($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degree = $aobj_context->mobj_data['degree'];
$section = $aobj_context->mobj_data['section'];
$day = $aobj_context->mobj_data['day'];
$period = $aobj_context->mobj_data['period'];
$noclass = $aobj_context->mobj_data['noclass'];
$subject = $aobj_context->mobj_data['subject'];
$teacher = $aobj_context->mobj_data['teacher'];
$sem = $aobj_context->mobj_data['sem'];
$time = $aobj_context->mobj_data['time'];
$usr = $_SESSION['usr'];
$editqry = "select * from calsstimetable
where fdegree = '{$degree}' and fsem = '{$sem}' and fsection = '{$section}'
and fday = '{$day}' and fperiod = '{$period}' and fnoclass = '{$noclass}'
and fcollcode = '{$collcode}'";
$result2 = $aobj_context->mobj_db->GetRow($editqry);
if(count($result2) == 0){
$query = "insert into calsstimetable(fdegree,fsem,fsection,fday,fperiod,fnoclass,fsubcode,fteachcode,fcreateddate,fcreatedusr,ftime,fcollcode)
values ('{$degree}','{$sem}','{$section}','{$day}','{$period}','{$noclass}','{$subject}','{$teacher}',now(),'{$usr}','{$time}','{$collcode}')";
$result = $aobj_context->mobj_db->Execute($query);
if($result){
$arr['msg'] = "Saved Successfully...!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"));
return $result;
}else{
$arr['msg'] = "Failed to Save..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return $arr;
}
}else{
$query1 = "update calsstimetable set
fsubcode = '{$subject}', fteachcode = '{$teacher}',
ftime = '{$time}'
where fdegree = '{$degree}' and fsem = '{$sem}' and fsection = '{$section}' and fday = '{$day}'
and fperiod = '{$period}' and fnoclass = '{$noclass}'";
$result1 = $aobj_context->mobj_db->Execute($query1);
if($result1){
$arr['msg'] = "Updated Successfully...!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"));
return;
}else{
$arr['msg'] = "Failed to update..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return;
}
}
}
function viewTimeTableData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degree = $aobj_context->mobj_data['degree'];
$section = $aobj_context->mobj_data['section'];
$sem = $aobj_context->mobj_data['sem'];
$qry = "select ifnull(FSUBCODE,'') as fsubcode,ifnull(FSUBNAME,'') as fsubname
from subject where fdegree = '{$degree}'
and fexamno ='{$sem}'
group by FSUBCODE";
$result1 = $aobj_context->mobj_db->GetAll($qry);
$qry1 = "select ifnull(fteachcode,'') as fteachcode,ifnull(fteachname,'') as fteachname from
masteach
where fcollcode = '{$collcode}'";
$result2 = $aobj_context->mobj_db->GetAll($qry1);
$qry3 = "select ifnull(c.fdegree,'') as fdegree,ifnull(c.fsem,'') as fsem,
ifnull(c.fsection,'') as fsection,ifnull(c.fday,'') as fday,
ifnull(c.fperiod,'') as fperiod,ifnull(c.fnoclass,'') as fnoclass,
ifnull(c.fsubcode,'') as fsubcode,ifnull(c.fteachcode,'') as fteachcode,
ifnull(m.fteachname,'') as fteachname,ifnull(s.fsubname,'') as fsubname,
ifnull(c.ftime,'') as ftime
from calsstimetable c
inner join subject s on s.fsubcode = c.fsubcode and c.fdegree = s.fdegree
and c.fsem = s.fexamno
inner join masteach m on m.fteachcode = c.fteachcode
where c.fdegree = '{$degree}' and c.fsection = '{$section}'
and c.fsem = '{$sem}'
and c.fcollcode = '{$collcode}'
group by c.fdegree,c.fsem,c.fsection,c.fday,c.fperiod,c.fnoclass
order by c.fdegree,c.fsem,c.fsection,c.fday,c.fperiod,c.fnoclass";
$result3 = $aobj_context->mobj_db->GetAll($qry3);
$arr['sub'] = $result1;
$arr['teach'] = $result2;
$arr['tab'] = $result3;
if($result1){
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"));
return $result;
}else{
$arr['msg'] = "Failed to load..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return $arr;
}
}
function deleteClassTimeTable($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degree = $aobj_context->mobj_data['degree'];
$section = $aobj_context->mobj_data['section'];
$sem = $aobj_context->mobj_data['sem'];
$day = $aobj_context->mobj_data['day'];
$period = $aobj_context->mobj_data['period'];
$noclass = $aobj_context->mobj_data['noclass'];
$qry = "delete from calsstimetable
where fdegree = '{$degree}' and fsem = '{$sem}' and fsection = '{$section}' and fday = '{$day}' and fperiod = '{$period}' and fnoclass = '{$noclass}'";
// var_dump($qry);
// die();
$result = $aobj_context->mobj_db->Execute($qry);
if($result){
$arr['msg'] = "Deleted Successfully...!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"));
return;
}else{
$arr['msg'] = "Failed to Delete..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return;
}
}
function getTtDegSem($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degree = $aobj_context->mobj_data['degree'];
$query = "select distinct fexamno,fexamname from degree
where fdegree = '{$degree}'";
$result = $aobj_context->mobj_db->GetAll($query);
if($result)
{
$data['semdet'] = $result;
echo($aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"));
return $result;
}else
{
$arr['msg'] = "No data found..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return $arr;
}
}
?>
|