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.145.99.221
<?php
class download_misc_files
{
function __construct($aobj_context)
{
$this->aobj_context=$aobj_context;
$this->college_code = $_SESSION['collcode'];
}
function GetDegreeNames()
{
$get_data="select distinct FDEGREE,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.'/'.$_REQUEST['db']."/misc_files/";
$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);
// $univcode =
$coll_code=$arr[5];
$semester=$arr[4];
$degree=$arr[3];
$file1=$arr[6];
// var_dump($arr[0]);
// var_dump($_SESSION['UNIVCODE']);
$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]['semester']=$semester;
$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='99%' 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-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Semester</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']];
$semester = $av['semester'];
$file = $av['file'];
$full_file_name=$av['full_file_name'];
$str_reval.="<tr class='ui-widget-content jqgrow'>";
$str_reval.="<td class='tbl_row_new' style='text-align:center; 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='text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; ' >{$semester}</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='misc_files/{$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)
{
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();
}
?>
|