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.139.234.68
Current Path : /var/www/oasis/src/ |
| Current File : /var/www/oasis/src/marksentryext.php |
<?php
function loadcopoqpcode($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$usr = $_SESSION['usr'];
$user_type = $_SESSION['usrtype'];
$qry1 = "select ifnull(sysusr,'') as fteachcode from s_sysdb
where college_code = '{$collcode}' and sysusr = '{$usr}'";
//var_dump($qry1);
$lobj1 = $aobj_context->mobj_db->GetRow($qry1);
if($user_type == '14' || $user_type == '40'){
$cnd = "";
}else{
$cnd = "where fteachcode = '{$lobj1['fteachcode']}'";
}
$query = "select ifnull(t.fsubcode,'') as fsubcode, concat(ifnull(FSUBNAME, ''),' - ',fssubname) as fsubname
from
tdvs_copomarks t
inner join
subject s on t.fsubcode = s.fqpcode
$cnd
group by t.fsubcode";
//var_dump($query);
$result = $aobj_context->mobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function loadcopopacketno($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$qpcode = $aobj_context->mobj_data["qpcode"];
$user_type = $_SESSION['usrtype'];
//var_dump($user_type);
$user = $_SESSION['usr'];
//$user_type = 40;
$cnd = "and t.fteachcode = '{$user}'";
if($user_type == '14' || $user_type == '40')
$cnd = "";
$qry = "select ifnull(t.fcollcode,'') as fcollcode from tdvs_copomarks t
where t.fsubcode = '{$qpcode}' {$cnd}
group by t.fcollcode";
$result = $aobj_context->mobj_db->GetAll($qry);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function loadcopovalno($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$qpcode = $aobj_context->mobj_data["qpcode"];
$packet = $aobj_context->mobj_data["packet"];
$qry = "select ifnull(fvalno,'') as fvalno from tdvs_copomarks
where fsubcode = '{$qpcode}' and fcollcode = '{$packet}'
group by fvalno";
$result = $aobj_context->mobj_db->GetAll($qry);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function viewmarksentryexternal($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$valno = $aobj_context->mobj_data["valno"];
$packet = $aobj_context->mobj_data["packet"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$collcode=$_SESSION['collcode'];
$query = "select fqpcode from subject where fdegree = '{$degree}' and fexamno = '{$examno}' and fcsubcode = '{$qpcode}'";
$res1 = $aobj_context->mobj_db->Getrow($query);
$fqpcode1 = $res1['fqpcode'];
$qry3 = "select fdegree,fexamno from tdvs_qpcopo where fqpcode = '{$qpcode}'";
$res3 = $aobj_context->mobj_db->Getrow($qry3);
$degree = $res3['fdegree'];
$examno = $res3['fexamno'];
$query = "select p.fqncode,pd.fqnno,p.fmaxmarks
from tdvs_qpcopo p
inner join tdvs_qptempdetl_copo pd on p.ftempcode = pd.ftempcode
and p.fpartcode = pd.fpartcode and p.fqncode = pd.fqncode
where p.fdegree = '{$degree}' and p.fexamno = '{$examno}'
and ifnull(p.fmaxmarks,0) >0
and p.fqpcode = '{$qpcode}'
order by pd.fqncode";
$res=$aobj_context->mobj_db->GetAll($query);
$oldqn = "";
$id = 14+count($res);
//var_dump($id);
$e_data.="<table id = 'showteachsub' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' >";
$e_data.="<thead style='position: sticky;top: 0;'>";
$e_data.="<th align='left' colspan='{$id}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Marks Entry</th>";
$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
$e_data.="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Sl.<br>No.</center></td>";
$e_data.="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Script No.</center></td>";
$e_data.="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Tot.<br>Marks</center></td>";
$e_data.="<td style='padding:2px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Online<br>Marks</center></td>";
$fileds = "";
$x =0;
$arry = [];
$qno = [];
$qnArr = [];
foreach($res as $value)
{
$splitvalue = explode(".",$value['fqnno']);
if($oldqn !== $splitvalue[0]){
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>
{$splitvalue[0]} Total
</td>";
$oldqn = $splitvalue[0];
array_push($qnArr, $splitvalue[0]);
$fileds .= "ifnull(".'fq'.$oldqn.",'-1') as ".'fq'.$oldqn.", ";
$arry[$x] = 'fq'.$oldqn;
$x++;
}
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>{$value['fqnno']}<br>({$value['fmaxmarks']})
<input type = 'hidden' value ='".$value['fmaxmarks']."' id = '$x".'qnmax'."'/>
</center></td>";
$fileds .= "ifnull(".'fq'.strtolower(str_replace(".","",$value['fqnno'])).",'-1') as ".'fq'.strtolower(str_replace(".","",$value['fqnno'])).", ";
$arry[$x] = 'fq'.strtolower(str_replace(".","",$value['fqnno']));
array_push($qno, $value['fqnno']);
$x++;
}
$e_data.="</tr>";
$e_data.="</thead>";
$query = "select $fileds fregno,ftotmarks,ifnull(fonlinetot,'') as fonlinetot
from tdvs_copomarks
where fcollcode = '{$packet}' and fvalno = '{$valno}'
and fsubcode = '{$qpcode}'";
$res2= $aobj_context->mobj_db->GetAll($query);
$i = 1;
$oldqn = "";
// var_dump($arry);die();
// $uniqueNumbers = array_unique(array_map(function($item) {
// return (int)filter_var($item, FILTER_SANITIZE_NUMBER_INT);
// }, $inputArray));
foreach($res2 as $val)
{
$e_data.="<tr id = 'td_$i'>";
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>$i</center></td>";
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>{$val['fregno']}
<input type = 'hidden' value ='".$val['fregno']."' id = '$i".'hregno'."'/>
<input type = 'hidden' value ='N' id = '$i".'hcregno'."'/>
<input type = 'hidden' value ='".count($arry)."' id = '$i".'totqp'."'/>
</center></td>";
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;text-align: center;' id = '$i".'totmarks'."'>{$val['ftotmarks']}</td>";
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;text-align: center;' id = '$i".'onlinetot'."'>{$val['fonlinetot']}</td>";
for($z =0;$z<count($arry);$z++)
{
preg_match_all('!\d+!', $arry[$z], $matches);
// print output of function
$qpno = $matches[0][0];
if(substr($arry[$z], -1) == '1' || substr($arry[$z], -1) == '2' || substr($arry[$z], -1) == '3' || substr($arry[$z], -1) == '4' || substr($arry[$z], -1) == '5' || substr($arry[$z], -1) == '6' || substr($arry[$z], -1) == '7' || substr($arry[$z], -1) == '8' || substr($arry[$z], -1) == '9' || substr($arry[$z], -2) == '10')
{
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;text-align:center'>
<input type = 'text' value ='".$val[$arry[$z]]."' disabled style='width:30px;text-align: center;' onchange = 'getregupd(this),valmaxmarksNewExt(this)' id = '$i".'_'."$arry[$z]_$qpno'/>
<input type = 'hidden' value ='".$arry[$z]."' id = '$i".'_hqp_'."$z'/>
</td>";
}else
{
$e_data.="<td style='padding:2px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;text-align:center'><input type = 'text' value ='".$val[$arry[$z]]."' style='width:30px;text-align: center;' onchange = 'getregupd(this),valmaxmarksNewExt(this)' id = '$i".'_qp_'.$qpno."_$z'/>
<input type = 'hidden' value ='".$arry[$z]."' id = '$i".'_hqp_'."$z'/>
</td>";
}
}
$e_data.="</tr>";
$i++;
}
$e_data.="</table>";
$lob = true;
if($lob){
$arry['tabledata'] = $e_data;
$arry['qpcnt'] = $z;
$arry['tablecnt'] = count($res2);
$arry['qno'] = $qno;
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function SaveCopoMarkEntryExternal($aobj_context)
{
$valno = $aobj_context->mobj_data["valno"];
$packet = $aobj_context->mobj_data["packet"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$submarks = $aobj_context->mobj_data["submarks"];
$collcode=$_SESSION['collcode'];
$fsubarry = json_decode($submarks);
$fviewopt = $_SESSION['fviewopt'];
if($fviewopt == 'T')
{
$rdata='Only View Option Enabled';
echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
return;
}
$queryFreeze = "select distinct ifnull(ffreeze, '')as ffreeze from tdvs_copomarks
where fcollcode='{$packet}' and fvalno='{$valno}' and fsubcode='{$qpcode}'";
$resFreeze = $aobj_context->mobj_db->GetRow($queryFreeze);
if($resFreeze['ffreeze'] == 'T'){
$rdata = "Already freezed";
echo($aobj_context->mobj_output->ToJSONEnvelope($rdata, -1, "Failure"));
return;
}
$qry3 = "select fdegree,fexamno from tdvs_qpcopo where fqpcode = '{$qpcode}'";
$res3 = $aobj_context->mobj_db->Getrow($qry3);
$degree = $res3['fdegree'];
$examno = $res3['fexamno'];
$query = "select fcsubcode from subject where fdegree = '{$degree}' and fexamno = '{$examno}' and fqpcode = '{$qpcode}'";
$res1 = $aobj_context->mobj_db->Getrow($query);
$fsubcode = $res1['fcsubcode'];
foreach($fsubarry as $val)
{
$res = $val;
foreach($res as $value)
{
$regno = $value->regno;
$totmarks = $value->totmarks;
$maxmarks = $value->maxmarks;
$qp = $value->qp;
$upd = "update tdvs_copomarks set $qp = '{$maxmarks}',
ftotmarks = '{$totmarks}', fupddate=now(),flogdate = now()
where fregno = '{$regno}' and fvalno = '{$valno}'
and fsubcode = '{$qpcode}'
and fcollcode = '{$packet}'";
$resupd = $aobj_context->mobj_db->Execute($upd);
}
}
if($resupd)
{
$rdata = "Updated Successfully.";
echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return;
}
else
{
$rdata = "No Updation / Add..!";
echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
return;
}
}
function freezeCopoSeeMarksEntry($aobj_context){
$valno = $aobj_context->mobj_data["valno"];
$packet = $aobj_context->mobj_data["packet"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$usr = $_SESSION['usr'];
$queryFreeze = "select distinct ifnull(ffreeze, '')as ffreeze from tdvs_copomarks
where fcollcode='{$packet}' and fvalno='{$valno}' and fsubcode='{$qpcode}'";
$resFreeze = $aobj_context->mobj_db->GetRow($queryFreeze);
if($resFreeze['ffreeze'] == 'T'){
$data = "Already freezed";
echo($aobj_context->mobj_output->ToJSONEnvelope($data, -1, "Failure"));
return;
}
$query = "update tdvs_copomarks set ffreeze='T', ffreezedate=now(), ffreezeusr='{$usr}'
where fcollcode='{$packet}' and fvalno='{$valno}' and fsubcode='{$qpcode}'";
$resupd = $aobj_context->mobj_db->Execute($query);
if($resupd){
$data = "Freezed Successfully.";
echo($aobj_context->mobj_output->ToJSONEnvelope($data, 0, "success"));
return;
}else{
$data = "Failed to freeze";
echo($aobj_context->mobj_output->ToJSONEnvelope($data, -1, "Failure"));
return;
}
}
?>
|