require("../include/before.php"); include("../include/show_page_title.php"); include ("../include/form_utils.php"); include ("../include/classes/cselect.php"); include ("../include/tables.php"); include("../include/show_cmd_button.php"); include ("../include/classes/ccheckbox.php"); include ("search_fct.php"); //member information $member_id = $auth->member_id; //number of values for each chkbox array $height_num_options = count($appearance[1]); $weight_num_options = count($appearance[2]); $ethnicity_num_options = count($appearance[5]); $marital_num_options = count($appearance[6]); //prepopulating the forms if data is available if ($member_id!="" && $_SESSION['isPostBack']=="")//member; first time view of the page { //prepopulating form db - preferences table $pref_query = "SELECT members.gender, preferences.* FROM preferences INNER JOIN members ON preferences.member_id = members.id WHERE members.id ='".$member_id."'"; $pref_rs = $conn->query($pref_query); $pref = $conn->fetch_array($pref_rs); $country=$pref["country"]; $region = $pref['region']; $city = $pref['city']; $zip = $pref['zip']; $gender = $pref['gender']; $desiredPartner = $pref['desired_gender']; $minAge = $pref['min_age']; $maxAge = $pref['max_age']; $chkPictures = $pref['only_pict']; $chk_instructors = $pref['you_teach']; $disciplines_code = $pref['discipline_code']; $interests_code = $pref['interest_code']; $height_checked_arr = code_to_checked_arr($pref['height'],$height_num_options); $weight_checked_arr = code_to_checked_arr($pref['weight'],$weight_num_options); $ethnicity_checked_arr = code_to_checked_arr($pref['ethnicity'],$ethnicity_num_options); $marital_checked_arr = code_to_checked_arr($pref['marital'],$marital_num_options); } elseif ($_SESSION['isPostBack']!="") // member or visitator - postback { $country = loadAndClearSavedField("country", "advancedSearch"); $region = loadAndClearSavedField("region", "advancedSearch"); $city = loadAndClearSavedField("city", "advancedSearch"); $zip = loadAndClearSavedField("zip", "advancedSearch"); $gender = loadAndClearSavedField("gender", "advancedSearch"); $desiredPartner = loadAndClearSavedField("desiredPartner", "advancedSearch"); $minAge = loadAndClearSavedField("minAge", "advancedSearch"); $maxAge = loadAndClearSavedField("maxAge", "advancedSearch"); $chkPictures = loadAndClearSavedField("chkPictures", "advancedSearch"); $chk_instructors = loadAndClearSavedField("chk_instructors", "advancedSearch"); $chk_practitioners = loadAndClearSavedField("chk_practitioners", "advancedSearch"); $marital_code = loadAndClearSavedField("marital_code", "advancedSearch"); $height_code = loadAndClearSavedField("height_code", "advancedSearch"); $wieght_code = loadAndClearSavedField("weight_code", "advancedSearch"); $ethnicity_code = loadAndClearSavedField("ethnicity_code", "advancedSearch"); $marital_checked_arr = code_to_checked_arr($marital_code,$marital_num_options); $height_checked_arr = code_to_checked_arr($height_code,$height_num_options); $weight_checked_arr = code_to_checked_arr($wieght_code,$weight_num_options); $ethnicity_checked_arr = code_to_checked_arr($ethnicity_code,$ethnicity_num_options); $disciplines_code = loadAndClearSavedField("disciplines_code", "advancedSearch"); $interests_code = loadAndClearSavedField("interests_code", "advancedSearch"); $_SESSION['isPostBack']=""; } if ($minAge==0) $minAge=""; if ($maxAge==0) $maxAge=""; //end prepopulating //creating the drop-down lists and jump menus //1. Country $country_select = new CSelect($country,$conn); $available_countries=get_available_countries(); $country_select_labels = array_values($available_countries); $country_select_values = array_keys($available_countries); //2. Region (displayed only if a country has been selected) $region_select = new CSelect($region,$conn); $available_regions=get_available_regions($country); $region_select_labels = array_values($available_regions); $region_select_values = array_keys($available_regions); //3. distance /* $distance_select = new CSelect($distance,$conn); $distance_select_labels = array_values($appearance[13]); $distance_select_values = array_keys($appearance[13]); */ //4. gender $gender_select = new CSelect($gender,$conn); $gender_values = array("2","1","0"); $gender_labels = array("","Male","Female "); //5. desiredPartner $desiredPartner_select = new CSelect($desiredPartner,$conn); $desiredPartner_values = array("2","1","0"); $desiredPartner_labels = array("Any","Male","Female "); //end (selects) //creating the check-box elements //1. marital status $marital_chk = new CCheckBoxArray("marital_chk",$conn); $marital_chk->set_cols(3); $marital_js_arr = create_js("marital_chk",$marital_num_options);//create_js is found in search_fct.php $appearance[6][0] = 'Any'; //$marital_chk->arr2chk($marital_chk_values,$marital_chk_labels,'',$marital_js_arr,$marital_checked_arr); $marital_chk->arr2chk(array_fill(0,$marital_num_options,1),array_values($appearance[6]),'',$marital_js_arr,$marital_checked_arr); //2.Height $height_chk = new CCheckBoxArray("height_chk",$conn); $height_chk->set_cols($height_num_options); $height_js_arr = create_js("height_chk",$height_num_options); $appearance[1][0] = 'Any'; $height_chk->arr2chk(array_fill(0,$height_num_options,1),array_values($appearance[1]),'',$height_js_arr,$height_checked_arr); //3.Weight $weight_chk = new CCheckBoxArray("weight_chk",$conn); $weight_chk->set_cols($weight_num_options); $weight_js_arr = create_js("weight_chk",$weight_num_options); $appearance[2][0] = 'Any'; $weight_chk->arr2chk(array_fill(0,$weight_num_options,1),array_values($appearance[2]),'',$weight_js_arr,$weight_checked_arr); //4.Ethnicity $ethnicity_chk = new CCheckBoxArray("ethnicity_chk",$conn); $ethnicity_chk->set_cols(3); $ethnicity_js_arr = create_js("ethnicity_chk",$ethnicity_num_options); $appearance[5][0] = 'Any'; $ethnicity_chk->arr2chk(array_fill(0,$ethnicity_num_options,1),array_values($appearance[5]),'',$ethnicity_js_arr,$ethnicity_checked_arr); //5.Practiced discplines $disciplines_chk = new CCheckBoxArray("disciplines_chk",$conn); $disciplines_chk->set_cols(4); //$disciples_js_arr = create_js("weight_chk",$weight_num_options); $query="SELECT * FROM disciplines ORDER BY discipline_id"; $disciplines_res=$conn->query($query); $disciplines_arr=resource2array($disciplines_res,"discipline","discipline_id"); //$disciplines_arr=array_insert($disciplines_arr,1,0,"Any");//insert Any option $disciplines_code_arr = code2arr($disciplines_code); $disciplines_checked_arr = code_arr2checked_arr($disciplines_code_arr, $disciplines_arr); $disciplines_chk->arr2chk(array_keys($disciplines_arr),array_values($disciplines_arr),'',$interests_js_arr,$disciplines_checked_arr); //6.Member interests $interests_chk = new CCheckBoxArray("interests_chk",$conn); $interests_chk->set_cols(4); $query="SELECT * FROM interests ORDER BY interest_id"; $interests_res=$conn->query($query); $interests_arr=resource2array($interests_res,"interest","interest_id"); $interests_code_arr = code2arr($interests_code); $interests_checked_arr = code_arr2checked_arr($interests_code_arr, $interests_arr); $interests_chk->arr2chk(array_keys($interests_arr),array_values($interests_arr),'',$interests_js_arr,$interests_checked_arr); //end (check-box) show_page_title("Search","Advanced search"); ?>
include("../include/after.php"); ?>