/** * Display the widget! * * @param array MUST contain at least the basic display params */ function display($params) { global $DB, $Item, $Blog; $this->init_display($params); echo $this->disp_params['block_start']; $this->disp_title(); echo $this->disp_params['block_body_start']; $org_ID = intval($this->disp_params['org_ID']); if ($org_ID > 0) { $OrganizationCache =& get_OrganizationCache(); $Organization =& $OrganizationCache->get_by_ID($org_ID, false, false); } if (empty($Organization)) { // No organization found global $Messages; $Messages->add(T_('Requested Team was not found.'), 'error'); $Messages->display(); } else { // Get all users of the selected organization $users = $Organization->get_users(); if ($this->disp_params['display_icons']) { // Initialise css classes for icons depending on widget setting and only when they are displayed $icon_colors_classes = ''; if (!empty($this->disp_params['icon_colors'])) { // If at least one color status is selected foreach ($this->disp_params['icon_colors'] as $class_name => $is_selected) { if (!empty($is_selected)) { $icon_colors_classes .= ' ufld__' . $class_name . 'color'; } } } } if (count($users)) { foreach ($users as $org_User) { echo '<div class="col-lg-4 col-sm-6 text-center">'; $user_url = $this->disp_params['link_profile'] ? $org_User->get_userpage_url($Blog->ID, true) : ''; if (!empty($user_url)) { // Display url to user page only when it is allowed by widget setting echo '<a href="' . $user_url . '" class="user_link">'; } // Profile picture echo $org_User->get_avatar_imgtag('crop-top-320x320', 'img-circle img-responsive img-center'); if (!empty($user_url)) { // End of user link, see above echo '</a>'; echo '<a href="' . $user_url . '" class="user_link">'; } // Full name echo '<h3>' . $org_User->get('fullname') . '</h3>'; if (!empty($user_url)) { // End of user link, see above echo '</a>'; } if ($this->disp_params['display_icons']) { // Display user links as icons $url_fields = $org_User->userfields_by_type('url'); if (count($url_fields)) { echo '<div class="ufld_icon_links">'; foreach ($url_fields as $field) { echo '<a href="' . $field->uf_varchar . '"' . (empty($icon_colors_classes) ? '' : ' class="ufld_' . $field->ufdf_code . $icon_colors_classes . '"') . '>' . '<span class="' . $field->ufdf_icon_name . '"></span>' . '</a>'; } echo '</div>'; } } // Info if (!empty($this->disp_params['field_code']) && ($field_values = $org_User->userfield_values_by_code($this->disp_params['field_code']))) { $field_extra_lines = intval($this->disp_params['field_extra_lines']); echo '<p class="user_field"' . (empty($field_extra_lines) ? '' : ' style="height:' . $field_extra_lines * 1.5 . 'em;' . '-webkit-line-clamp:' . $field_extra_lines . '"') . '>'; foreach ($field_values as $f => $field_value) { if ($f > 0) { // Space between each field value echo ' '; } echo preg_replace("/[\r\n]+/", ' ', $field_value); } echo '</p>'; } echo '</div>'; } echo '<div class="clear"></div>'; } } echo $this->disp_params['block_body_end']; echo $this->disp_params['block_end']; return true; }
$comment_lower_status = $edited_Comment->get_next_status(false, $edited_Comment->status); echo ':' . ($comment_raise_status ? $comment_raise_status[0] : ''); echo ':' . ($comment_lower_status ? $comment_lower_status[0] : ''); } break; case 'get_user_new_org': // Used in the identity user form to add a new organization if (!is_logged_in()) { // User must be logged in break; } $first_org = param('first_org', 'integer', 0); // Use the glyph or font-awesome icons if it is defined by skin param('b2evo_icons_type', 'string', ''); $Form = new Form(); $OrganizationCache =& get_OrganizationCache(); $OrganizationCache->clear(); $OrganizationCache->load_all(); $Form->output = false; $Form->switch_layout('none'); $org_suffix = ' <strong>' . T_('Role') . ':</strong> ' . $Form->text_input('org_roles[]', '', 20, '', '', array('maxlength' => 255)) . ' '; $Form->switch_layout(NULL); $Form->output = true; // Special form template that will be replaced to current skin on ajax response $Form->fieldstart = '#fieldstart#'; $Form->fieldend = '#fieldend#'; $Form->labelclass = '#labelclass#'; $Form->labelstart = '#labelstart#'; $Form->labelend = '#labelend#'; $Form->inputstart = '#inputstart#'; $Form->inputend = '#inputend#';
/** * Callback to add filters on top of the result set * * @param Form */ function callback_filter_userlist(&$Form) { global $Settings, $current_User, $Blog, $edited_Organization; $Form->hidden('filter', 'new'); if (!is_admin_page() && !empty($Blog) && $Blog->get_setting('allow_access') == 'members') { // Restrict by members only when it is frontoffice and Blog allow access only for members $Form->checkbox('membersonly', get_param('membersonly'), T_('Restrict to members of this blog')); } $Form->text('keywords', get_param('keywords'), 20, T_('Name'), '', 50); $Form->checkbox('gender_men', get_param('gender_men'), T_('Men')); $Form->checkbox('gender_women', get_param('gender_women'), T_('Women')); 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', 'grp_level DESC, grp_name ASC'); $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)); } $location_filter_displayed = false; if (user_country_visible()) { // Filter by country load_class('regional/model/_country.class.php', 'Country'); load_funcs('regional/model/_regional.funcs.php'); if (has_cross_country_restriction('users', 'list')) { // User cannot browse other users from other country global $current_User; $Form->info(T_('Country'), $current_User->get_country_name()); // Create a hidden country field to correct ajax request to load regions, subregions and cities $Form->hidden('country', $current_User->ctry_ID, array('id' => 'country')); } else { // User can browse other users from other country $CountryCache =& get_CountryCache(NT_('All')); $Form->select_country('country', get_param('country'), $CountryCache, T_('Country'), array('allow_none' => true)); $location_filter_displayed = true; } } if (user_region_visible()) { // Filter by region $region_filter_disp_style = regions_exist(get_param('country'), true) ? '' : ' style="display:none"'; echo '<span id="region_filter"' . $region_filter_disp_style . '>'; $Form->select_input_options('region', get_regions_option_list(get_param('country'), get_param('region')), T_('Region')); echo '</span>'; $location_filter_displayed = $location_filter_displayed || empty($region_filter_disp_style); } 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>'; } $Form->interval('age_min', get_param('age_min'), 'age_max', get_param('age_max'), 3, T_('Age group')); $Form->interval('level_min', get_param('level_min'), 'level_max', get_param('level_max'), 3, T_('Level')); if (empty($edited_Organization)) { // Show organization filter only when organization form is not selected $OrganizationCache =& get_OrganizationCache(T_('All')); $OrganizationCache->load_all(); if (count($OrganizationCache->cache) > 0) { $Form->select_input_object('org', get_param('org'), $OrganizationCache, T_('Organization'), array('allow_none' => true)); } } 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 if( typeof( country_ID ) == 'undefined' ) { country_ID = 0; } 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 } }