/**
 * GeoDirectory BuddyPress Integration settings form content.
 *
 * @since 1.0.0
 * @package GeoDirectory_BuddyPress_Integration
 *
 * @param string $tab_name Tab name.
 */
function geodir_buddypress_get_option_form($tab_name)
{
    switch ($tab_name) {
        case 'gdbuddypress_settings':
            geodir_admin_fields(geodir_buddypress_settings());
            ?>
<p class="submit">
  <input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', GDBUDDYPRESS_TEXTDOMAIN);
            ?>
" />
  <input type="hidden" name="subtab" value="gdbuddypress_settings" id="last_tab" />
</p>
</div>
<?php 
            break;
    }
    // end of switch
}
/**
 * Review manager General Tab settings.
 *
 * @since 1.0.0
 * @package GeoDirectory_Review_Rating_Manager
 *
 * @param string $tab_name GeoDirectory Tab name.
 */
function geodir_review_rating_general_options($tab_name)
{
    switch ($tab_name) {
        case 'geodir_multirating_options':
            geodir_admin_fields(geodir_reviewrating_default_options());
            ?>
				<p class="submit">
				<input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', GEODIRREVIEWRATING_TEXTDOMAIN);
            ?>
" />
				<input type="hidden" name="subtab" value="geodir_multirating_options" id="last_tab" />
				</p>
			</div>
			<?php 
            break;
    }
    // end of switch
}
/**
 * @param $tab_name
 */
function geodir_location_default_option_form($tab_name)
{
    switch ($tab_name) {
        case 'geodir_location_setting':
            geodir_admin_fields(geodir_location_default_options());
            ?>
			
			<p class="submit">
				
			<input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', GEODIRLOCATION_TEXTDOMAIN);
            ?>
" />
			<input type="hidden" name="location_ajax_action" value="settings">
			</p>
			</div>
			
			<?php 
            break;
    }
    // end of switch
}
function geodir_autocompleter_options_form($tab)
{
    switch ($tab) {
        case 'advanced_search_fields':
            geodir_admin_fields(geodir_autocompleter_options());
            ?>
			<p class="submit">
        <input class="button-primary" type="submit" name="geodir_autocompleter_save"  value="<?php 
            _e('Save changes', GEODIRADVANCESEARCH_TEXTDOMAIN);
            ?>
">
        </p>
			</div> <?php 
            break;
        case 'geolocation_fields':
            geodir_admin_fields(geodir_autocompleter_options());
            ?>
			<p class="submit">
        <input class="button-primary" type="submit" name="geodir_autocompleter_save"  value="<?php 
            _e('Save changes', GEODIRADVANCESEARCH_TEXTDOMAIN);
            ?>
">
        </p>
			</div> <?php 
            break;
    }
}
/**
 * Displays setting form for the given tab.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global array $geodir_settings Geodirectory settings array.
 * @global object $wpdb WordPress Database object.
 * @param string $tab_name Tab name.
 */
function geodir_admin_option_form($tab_name)
{
    //echo $tab_name.'_array.php' ;
    global $geodir_settings, $is_default, $mapzoom;
    if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) {
        /**
         * Contains settings array for given tab.
         *
         * @since 1.0.0
         * @package GeoDirectory
         */
        include_once 'option-pages/' . $tab_name . '_array.php';
    }
    $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : '';
    switch ($tab_name) {
        case 'general_settings':
            geodir_admin_fields($geodir_settings['general_settings']);
            /**
             *
             * Update Taxonomy Options *
             *
             **/
            /*add_action('updated_option_place_prefix','update_listing_prefix');
              function update_listing_prefix(){
                  geodir_register_defaults();
              }*/
            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) {
                $hide_save_button = "style='display:none;'";
            } else {
                $hide_save_button = '';
            }
            /**
             * Filter weather the default save button in the GD admin settings pages should be shown.
             *
             * @since 1.0.0
             * @param string $hide_save_button The style element, either blank or: style='display:none;'.
             */
            $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button);
            ?>

            <p class="submit">
            <input <?php 
            echo $hide_save_button;
            ?>
 name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', 'geodirectory');
            ?>
" />
            <input type="hidden" name="subtab" id="last_tab" />
            </p>
            
            </div>
            
		<?php 
            break;
        case 'design_settings':
            geodir_admin_fields($geodir_settings['design_settings']);
            ?>
			<p class="submit">
			<input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', 'geodirectory');
            ?>
