0xV3NOMx
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.137.170.76


Current Path : /proc/thread-self/root/var/www/html/admission/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/admission/src/sendOrder.php

<?php
include("/var/www/config.php");
    function getTeachData($aobj_context){
        $univcode = $aobj_context->mobj_data["univcode"];

        $query = "select fteachcode,fteachname,ifnull(fcollcode,'') as fcollcode from masteach";

        $result = $aobj_context->pobj_db->GetAll($query);

        $que = "select concat(fcollcode ,' - ', fcollname) as fcollname,fcollcode 
        from college where fdeleted <> 'T';";

        $res = $aobj_context->pobj_db->GetAll($que);
        if($result){
            $arr['teach'] = $result;
            $arr['coll'] = $res;
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
        }else{
            $arr['msg'] = "No data found";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
            return;
        }

    }

    function sendOrderDet($aobj_context){
        include("sendGridMail.php");
        include("error_log.php");
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data["univcode"];
        $ftype = $aobj_context->mobj_data["ftype"];
        $teachcode = $aobj_context->mobj_data["fteach"];
        $fexam = $aobj_context->mobj_data["fexam"];
        $fschool = $aobj_context->mobj_data["fschool"];
        $fpract = $aobj_context->mobj_data["fpract"];
        $theory = $aobj_context->mobj_data["theory"];
        $fttodate = $aobj_context->mobj_data["fttodate"];
        $ftfrmdate = $aobj_context->mobj_data["ftfrmdate"];
        $fpfrmdate = $aobj_context->mobj_data["fpfrmdate"];
        $fptodate = $aobj_context->mobj_data["fptodate"];
        $updtype = $aobj_context->mobj_data["updtype"];
        $fuser = $aobj_context->mobj_data["fuser"];
        $fstatus = $aobj_context->mobj_data["fstatus"];
        $fteachcoll = $aobj_context->mobj_data["fteachcoll"];
        $date = date('Y-m-d H:i:s');
        $onldate = date('d-m-Y');

        if($fpract === 'true'){
            $fpart = 'T';
        }else if($fpract === 'false'){
            $fpart = 'F';
            // $fpfrmdate = "";
            // $fptodate = "";
        }else{
            $fpart = $fpract;
        }

        if($theory === 'true'){
            $ftheory = 'T';
        }else if($theory === 'false'){
            $ftheory = 'F';
            // $ftfrmdate = "";
            // $fttodate = "";
        }else{
            $ftheory = $theory;
        }

        $que = "select fteachname,femail from masteach where fteachcode = '{$teachcode}'";
        $res = $aobj_context->pobj_db->GetRow($que);
        $emailid = $res['femail'];
        $fname = $res['fteachname'];

        $unishort = "select funivname, ffolder, pdf_logo_path  from control";
        $resunishort = $aobj_context->pobj_db->GetRow($unishort);

        $univname = $resunishort['funivname'];
        $univshort = strtoupper($resunishort['ffolder']);
        $logopath = $resunishort['pdf_logo_path'];

        $teachDet = "select concat(ifnull(ftitle,''),' ',ifnull(m.fteachname, ''))as fteachname, 
                     ifnull(m.fcollname, '')as fcollname, d.fdegncode, 
                     ifnull(d.fdegndesc, '')as fdegndesc,
                     ifnull(m.fmobile,'') as fmobile 
                     from masteach m inner join masdegn d on d.fdegncode = m.fdegncode 
                     where fteachcode = '{$teachcode}'";
                    
        $teachDet1 = $aobj_context->pobj_db->GetRow($teachDet);
        
        $teachname = $teachDet1['fteachname'];
        $colladd = $teachDet1['fcollname'];
        $degn = $teachDet1['fdegndesc'];
        
        $colldet = "select * from college where fcollcode = '{$fschool}'";
        $qurcolldet = $aobj_context->pobj_db->GetRow($colldet);
        $fcollname = $qurcolldet['FCOLLNAME'];

        $fteachcollque = "select * from college where fcollcode = '{$fteachcoll}'";
        $qurfteachcoll = $aobj_context->pobj_db->GetRow($fteachcollque);
        $fteachemail = $qurfteachcoll['FEMAIL'];
        
        $query = "select fteachcode,FEXAMID,FEXAM from examorder where fteachcode = '{$teachcode}'";
        $res = $aobj_context->pobj_db->GetRow($query);
        $id = $res['FEXAMID'];
        if($id != ""){
            $cond = "FEXAMID,";
            $cond1 = "'{$id}',"; 
        }else{
            $cond = "";
            $cond1 = ""; 
        }
        if($updtype != "edit"){
            $query = "INSERT ignore INTO examorder ($cond FTYPE, FTEACHCODE, FEXAM, FCOLLCODE, FNAME,FEMAIL,
            FTHEORY,FTFRMDATE,FTTODATE,FPRACTICAL,FPFRMDATE,FPTODATE,FUSERID,FEMAILSTATUS,FDATE,FTEACHCOLL)
            values($cond1 '{$ftype}','{$teachcode}','{$fexam}','{$fschool}','{$fname}','{$emailid}',
            '{$ftheory}','{$ftfrmdate}','{$fttodate}','{$fpart}','{$fpfrmdate}','{$fptodate}',
            '{$fuser}','T',now(),'{$fteachcoll}')";
        }else{
            $query = "update examorder set FTHEORY= '{$ftheory}',FTFRMDATE = '{$ftfrmdate}',
            FTTODATE = '{$fttodate}',FPRACTICAL = '{$fpart}' ,FPFRMDATE= '{$fpfrmdate}',
            FPTODATE = '{$fptodate}',
            FUSERID = '{$fuser}',FEMAILSTATUS='{$fstatus}' ,FDATE = now()
            where FEXAMID = '{$id}' and FCOLLCODE = '{$fschool}' and FEXAM = '{$fexam}'";
        }
        
        $result = $aobj_context->pobj_db->Execute($query);

        if($fstatus == 'T'){
            if($univcode == "051"){
                $logo_path = "/img/dyp_elogo.jpeg";
            }else{
                $logo_path = $logopath;
            }

            $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;}";	
            $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:right'>Date.:"." $onldate "."</p>";

            $message.="<p>To,<br></p>";
            $message.="<p style='line-height: 0;'>"."$teachname".",<br></p>";
            if($degn != ""){
                $message.="<p style='line-height: 2;'>"."$degn".",<br></p>";
            }
            if($colladd != ""){
                $message.="<p style='line-height: 0;'>"."$colladd".",<br></p>";
            }
            
            $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
            <b>Sub: Appointment as "."$ftype"." for University Examination, "."$fcollname"."<b/>.</p>";

            $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
            Respected Sir / Madam,</p>";

            $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
            You are appointed as the "."$ftype"." for University Examination, "."  "."$fcollname".".</p>";
          
            if($ftype == 'Presiding Officer'){
                if($theory === 'true' || $theory === 'T'){
                $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                <b>Theory Examination:         ".date_format(date_create($ftfrmdate),"d-m-Y")."  to  ".date_format(date_create($fttodate),"d-m-Y")."<b/>.</p>";
                }
                if($fpract === 'true' || $fpract === 'T'){
                $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                <b>Practical Examination: ".date_format(date_create($fpfrmdate),"d-m-Y")."  to  ".date_format(date_create($fptodate),"d-m-Y")."<b/>.</p>";
                }
                $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                You are asked to reply us the list of required officers to conduct the examination smoothly.</p>";
                $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                Please do the needfull.</p>";
            }else{
                $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                You have to work as observer for following dates.</p>";

                if($theory === 'true' || $theory === 'T'){
                    $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                    <b>Theory Examinations:          ".date_format(date_create($ftfrmdate),"d-m-Y")."  to  ".date_format(date_create($fttodate),"d-m-Y")."<b/>.</p>";
                }
                if($fpract === 'true' || $fpract === 'T'){
                    $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                    <b>Practical Examination: ".date_format(date_create($fpfrmdate),"d-m-Y")."  to  ".date_format(date_create($fptodate),"d-m-Y")."<b/>.</p>";
                }
                // if($theory == 'true'){
                // $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                // <b>Date: "."$ftfrmdate".","."<br/>"."$fttodate"."</b>.</p>";
                // }
                $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                At the end of each day, you are asked to provide the Report to COE in the prescribed format.</p>";
            
            }

            $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
            Thanking You,</p>";

            // $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
            // Yours Sincerely<br>";

            $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.="<b>Controller of Examinations<br>"."$univname"."<br>
            Navi Mumbai<b/>
            </p>";

            $message.="</body>";
            $message.="</html>";

            $subject= strtoupper("$univshort".": Appointment as"." "."$ftype"." for the University Examination"); 
            $from = "";
            $cc = "arun.v@logisys.org";
            $resp = sendGridMail($emailid,$subject,$message,$univcode,$cc);
            $fteachcoll = sendGridMail($fteachemail,$subject,$message,$univcode); 
        }
        if($result){
            $arr['msg'] = "Saved Successfully";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
        }else{
            $arr['msg'] = "No data found";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
            return;
        }

    }
    
    function getExamOrderDet($aobj_context){
        $univcode = $aobj_context->mobj_data["univcode"];

        $query = "select * from examorder";

        $result = $aobj_context->pobj_db->GetAll($query);

        if($result){
            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 getOrderData($aobj_context){
        $univcode = $aobj_context->mobj_data["univcode"];
        $fid = $aobj_context->mobj_data["fid"];
        $fcoll = $aobj_context->mobj_data["fcoll"];
        $fexam = $aobj_context->mobj_data["fexam"];

        $query = "select * from examorder 
        where fexamid = '{$fid}' and fexam = '{$fexam}' and fcollcode = '{$fcoll}'";

        $result = $aobj_context->pobj_db->GetRow($query);

        if($result){
            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;
        }

    }
?>