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


Current Path : /var/www/html/mum/srcold/
Upload File :
Current File : /var/www/html/mum/srcold/display_details_in_grid_custom.php

<?php
  /*
            Author :  Natesha
	 Date : 2010-04-29
	 Module : Custom Grid

    */    
  
  class display_details_in_grid
	{
	   public $table_cols;
	   public $display_qry;
	           function __construct($aobj_context)
	              {
		              session_start();
		              $this->aobj_context=$aobj_context;
		              $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
					  $this->user_id = $_SESSION['user_id'];	
					 require_once("json.php"); 	
		           }
		//End : Constructor 
		function DisplayDetailsInGrid()
		{ 
				$json = new Services_JSON(); 
				$limit = $this->aobj_context->mobj_data["rows"];
				$sidx = $this->aobj_context->mobj_data["sidx"];
				$sord = $this->aobj_context->mobj_data["sord"];
				$page = $this->aobj_context->mobj_data["page"];
				if(!$sidx) 
				$sidx =1; 
				$search =$this->aobj_context->mobj_data["_search"];					 
				$filter_toolbal_cond="";
				if($search=='true')
				{	 
					foreach($this->aobj_context->mobj_data as $search_k=>$search_v)
						{
							$s_val=trim($search_v);
							if(in_array($search_k,$this->table_cols))
							$filter_toolbal_cond.=" and {$search_k} like '{$s_val}%' ";	
						}
					$count_id="select count(*) as count from ({$this->display_qry} {$filter_toolbal_cond}) a ";		
				}				 
				else
				{
					$count_id="select count(*) as count from ({$this->display_qry}) a ";	
				}
				
				$count_id_obj=$this->aobj_context->mobj_db->GetRow($count_id);	
				$count = $count_id_obj['count'];
				 
				 // calculation of total pages for the query 
					if( $count >0 ) 
					{ 
						$total_pages = ceil($count/$limit); 
					} 
					else 
					{ 
						$total_pages = 0; 
					} 
					if ($page > $total_pages) 
					$page=$total_pages; 
					$start = $limit*$page - $limit;					
					if($start <0) 
					$start = 0; 
					
					if($search=='true')
					{
					//echo $filter_toolbal_cond;		
						$SQL="select * from ({$this->display_qry}) a  where 1=1					 
								{$filter_toolbal_cond}
							ORDER BY $sidx $sord LIMIT $start,$limit";
						
					}
					else
					{
					$SQL = " {$this->display_qry} 
							ORDER BY $sidx $sord LIMIT $start , $limit"; 
								
					}
					 
					$lobj_rs =$this->aobj_context->mobj_db->GetAll($SQL);
					
					$responce->page = $page; 
					$responce->total = $total_pages; 
					$responce->records = $count; 
					foreach($lobj_rs as $key =>$value)
					{
					$val='';
					$responce->rows[$key]['id']=$value[id];
					$l=0;
						foreach($value as $key1 =>$value1)
						{	 
							if($key1!='id'){ 
							$val[$l]=$value[$key1];
							 $l++; 
							}
						} 
					$responce->rows[$key]['cell']=($val);
					}
					 
					echo $json->encode($responce);
					 
		}
	}
  
     
?>