" />
			<input type="hidden" name="subtab" id="last_tab" />
			</p>
			</div>
        <?php 
            break;
        case 'permalink_settings':
            geodir_admin_fields($geodir_settings['permalink_settings']);
            ?>
            <p class="submit">
            <input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', 'geodirectory');
            ?>
" />
            <input type="hidden" name="subtab" id="last_tab" />
            </p>
            </div>	
		<?php 
            break;
        case 'title_meta_settings':
            geodir_admin_fields($geodir_settings['title_meta_settings']);
            ?>
            <p class="submit">
            <input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', 'geodirectory');
            ?>
" />
            <input type="hidden" name="subtab" id="last_tab" />
            </p>
            </div>
		<?php 
            break;
        case 'notifications_settings':
            geodir_admin_fields($geodir_settings['notifications_settings']);
            ?>
			
			<p class="submit">
				
			<input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', 'geodirectory');
            ?>
" />
			<input type="hidden" name="subtab" id="last_tab" />
			</p>
			</div>
			
		<?php 
            break;
        case 'default_location_settings':
            ?>
            <div class="inner_content_tab_main">
                <div class="gd-content-heading">
                    <?php 
            global $wpdb;
            $location_result = geodir_get_default_location();
            $prefix = '';
            $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '';
            $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '';
            $city = isset($location_result->city) ? $location_result->city : '';
            $region = isset($location_result->region) ? $location_result->region : '';
            $country = isset($location_result->country) ? $location_result->country : '';
            $map_title = __("Set Address On Map", 'geodirectory');
            ?>

                    <h3><?php 
            _e('Set Default Location', 'geodirectory');
            ?>
</h3>

                    <input type="hidden" name="add_location" value="location">

                    <input type="hidden" name="update_city" value="<?php 
            if (isset($location_result->location_id)) {
                echo $location_result->location_id;
            }
            ?>
">

                    <input type="hidden" name="address" id="<?php 
            echo $prefix;
            ?>
address" value="">

                    <table class="form-table default_location_form">
                        <tbody>
                        <tr valign="top" class="single_select_page">
                            <th class="titledesc" scope="row"><?php 
            _e('City', 'geodirectory');
            ?>
</th>
                            <td class="forminp">
                                <div class="gtd-formfeild required">
                                    <input class="require" type="text" size="80" style="width:440px"
                                           id="<?php 
            echo $prefix;
            ?>
city" name="city"
                                           value="<?php 
            if (isset($location_result->city)) {
                echo $location_result->city;
            }
            ?>
"/>

                                    <div
                                        class="gd-location_message_error"> <?php 
            _e('This field is required.', 'geodirectory');
            ?>
</div>
                                </div>
                                <span class="description"></span>
                            </td>
                        </tr>
                        <tr valign="top" class="single_select_page">
                            <th class="titledesc" scope="row"><?php 
            _e('Region', 'geodirectory');
            ?>
</th>
                            <td class="forminp">
                                <div class="gtd-formfeild required">
                                    <input class="require" type="text" size="80" style="width:440px"
                                           id="<?php 
            echo $prefix;
            ?>
region" name="region"
                                           value="<?php 
            if (isset($location_result->region)) {
                echo $location_result->region;
            }
            ?>
"/>

                                    <div
                                        class="gd-location_message_error"> <?php 
            _e('This field is required.', 'geodirectory');
            ?>
</div>
                                </div>
                                <span class="description"></span>
                            </td>
                        </tr>
                        <tr valign="top" class="single_select_page">
                            <th class="titledesc" scope="row"><?php 
            _e('Country', 'geodirectory');
            ?>
</th>
                            <td class="forminp">
                                <div class="gtd-formfeild required" style="padding-top:10px;">
                                    <?php 
            $country_result = isset($location_result->country) ? $location_result->country : '';
            ?>
                                    <select id="<?php 
            echo $prefix;
            ?>
country" class="chosen_select"
                                            data-location_type="country" name="<?php 
            echo $prefix;
            ?>
country"
                                            data-placeholder="<?php 
            _e('Choose a country.', 'geodirectory');
            ?>
"
                                            data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0"
                                            data-showeverywhere="0">
                                        <?php 
            geodir_get_country_dl($country, $prefix);
            ?>
                                    </select>

                                    <div
                                        class="gd-location_message_error"><?php 
            _e('This field is required.', 'geodirectory');
            ?>
