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.149.25.26


Current Path : /var/www/html/admission/src/
Upload File :
Current File : /var/www/html/admission/src/teacherEmail.php

<?php

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

    $query = "select dg.fdeggrp,dg.fdescpn from deggrp dg 
            inner join degree d on dg.fdeggrp=d.fdeggrp group by dg.fdeggrp;";
              
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getdegreetmdet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];

    $query = "select distinct dg.fdeggrp,d.fdegree,d.fdescpn from degree d inner join  deggrp dg on dg.fdeggrp=d.fdeggrp 
    where dg.fdeggrp='{$deggrp}';";

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

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getsemtmdet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];
    $degree = $aobj_context->mobj_data['degree'];


    $query = "select distinct d.fexamno,d.fexamname from degree d 
                inner join  deggrp dg on dg.fdeggrp=d.fdeggrp 
                where dg.fdeggrp='{$deggrp}' 
                and d.fdegree='{$degree}'; ";
                
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

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

    $deggrp = $aobj_context->mobj_data['deggrp'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];

    $query = "select distinct fcsubcode as fsubcode,fsubname from subject s
                inner join degree d on d.fdegree = s.fdegree and s.fexamno= d.fexamno
                where s.fdegree='{$degree}' and s.fexamno='{$sem}' 
                and d.fdeggrp='{$deggrp}' and ftheory ='f' and fintass ='f'
                order by s.fsubcode;";
                
                
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

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

    $query = "select distinct fcollcode,fteachcode,fteachname from masteach";

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

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function loadtableinfotm($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];
    $subj = $aobj_context->mobj_data['subj'];

    $query = "select p.fteachcode,m.fteachcode,m.fteachname,
                date_format( IF(p.fstartdate = '0000-00-00', '', p.fstartdate), '%d/%m/%Y') AS fstartdate,
                date_format( IF(p.fenddate = '0000-00-00', '', p.fenddate), '%d/%m/%Y') AS fenddate,
                p.fmail,p.fdelete from prexaminer p 
                inner join masteach m on p.fteachcode=m.fteachcode 
                where p.fdeggrp='{$deggrp}' and p.fdegree='{$degree}' and p.fexamno='{$sem}'
                 and p.fsubcode='{$subj}'";
                 
     
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function updatepractclexamner($aobj_context)
{
    include("sendGridMail.php");
    include ('/var/www/html/sms/sendsmsapiv1.php');
    include("error_log.php");
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];
    $subj = $aobj_context->mobj_data['subject'];
    $user = $aobj_context->mobj_data['user'];

    $table = json_decode($aobj_context->mobj_data['arr'], true);
    $onldate = date('d-m-Y');

    foreach ($table as $value) {

        $deleteQuery = "DELETE FROM prexaminer WHERE fdeggrp = '{$deggrp}' 
                        AND fdegree = '{$degree}' AND fexamno = '{$sem}' AND fsubcode = '{$subj}' 
                        AND fteachcode = '{$value['data']['value']}'";
                       
        $deleteResult = $aobj_context->pobj_db->Execute($deleteQuery);

    if ($deleteResult) {

        $insertQuery = "INSERT INTO prexaminer (fdeggrp, fdegree, fexamno, fsubcode, fteachcode, 
                        fstartdate, fenddate, fmail, fcreatedate, fcreateuser, fdelete, fdeluser, fdeldate)
                    VALUES
                        ('{$deggrp}', '{$degree}', '{$sem}', '{$subj}', '{$value['data']['value']}', 
                        date_format(str_to_date('{$value['fstartdate']}', '%d/%m/%Y'), '%Y-%m-%d'), 
                        date_format(str_to_date('{$value['fenddate']}', '%d/%m/%Y'), '%Y-%m-%d'), 
                        '{$value['fmail']}', NOW(), '{$user}', '{$value['fdelete']}', '{$user}', NOW())";

                    
        $result = $aobj_context->pobj_db->Execute($insertQuery);

        if ($result) {

            if ($value['fmail'] == 'T') {

                $getEmail = "select FEMAIL,fteachname,fmobile from masteach where fteachcode = '{$value['data']['value']}' ";
                $ret = $aobj_context->pobj_db->GetRow($getEmail);
                $emailsent = $ret['FEMAIL'];
                $teahername = $ret['fteachname'];
                $mobno = $ret['fmobile'];

                $querysub = "select distinct fsubcode,FSUBNAME from subject where fsubcode= LEFT('{$subj}',4) and  fdegree='{$degree}' and fexamno='{$sem}' ";
                $resultsub = $aobj_context->pobj_db->GetRow($querysub);

                $fsubcode = $resultsub['fsubcode'];
                $FSUBNAME = $resultsub['FSUBNAME'];

                $degquery = "select distinct fdegree,fdescpn from degree where fdegree ='{$degree}'";
                $degreresult = $aobj_context->pobj_db->GetRow($degquery);

                $degreeres = $degreresult['fdegree'];
                $descpn = $degreresult['fdescpn'];

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

                $univname = $resunishort['funivname'];
                $town = $resunishort['FTOWN'];
                $univshort = strtoupper($resunishort['ffolder']);
                $univshort1 = strtoupper($resunishort['fshortuniv']);

                $qur = "select fmodemail,ftdvs_helplineno from control";
                $resn = $aobj_context->pobj_db->GetRow($qur);

                $mailmtr = $resn['fmodemail'];

                $helplineno = $resn['ftdvs_helplineno'];

                $qur1 = "select fexamdate from deggrp where fdeggrp = '{$deggrp}'";
                $resn1 = $aobj_context->pobj_db->GetRow($qur1);

                $exm = $resn1['fexamdate'];

                $query1 = "select * from prexaminer where fteachcode='{$value['data']['value']}'";
                $result1 = $aobj_context->pobj_db->GetRow($query1);

                $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 = '{$value['data']['value']}'";
                
                $teachDet1 = $aobj_context->pobj_db->GetRow($teachDet);

                $teachname = $teachDet1['fteachname'];
                $colladd = $teachDet1['fcollname'];
                $degn = $teachDet1['fdegndesc'];

                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;}";
                $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>To,<br></p>";
                $message.="<p style='line-height: 1;'>"."$teachname".",<br></p>";
                if($degn != ""){
                    $message.="<p style='line-height: 0;'>"."$degn".",<br></p>";
                }
                if($colladd != ""){
                    $message.="<p style='line-height: 1;'>"."$colladd".",<br><br><br></p>";
                }
                $message .= "<p >Dear Sir/Madam,<br><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 Practical Examiner for the course " . "$fsubcode" . "/" . "$FSUBNAME" . " of $descpn, University exams.<br>
                                You are asked to report to the School/University from  {$value['fstartdate']} to {$value['fenddate']} </p>";

                $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                                            <b>Kindly note the following points:</b><br/>
                                                <ol>
                                                    <li>You are asked to report at the school / University as per the schedule of the practical exam.</li>
                                                    <li>Mobile phones and any other Electronic devices are strictly prohibited during examination.</li>
                                                    <li>The practical exam is to be conducted as per the standard procedures.</li>
                                                    <li>Marks of the students should be entered in the software. A printed copy is to be submitted to the CoE office along with the answer script bundles.</li>
                                                    <li>The proof for the claim of travelling allowance (for external examiners only) is to be submitted to the CoE office.</li>
                                                </ol>
                                        </p>";


                $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
                                Kindly call to " . "$helplineno" . " if you have any clarifications..<br></p>";
                $message .="<br/>";


                $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,</p>";

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

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

                $subject = strtoupper("$univshort" . ": Appointment as Practical Examiner for the University -" . $fexamdate . " Examination");
                $from = "";

                $resp = sendGridMail($emailsent, $subject, $message, $univcode);

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

                $smsotp = "From $univshort: Dear Sir / Madam, $univshort1 is pleased to appoint you as Practical Examiner for our University Practical Examination. Kindly check the mail for details. - Uniclare";
   
                
                $sms = new SMS('026', 'OTP');
                $resf = $sms->sendIndvidualSms($mobno, $smsotp, '900', 'PGET');
                

            }
            }
        }
    }

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Could Not Update";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function loaDergrpview($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
  
    $query = "select distinct dg.fdeggrp,d.fdescpn  from prexaminer dg 
                inner join degree d on dg.fdeggrp=d.fdeggrp group by dg.fdeggrp";
              
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getdegreeviewdet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];
    
    if($deggrp === "All"){
        $deggrpCond = "d.fdeggrp BETWEEN '0' AND 'Z'";
    }else{
        $deggrpCond = "d.fdeggrp='{$deggrp}'";
    }
   

    $query = "select distinct d.fdeggrp,d.fdegree,p.fdescpn from prexaminer d inner join  
    deggrp dg on dg.fdeggrp=d.fdeggrp inner join degree p on d.fdegree=p.fdegree 
    where  $deggrpCond;";
  
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function getsemviewdet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];
    $degree = $aobj_context->mobj_data['degree'];

    if($deggrp === "All"){
        $deggrpCond = "p.fdeggrp BETWEEN '0' AND 'Z'";
    }else{
        $deggrpCond = "p.fdeggrp='{$deggrp}'";
    }

    if($degree === "All"){
        $degreeCond = "p.fdegree BETWEEN '0' AND 'Z'";
    }else{
        $degreeCond = "p.fdegree='{$degree}'";
    }


    $query = "select distinct p.fexamno,d.fexamname from prexaminer p 
                inner join degree d on p.fexamno=d.fexamno and p.fdeggrp=d.fdeggrp and 
                p.fdegree=d.fdegree
                where $deggrpCond
                and $degreeCond; ";
               
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}

