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 : 18.118.200.109


Current Path : /var/www/html/univadmin/src/
Upload File :
Current File : /var/www/html/univadmin/src/tdvs_mail.php

<?php
    function tdvs_getTeacher($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['univcode'];

        $query = "select ifnull(fteachcode, '')as value, 
                  concat(ifnull(fteachcode, ''), ' - ', ifnull(fteachname, ''))as text 
	              from tdvs_masteach;";
        $result = $aobj_context->pobj_db->GetAll($query); 
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
            return;
        }else{
            $arr['msg'] = "No Teacher Data Found";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		    return;
        }
    }

    function tdvs_get_mail_data($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['univcode'];
        $teacher = $aobj_context->mobj_data['teacher'];
        $status = $aobj_context->mobj_data['status'];

        $teachArr = explode(",", $teacher);
        foreach($teachArr as $key => $val){
            $teach .= "'".$val."',";
        }
        $teachArray = substr_replace($teach ,"",-1);

        if($teachArray === "'All'"){
            $teachCond = "m.fteachcode between '000' and 'ZZZ'";
        }else{
            $teachCond = "m.fteachcode in ($teachArray)";
        }

        if($status === "All"){
            $statusCond = " ";
        }else if($status === "registered"){
            $statusCond = "and ifnull(factive, 'F') = 'T'";
        }else if($status === "not_registered"){
            $statusCond = "and ifnull(factive, 'F') = 'F'";
        }

        $query = "select distinct m.fteachcode, m.fteachname, m.fmobile, m.femail, 
                  if(ifnull(t.fteachcode, '')='','Not Registered', 'Registered')as fstatus
                  from tdvs_masteach m left join tdvs_tabuser t on t.fteachcode = m.fteachcode 
                  and factive='T' where {$teachCond} {$statusCond}";
        $result = $aobj_context->pobj_db->GetAll($query);
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
            return;
        }else{
            $arr['msg'] = "No Teacher Data Found";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		    return;
        }
    }

    function tdvs_sendTeacherMail($aobj_context){
        include("sendGridMail.php");
        include ('/var/www/html/sms/sendsmsapiv1.php');

        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['univcode'];
        $data = json_decode($aobj_context->mobj_data['data'], true);

        $univQuery = "select funivname,ffolder,ftdvs_helplineno,fshortuniv from control";
        $resUnivQuery = $aobj_context->pobj_db->GetRow($univQuery);

        $univname = $resUnivQuery['funivname'];
        $ffolder = strtoupper($resUnivQuery['ffolder']);
        $helplineNo = $resUnivQuery['ftdvs_helplineno'];
        $univshort1 = strtoupper($resUnivQuery['fshortuniv']);
       

        foreach($data as $val){

            $emailid = $val['femail'];
            $mobile = $val['fmobile'];
            $teachcode = $val['fteachcode'];

            if($univcode === "053"){
                $pwd = "select fpasswd from tdvs_tabuser where fteachcode = '{$teachcode}'";
                $resPwd = $aobj_context->pobj_db->GetRow($pwd);
                $password = $resPwd['fpasswd'];
                $temp = "Login";
                $pass = "Password : ".$password."<br>";
                $subject = "Kindly open the link given below to login to ". $univname." digital evaluation portal to start evaluation of answer booklets.";
                $link = "";
            }else{
                $temp = "Registration";
                $subject = "Kindly open the link given below to register and login to". $univname. "digital evaluation portal. 
                            Once the registration is completed login the same link to start evaluation of answer booklets.";
                 $pass = "";
                 $link = "<a target='_blank' href='https://universitysolutions.in/univadmin/demovideo/051_Digital_Valuation_Demo.mp4'>Demo Video for Registration and Evaluation</a>";
            }

            $message = "Dear Sir / Madam,  <br/> <br/>";
            $message .= "Greetings from". $univname ."<br/> <br/>";
            $message .= $subject;
            $message .="<br> For any technical assistance please call to". $helplineNo;
            
            $message .= "<br/> <br/> Your registration details are as follows.<br>";
            
            $message .= "Teacher Code :". $teachcode. "<br>";
            $message .= "Mobile No. :".$mobile."<br>";
            $message .= $pass;
            $message .= "Link : https://tdvs.universitysolutions.in/#/".strtolower($ffolder)."<br/>";
            $message .= $link. "<br/>";
            $message .=  "<br/>Regards,<br/>Examination Team<br/>".$univname."<br/>";
            
            $subject = strtoupper("$ffolder".": Takshila - Digital Valuation System (TDVS), ".$temp); 
            
            $resp = sendGridMail($emailid,$subject,$message,$univcode);  
            $res = json_decode($resp);

            date_default_timezone_set('Asia/Kolkata');
            $time =  date("h:i A");

            $smsotp = "From $ffolder: Dear Sir / Madam, $univshort1 is pleased to appoint you as Theory Examiner for our University Theory Examination. Kindly check the mail for details. - Uniclare";

            
            $sms = new SMS('026', 'OTP');
            $resf = $sms->sendIndvidualSms($mobile, $smsotp, '900', 'PGET');
            

        }
        if($res->message){
            $arr['msg'] = "Mail Sent";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
            return;
        }else{
            $arr['msg'] = "Cant send the Mail";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		    return;
        }
    }
?>