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.129.42.59
<?php
function getQpSetterDetData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$query = "select ifnull(qp.fqpcode, '')as fqpcode,
concat(ifnull(s.fsubname, ''), ' - ', ifnull(s.fsubshort, ''))as fsubname,
ifnull(s.fvalmax, '')as fvalmax,
ifnull(qp.fset, '')as fset,
ifnull(qp.fqpcodeno, '')as fqpcodeno,
ifnull(qp.fyear, '') as fyear,
ifnull(qp.fexamtype, '') as fexamtype,
ifnull(qp.fsqppatren, '')as fqppattern,
ifnull(qp.fsqpsyllabus, '')as fqpsyllabus,
ifnull(qp.fstatus, '')as fstatus
from qpseterdet1 qp inner join subject s on qp.fqpcode = s.fqpcode
where fteachcode = '{$teachcode}'
group by fqpcode, fset, fqpcodeno";
$result = $aobj_context->pobj_db->GetAll($query);
if(count($result) > 0){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
} else {
$arr['msg'] = 'No data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function acceptQPSetterDetData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$qpcodeno = $aobj_context->mobj_data["qpcodeno"];
$set = $aobj_context->mobj_data["set"];
$status = $aobj_context->mobj_data["status"];
$year = $aobj_context->mobj_data["year"];
$examtype = $aobj_context->mobj_data["examtype"];
$query = "update qpseterdet1 set fstatus = '{$status}'
where fteachcode = '{$teachcode}' and fqpcode = '{$qpcode}'
and fset = '{$set}' and fqpcodeno = '{$qpcodeno}'
and fyear = '{$year}' and fexamtype = '{$examtype}'";
$result = $aobj_context->pobj_db->Execute($query);
if($result){
$arr['msg'] = "successfully updated";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
} else {
$arr['msg'] = 'failed to update';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function getUploadQPseterDetData($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$query = "select ifnull(qp.fqpcode, '')as fqpcode,
concat(ifnull(s.fsubname, ''), ' - ', ifnull(s.fsubshort, ''))as fsubname,
ifnull(s.fvalmax, '')as fvalmax,
ifnull(qp.fset, '')as fset,
ifnull(qp.fqpcodeno, '')as fqpcodeno,
ifnull(qp.fyear, '') as fyear,
ifnull(qp.fexamtype, '') as fexamtype,
ifnull(qp.fsqppatren, '')as fqppattern,
ifnull(qp.fsqpsyllabus, '')as fqpsyllabus,
ifnull(qp.fqpfilepath, '')as fqpfilepath,
ifnull(qp.fanskeypath, '')as fanskeypath
from qpseterdet1 qp inner join subject s on qp.fqpcode = s.fqpcode
where qp.fstatus = 'ACCEPTED' and qp.fteachcode = '{$teachcode}'; ";
$result = $aobj_context->pobj_db->GetAll($query);
if(count($result) > 0){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
} else {
$arr['msg'] = 'No data Found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function uploadQpPrepareFiles($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
include("error_log.php");
$univcode = $aobj_context->mobj_data["univcode"];
$teachcode = $aobj_context->mobj_data["teachcode"];
$mobile = $aobj_context->mobj_data["mobile"];
$data = json_decode($aobj_context->mobj_data["data"], true);
$qpFile = $_FILES['qpfile'];
$qpFileName = $qpFile['name'];
$qpFileData = $qpFile['tmp_name'];
$qpExt = pathinfo($qpFileName, PATHINFO_EXTENSION);
$date = date('Y-m-d H:i:s');
$ansKeyFile = $_FILES['ansKeyFile'];
$ansKeyFileName = $ansKeyFile['name'];
$ansKeyFileData = $ansKeyFile['tmp_name'];
$qpAnsKeyExt = pathinfo($ansKeyFileName, PATHINFO_EXTENSION);
$fexam = $data['fyear']."-".$data['fexamtype'];
$qpcode = $data['fqpcode'];
$set = $data['fset'];
$section = $data['fqpcodeno'];
$qryMod = "select ifnull(fmodqpupd, '')as fmodqpupd from qpseterdet1 where
fteachcode = '{$teachcode}'
and fqpcode = '{$data['fqpcode']}'
and fset = '{$data['fset']}'
and fqpcodeno = '{$data['fqpcodeno']}'
and fyear = '{$data['fyear']}'
and fexamtype = '{$data['fexamtype']}'";
$resMod = $aobj_context->pobj_db->GetRow($qryMod);
if($resMod['fmodqpupd'] !== ""){
$arr['msg'] = 'cannot upload file. moderation completed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
if($qpFileName != "" || $qpFileName != NULL ){
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$length = 30;
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
$file_name = $teachcode."_".$qpcode."_".$set."_".$section."_qp_".$randomString.".".$qpExt;
$dir = mkdir($aobj_context->main_src. "QP_Details/" .$univcode. "/" .$fexam. "/" .$qpcode. "/", 0777);
move_uploaded_file($qpFileData, "QP_Details/" .$univcode. "/". $fexam. "/" .$qpcode. "/" .$file_name);
$file_path = "QP_Details/" .$univcode. "/" .$fexam. "/" .$qpcode. "/" .$file_name;
$file = $aobj_context->main_src."QP_Details/{$univcode}/{$fexam}/{$qpcode}/{$file_name}";
if(file_exists($file)){
if($file){
$query = "update qpseterdet1 set fqpduser = '{$teachcode}', fqpdtme = '{$date}',
fuploadstatus = 'T',fqpfilepath = '{$file_path}'
where fteachcode = '{$teachcode}'
and fqpcode = '{$qpcode}'
and fset = '{$set}'
and fqpcodeno = '{$section}'
and fyear = '{$data['fyear']}'
and fexamtype = '{$data['fexamtype']}'";
$result = $aobj_context->pobj_db->Execute($query);
$remarks = "Upload Question Paper - uploaded Question Paper file against ".$qpcode;
$res = error_logs($aobj_context, $univcode, $remarks, $collcode, "Upload Question Paper Details - Upload Question Paper", $teachcode, $mobile);
}
}
}
if($ansKeyFileName != "" || $ansKeyFileName != NULL){
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$length = 30;
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
$file_name = $teachcode. "_" .$qpcode. "_" .$set. "_" .$section. "_ans_" .$randomString. "." .$qpAnsKeyExt;
mkdir($aobj_context->main_src."QP_Details/" .$univcode. "/" .$fexam. "/" .$qpcode. "/", 0777, true);
move_uploaded_file($ansKeyFileData, "QP_Details/" .$univcode. "/" .$fexam. "/" .$qpcode. "/" .$file_name);
$file_path = "QP_Details/" .$univcode. "/" .$fexam. "/" .$qpcode. "/" .$file_name;
$file = $aobj_context->main_src."QP_Details/{$univcode}/{$fexam}/{$qpcode}/{$file_name}";
if(file_exists($file)){
if($file){
$query = "update qpseterdet1 set fqpduser = '{$teachcode}', fqpdtme = '{$date}',
fuploadstatus = 'T', fanskeypath = '{$file_path}'
where fteachcode = '{$teachcode}'
and fqpcode = '{$qpcode}'
and fset = '{$set}'
and fqpcodeno='{$section}'
and fyear = '{$data['fyear']}'
and fexamtype = '{$data['fexamtype']}'";
$result = $aobj_context->pobj_db->Execute($query);
$remarks = "Upload Answer Key - uploaded answer key file against ".$qpcode;
$res = error_logs($aobj_context, $univcode, $remarks, $collcode, "Upload Question Paper Details - Upload Answer Key", $teachcode, $mobile);
}
}
}
if($res){
$arr['msg'] = 'Success';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else{
$arr['msg'] = 'File Not Uploaded';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function selectModerator($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$board = $aobj_context->mobj_data["board"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$deggrp = $aobj_context->mobj_data["deggrp"];
$split = explode("*", $deggrp);
$dggrp = $split[0];
if($qpcode === "All"){
$qpcond = " ";
}else{
$qpcond = "and s.fqpcode = '{$qpcode}'";
}
if($board === "All"){
$boardCond = " ";
}else{
$boardCond = "and s.fboard = '{$board}'";
}
$get_data= "select distinct s.fqpcode,
concat(s.fsubname, ' - ', s.fsubshort) as fsubname,
q.fset, q.fqpcodeno,
count(q.fset) - sum(ifnull(q.fqpfilepath, 1))as uploaded,
sum(ifnull(q.fqpfilepath, 1)) as not_uploaded,
ifnull(q.fmodteach, '')as fmodteach,
ifnull(mas.fteachname, '')as fmodname,
ifnull(q.fmodfromdate,'') as fmodfromdate,
ifnull(q.fmodtodate,'') as fmodtodate,
ifnull(q.flogin, '')as fstatus
from qpseterdet1 q inner join subject s on q.fqpcode = s.fqpcode
left join masteach mas on mas.fteachcode = q.fmodteach
inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
where d.fdeggrp = '{$dggrp}' and ifnull(s.fqpcode, '') <> ''
{$qpcond} {$boardCond}
group by q.fqpcode, q.fset, q.fqpcodeno
order by q.fqpcode";
$lobj_get_data = $aobj_context->pobj_db->GetAll($get_data);
$teach = "select fteachcode, fteachname, fmobile from masteach where ifnull(fteachcode, '')<>''";
$teach_res = $aobj_context->pobj_db->GetAll($teach);
if($teach_res){
$arr['teach'] = $teach_res;
$arr['mod'] = $lobj_get_data;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}else{
$arr['msg'] = 'Failed to load';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function saveAssignModeratorDet($aobj_context){
include("sendGridMail.php");
include("error_log.php");
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$user = $aobj_context->mobj_data["user"];
$year = $aobj_context->mobj_data["exam"];
$board = $aobj_context->mobj_data["board"];
$qpcode = $aobj_context->mobj_data["qpcode"];
$data = json_decode($aobj_context->mobj_data["data"], true);
$onldate = date('d-m-Y');
$split = explode("*",$year);
$degree = $split[0];
$splitagain = explode("-",$split[1]);
$year = $splitagain[0];
$mode = $splitagain[1];
$new_arr = [];
foreach($data as $value){
if($value['femail'] === 'T'){
array_push($new_arr, $value['fmodteach']);
}
}
$teachArr = array_unique($new_arr);
foreach($data as $val){
$query = "update qpseterdet1 set fmodteach='{$val['fmodteach']}',
fmodfromdate='{$val['fmodfromdate']}', flogin='{$val['fstatus']}',
fmodtodate='{$val['fmodtodate']}'
where fqpcode='{$val['fqpcode']}'
and fset='{$val['fset']}'
and fqpcodeno='{$val['fqpcodeno']}'
and fyear='{$year}'
and fexamtype='{$mode}'";
$result = $aobj_context->pobj_db->Execute($query);
$remarks = "Moderator is Assigned for teacher ".$val['fmodteach']." and qpcode ".$val['fqpcode']." and exam year and number ".$year."-".$mode;
$res = error_logs($aobj_context, $univcode, $remarks, $collcode, "Assign Moderator", $user, $user);
}
foreach($teachArr as $val){
$qryMobile = "select ifnull(fmobile, '')as fmobileno,
ifnull(femail, '')as femail from masteach where
fteachcode = '{$val}'";
$resMobile = $aobj_context->pobj_db->GetRow($qryMobile);
$mobileno = $resMobile['fmobileno'];
$emailid = $resMobile['femail'];
$slt = "select fmobileno, fusertype, fpasswd, femail from
logisys3_comexam.masuser where
fregno = '{$val}'
and funivcode='{$univcode}'
and fmobileno='{$mobileno}'";
$reslt = $aobj_context->pobj_db->GetRow($slt);
$usertype = $reslt['fusertype'];
if(count($reslt) > 0){
$queryIns = "update logisys3_comexam.masuser set
fusertype = concat('{$usertype}','*','502'), ftype = 'M', ftemp = 'M'
where fmobileno = '{$mobileno}' and funivcode = '{$univcode}'";
}else{
$queryIns = "insert ignore into logisys3_comexam.masuser(FUNIVCODE, FREGNO, FMOBILENO,
FUSERTYPE, FPASSWD, ftype, FTEMP, FACTIVE)
values('{$univcode}', '{$val}', '{$mobileno}',
'502', '{$mobileno}', 'M', 'M', 'T')";
}
$resultIns = $aobj_context->pobj_db->Execute($queryIns);
$remarks = "Added new Usertype for ".$mobileno." and Univcode ".$univcode;
$res = error_logs($aobj_context, $univcode, $remarks, $collcode, "Assign Moderator", $user, $user);
$unishort = "select funivname, ffolder, pdf_logo_path, FTOWN, fmodemail, ftdvs_helplineno from control";
$resunishort = $aobj_context->pobj_db->GetRow($unishort);
$univname = $resunishort['funivname'];
$town = $resunishort['FTOWN'];
$univshort = strtoupper($resunishort['ffolder']);
$teachDet = "select ifnull(m.fteachname, '')as fteachname,
ifnull(m.fcollname, '')as fcollname, d.fdegncode,
ifnull(d.fdegndesc, '')as fdegndesc
from masteach m inner join masdegn d on d.fdegncode = m.fdegncode
where fteachcode = '{$val}'";
$teachDet1 = $aobj_context->pobj_db->GetRow($teachDet);
$teachname = $teachDet1['fteachname'];
$colladd = $teachDet1['fcollname'];
$degn = $teachDet1['fdegndesc'];
$query1 = "select distinct s.fqpcode, s.fsubname, d.fexamdate,
d.fexamname, d.fdescpn from subject s
inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
where fqpcode = '{$qpcode}'";
$res1 = $aobj_context->pobj_db->GetRow($query1);
$fqpcode = $res1['fqpcode'];
$fsubname = $res1['fsubname'];
$fexamdate = $res1['fexamdate'];
$fexamnmae = $res1['fexamname'];
$fdescpn = $res1['fdescpn'];
$qur1 = "select fexamdate from deggrp where fdeggrp = '{$degree}'
and fyear='{$year}' and fexamtype='{$mode}'";
$resn1 = $aobj_context->pobj_db->GetRow($qur1);
$exm =$resn1['fexamdate'];
$qry = "select q.fqpcode, q.fyear, q.fexamtype, count(fset)as fset,
date_format(q.fmodfromdate, '%d/%m/%Y')as fmodfromdate,
s.fsubname, dg.fexamdate from qpseterdet1 q inner join subject s on
s.fqpcode = q.fqpcode
inner join degree d on d.fdegree = s.fdegree
and d.fexamno = s.fexamno inner join deggrp dg
on dg.fdeggrp = d.fdeggrp and dg.fexamtype = q.fexamtype
and dg.fyear = q.fyear
where q.fqpcode='{$qpcode}' and q.fmodteach='{$val}'
and q.fyear='{$year}' and q.fexamtype='{$mode}'
group by q.fqpcode";
$res = $aobj_context->pobj_db->GetRow($qry);
$masQry = "select fmobileno, fusertype, fpasswd, femail from
logisys3_comexam.masuser where
fregno = '{$val}'
and funivcode='{$univcode}'
and fmobileno='{$mobileno}'";
$resMasQry = $aobj_context->pobj_db->GetRow($slt);
$password = $resMasQry['fpasswd'];
$fromdate=$res['fmodfromdate'];
if($univcode == "051"){
$logo_path = "/img/dyp_elogo.jpeg";
}else{
$logo_path = $resunishort['pdf_logo_path'];
}
$logo = "https://college.universitysolutions.in/".$resunishort['ffolder']. $logo_path;
$message="<html>";
$message.="<body>";
$message.="<style>";
$message.=".mail_tbl td{text-align:left; padding:2px; font-size:12px;
font-family: Verdana, Arial, Helvetica, sans-serif;}
table,td, th{
border: 1px solid black;
border-collapse: collapse;
} ";
$message.="</style>";
$message.="<center><img src='{$logo}' height='100px' width='200px'/></center>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align:center; color:red'>
CONFIDENTIAL</p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align:right'>Date.:"." $onldate "."</p>";
$message.="<p>Dear Sir/Madam,<br><br></p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
The University is pleased to appoint you as the Question paper moderator for the course "."$fqpcode"."–"."$fsubname"." of $fdescpn, University exams.<br>
You are asked to report to the CoE office on {$fromdate} and complete the Question paper moderation on the same day.</p>";
$message.="<div style='justify-content:center; align-itmes:center;'>";
$message.="<table style='width: 40%;border: 1px solid;'>
<thead>
<tr>
<th style='border: 1px solid;text-align:center;'>Course Code</th>
<th style='border: 1px solid;text-align:center;'>Subject Name</th>
</tr>
</thead>
<tbody>";
$message.="<tr>";
$message.="<td style='border: 1px solid;text-align:center;'>".$res['fqpcode']."</td>";
$message.="<td style='border: 1px solid;text-align:initial; padding-left:10px'>".$res['fsubname']."</td>";
// $message.="<td style='border: 1px solid;text-align:initial; padding-left:10px'>".$res['fexamdate']."</td>";
// $message.="<td style='border: 1px solid;text-align:center;'>".$res['fset']."</td>";
// <th style='border: 1px solid;text-align:center;'>Set No.</th><th style='border: 1px solid;text-align:center;'>Exam Date</th>
$message.="</tr>";
$message.="</tbody>
</table>";
$message.="</div>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>{$mailmtr}</p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Portal Login details are as follows.<br><br>";
$message.="Portal Link: https://egov.universitysolutions.in/#/"."<br>";
$message.="Mobile No.:"."{$mobileno}"."<br>";
$message.="Password.:"."{$password}"."<br></p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Kindly call to "."$helplineno"." in case if you have any technical issues.<br></p>";
$message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
Thanking You,</p>";
$querySign = "select distinct s.fqpcode, d.fsignpath from degree d inner join subject s on
s.fdegree = d.fdegree and s.fexamno = d.fexamno
where s.fqpcode='{$fqpcode}' and ifnull(fsignpath,'')<>''";
$ressign = $aobj_context->pobj_db->GetRow($querySign);
$sign = $ressign['fsignpath'];
$signpath = "https://college.universitysolutions.in/".$resunishort['ffolder']."/img/".$sign;
if($sign!==NULL){
$message .= "<img src='{$signpath}' width='100' height='50'/>";
$message .= "<br/>";
}
$message.="Controller of Examinations<br>"."$univname"."<br>
$town
</p>";
$message.="</body>";
$message.="</html>";
$subject= strtoupper("$univshort".": Appointment as Moderator for the University ".$fexamdate." Examination");
$from = "";
$resp = sendGridMail($emailid,$subject,$message,$univcode);
}
if($result){
$arr['msg'] = 'successfully updated';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}else{
$arr['msg'] = 'failed to update';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
?>
|