ok
Direktori : /home2/selectio/www/subamangala/admin/data-tables/ |
Current File : /home2/selectio/www/subamangala/admin/data-tables/profiles-admin-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; //$allPermissions=$_SESSION['permission']; $requestData= $_REQUEST; if($requestData['length']==-1){ $requestData['length']=100000; } /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'id', 2 =>'id', 3 =>'created_on' ); $conditions=""; if(isset($_POST['profiles_id'])){ $string_profiles_id = implode("','", $_POST['profiles_id']); $conditions.="and h.id in ('".$string_profiles_id."')"; } if(isset($_POST['caste'])){ $castses = $_POST['caste']; $caste = implode(",",$castses); $conditions.="and caste.id in ('".$caste."')"; } if(isset($_POST['star'])){ $natchatrams = $_POST['star']; $natchatram = implode(",",$natchatrams); $conditions.="and natchatram.id in ('".$natchatram."')"; } if(isset($_POST['education'])){ $educations = $_POST['education']; $education = implode(",",$educations); $conditions.="and h.edu_cat in ('".$education."')"; } if(isset($_POST['height'])){ $heights = $_POST['height']; $height = implode(",",$heights); $conditions.="and h.height_cat in ('".$height."')"; } if(isset($_POST['thosam'])){ $thosams = $_POST['thosam']; $thosam = implode(",",$thosams); $conditions.="and admin_preference.Pref_Dhosam in ('".$thosam."')"; } if(isset($_POST['marriage'])){ $marriages = $_POST['marriage']; $marriage = implode(",",$marriages); $conditions.="and h.marriage in ('".$marriage."')"; } if(isset($_POST['miny'])){ $conditions.="and admin_preference.From_Year ='".$_POST['miny']."'"; } if(isset($_POST['maxy'])){ $conditions.="and admin_preference.To_Year ='".$_POST['maxy']."'"; } /*Fetch All Data Start*/ // error_log("SELECT h.*,caste.name as caste_name,subcaste.name as subcaste_name,admin_preference.Pref_Limit as profile_pref_limit,admin_preference.Entry_Date as profile_pref_date,admin_preference.Pref_Dhosam FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN natchatram ON h.natchatram=natchatram.id INNER JOIN admin_preference ON admin_preference.Profileid=h.id INNER JOIN subcaste ON h.subcaste=subcaste.id where h.id!=0 and delete_status = 1 ".$conditions." ORDER BY h.id DESC"); $statement = $pdo->prepare("SELECT h.*,caste.name as caste_name,subcaste.name as subcaste_name,admin_preference.Pref_Limit as profile_pref_limit,admin_preference.Entry_Date as profile_pref_date,admin_preference.Pref_Dhosam FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN natchatram ON h.natchatram=natchatram.id INNER JOIN admin_preference ON admin_preference.Profileid=h.id INNER JOIN subcaste ON h.subcaste=subcaste.id where h.id!=0 and delete_status = 1 ".$conditions." ORDER BY h.id DESC"); $result = $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT h.*,caste.name as caste_name,subcaste.name as subcaste_name,admin_preference.Pref_Limit as profile_pref_limit,admin_preference.Entry_Date as profile_pref_date,admin_preference.Pref_Dhosam FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN natchatram ON h.natchatram=natchatram.id INNER JOIN admin_preference ON admin_preference.Profileid=h.id INNER JOIN subcaste ON h.subcaste=subcaste.id where h.id!=0 and delete_status = 1 ".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND ( h.id LIKE '%".$_REQUEST['search']."%' "; $sql.=" OR h.bname LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.regtype LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.edu LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.gender LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.caste LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.natchatram LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.edu_cat LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.father_name LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.native_place LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.regdate LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.brokercount LIKE '%".$_REQUEST['search']."%'"; $sql.=" OR h.dob LIKE '%".$_REQUEST['search']."%' ) "; } //$sql.=" order by id asc"; /*Fetch Filter Data End*/ $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $data = array(); $i=1; foreach( $query as $row ) { // preparing an array $nestedData=array(); $action= "<div class='text-center'><div class='btn-group'>"; //if($allPermissions['category']['update']=="1"){ $action.=" <a style='padding: 6px;margin-right: 3px;' href='edit-profile.php?id=".$row["id"]."' title='Edit Profile' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a>"; $action.=" <a style='padding: 6px;margin-right: 3px;' href='view-profile.php?id=".$row["id"]."' title='View Profile' class='tip btn btn-warning btn-xs'> <i class='fa fa-eye'></i> </a>"; //} //if($allPermissions['category']['delete']=="1"){ $action.=" <a style='padding: 6px;margin-right: 3px;' target='_blank' href='profile-print.php?id=".$row["id"]."' title='Print Profile' class='tip btn btn-danger btn-xs'> <i class='fa fa-print'></i> </a>"; // } $action.="</div></div>"; // $nestedData[] = $action; // $nestedData[]='<input type="checkbox" class="s" id="xyz_'.$row["id"].'" name="assign_ids" value="'.$row["id"].'">'; $nestedData[] = $row["regtype"]; $nestedData[] = $row["regnop"].''.$row['id']; $nestedData[] = $row["bname"]; $nestedData[] = $row["dname"]; if($row["cellno"]!=''){ $nestedData[] = $row["cellno"]; }else{ $nestedData[]='<span>NULL</span>'; } $nestedData[] = $row["dob"]; $nestedData[] = $row["gender"]; $nestedData[] = $row["caste_name"]; if($row["subcaste_name"]!=''){ $nestedData[] = $row["subcaste_name"]; }else{ $nestedData[]='<span>NULL</span>'; } if($row["rasi"]=="1"){ $nestedData[]= "மேஷம்";} else if($row["rasi"]=="2"){ $nestedData[]= "ரிஷபம்";} else if($row["rasi"]=="3"){ $nestedData[]= "மிதுனம்";} else if($row["rasi"]=="4"){ $nestedData[]= "கடகம்";} else if($row["rasi"]=="5"){ $nestedData[]= "சிம்மம்";} else if($row["rasi"]=="6"){ $nestedData[]= "கன்னி";} else if($row["rasi"]=="7"){ $nestedData[]= "துலாம்";} else if($row["rasi"]=="8"){ $nestedData[]= "விருச்சிகம்";} else if($row["rasi"]=="9"){ $nestedData[]= "தனுசு";} else if($row["rasi"]=="10"){ $nestedData[]= "மகரம்";} else if($row["rasi"]=="11"){ $nestedData[]= "கும்பம்";} else{ $nestedData[]= "மீனம்";} if($row["natchatram"]=="1"){ $nestedData[]= "அஸ்வினி";} else if($row["natchatram"]=="2"){ $nestedData[]= "பரணி";} else if($row["natchatram"]=="3"){ $nestedData[]= "கார்த்திகை";} else if($row["natchatram"]=="4"){ $nestedData[]= "ரோகிணி";} else if($row["natchatram"]=="5"){ $nestedData[]= "மிருகசீரிடம்";} else if($row["natchatram"]=="6"){ $nestedData[]= "திருவாதிரை";} else if($row["natchatram"]=="7"){ $nestedData[]= "புனர்பூசம்";} else if($row["natchatram"]=="8"){ $nestedData[]= "பூசம்";} else if($row["natchatram"]=="9"){ $nestedData[]= "ஆயில்யம்";} else if($row["natchatram"]=="10"){ $nestedData[]= "மகம்";} else if($row["natchatram"]=="11"){ $nestedData[]= "பூரம்";} else if($row["natchatram"]=="12"){ $nestedData[]= "உத்தரம்";} else if($row["natchatram"]=="13"){ $nestedData[]= "அஸ்தம்";} else if($row["natchatram"]=="14"){ $nestedData[]= "சித்திரை";} else if($row["natchatram"]=="15"){ $nestedData[]= "சுவாதி";} else if($row["natchatram"]=="16"){ $nestedData[]= "விசாகம்";} else if($row["natchatram"]=="17"){ $nestedData[]= "அனுஷம்";} else if($row["natchatram"]=="18"){ $nestedData[]= "கேட்டை";} else if($row["natchatram"]=="19"){ $nestedData[]= "மூலம்";} else if($row["natchatram"]=="20"){ $nestedData[]= "பூராடம்";} else if($row["natchatram"]=="21"){ $nestedData[]= "உத்திராடம்";} else if($row["natchatram"]=="22"){ $nestedData[]= "திருவோணம்";} else if($row["natchatram"]=="23"){ $nestedData[]= "அவிட்டம்";} else if($row["natchatram"]=="24"){ $nestedData[]= "சதயம்";} else if($row["natchatram"]=="25"){ $nestedData[]= "பூரட்டாதி";} else if($row["natchatram"]=="26"){ $nestedData[]= "உத்திரட்டாதி";} else if($row["natchatram"]=="27"){ $nestedData[]= "ரேவதி"; } $nestedData[] = $row["edu_cat"]; $nestedData[] = $row["father_name"]; $nestedData[] = $row["father_dname"]; $nestedData[] = $row["native_place"]; $nestedData[] = $row["family_idty"]; $nestedData[] = $row["regdate"]; $svalue=''; if($row['brokercount']>0) { if(@strpos(",", $row['broker_ids']) !== false ) { $bro_ids[0] = $row['broker_ids']; } else { $bro_ids = explode(",",$row['broker_ids']); } for($i=0;$i<$row['brokercount'];$i++) { $statement3 = $pdo->prepare("SELECT * FROM brokers where id='$bro_ids[$i]'"); $statement3->execute(); $bro_row = $statement3->fetchAll(PDO::FETCH_ASSOC); if($bro_row[0]['brokername']!="") { $svalue=$svalue.''.$bro_row[0]['brokername'].','; } } } $nestedData[] =$svalue; $nestedData[] = $row["registeredby"]; if($row['loginstatus']=='Disable') { $nestedData[] = '<p style="color:red;font-weight:bold;">'.$row["loginstatus"].'</p>'; } else{ $nestedData[] = '<p style="color:green;font-weight:bold;">'.$row["loginstatus"].'</p>'; } $nestedData[] = $row["Total_Matches"]; if($row['profile_pref_limit']!=0) { $nestedData[]='<td style="font-weight:bold; width:auto!important; white-space:nowrap;text-align:center;">'.$row["profile_pref_limit"].'</td> '; $nestedData[]='<td style="font-weight:bold; width:auto!important; white-space:nowrap;ext-align:center;">'.$row["profile_pref_date"].'</td> '; } else{ $nestedData[]='<td style="font-weight:bold; width:auto!important; white-space:nowrap;text-align:center;">-</td>'; $nestedData[]='<td style="font-weight:bold; width:auto!important; white-space:nowrap;text-align:center;">-</td>'; } if($row["marriage"]=="first"){ $nestedData[]= "இல்லை";} else {$nestedData[]= "ஆம்";} $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>