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.118.138.113
<?php
function admboardexaminers($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$board = $aobj_context->mobj_data['board'];
$qpcode = $aobj_context->mobj_data['qpcode'];
$query1 = "SELECT teachers.fteachcode, teachers.fteachname, IF(teachsub.fboard = '{$board}' AND teachsub.fqpcode = '{$qpcode}',(IF(IFNULL(fselected,'') = 'T','Checked','')),'') AS selected FROM teachers LEFT OUTER JOIN teachsub
ON teachers.fteachcode = teachsub.fteachcode AND teachers.fboard = teachsub.fboard AND teachsub.fqpcode = '{$qpcode}' ";
$rst1 = $aobj_context->mobj_db->GetAll($query1);
$examinerdetails = '';
$slno = 1;
foreach($rst1 as $exmkey=>$exmval)
{
$examinerdetails .= "<tr> ";
$examinerdetails .= '<td style="width:10%;float:left;" align="center">'.$slno.'</td>';
$examinerdetails .= '<td style="width:15%;float:left;" align="center"><input type="hidden" id="hteachcode'.$slno.'" name = "idtyteach" value="'.$exmval['fteachcode'].'">'.$exmval['fteachcode'].'</td>';
$examinerdetails .= '<td style="width:60%;float:left;" align="left">'.$exmval['fteachname'].'</td>';
$examinerdetails .= '<td style="width:15%;float:left;" align="center"><input style="margin:-2px 0px;" type="checkbox" '.$exmval['selected'].' value = "'.$exmval['fteachcode'].'" id="teachsel'.$slno.'" ></td>';
$examinerdetails .= "</tr> ";
++$slno;
}
echo $aobj_context->mobj_output->ToJSONEnvelope($examinerdetails,0,"Success");
return true;
}
function admsaveboardexaminers($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
include_once("/JSON.php");
session_start();
$json = new Services_JSON();
$board = $aobj_context->mobj_data['board'];
$qpcode = $aobj_context->mobj_data['qpcode'];
$brdexmarrjson = stripslashes($aobj_context->mobj_data["brdexminersarr"]);
$examinerarrdata = $json->decode($brdexmarrjson);
$examinersarr = get_object_vars($examinerarrdata);
for($k=1;$k<=count($examinersarr);$k++)
{
$query2 = "select * from teachsub
where fteachcode = '{$examinersarr[$k]->teachcode}' and fboard = '{$board}' and fqpcode = '{$qpcode}'";
$rst2 = $aobj_context->mobj_db->getRow($query2);
if($rst2)
{
$query = "update teachsub SET fselected = '{$examinersarr[$k]->selected}'
where fteachcode = '{$examinersarr[$k]->teachcode}' and fboard = '{$board}' and fqpcode = '{$qpcode}'";
$rst = $aobj_context->mobj_db->Execute($query);
}
else
{
$query3 = "insert into teachsub(fteachcode,fboard,fqpcode,fselected)
values('{$examinersarr[$k]->teachcode}','{$board}','{$qpcode}','{$examinersarr[$k]->selected}')";
$rst3 = $aobj_context->mobj_db->Execute($query3);
}
}
$succ_msg = "Updated successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($succ_msg,0,"Success");
return true;
}
?>
|