// Load also the cities echo '-##-' . get_cities_option_list($country_ID, $region_ID, 0, 0, $params); } break; case 'get_cities_option_list': // Get option list with cities by selected country, region or sub-region $country_ID = param('ctry_id', 'integer', 0); $region_ID = param('rgn_id', 'integer', 0); $subregion_ID = param('subrg_id', 'integer', 0); $page = param('page', 'string', ''); $params = array(); if ($page == 'edit') { $params['none_option_text'] = T_('Unknown'); } load_funcs('regional/model/_regional.funcs.php'); echo get_cities_option_list($country_ID, $region_ID, $subregion_ID, 0, $params); break; case 'get_field_bubbletip': // Get info for user field $field_ID = param('field_ID', 'integer', 0); if ($field_ID > 0) { // Get field info from DB $field = $DB->get_row(' SELECT ufdf_bubbletip, ufdf_duplicated FROM T_users__fielddefs WHERE ufdf_ID = ' . $DB->quote($field_ID)); if (is_null($field)) { // No field in DB break; } if (!empty($field->ufdf_bubbletip)) {
/** * Callback to add filters on top of the result set * * @param Form */ function callback_filter_userlist(&$Form) { global $Settings, $current_User; $Form->hidden('filter', 'new'); $Form->text('keywords', get_param('keywords'), 20, T_('Name'), '', 50); echo '<span class="nowrap">'; $Form->checkbox('gender_men', get_param('gender_men'), T_('Men')); $Form->checkbox('gender_women', get_param('gender_women'), T_('Women')); echo '</span>'; if (!is_admin_page()) { echo '<br />'; } if (is_admin_page()) { // show this filters only on admin interface if ($current_User->check_perm('users', 'edit')) { // Show "Reported users" filter only for users with edit user permission $Form->checkbox('reported', get_param('reported'), T_('Reported users')); $Form->checkbox('custom_sender_email', get_param('custom_sender_email'), T_('Users with custom sender address')); $Form->checkbox('custom_sender_name', get_param('custom_sender_name'), T_('Users with custom sender name')); } $Form->select_input_array('account_status', get_param('account_status'), get_user_statuses(T_('All')), T_('Account status')); $GroupCache = new DataObjectCache('Group', true, 'T_groups', 'grp_', 'grp_ID', 'grp_name'); $group_options_array = array('-1' => T_('All (Ungrouped)'), '0' => T_('All (Grouped)')) + $GroupCache->get_option_array(); $Form->select_input_array('group', get_param('group'), $group_options_array, T_('User group'), '', array('force_keys_as_values' => true)); echo '<br />'; } if (user_country_visible()) { // Filter by country load_class('regional/model/_country.class.php', 'Country'); load_funcs('regional/model/_regional.funcs.php'); $CountryCache =& get_CountryCache(T_('All')); $Form->select_country('country', get_param('country'), $CountryCache, T_('Country'), array('allow_none' => true)); } if (user_region_visible()) { // Filter by region echo '<span id="region_filter"' . (!regions_exist(get_param('country'), true) ? ' style="display:none"' : '') . '>'; $Form->select_input_options('region', get_regions_option_list(get_param('country'), get_param('region')), T_('Region')); echo '</span>'; } if (user_subregion_visible()) { // Filter by subregion echo '<span id="subregion_filter"' . (!subregions_exist(get_param('region'), true) ? ' style="display:none"' : '') . '>'; $Form->select_input_options('subregion', get_subregions_option_list(get_param('region'), get_param('subregion')), T_('Sub-region')); echo '</span>'; } if (user_city_visible()) { // Filter by city echo '<span id="city_filter"' . (!cities_exist(get_param('country'), get_param('region'), get_param('subregion'), true) ? ' style="display:none"' : '') . '>'; $Form->select_input_options('city', get_cities_option_list(get_param('country'), get_param('region'), get_param('subregion'), get_param('city')), T_('City')); echo '</span>'; } echo '<br />'; $Form->interval('age_min', get_param('age_min'), 'age_max', get_param('age_max'), 3, T_('Age group')); echo '<br />'; $criteria_types = param('criteria_type', 'array/integer'); $criteria_values = param('criteria_value', 'array/string'); if (count($criteria_types) == 0) { // Init one criteria fieldset for first time $criteria_types[] = ''; $criteria_values[] = ''; } foreach ($criteria_types as $c => $type) { $value = trim(strip_tags($criteria_values[$c])); if ($value == '' && count($criteria_types) > 1 && $c > 0) { // Don't display empty field again after filter request continue; } if ($c > 0) { // Separator between criterias echo '<br />'; } $Form->output = false; $criteria_input = $Form->text('criteria_value[]', $value, 17, '', '', 50); $criteria_input .= get_icon('add', 'imgtag', array('rel' => 'add_criteria')); $Form->output = true; global $user_fields_empty_name; $user_fields_empty_name = T_('Select...'); $Form->select('criteria_type[]', $type, 'callback_options_user_new_fields', T_('Specific criteria'), $criteria_input); } if (user_region_visible()) { // JS functions for AJAX loading of regions, subregions & cities ?> <script type="text/javascript"> jQuery( '#country' ).change( function() { var this_obj = jQuery( this ); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_regions_option_list&ctry_id=' + jQuery( this ).val(), success: function( result ) { jQuery( '#region' ).html( ajax_debug_clear( result ) ); if( jQuery( '#region option' ).length > 1 ) { jQuery( '#region_filter' ).show(); } else { jQuery( '#region_filter' ).hide(); } load_subregions( 0 ); // Reset sub-regions } } ); } ); jQuery( '#region' ).change( function () { // Change option list with sub-regions load_subregions( jQuery( this ).val() ); } ); jQuery( '#subregion' ).change( function () { // Change option list with cities load_cities( jQuery( '#country' ).val(), jQuery( '#region' ).val(), jQuery( this ).val() ); } ); function load_subregions( region_ID ) { // Load option list with sub-regions for seleted region jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_subregions_option_list&rgn_id=' + region_ID, success: function( result ) { jQuery( '#subregion' ).html( ajax_debug_clear( result ) ); if( jQuery( '#subregion option' ).length > 1 ) { jQuery( '#subregion_filter' ).show(); } else { jQuery( '#subregion_filter' ).hide(); } load_cities( jQuery( '#country' ).val(), region_ID, 0 ); } } ); } function load_cities( country_ID, region_ID, subregion_ID ) { // Load option list with cities for seleted region or sub-region jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: 'action=get_cities_option_list&ctry_id=' + country_ID + '&rgn_id=' + region_ID + '&subrg_id=' + subregion_ID, success: function( result ) { jQuery( '#city' ).html( ajax_debug_clear( result ) ); if( jQuery( '#city option' ).length > 1 ) { jQuery( '#city_filter' ).show(); } else { jQuery( '#city_filter' ).hide(); } } } ); } </script> <?php } }
/** * Display location select elements (Country, Region, Subregion, City) * * @param object Form * @param object Edited Item */ function echo_item_location_form(&$Form, &$edited_Item) { load_class('regional/model/_country.class.php', 'Country'); load_funcs('regional/model/_regional.funcs.php'); $edited_Item_Blog = $edited_Item->get_Blog(); if (!$edited_Item_Blog->country_visible()) { // If country is NOT visible it means all other location fields also are not visible, so exit here return; } global $rsc_url; $Form->begin_fieldset(T_('Location')); $table_class = ''; if ($edited_Item->is_special()) { // A post with special type should always has the location fields as not required // This css class hides all red stars of required fields $table_class = ' not_required'; } $Form->switch_layout('table'); $Form->formstart = '<table id="item_locations" cellspacing="0" class="fform' . $table_class . '">' . "\n"; $Form->labelstart = '<td class="right"><strong>'; $Form->labelend = '</strong></td>'; echo $Form->formstart; $button_refresh_regional = '<button id="%s" type="submit" name="actionArray[edit_switchtab]" class="action_icon refresh_button">' . get_icon('refresh') . '</button>'; $button_refresh_regional .= '<img src="' . $rsc_url . 'img/ajax-loader.gif" alt="' . T_('Loading...') . '" title="' . T_('Loading...') . '" style="display:none;margin-left:5px" align="top" />'; // Country $CountryCache =& get_CountryCache(); $country_is_required = $edited_Item->Blog->get_setting('location_country') == 'required'; $Form->select_country('item_ctry_ID', $edited_Item->ctry_ID, $CountryCache, T_('Country'), array('required' => $country_is_required, 'allow_none' => true)); if ($edited_Item->Blog->region_visible()) { // Region $region_is_required = $edited_Item->Blog->get_setting('location_region') == 'required'; $Form->select_input_options('item_rgn_ID', get_regions_option_list($edited_Item->ctry_ID, $edited_Item->rgn_ID, array('none_option_text' => T_('Unknown'))), T_('Region'), sprintf($button_refresh_regional, 'button_refresh_region'), array('required' => $region_is_required)); } if ($edited_Item->Blog->subregion_visible()) { // Subregion $subregion_is_required = $edited_Item->Blog->get_setting('location_subregion') == 'required'; $Form->select_input_options('item_subrg_ID', get_subregions_option_list($edited_Item->rgn_ID, $edited_Item->subrg_ID, array('none_option_text' => T_('Unknown'))), T_('Sub-region'), sprintf($button_refresh_regional, 'button_refresh_subregion'), array('required' => $subregion_is_required)); } if ($edited_Item->Blog->city_visible()) { // City $city_is_required = $edited_Item->Blog->get_setting('location_city') == 'required'; $Form->select_input_options('item_city_ID', get_cities_option_list($edited_Item->ctry_ID, $edited_Item->rgn_ID, $edited_Item->subrg_ID, $edited_Item->city_ID, array('none_option_text' => T_('Unknown'))), T_('City'), sprintf($button_refresh_regional, 'button_refresh_city'), array('required' => $city_is_required)); } echo $Form->formend; $Form->switch_layout(NULL); $Form->end_fieldset(); }
$CountryCache =& get_CountryCache(); $Form->select_country('edited_user_ctry_ID', $edited_User->ctry_ID, $CountryCache, T_('Country'), array('required' => $Settings->get('location_country') == 'required', 'allow_none' => $has_full_access || empty($edited_User->ctry_ID) || !empty($edited_User->ctry_ID) && $Settings->get('location_country') != 'required')); } if (user_region_visible()) { // Display a select input for Region $regions_option_list = get_regions_option_list($edited_User->ctry_ID, $edited_User->rgn_ID, array('none_option_text' => T_('Unknown'))); $Form->select_input_options('edited_user_rgn_ID', $regions_option_list, T_('Region'), sprintf($button_refresh_regional, 'button_refresh_region'), array('required' => $Settings->get('location_region') == 'required')); } if (user_subregion_visible()) { // Display a select input for Subregion $subregions_option_list = get_subregions_option_list($edited_User->rgn_ID, $edited_User->subrg_ID, array('none_option_text' => T_('Unknown'))); $Form->select_input_options('edited_user_subrg_ID', $subregions_option_list, T_('Sub-region'), sprintf($button_refresh_regional, 'button_refresh_subregion'), array('required' => $Settings->get('location_subregion') == 'required')); } if (user_city_visible()) { // Display a select input for City $cities_option_list = get_cities_option_list($edited_User->ctry_ID, $edited_User->rgn_ID, $edited_User->subrg_ID, $edited_User->city_ID, array('none_option_text' => T_('Unknown'))); $Form->select_input_options('edited_user_city_ID', $cities_option_list, T_('City'), sprintf($button_refresh_regional, 'button_refresh_city'), array('required' => $Settings->get('location_city') == 'required')); } $Form->interval('edited_user_age_min', $edited_User->age_min, 'edited_user_age_max', $edited_User->age_max, 3, T_('My age group')); // Organization select fields: $OrganizationCache =& get_OrganizationCache(); $OrganizationCache->load_all(); $count_all_orgs = count($OrganizationCache->cache); $count_user_orgs = 0; if ($count_all_orgs > 0) { // Display an organization select box if at least one is defined $user_orgs = $edited_User->get_organizations_data(); $org_allow_none = false; if (empty($user_orgs)) { // Set it for first(empty) organization select box $user_orgs[0] = 0;