</div>

                                </div>


                                <span class="description"></span>
                            </td>
                        </tr>
                        <tr valign="top" class="single_select_page">
                            <th class="titledesc"
                                scope="row"><?php 
            _e('Set Location on Map', 'geodirectory');
            ?>
</th>
                            <td class="forminp">
                                <?php 
            /**
             * Contains add listing page map functions.
             *
             * @since 1.0.0
             */
            include geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php";
            ?>
                            </td>
                        </tr>
                        <tr valign="top" class="single_select_page">
                            <th class="titledesc" scope="row"><?php 
            _e('City Latitude', 'geodirectory');
            ?>
</th>
                            <td class="forminp">
                                <div class="gtd-formfeild required" style="padding-top:10px;">
                                    <input type="text" class="require" size="80" style="width:440px"
                                           id="<?php 
            echo $prefix;
            ?>
latitude" name="latitude"
                                           value="<?php 
            if (isset($location_result->city_latitude)) {
                echo $location_result->city_latitude;
            }
            ?>
"/>

                                    <div
                                        class="gd-location_message_error"><?php 
            _e('This field is required.', 'geodirectory');
            ?>
</div>
                                </div>
                                <span class="description"></span>
                            </td>
                        </tr>
                        <tr valign="top" class="single_select_page">
                            <th class="titledesc"
                                scope="row"><?php 
            _e('City Longitude', 'geodirectory');
            ?>
</th>
                            <td class="forminp">
                                <div class="gtd-formfeild required" style="padding-top:10px;">
                                    <input type="text" class="require" size="80" style="width:440px"
                                           id="<?php 
            echo $prefix;
            ?>
longitude" name="longitude"
                                           value="<?php 
            if (isset($location_result->city_longitude)) {
                echo $location_result->city_longitude;
            }
            ?>
"/>

                                    <div
                                        class="gd-location_message_error"><?php 
            _e('This field is required.', 'geodirectory');
            ?>
</div>
                                </div>
                                <span class="description"></span>
                            </td>
                        </tr>
                        <?php 
            if (isset($location_result->location_id) && $location_result->location_id >= 0) {
                ?>
                            <tr valign="top" class="single_select_page">
                                <th class="titledesc"
                                    scope="row"><?php 
                _e('Action For Listing', 'geodirectory');
                ?>
</th>
                                <td class="forminp">
                                    <div class="gtd-formfeild" style="padding-top:10px;">
                                        <input style="display:none;" type="radio" name="listing_action"
                                               checked="checked" value="delete"/>
                                        <label><?php 
                _e('Post will be updated if both city and map marker position has been changed.', 'geodirectory');
                ?>
</label>
                                    </div>
                                </td>
                            </tr>
                        <?php 
            }
            ?>
                        </tbody>
                    </table>

                    <p class="submit">
                        <input type="hidden" name="is_default" value="1"/>
                        <input id="location_save" type="submit" value="Save changes" class="button-primary" name="save">
                    </p>

                </div>
            </div>
            <?php 
            break;
        case $listing_type . '_fields_settings':
            geodir_custom_post_type_form();
            break;
        case 'tools_settings':
            geodir_diagnostic_tools_setting_page();
            break;
        case 'compatibility_settings':
            geodir_theme_compatibility_setting_page();
            break;
        case 'import_export':
            geodir_import_export_page();
            break;
    }
    // end of switch
}
function geodir_claim_default_option_form($tab_name)
{
    switch ($tab_name) {
        case 'geodir_claim_options':
            geodir_admin_fields(geodir_claim_default_options());
            ?>
			
			<p class="submit">
				
			<input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', GEODIRCLAIM_TEXTDOMAIN);
            ?>
" />
			<input type="hidden" name="subtab" value="geodir_claim_options" id="last_tab" />
			</p>
			</div>
			
			<?php 
            break;
        case 'geodir_claim_notification':
            geodir_admin_fields(geodir_claim_notifications());
            ?>
			
			<p class="submit">
				
			<input name="save" class="button-primary" type="submit" value="<?php 
            _e('Save changes', GEODIRCLAIM_TEXTDOMAIN);
            ?>
" />
			<input type="hidden" name="subtab" value="geodir_claim_notification" id="last_tab" />
			</p>
			</div>
			 
		<?php 
            break;
    }
    // end of switch
}