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


Current Path : /proc/thread-self/root/var/www/oasis/src_old/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src_old/download_misc_files.php

<?php
class download_misc_files
{  
    function __construct($aobj_context)
    {
		$this->aobj_context=$aobj_context;
		$this->college_code = $_SESSION['collcode'];
		$this->type = $aobj_context->mobj_data['type'];
		$this->mode = $aobj_context->mobj_data['mode'];
		
	}
	
	function GetDegreeNames()
	{
		$get_data="select distinct FDEGREE,CONCAT(FDEGREE,' - ',FDESCPN) AS FDESCPN from degree ORDER BY FDEGREE,FEXAMNO";
		$lobj_get_data= $this->aobj_context->mobj_db->GetAll($get_data);
		$this->degree_arr=array();
		foreach($lobj_get_data as $ak=>$av)
		{
			$this->degree_arr[$av['FDEGREE']]=$av['FDESCPN'];
		}
	}
	 function DownloadMiscFiles()
	 {
	 
		
		$dir=$this->aobj_context->main_src."/docs/".$this->type."/".$this->mode;
		
		$this->fdir=$this->aobj_context->main_src."docs/".$this->type."/".$this->mode."/";
		
		$this->file_names_arr=array();	 
			$file_names="";
			if (is_dir($dir)) 
			{
		
				if ($dh = opendir($dir)) 
				{
					$cnt=0;
					while (($file = readdir($dh)) !== false) 
					{
						if(!empty($file) && $file!="." && $file!=".." && $file!="Thumbs.db")
						{
							$arr=explode("-",$file);
							
							array_multisort($arr[1], SORT_DESC, SORT_STRING,
							$arr[2], SORT_ASC, SORT_STRING);
					
							$coll_code=$arr[0];
							$degree=$arr[1];
							$file1=$arr[2];
							//var_dump($arr[2]);
							
				
							$this->file_names_arr[$coll_code][$cnt]['full_file_name']=$file;
							$this->file_names_arr[$coll_code][$cnt]['degree']=$degree;
							$this->file_names_arr[$coll_code][$cnt]['file']=$file1;
							
							$cnt++;
						 }	
						 //sort($this->file_names_arr[$coll_code][$cnt]['full_file_name']);
					}	
					
					
				}				
					closedir($dh);
			}
			 
	 }
	 function FormHtml()
	 {
		$str_reval="<table style='padding:3px 4px 3px 3px;' align='center' class='tr_ventor_row' id='reval_table_data' width='60%' border='0' cellspacing='0' cellpadding='0'>";
		$str_reval.="<th align='left' colspan='6' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Download List</th>";
		$str_reval.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
		$str_reval.="<td align='center' style=' font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Degree</td>";
		$str_reval.="<td align='center' style=' font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>File Names</td>";
		$str_reval.="</tr>";
		$print_arr =$this->file_names_arr[$this->college_code];
		
		sort($print_arr);
		//array_multisort($print_arr, SORT_ASC, SORT_STRING);
						//	$arr[2], SORT_ASC, SORT_STRING);
						
		foreach($print_arr as $ak=>$av)
		{
			$degree_name=$this->degree_arr[$av['degree']];	
			$file=$av['file'];
			$full_file_name=$av['full_file_name'];
			//var_dump($this->fdir.'/'.$full_file_name);
			$str_reval.="<tr class='ui-widget-content jqgrow'>";		
			$str_reval.="<td class='tbl_row_new' style='text-align:left; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;  ' >{$degree_name}</td>";
			$str_reval.="<td class='tbl_row_new' style='border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:left;'  ><a style='color:blue;cursor:pointer;text-decoration:none;' target='_new' href='{$this->fdir}{$full_file_name}'>{$file}</a></td>";
			$str_reval.="</tr>";
		}
		$str_reval.="</html>";
		$data=$str_reval;
		$data1="No Data Found";
		if(count($print_arr)>0)
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
		else
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($data1,0,"success"); 
	 }
	function __destruct() {  }
}

function DownloadMiscFiles($aobj_context)
{
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
		ini_set("memory_limit",-1);
		ini_set('max_execution_time',2900);
		$class_obj=new download_misc_files($aobj_context);	
		$class_obj->GetDegreeNames();
		$class_obj->DownloadMiscFiles();
		$class_obj->FormHtml();
}

function getfoldername($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	//$folder_path=$aobj_context->main_src."/misc_files/";
	$type = $aobj_context->mobj_data['type'];
	$folder_path=$aobj_context->main_src."/docs/".$type;
	$html = "<option value = ''>Select Examination</option>";
	$file2 =  array_slice(scandir($folder_path), 2);
	foreach($file2 as $value)
	{
		//var_dump($value);
		if(strpos($value,'.') === false)
		{
			$html.="<option value = '{$value}'>{$value}</option>";
		}	
	}
	//var_dump($html);
	echo $aobj_context->mobj_output->ToJSONEnvelope($html,0,"success"); 
	return;
}		
?>