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.220.196.68
<?php
class display_custom_html
{
public $data_set;
// DEFAULT CONSTRUCTOR TO ASSIGN MEMBER VARIABLES
function __construct($arr)
{
$this->data_set=$arr[data];
$this->html_header_name=$arr[html_header_name];
$this->key=$arr[key];
$this->th_required=$arr[th_required];
$this->header_required=$arr[header_required];
$this->total_required=$arr[total_required];
$this->sl_no_required=$arr[sl_no_required];
$this->total_cols_arr=$arr[total_cols_arr];
$this->header_format_required=$arr[header_format_required];
if(!isset($arr[header_required]))
$this->header_required=1;
if(!isset($arr[th_required]))
$this->th_required=1;
if(!isset($arr[header_format_required]))
$this->header_format_required=0;
if(!isset($arr[sl_no_required]))
$this->sl_no_required=0;
$this->GetHtml();
}
function GetHtml()
{
$first_cols_arr=array("SL No");
$header_vals= array_keys($this->data_set[0]);
if($this->sl_no_required==1)
$header_vals=array_merge($first_cols_arr,$header_vals);
$col_span_count=count($final_header_val);
$this->html="<table cellspacing=0 style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='user_rights_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
if($this->header_required==1)
{
$this->html.="<th align='left' colspan='{$col_span_count}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>{$this->html_header_name}</th>";
}
$this->html.="<tr class='ui-state-default ui-jqgrid-hdiv' style='line-height:18px;background-color:#EEEEEE'>";
//$this->html.="<td align='center' style='width:55px; font-size:12px; border-left:1px solid #C8C8C8;color:#464646; border-right:1px solid #C8C8C8; border-bottom:1px solid #C8C8C8;'> SL No</td>";
$cnt=1;
$prop_arr=array();
if($this->th_required==1)
{
foreach($header_vals as $k=>$v)
{
$v_a=explode(":",$v);
$name=$v_a[0];
$width=$v_a[1];
$al=$v_a[2];
$align="";
if(strtolower($al)=="l")
$align="left";
if(strtolower($al)=="c")
$align="center";
if(strtolower($al)=="r")
$align="right";
if(empty($align))
$align="left";
$prop_arr[$name]['align']=$align;
$prop_arr[$name]['width']=$width;
$w_style="";
if(!empty($width))
{
$w_style=" width:{$width};";
}
if($this->header_format_required==0)
$this->html.="<td align='center' style=' font-size:12px; border-right:1px solid #C8C8C8; border-bottom:1px solid #C8C8C8;color:#464646;'>{$v}</td>";
else
{
if($cnt==1)
$this->html.="<td align='center' style=' {$w_style} font-size:12px; border-left:1px solid #C8C8C8; border-right:1px solid #C8C8C8; border-bottom:1px solid #C8C8C8;color:#464646;'>{$name}</td>";
else
$this->html.="<td align='center' style=' {$w_style} font-size:12px; border-right:1px solid #C8C8C8; border-bottom:1px solid #C8C8C8;color:#464646;'>{$name}</td>";
$cnt++;
}
}
}
$sl_no=1;
$this->total_arr=array();
foreach($this->data_set as $ck=>$cv)
{
if($this->sl_no_required==1)
{
$cv = array('SL No' => $sl_no) + $cv;
}
$int_code=$cv[$this->key];
if($sl_no%2==0)
$color="#f9f9f9";
else
$color="#FFFFFF";
$this->html.="<tr class='ui-widget-content jqgrow' style='background-color:{$color}'>";
//$this->html.="<td class='tbl_row_new' style=' border-left:1px solid #C8C8C8; border-right:1px solid #C8C8C8; padding:2px; font-size:12px;' >{$sl_no}</td>";
$cnt=1;
foreach($cv as $ckk=>$cvv)
{
$v_a=explode(":",$ckk);
$name=$v_a[0];
if($this->total_required==1 and in_array($name,$this->total_cols_arr))
{
$this->total_arr[$name]+=$cvv;
}
$user_align=$prop_arr[$name]['align'];
$t_align="";
if(!empty($user_align))
{
$t_align=" text-align:{$user_align}; ";
}
if($cnt==1)
$this->html.="<td class='ggrid_tbl_row_btw' style='{$t_align} border-left:1px solid #C8C8C8;border-right:1px solid #C8C8C8; padding:2px; font-size:12px; '>{$cvv}</td>";
else
$this->html.="<td class='ggrid_tbl_row_btw' style='{$t_align} border-right:1px solid #C8C8C8; padding:2px; font-size:12px; '>{$cvv}</td>";
$cnt++;
}
$this->html.="</tr>";
$sl_no++;
}
if(!empty($this->total_arr))
{
$this->html.="<tr class='ui-widget-content jqgrow' style='font-weight:bold;background-color:{$color}'>";
$cnt=1;
foreach($prop_arr as $ak=>$av)
{
$name=$ak;
$cell_val=$this->total_arr[$name];
$cell_val=empty($cell_val)?" ":$cell_val;
$border_left="";
if($cnt==1 && $cell_val==" ")
{
$cell_val="Grand Total";
$border_left=" border-left:1px solid #C8C8C8; ";
}
$align=$av['align'];
$width=$av['width'];
$t_align="";
if(!empty($align))
{
$t_align=" text-align:{$align}; ";
}
$this->html.="<td class='ggrid_tbl_row_btw' style='{$t_align} {$border_left} border-right:1px solid #C8C8C8; padding:2px; font-size:12px; '>{$cell_val}</td>";
$cnt++;
}
$this->html.="</tr>";
}
//echo "<pre>";
//print_r($prop_arr);
//print_r($this->total_arr);die();
$this->html.="</table>";
return $this->html;
}
}
class display_custom_html_ggrid
{
public $data_set;
// DEFAULT CONSTRUCTOR TO ASSIGN MEMBER VARIABLES
function __construct($arr)
{
$this->data_set=$arr[data];
$this->html_header_name=$arr[html_header_name];
$this->header_required=$arr[header_required];
if(!isset($arr[header_required]))
$this->header_required=1;
$this->header_table_arr_width=$arr[header_table_arr_width];
$this->GetHtml();
}
function GetHtml()
{
$first_col=ceil(count($this->data_set)/2);
$sec_col=count($this->data_set)- $first_col;
//echo $first_col.'--'. $sec_col;
$this->html="<table cellspacing=0 style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='user_rights_table_data' width='100%' border='0' cellspacing='0' cellpadding='0'>";
if($this->header_required==1)
{
$this->html.="<th align='left' colspan='4' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>{$this->html_header_name}</th>";
}
$this->html.="<tr class='ui-state-default ui-jqgrid-hdiv' style='line-height:18px;background-color:#EEEEEE'>";
$sl_no=1;
$final_arr=array() ;
foreach($this->data_set as $ak=>$av)
{
$final_arr[$sl_no][$ak]=$av;$sl_no++;
}
$sl_no=1;
//echo "<pre>";print_r($final_arr);
for($i=1;$i<=$first_col;$i++)
{
if(count($this->data_set)%2==0)
$next_col=$i+$sec_col;
else
$next_col=$i+$sec_col+1;
if($sl_no%2==0)
$color="#f9f9f9";
else
$color="#FFFFFF";
$this->html.="<tr class='ui-widget-content jqgrow' style='background-color:{$color}'>";
$first_cell_arr=array_keys($final_arr[$i]);
$first_cell=$first_cell_arr[0];
$sec_cell_arr=array_values($final_arr[$i]);
$sec_cell=$sec_cell_arr[0];
$thi_cell_arr=array_keys($final_arr[$next_col]);
$thi_cell=$thi_cell_arr[0];
$four_cell_arr=array_values($final_arr[$next_col]);
$four_cell=$four_cell_arr[0];
$td1_width="";
$td2_width="";
$td3_width="";
$td4_width="";
if(!empty($this->header_table_arr_width))
{
$td1_width="width:{$this->header_table_arr_width[0]};";
$td2_width="width:{$this->header_table_arr_width[1]};";
$td3_width="width:{$this->header_table_arr_width[2]};";
$td4_width="width:{$this->header_table_arr_width[3]};";
}
$border_top="";
if($sl_no==1 && $this->header_required==0)
$border_top="border-top:1px solid #C8C8C8;";
$this->html.="<td class='ggrid_tbl_row_btw' style='{$td1_width} {$border_top} border-left:1px solid #C8C8C8;font-weight:bold; border-right:1px solid #C8C8C8; padding:2px; font-size:12px; '>{$first_cell}</td>";
$this->html.="<td class='ggrid_tbl_row_btw' style=' {$td2_width} {$border_top} border-right:1px solid #C8C8C8; padding:2px; font-size:12px; '>{$sec_cell}</td>";
$this->html.="<td class='ggrid_tbl_row_btw' style='{$td3_width} {$border_top} border-right:1px solid #C8C8C8;font-weight:bold; padding:2px; font-size:12px; '>{$thi_cell}</td>";
$this->html.="<td class='ggrid_tbl_row_btw' style=' {$td4_width} {$border_top} border-right:1px solid #C8C8C8; padding:2px; font-size:12px; '>{$four_cell}</td>";
$this->html.="</tr>";
$sl_no++;
}
$this->html.="</table>";
return $this->html;
}
}
?>
|