Skip to:
Content

BuddyPress.org

Changeset 63


Ignore:
Timestamp:
05/07/2008 10:33:17 PM (16 years ago)
Author:
jbasdf
Message:

Added code to generate multi-select and multi-checkboxes on signup screen.

Location:
trunk/bp-xprofile
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-classes.php

    r50 r63  
    438438                }
    439439               
     440                $html .= '<span class="desc">' . $this->desc . '</span>';               
     441                $html .= '</div>';
     442               
     443            break;
     444           
     445            case 'multiselectbox':
     446                $options = $this->get_children();
     447
     448                $html .= '<label for="field_' . $this->id . '">' . $asterisk . $this->name . ':</label>';
     449                $html .= $this->message . '<select class="multi-select" multiple="multiple" name="field_' . $this->id . '[]" id="field_' . $this->id . '">';
     450                    for ( $k = 0; $k < count($options); $k++ ) {
     451                        $option_value = BP_XProfile_ProfileData::get_value($options[$k]->parent_id);
     452   
     453                        if ( $option_value == $options[$k]->name ) {
     454                            $selected = ' selected="selected"';
     455                        } else {
     456                            $selected = '';
     457                        }
     458                       
     459                        $html .= '<option' . $selected . ' value="' . $options[$k]->name . '">' . $options[$k]->name . '</option>';
     460                    }
     461                $html .= '</select>';
     462                $html .= '<span class="desc">' . $this->desc . '</span>';
     463            break;
     464           
     465            case 'multicheckbox':
     466                $options = $this->get_children();
     467               
     468                $html .= '<div id="field_' . $this->id . '[]"><span>' . $asterisk . $this->name . ':</span>' . $this->message;
     469                $html .= '<ul class="multi-checkbox">';
     470               
     471                $option_values = BP_XProfile_ProfileData::get_value($options[0]->parent_id);
     472                $option_values = unserialize($option_values);
     473               
     474                for ( $k = 0; $k < count($options); $k++ ) {   
     475                    for ( $j = 0; $j < count($option_values); $j++ ) {
     476                        if ( $option_values[$j] == $options[$k]->name ) {
     477                            $selected = ' checked="checked"';
     478                            break;
     479                        }
     480                    }
     481                                       
     482                    $html .= '<li><label><input' . $selected . ' type="checkbox" name="field_' . $this->id . '[]" id="field_' . $options[$k]->id . '_' . $k . '" value="' . $options[$k]->name . '"> ' . $options[$k]->name . '</label></li>';
     483                   
     484                    $selected = '';
     485                }
     486               
     487                $html .= '</ul>';
    440488                $html .= '<span class="desc">' . $this->desc . '</span>';               
    441489                $html .= '</div>';
  • trunk/bp-xprofile/bp-xprofile-cssjs.php

    r52 r63  
    159159        .crop-img { float: left; margin: 0 20px 15px 0; }
    160160        .submit { clear: left; }
     161
     162        select.multi-select{
     163            width:90%;
     164        height:10em !important;
     165    }
     166
     167    ul.multi-checkbox {
     168        margin: 0 5px 0 0px;
     169        padding: .5em .9em;
     170        height: 10em;
     171        overflow: auto;
     172        list-style: none;
     173        border: solid 1px #ccc;
     174        width:90%;           
     175    }
     176
     177    ul.multi-checkbox li{
     178        padding: 0;
     179        margin: 0;
     180    }
    161181
    162182    <?php if ( $wpdb->blogid == $userdata->primary_blog ) { ?>
Note: See TracChangeset for help on using the changeset viewer.