function loadtableinfoview($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $univcode = $aobj_context->mobj_data['univcode'];
    $deggrp = $aobj_context->mobj_data['deggrp'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];

    // var_dump($deggrp,$degree,$sem);
    // die();
    if($deggrp === "All"){
        $deggrpCond = "p.fdeggrp BETWEEN '0' AND 'Z'";
    }else{
        $deggrpCond = "p.fdeggrp='{$deggrp}' ";
    }

    if($degree === "All"){
        $degreeCond = "p.fdegree BETWEEN '0' AND 'Z'";
    }else{
        $degreeCond = "p.fdegree='{$degree}'";
    }

    if($sem === "All"){
        $semCond = "p.fexamno BETWEEN '0' AND 'Z'";
    }else{
        $semCond = "p.fexamno='{$sem}'";
    }

        $query = "select distinct p.fdeggrp,p.fdegree,d.fdescpn,p.fexamno,d.fexamname,p.fsubcode,s.fsubname,
        p.fteachcode,m.fteachname,
        date_format( IF(p.fstartdate = '0000-00-00', '', p.fstartdate), '%d/%m/%Y') AS fstartdate,
        date_format( IF(p.fenddate = '0000-00-00', '', p.fenddate), '%d/%m/%Y') AS fenddate,
        p.fmail,
        DATE_FORMAT(IF(p.fcreatedate = '0000-00-00 00:00:00', '', p.fcreatedate), '%d/%m/%Y %H:%i:%s') AS fcreatedate
        from `prexaminer` p 
        inner join masteach m on p.fteachcode=m.fteachcode inner join degree d on p.fdegree=d.fdegree 
        and p.fdeggrp=d.fdeggrp and p.fexamno=d.fexamno inner join subject s on p.fdegree=s.fdegree
        and p.fexamno=s.fexamno and p.fsubcode=s.fcsubcode
        where  $deggrpCond and  $degreeCond  and $semCond and fmail='T' ORDER BY
        p.fcreatedate DESC";
        // var_dump($query);
        // die();
                   
          
    $result = $aobj_context->pobj_db->GetAll($query);

    if ($result) {
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    } else {
        $arr['msg'] = "Data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr, -1, "failure");
        return;
    }
}
// $query = "INSERT INTO prexaminer (fdeggrp, fdegree, fexamno, fsubcode, 
// fteachcode, fstartdate, fenddate, fmail, fcreatedate, fcreateuser,  
// fdelete, fdeluser, fdeldate)
// VALUES
// ('{$deggrp}', '{$degree}', '{$sem}', '{$subj}', 
// '{$value['data']['value']}', 
// date_format(str_to_date('{$value['fstartdate']}', '%d/%m/%Y'),'%Y-%m-%d') , 
// date_format(str_to_date('{$value['fenddate']}', '%d/%m/%Y'),'%Y-%m-%d') , 
// '{$value['fmail']}', NOW(), '{$user}','{$value['fdelete']}','{$user}',NOW())
// ON DUPLICATE KEY UPDATE
// fdeggrp ='{$deggrp}',
// fdegree ='{$degree}',
// fexamno ='{$sem}',
// fsubcode ='{$subj}',
// fteachcode ='{$value['data']['value']}',
// fstartdate =date_format(str_to_date('{$value['fstartdate']}', '%d/%m/%Y'),'%Y-%m-%d') , 
// fenddate =date_format(str_to_date('{$value['fenddate']}', '%d/%m/%Y'),'%Y-%m-%d') ,
// fmail ='{$value['fmail']}',
// fupddate =NOW(),
// fupduser ='{$user}',
// fdelete ='{$value['fdelete']}',
// fdeluser ='{$user}',
// fdeldate =NOW()";