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.144.254.149
<?php
require_once("/var/www/html/aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
function getResStudDegree($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$collcode = $aobj_context->mobj_data['coll'];
$cond = "";
if($collcode != ""){
$cond = "where r.fcollcode = '{$collcode}'";
}
$query = "select distinct r.fdegree, d.fdescpn from degree d
inner join res_stud r on r.fdegree = d.fdegree
and r.fexamno = d.fexamno $cond";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
return;
}else{
$arr['msg'] = "No Degree Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function getResStudSem($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$degree = $aobj_context->mobj_data['degree'];
if($degree === "All"){
$degCond = "";
}else{
$degCond = "where r.fdegree = '{$degree}'";
}
$query = "select distinct r.fexamno, d.fexamname from degree d
inner join res_stud r on r.fdegree = d.fdegree
and r.fexamno = d.fexamno {$degCond}
group by fexamno";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
return;
}else{
$arr['msg'] = "No Sem Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function getResStudSubject($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$degree = $aobj_context->mobj_data['degree'];
$sem = $aobj_context->mobj_data['sem'];
if($degree === "All"){
$degCond = "";
}else{
$degCond = "and r.fdegree = '{$degree}'";
}
if($sem === "All"){
$semCond = "";
}else{
$semCond = "and r.fexamno='{$sem}'";
}
$query = "select distinct s.fqpcode, concat(s.fsubname, ' - ' , s.fsubshort)as
fsubname from subject s inner join res_stud r on
r.fexamno = s.fexamno and r.fdegree = s.fdegree
where ifnull(s.fqpcode, '')<>''
{$degCond} {$semCond}";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
return;
}else{
$arr['msg'] = "No Subject Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function getResStudData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$degree = $aobj_context->mobj_data['degree'];
$sem = $aobj_context->mobj_data['sem'];
$subject = $aobj_context->mobj_data['subject'];
$type = $aobj_context->mobj_data['type'];
if($degree === "All"){
$degreeCond = "";
}else{
$degreeCond = "and r.fdegree = '{$degree}'";
}
if($sem === "All"){
$semCond = "";
}else{
$semCond = "and r.fexamno='{$sem}'";
}
if($subject === "All"){
$subCond = "";
}else{
$subCond = "and s.fqpcode='{$subject}'";
}
$query = "select r.appno, r.fregno, r.fdegree, r.fexamno, s.fqpcode,
concat(s.fsubname, ' - ', s.fsubshort)as fsubanme, r.fcorrtype, r.famount,
FACKDATE, FACKUSER, FUNIVRECDATE, FPAYMENTREMARKS, FPAYMENTSTATUS, FPAYMENTCONFIRM
from res_stud r inner join subject s on s.fdegree = r.fdegree and s.fexamno = r.fexamno
and r.fsubcode = s.fcsubcode
where r.fcorrtype='{$type}' {$degreeCond} {$semCond} {$subCond}";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
return;
}else{
$arr['msg'] = "No Data Found";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function saveResStudData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$degree = $aobj_context->mobj_data['degree'];
$sem = $aobj_context->mobj_data['sem'];
$subject = $aobj_context->mobj_data['subject'];
$type = $aobj_context->mobj_data['type'];
$fregno = $aobj_context->mobj_data['fregno'];
$appno = $aobj_context->mobj_data['appno'];
$file = $_FILES['file'];
$filename = $_FILES['file']['name'];
$tmpname = $_FILES['file']['tmp_name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if($filename !== NULL || $filename !== "undefined"){
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$length = 5;
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
$file_name = $univcode."_".$fregno."_".$randomString.".".$ext;
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => IAM_KEY,
'secret' => IAM_SECRET
),
'version' => "latest",
'region' => 'ap-south-1'
)
);
try {
$slt = "select fcsubcode from subject where
fdegree='{$degree}' and fexamno='{$sem}' and fqpcode='{$subject}'";
$result = $aobj_context->pobj_db->GetRow($slt);
$fsubcode = $result['fcsubcode'];
$s3->putObject(['Bucket' => "university-photocopy", 'Key' => $file_name, 'SourceFile' => $tmpname]);
$query = "update res_stud set FACKDATE=now(), FUNIVRECDATE=now(),
FPAYMENTREMARKS='12345',FPAYMENTSTATUS='success',
FPAYMENTCONFIRM='success', FACKUSER='direct', FXRPATH='{$file_name}' where
FDEGREE='{$degree}' and FEXAMNO='{$sem}' and APPNO='{$appno}'
and FREGNO='{$fregno}' and fcorrtype='{$type}' and fsubcode='{$fsubcode}'";
$res = $aobj_context->pobj_db->Execute($query);
if($res){
$arr['msg'] = 'File uploaded';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else{
$arr['msg'] = 'Failed to upload';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}catch(S3Exception $e){
$arr['msg'] = 'Failed to upload';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
return;
}else{
$arr['msg'] = "Failed to upload";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
return;
}
}
function saveResStudAllData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$type = $aobj_context->mobj_data['type'];
$data = json_decode($aobj_context->mobj_data['data'], true);
foreach($data as $val){
$slt = "select fcsubcode from subject where
fdegree='{$val['fdegree']}' and fexamno='{$val['fexamno']}'
and fqpcode='{$val['fqpcode']}'";
$result = $aobj_context->pobj_db->GetRow($slt);
$fsubcode = $result['fcsubcode'];
if($val['fstatus'] === 'T'){
$query = "update res_stud set FACKDATE=now(), FUNIVRECDATE=now(),
FPAYMENTREMARKS='12345',FPAYMENTSTATUS='success',
FPAYMENTCONFIRM='success', FACKUSER='direct' where
FDEGREE='{$val['fdegree']}' and FEXAMNO='{$val['fexamno']}' and APPNO='{$val['appno']}'
and FREGNO='{$val['fregno']}' and fcorrtype='{$type}' and fsubcode='{$fsubcode}'";
}else{
$query = "update res_stud set FACKDATE='', FUNIVRECDATE='',
FPAYMENTREMARKS='',FPAYMENTSTATUS='',
FPAYMENTCONFIRM='', FACKUSER='' where
FDEGREE='{$val['fdegree']}' and FEXAMNO='{$val['fexamno']}' and APPNO='{$val['appno']}'
and FREGNO='{$val['fregno']}' and fcorrtype='{$type}' and fsubcode='{$fsubcode}'";
}
$res = $aobj_context->pobj_db->Execute($query);
}
if($res){
$arr['msg'] = "SuccessFully Updated";
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;
}
}
?>
|