<?php
// Con esto obtenemos toda la info necesaria del grupo actual
// para usar fuera del bucle bp_has_groups()
global $bp;
bp_has_groups(); bp_groups (); bp_the_group();
?>

<script type="text/javascript">
var $ = jQuery;
$(document).ready( function() {

    $('#messages-seleted').click(function(){
        $('form input:checkbox').attr('checked',true);
    });

    $('#messages-desseleted').click(function(){
        $('form input:checkbox').attr('checked',false);
    });
    
});
</script>

<div class="left-menu">

    <div id="massage-group-list">
        <ul>
            <?php
            $membresIds = BP_Groups_Member::get_all_for_group( '116' , $limit = false, $page = false, $exclude_admins_mods = false, $exclude_banned = true, $exclude = false);

            foreach ($membresIds['members'] as $membreId) {
                ?>
                <li class="user-<?php echo $membreId->user_id ?>" style="min-height: 42px;">
                    <?php echo bp_core_fetch_avatar( array( 'item_id' => $membreId->user_id, 'type' => $avatar_size, 'width' => 32, 'height' => 32 ) ) ?>
                    
                    <h5>
                        <label for="checkMessages-<?php echo $membreId->user_id ?>">
                            <?php echo bp_core_get_user_displayname( $membreId->user_id )?>
                        </label>
                        <input type="checkbox" name="idsSendMail[]" value="<?php echo $membreId->user_id ?>" id="checkMessages-<?php echo $membreId->user_id ?>">
                    </h5>
                </li>
                <?php
            }
            ?>
        </ul>
        
    </div>
    
    <p id="messages-seleted">
        <?php _e('Seleccionar todos', 'buddypress'); ?>
    </p>
    
    <p id="messages-desseleted">
        <?php _e('Desseleccionar todos', 'buddypress'); ?>
    </p>

</div><!-- .left-menu -->

<div class="main-column">

    <div id="message-content">
        <p><?php _e('Enviar mensaje privado a los usuarios del grupo', 'buddypress'); ?></p>
        
        <label for="message-group-subject"><?php _e('Asunto', 'buddypress'); ?></label>
        <input type="text" name="subject" value="" id="message-group-subject" />
        
        <label for="message-group-content"><?php _e('Mensaje', 'buddypress'); ?></label>
        <textarea rows="15" cols="40" name="content" id="message-group-content"></textarea>
        
    </div>

</div><!-- .main-column -->

<div class="clear"></div>

<?php
if ($_GET['send']) {
    echo '<span id="sendMessageGroup">' . __('mensaje enviado', 'buddypress') . '</span>';
}
?>
<div class="clear"></div>
<div class="clear"></div>

<input type="submit" name="save" value="<?php _e('enviar', 'buddypress'); ?>" id="send-messages-group" />
<?php
wp_nonce_field( 'groups_edit_save_' . $this->slug );