public function searchMembersAdvanced($firstName, $lastName, $purposeList, $instrumentList, $experience, $gender, $ageRange, $genreList, $inspirations, $country, $state, $city, $region, $searchType, $currentPage, $pagingAmount, $dbConnection = null)
 {
     $inspirationList = null;
     $memberSearchResults = null;
     $memberSkeletons = null;
     $countryID = null;
     $stateID = null;
     $cityID = null;
     $regionID = null;
     try {
         $memberSearchParameters = new SearchParameters();
         $memberSearchParameters->setVariable(SearchConstants::SEARCH_TYPE_INPUT_ID, $searchType);
         $memberSearchParameters->setVariable(SearchConstants::CURRENT_PAGE_ID, $currentPage);
         $memberSearchParameters->setVariable(SearchConstants::PAGING_AMOUNT_ID, $pagingAmount);
         //These elements are common to both search types
         $countryID = SearchUtilities::processSelectValues($country, 'defaultValue', '0');
         if ($countryID != null) {
             $stateID = SearchUtilities::processSelectValues($state, 'defaultValue', '0');
         }
         if ($stateID != null) {
             $cityID = SearchUtilities::processSelectValues($city, 'defaultValue', '0');
         }
         if ($cityID != null) {
             $regionID = SearchUtilities::processSelectValues($region, 'defaultValue', '0');
         }
         $memberSearchParameters->setVariable(LocationConstants::LOCATION_COUNTRY_INPUT_ID, $countryID);
         $memberSearchParameters->setVariable(LocationConstants::LOCATION_STATE_INPUT_ID, $stateID);
         $memberSearchParameters->setVariable(LocationConstants::LOCATION_CITY_INPUT_ID, $cityID);
         $memberSearchParameters->setVariable(LocationConstants::LOCATION_REGION_INPUT_ID, $regionID);
         $memberSearchParameters->setVariable(MemberSearchConstants::FIRST_NAME_INPUT_ID, $firstName);
         $memberSearchParameters->setVariable(MemberSearchConstants::LAST_NAME_INPUT_ID, $lastName);
         $memberSearchParameters->setVariable(MemberSearchConstants::POSITION_INPUT_ID, SearchUtilities::processMultipleSelectValues($instrumentList, 'defaultValue'));
         $memberSearchParameters->setVariable(MemberSearchConstants::GENRE_INPUT_ID, SearchUtilities::processMultipleSelectValues($genreList, 'defaultValue'));
         $memberSearchParameters->setVariable(MemberSearchConstants::FOR_INPUT_ID, SearchUtilities::processMultipleSelectValues($purposeList, 'defaultValue'));
         $memberSearchParameters->setVariable(MemberSearchConstants::EXPERIENCE_INPUT_ID, SearchUtilities::processSelectValues($experience, 'defaultValue'));
         $memberSearchParameters->setVariable(MemberSearchConstants::GENDER_INPUT_ID, SearchUtilities::processSelectValues($gender, 'defaultValue'));
         $memberSearchParameters->setVariable(MemberSearchConstants::AGE_INPUT_ID, SearchUtilities::processSelectValues($ageRange, 'defaultValue'));
         if ($inspirations != null) {
             $inspirationList = explode(',', $inspirations);
         }
         $memberSearchParameters->setVariable(MemberSearchConstants::INSPIRATIONS_INPUT_ID, $inspirationList);
         $memberCount = MemberSearchDao::getMemberSearchCount($memberSearchParameters, $dbConnection);
         $memberSkeletons = MemberSearchDao::searchMembers($memberSearchParameters, $dbConnection);
         $memberSearchResults = new SearchResults();
         $memberSearchResults->setVariable(SearchResults::SEARCH_PARAMETERS, $memberSearchParameters);
         $memberSearchResults->setVariable(SearchResults::SKELETONS, $memberSkeletons);
         $memberSearchResults->setVariable(SearchResults::COUNT, $memberCount);
         $memberSearchResults->setVariable(SearchResults::PAGE_COUNT, ceil($memberCount / $pagingAmount));
     } catch (Exception $e) {
         $memberSearchResults = null;
         echo 'Caught exception: ', $e->getMessage(), "\n";
     }
     return $memberSearchResults;
 }
 public function searchBandsAdvanced($bandName, $genres, $inspirations, $country, $state, $city, $region, $searchType, $currentPage, $pagingAmount, $dbConnection = null)
 {
     $bandSearchResults = null;
     $bandSkeletons = null;
     $inspirationList = null;
     $countryID = null;
     $stateID = null;
     $cityID = null;
     $regionID = null;
     try {
         if ($inspirations != null) {
             $inspirationList = explode(',', $inspirations);
         }
         $countryID = SearchUtilities::processSelectValues($country, 'defaultValue', '0');
         if ($countryID != null) {
             $stateID = SearchUtilities::processSelectValues($state, 'defaultValue', '0');
         }
         if ($stateID != null) {
             $cityID = SearchUtilities::processSelectValues($city, 'defaultValue', '0');
         }
         if ($cityID != null) {
             $regionID = SearchUtilities::processSelectValues($region, 'defaultValue', '0');
         }
         //Construct Search Parameter object
         $searchParameters = new SearchParameters();
         $searchParameters->setVariable(SearchConstants::SEARCH_TYPE_INPUT_ID, $searchType);
         $searchParameters->setVariable(SearchConstants::CURRENT_PAGE_ID, $currentPage);
         $searchParameters->setVariable(SearchConstants::PAGING_AMOUNT_ID, $pagingAmount);
         $searchParameters->setVariable(BandSearchConstants::BAND_NAME_INPUT_ID, $bandName);
         $searchParameters->setVariable(BandSearchConstants::GENRE_INPUT_ID, SearchUtilities::processMultipleSelectValues($genres, 'defaultValue'));
         $searchParameters->setVariable(BandSearchConstants::INSPIRATIONS_INPUT_ID, $inspirations);
         $searchParameters->setVariable(LocationConstants::LOCATION_COUNTRY_INPUT_ID, $countryID);
         $searchParameters->setVariable(LocationConstants::LOCATION_STATE_INPUT_ID, $stateID);
         $searchParameters->setVariable(LocationConstants::LOCATION_CITY_INPUT_ID, $cityID);
         $searchParameters->setVariable(LocationConstants::LOCATION_REGION_INPUT_ID, $regionID);
         $bandCount = BandSearchDao::getBandSearchCount($searchParameters, $dbConnection);
         $bandSkeletons = BandSearchDao::searchBands($searchParameters, $dbConnection);
         $bandSearchResults = new SearchResults();
         $bandSearchResults->setVariable(SearchResults::SEARCH_PARAMETERS, $searchParameters);
         $bandSearchResults->setVariable(SearchResults::SKELETONS, $bandSkeletons);
         $bandSearchResults->setVariable(SearchResults::COUNT, $bandCount);
         $bandSearchResults->setVariable(SearchResults::PAGE_COUNT, ceil($bandCount / $searchParameters->getVariable(SearchConstants::PAGING_AMOUNT_ID)));
     } catch (Exception $ex) {
         $bandSearchResults = null;
         echo 'processSearch exception: ', $ex->getMessage(), "\n";
     }
     return $bandSearchResults;
 }
 public function searchAdvertisements($forInput, $positionList, $country, $state, $city, $region, $searchType, $currentPage, $pagingAmount, $dbConnection = null)
 {
     $advertisementSearchResults = null;
     $advertisementSkeletons = null;
     $countryID = null;
     $stateID = null;
     $cityID = null;
     $regionID = null;
     try {
         //Construct Search Parameter object
         $advertisementSearchParameters = new SearchParameters();
         $advertisementSearchParameters->setVariable(SearchConstants::SEARCH_TYPE_INPUT_ID, $searchType);
         $advertisementSearchParameters->setVariable(SearchConstants::CURRENT_PAGE_ID, $currentPage);
         $advertisementSearchParameters->setVariable(SearchConstants::PAGING_AMOUNT_ID, $pagingAmount);
         //These elements are common to both search types
         $countryID = SearchUtilities::processSelectValues($country, 'defaultValue', '0');
         if ($countryID != null) {
             $stateID = SearchUtilities::processSelectValues($state, 'defaultValue', '0');
         }
         if ($stateID != null) {
             $cityID = SearchUtilities::processSelectValues($city, 'defaultValue', '0');
         }
         if ($cityID != null) {
             $regionID = SearchUtilities::processSelectValues($region, 'defaultValue', '0');
         }
         $advertisementSearchParameters->setVariable(AdvertisementSearchConstants::FOR_INPUT_ID, SearchUtilities::processMultipleSelectValues($forInput, 'defaultValue'));
         $advertisementSearchParameters->setVariable(AdvertisementSearchConstants::POSITION_INPUT_ID, SearchUtilities::processMultipleSelectValues($positionList, 'defaultValue'));
         $advertisementSearchParameters->setVariable(LocationConstants::LOCATION_COUNTRY_INPUT_ID, $countryID);
         $advertisementSearchParameters->setVariable(LocationConstants::LOCATION_STATE_INPUT_ID, $stateID);
         $advertisementSearchParameters->setVariable(LocationConstants::LOCATION_CITY_INPUT_ID, $cityID);
         $advertisementSearchParameters->setVariable(LocationConstants::LOCATION_REGION_INPUT_ID, $regionID);
         $advertisementCount = AdvertisementSearchDao::getSearchAdvertisementsCount($advertisementSearchParameters, $dbConnection);
         $advertisementSkeletons = AdvertisementSearchDao::searchAdvertisements($advertisementSearchParameters, $dbConnection);
         $advertisementSearchResults = new SearchResults();
         $advertisementSearchResults->setVariable(SearchResults::SEARCH_PARAMETERS, $advertisementSearchParameters);
         $advertisementSearchResults->setVariable(SearchResults::SKELETONS, $advertisementSkeletons);
         $advertisementSearchResults->setVariable(SearchResults::COUNT, $advertisementCount);
         $advertisementSearchResults->setVariable(SearchResults::PAGE_COUNT, ceil($advertisementCount / $pagingAmount));
     } catch (Exception $ex) {
         $advertisementSearchResults = null;
         echo 'Caught exception: ' . $ex->getMessage();
     }
     return $advertisementSearchResults;
 }