ok
Direktori : /home2/selectio/www/subamangala/admin/data-tables/ |
Current File : /home2/selectio/www/subamangala/admin/data-tables/profiles-search-datatable.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['gender'])){ $string_gender = implode("','", $_POST['gender']); $conditions.="and h.gender in ('".$string_gender."')"; } if(isset($_POST['regtype'])){ $string_regtype = implode("','", $_POST['regtype']); $conditions.="and h.regtype in ('".$string_regtype."')"; } if(isset($_POST['regnop'])){ $string_regnop = implode("','", $_POST['regnop']); $conditions.="and h.regnop in ('".$string_regnop."')"; } if(isset($_POST['brokername'])){ $string_brokername = implode("','", $_POST['brokername']); $conditions.="and h.broker_ids in ('".$string_brokername."')"; } if(isset($_POST['bname'])){ $string_bname = implode("','", $_POST['bname']); $conditions.="and h.bname in ('".$string_bname."')"; } if(isset($_POST['dname'])){ $string_dname = implode("','", $_POST['dname']); $conditions.="and h.dname in ('".$string_dname."')"; } if(isset($_POST['father_name'])){ $string_father_name = implode("','", $_POST['father_name']); $conditions.="and h.father_name in ('".$string_father_name."')"; } if(isset($_POST['father_dname'])){ $string_father_dname = implode("','", $_POST['father_dname']); $conditions.="and h.father_dname in ('".$string_father_dname."')"; } if(isset($_POST['native_place'])){ $string_native_place = implode("','", $_POST['native_place']); $conditions.="and h.native_place in ('".$string_native_place."')"; } if(isset($_POST['native_place'])){ $string_native_place = implode("','", $_POST['native_place']); $conditions.="and h.native_place in ('".$string_native_place."')"; } if(isset($_POST['natchatram'])){ $string_natchatram = implode("','", $_POST['natchatram']); $conditions.="and h.natchatram in ('".$string_natchatram."')"; } if(isset($_POST['caste'])){ $string_caste = implode("','", $_POST['caste']); $conditions.="and h.caste in ('".$string_caste."')"; } if(isset($_POST['subcaste'])){ $string_subcaste = implode("','", $_POST['subcaste']); $conditions.="and h.subcaste in ('".$string_subcaste."')"; } if(isset($_POST['cellno'])){ $string_cellno = implode("','", $_POST['cellno']); $conditions.="and h.cellno in ('".$string_cellno."')"; } if(isset($_POST['cellno'])){ $string_cellno = implode("','", $_POST['cellno']); $conditions.="and h.cellno in ('".$string_cellno."')"; } if(isset($_POST['dob'])){ $string_dob = implode("','", $_POST['dob']); $conditions.="and h.dob in ('".$string_dob."')"; } if(isset($_POST['marriage'])){ $string_marriage = implode("','", $_POST['marriage']); $conditions.="and h.marriage in ('".$string_marriage."')"; } if(isset($_POST['rname'])){ $string_rname = implode("','", $_POST['rname']); $conditions.="and h.rname in ('".$string_rname."')"; } /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT h.*,caste.name as caste_name,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.id where h.id!=0 and delete_status = 1 ".$conditions." ORDER BY h.id DESC"); error_log("SELECT h.*,caste.name as caste_name,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.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,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.id where h.id!=0 and delete_status = 1 ".$conditions; error_log("SELECT h.*,caste.name as caste_name,preference.Pref_Limit as profile_pref_limit,preference.Entry_Date as profile_pref_date FROM `profiles` h INNER JOIN caste ON h.caste=caste.id INNER JOIN preference ON preference.Profileid=h.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']."%' ) "; } /*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-success 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[] = $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); ?>