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


Current Path : /var/www/html/collportal/student/
Upload File :
Current File : /var/www/html/collportal/student/studentOnlineStudyMaterial.php

<?php
    function getStudentSemester($aobj_context){
        $univcode  = $aobj_context->mobj_data["db"];
		$deg1  = $aobj_context->mobj_data["degree"];
        // var_dump($deg1);die();
        // $deg=explode('[',$deg1);
        // $degree=explode(']',$deg);
        if (preg_match('/\[(.*?)\]/', $deg1, $matches)) {
            $degree = $matches[1];
        } 
		$query = "select distinct o.fexamno as `key`,concat(d.fexamname, ' ', '[',o.fexamno,']')as `value`,
                  concat(d.fexamname, ' ', '[',o.fexamno,']')as `lable` 
				  from osmmain o inner join degree d 
				  on d.fdegree = o.fdegree and d.fexamno = o.fexamno where o.fdegree='{$degree}'";
		// $result = $aobj_context->mobj_db->GetAll($query);
        $result = $aobj_context->mobj_db->GetAll($query);
       
		if($result){
			echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success"); 
			return;
		}else{
			$arr = 'failed to get semester';
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure"); 
			return;
		}
    }

    function getChaptersOfStudents($aobj_context){
        $univcode  = $aobj_context->mobj_data["db"];
		$sem1  = $aobj_context->mobj_data["sem"];
		$degree1  = $aobj_context->mobj_data["degree"];
		$collcode1 = $aobj_context->mobj_data["collcode"];

        if (preg_match('/\[(.*?)\]/', $collcode1, $matches)) {
            $collcode = $matches[1];
        } 
        if (preg_match('/\[(.*?)\]/', $degree1, $matches)) {
            $degree = $matches[1];
        } 

        if (preg_match('/\[(.*?)\]/', $sem1, $matches)) {
            $sem = $matches[1];
        } 
      
        if($sem == "null" || $sem == ""||$sem=="select"){
			$cond = "";
		}else{
			$cond = "and s.fexamno='$sem'";
		}

	
		$query = "SELECT distinct ifnull(fchapter,' - ') as`value`,
                  ifnull(fchapter,' - ') as `lable`  from osmmain s 
				  inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno 
				  inner join subject su on su.fdegree = s.fdegree and su.fexamno = s.fexamno 
				  and su.fsubcode = s.fsubcode and su.fintass = 'F' 
				  where ifnull(s.fdeleted,'') <> 'T' and s.fdegree = '{$degree}' 
				  and ifnull(s.FAPPRSTATUS,'') = 'approved' 
				  and s.fcollcode = '{$collcode}' {$cond}
				  order by s.FCREATEDATE desc,s.fexamno,su.fsubcode";

		$result = $aobj_context->mobj_db->GetAll($query);
		if($result){
			echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success"); 
			return;
		}else{
			$arr = 'No Data';
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure"); 
			return;
		}
    }

    function getStudyMaterial($aobj_context){
        $univcode  = $aobj_context->mobj_data["db"];
		$sem1  = $aobj_context->mobj_data["sem"];
		$degree1  = $aobj_context->mobj_data["degree"];
		$collcode1 = $aobj_context->mobj_data["collcode"];
        $chapter = $aobj_context->mobj_data["chapter"];
        $regno = $aobj_context->mobj_data["regno"];

        if (preg_match('/\[(.*?)\]/', $sem1, $matches)) {
            $sem = $matches[1];
        } 
        if($sem == "" || $sem == "null"||$sem=="select"){
            $cndsem = "";
        }else{
            $cndsem = "and s.fexamno='{$sem}'";
        }
    
        if($chapter == "" || $chapter == "null" ||$chapter=="All"||$chapter=="undefined"){
            $cndchapter = "";
        }else{
            $cndchapter = "and fchapter = '{$chapter}'";
        }
            
        if (preg_match('/\[(.*?)\]/', $collcode1, $matches)) {
            $collcode = $matches[1];
        } 

        if (preg_match('/\[(.*?)\]/', $degree1, $matches)) {
            $degree = $matches[1];
        }

        if(strtolower($degree) === 'phd'){
            $degCond = "";
        }else{
            $degCond = "and (s.fcollcode = '{$collcode}' or s.fcollcode = 'All')";
        }

        $query = "SELECT distinct  '{$regno}' as regno,s.fosmid,s.fdegree,s.fexamno,d.fdescpn,d.fexamname,s.fexamno,
                    date_format(s.FCREATEDATE,'%d/%m/%Y %h:%i:%s %p') as upddate,s.fcollcode,ifnull(FLINK,'') as flink,
                    su.fsubcode, su.fsubname, ifnull(s.fpath,'') as fpath, IFNULL(fchapter,' - ') as fchapter, s.FUPDTEACH 
                    from osmmain s inner join degree d
                    on s.fdegree = d.fdegree and s.fexamno = d.fexamno 
                    inner join subject su on su.fdegree = s.fdegree and su.fexamno = s.fexamno and su.fsubcode = s.fsubcode
                    and su.fintass = 'F'
                    where ifnull(s.fdeleted,'') <> 'T' and s.fdegree = '{$degree}'
                    and ifnull(s.FAPPRSTATUS,'') = 'approved'
                    {$degCond} {$cndchapter} {$cndsem}
                    order by s.FCREATEDATE desc,s.fexamno,su.fsubcode";
               
                
         $rst = $aobj_context->mobj_db->GetAll($query);
    
        if($rst)
            echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success"); 
        else
        {
            $error_msg = 'No data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure"); 
        }
        return;	
    }

    function getmaterialToview($aobj_context){
        $univcode  = $aobj_context->mobj_data["db"];
       
        $subcode = $aobj_context->mobj_data["subcode"];
        $examno = $aobj_context->mobj_data["examno"];
        $degree = $aobj_context->mobj_data["degree"];
        $regno = $aobj_context->mobj_data["regno"];
        $osmid = $aobj_context->mobj_data["osmid"];
        $collcode = $aobj_context->mobj_data["collcode"];
       
        $insert_qry = " insert into osmdetl(FOSMID,FDEGREE,FEXAMNO,FSUBCODE,FCOLLCODE,FREGNO,FCREATEDATE)
         values('{$osmid}','{$degree}','{$examno}','{$subcode}','{$collcode}','{$regno}',now()) ON DUPLICATE KEY UPDATE
        FCREATEDATE = now()";
		$insert_obj = $aobj_context->mobj_db->Execute($insert_qry);	
       
		if($insert_obj)
		{
            $folder  = $univcode;
			echo $aobj_context->mobj_output->ToJSONEnvelope($folder,0,"success"); 
			return;
			
		}
		else
		{
			$data="Please try after some time";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
			return;
		}
    }

    
?>