public function get_congregation_by_PIN($SearchForPIN) { // get data from DB $CongregationResults = get_congregation_from_db($SearchForPIN); if ($CongregationResults !== false) { // assign the properties $this->PIN = $CongregationResults->PIN; $this->CongregationName = $CongregationResults->Church_Name; $this->EIN = $CongregationResults->EIN; $this->Address1 = $CongregationResults->Yearbook_Address_Line_1; $this->Address2 = $CongregationResults->Yearbook_Address_Line_2; $this->City = $CongregationResults->Yearbook_City; $this->State = $CongregationResults->Yearbook_State; $this->PostalCode = $CongregationResults->Yearbook_Zip; $this->Phone = $CongregationResults->Phone; $this->Email = $CongregationResults->Email_Address; $this->Website = $CongregationResults->Web_Address; $this->Region = $CongregationResults->Region; $this->Latitude = $CongregationResults->Latitude; $this->Longitude = $CongregationResults->Longitude; $this->DateUpdated = $CongregationResults->Date_Updated; $this->DoNotAutoUpdate = $CongregationResults->DoNotAutoUpdate; // return true if we found data and loaded the class return true; } else { return false; } }
function init_congregation_search($isAdmin, $resultsTemplate, $useMap, $PagingLimit) { $FinalHTML = ''; // show the search form $FinalHTML .= show_congregation_search_form($isAdmin); // determine if there is a query if (get_congregation_search_query() != '') { // get the search parameters $searchQuery = get_congregation_search_query(); $searchDistance = get_congregation_search_distance(); $searchType = 'location'; if ($isAdmin) { $searchType = get_congregation_search_type(); } // keep showing the form, pre-popped with search query if ($searchQuery) { $congregationResults = null; if ($searchType == 'pin' && $isAdmin) { $congregationResults = get_congregation_from_db($searchQuery); } elseif ($searchType == 'name' && $isAdmin) { $congregationResults = get_congregation_by_name($searchQuery); } elseif ($searchType == 'city' && $isAdmin) { $congregationResults = get_congregation_by_city($searchQuery); } else { $congregationResults = get_congregations_by_location_search($searchQuery, $searchDistance); } if ($isAdmin) { $FinalHTML .= display_admin_formatted_congregation_results($congregationResults); //congregations-admin.php } else { $FinalHTML .= display_formatted_congregation_results($congregationResults, $resultsTemplate, $useMap, $PagingLimit); } } } return $FinalHTML; }