<?php
get_header();

/*
 // Control de aceptacion de Aviso Legal
$legalmeta = get_user_meta ( bp_loggedin_user_id(), 'AvisoLegal', true);
if ($legalmeta != 'aceptado') {
    
    if ($_POST['AceptarAviso'] != true) {
        
        echo '
        <script>
        jQuery(document).ready(function($) {
            $.fancybox({
                \'modal\'                : true,
                \'content\'                : \'<h2>Aviso Legal</h2>\'+
                \'<div style="overflow: auto; height: 180px; padding: 10px;">\'+
                \'Acepto las condiciones de uso y asimismo presto mi consentimiento para el tratamiento de mis datos personales. A tal efecto, KRONIGUNE ha establecido una política de privacidad donde Ud. podrá conocer la finalidad que se le darán a los datos suministrados a través del presente formulario, así como los derechos que le asisten.</div>\'+
                \'<div><form method="post" action="">\'+
                \'<input type="checkbox" name="AceptarAviso" value="1">\'+
                \'Acepto los t&eacute;rminos expuestos\'+
                \'<div style="margin-top: 20px; text-align: right;"><input type="submit" value="ACEPTAR">\'+
                \'</div></form></div>\',
                \'autoDimensions\'        : false,
                \'width\'                 : 500,
                \'height\'                : 300,
                \'transitionIn\'        : \'none\',
                \'transitionOut\'        : \'none\'
            });
        });
        </script>
        ';
    }
    elseif ($_POST['AceptarAviso'] == true) {
        update_user_meta(bp_loggedin_user_id(), 'AvisoLegal', 'aceptado');
    }
}
*/

locate_template( array( 'leftsidebar.php' ), true );

$sc     = check_scFilterMuro($_GET['sc']);
$filter = check_ironEstadoFilterMuro(esc_attr($_POST['IronEstadoFilter']),esc_attr($_GET['IronEstadoFilter']));

?>

    <div id="content">

        <div id="iron-encabezado-container">
            <h2 class="iron-encabezado-seccion">
                <?php echo __('Actividad','buddypress'); ?>
            </h2>

            <ul class="iron-encabezado-ul">
                <li class="iron-encabezado-li">
                    <a class="cluetip-through<?php if ($sc == 'personal') echo ' selected'; ?>" rel="<?php echo get_stylesheet_directory_uri() ?>/_inc/tips.php?id=7" href="<?php echo site_url(); ?>/activity/?sc=personal<?php echo isset($filter) ? '&IronEstadoFilter=' . $filter : ''; ?>">
                        <?php _e('S&oacute;lo yo', 'buddypress'); ?>
                    </a>
                </li>
                <li class="iron-encabezado-li">&middot;&nbsp;
                    <a class="cluetip-through<?php if ($sc == 'friends') echo ' selected'; ?>" rel="<?php echo get_stylesheet_directory_uri() ?>/_inc/tips.php?id=8" href="<?php echo site_url(); ?>/activity/?sc=friends<?php echo isset($filter) ? '&IronEstadoFilter=' . $filter : ''; ?>">
                        <?php _e('Mis amigos y yo', 'buddypress'); ?>
                    </a>
                </li>
                <li class="iron-encabezado-li">&middot;&nbsp;
                    <a class="cluetip-through<?php if ($sc == 'groups') echo ' selected'; ?>" rel="<?php echo get_stylesheet_directory_uri() ?>/_inc/tips.php?id=9" href="<?php echo site_url(); ?>/activity/?sc=groups<?php echo isset($filter) ? '&IronEstadoFilter=' . $filter : ''; ?>">
                        <?php _e('Grupos','buddypress'); ?>
                    </a>
                </li>
                <li class="iron-encabezado-li">&middot;&nbsp;
                    <a class="cluetip-through<?php if ($sc == 'all' || !$sc) echo ' selected'; ?>" rel="<?php echo get_stylesheet_directory_uri() ?>/_inc/tips.php?id=10" href="<?php echo site_url(); ?>/activity/?sc=all<?php echo isset($filter) ? '&IronEstadoFilter=' . $filter : ''; ?>">
                        <?php _e('Todos','buddypress'); ?>
                    </a>
                </li>
            </ul>
        </div>
        
        <div class="padder">
            
            <div id="content-top"></div>
            
            <?php do_action( 'bp_before_directory_activity_content' ) ?>
            
            <div id="content-middle">
                
                <?php
                /**
                 * Ocultamos los mensajes de error y notas
                 * do_action( 'template_notices' );
                 **/ 
                if ( is_user_logged_in() ) {
                    locate_template( array( 'activity/post-form.php' ), true );
                }
                ?>
                
                <div style="text-align: right; font-size: 10px; margin-top: -5px; #margin-top: 0px; margin-left: 20px; margin-bottom: 10px; margin-right: 20px; border-top: 1px solid #eaeaea; padding: 4px 4px 0px 4px;">
                
                    <form id="IronEstadoForm" name="IronEstadoForm" method="post" action="<?php echo site_url(). '/activity/?sc='.$_GET['sc']; ?>">
                        
                        <input type="hidden" id="IronEstadoFilter" name="IronEstadoFilter" value="<?php echo $filter; ?>">
                        <input type="hidden" id="IronScope" name="IronScope" value="<?php echo $sc; ?>">
                        <input type="hidden" name="sc" value="<?php echo $_GET['sc']; ?>">
                        
                        <?php if ($filter!='') { ?>
                            <p style="width: 374px; line-height: 100%; padding: 0px; margin: 0px; margin-top: 2px; float: left; text-align: right;">
                            <a style="font-weight: bold; font-size: 10px;" href="<?php echo site_url(); ?>/activity/"><?php _e('ver todo','buddypress'); ?></a>
                            </p>
                        <?php }
                        
                        $cats        = get_categories(array('hide_empty' => 0, 'parent' => 1));
                        $categorias  = array();
                        foreach ($cats as $cat) {
                            
                            if ($cat->slug == 'familiares') {
                                $bg         = "#E35900";
                                $imagename  = 'but_orange.png';
                            } elseif ($cat->slug == 'sintomaticos') {
                                $bg         = "#349BC4";
                                $imagename  = 'but_blue.png';
                            } elseif ($cat->slug == 'reflexivos') {
                                $bg         = "#697A00";
                                $imagename  = 'but_green.png';
                            } elseif ($cat->slug == 'transgresores') {
                                $bg         = "#753553";
                                $imagename  = 'but_purple.png';
                            }
                            
                            if ($filter == $cat->slug) {
                                $imagename  = str_replace('.png','_in.png',$imagename);
                            }
                            ?>
                            <img class="filter-buttons" id="IronCheck_<?php echo $cat->slug; ?>" src="<?php echo get_stylesheet_directory_uri() . '/_inc/images/' . $imagename; ?>" alt="<?php echo __('Filtrar por estado', 'buddypress') ?>" title="<?php echo __('Filtrar por estado', 'buddypress') ?>" />
                            <?php
                            /*
                            <a class="filter-buttons" href="<?php echo get_site_url() .'/activity/?IronEstadoFilter='.$cat->slug; ?>"><img src="<?php echo get_stylesheet_directory_uri() . '/_inc/images/'.$imagename; ?>" /></a>
                            <span style="-webkit-border-radius: 8px; -moz-border-radius: 8px; background: <?php echo $bg; ?>; padding: 4px; padding-bottom: 0px; margin: 2px;">
                            <input style="cursor: pointer;" type="radio" name="IronEstadoFilter" value="<?php echo $cat->slug; ?>" <?php if ($_POST['IronEstadoFilter']==$cat->slug) echo ' checked'; ?>
                            onclick="document.IronEstadoForm.submit();" title="Filtrar por estado: <?php echo $cat->name; ?>">
                            </span>
                            */
                        } ?>
                    </form>
                </div>
                
                <?php
                /*
                <div style=" text-align: right; margin-top: -5px; margin-left: 20px; margin-bottom: 10px; margin-right: 20px; border-top: 1px solid #eaeaea; padding-top: 10px;">
                <form name="IronEstadoForm" method="post" action="">
                <select name="IronEstadoFilter" style="width: 100px;" onchange="document.IronEstadoForm.submit();">
                <option selected value="">Todos</option>
                <?php
                $cats=get_categories(array('hide_empty' => 0, 'parent' => 1));
                $categorias = array();
                foreach ($cats as $cat) { ?>
                    <option <?php if ($_POST['IronEstadoFilter']==$cat->slug) echo ' selected'; ?> value="<?php echo $cat->slug; ?>"><?php echo $cat->name; ?></option>
                <?php } ?>
                </select>
                </form>
                </div>
                */
                
                /* ?>
                <?php // CUSTOM FILTER ?>
                <div id="ironmuro-filter">
                <?php //echo '<p class="iron-head">Actividad de ' . $current_user->display_name .'&nbsp;</p>'; ?>
                <?php //echo $iron_state; ?>
                
                <ul>
                    <li id="activity-filter-select" class="last">
                        <select>
                            <option value="-1"><?php _e( 'Mostrar Todo', 'buddypress' ) ?></option>
                            <option value="activity_update"><?php _e( 'Actualizaciones', 'buddypress' ) ?></option>
                            <option value="iron-animo, activity_update"><?php _e( 'Cambios de estado', 'buddypress' ) ?></option>
                            <option value="new_achievement"><?php _e( 'Hitos desbloqueados', 'buddypress' ) ?></option>
                            <optgroup label="Por Categoria">
                            <?php
                            // CATEGORIAS
                            $cats=get_categories(array('hide_empty' => 0, 'parent' => 1, 'orderby' => 'description'));
                            foreach ($cats as $cat) { ?>
                                <option value="<?php echo $cat->description; ?>"><?php _e( $cat->description, 'buddypress' ) ?></option>
                            <?php }
                            ?>
                            </optgroup>
                            
                            <?php if ( bp_is_active( 'blogs' ) ) : ?>
                                <option value="new_blog_post"><?php _e( 'Show Blog Posts', 'buddypress' ) ?></option>
                                <option value="new_blog_comment"><?php _e( 'Show Blog Comments', 'buddypress' ) ?></option>
                            <?php endif; ?>
                            
                            <?php if ( bp_is_active( 'forums' ) ) : ?>
                                <option value="new_forum_topic"><?php _e( 'Show New Forum Topics', 'buddypress' ) ?></option>
                                <option value="new_forum_post"><?php _e( 'Show Forum Replies', 'buddypress' ) ?></option>
                            <?php endif; ?>
                            
                            <?php if ( bp_is_active( 'groups' ) ) : ?>
                                <option value="created_group"><?php _e( 'Show New Groups', 'buddypress' ) ?></option>
                                <option value="joined_group"><?php _e( 'Show New Group Memberships', 'buddypress' ) ?></option>
                            <?php endif; ?>
                            
                            <?php if ( bp_is_active( 'friends' ) ) : ?>
                                <option value="friendship_accepted,friendship_created"><?php _e( 'Show Friendship Connections', 'buddypress' ) ?></option>
                            <?php endif; ?>
                            
                            <option value="new_member"><?php _e( 'Show New Members', 'buddypress' ) ?></option>
                            
                            ?>
                            <?php // do_action( 'bp_activity_filter_options' ) ?>
                        </select>
                    
                    </li>
                </ul>
                </div>
                <?php // END CUSTOM FILTER
                */ ?>
                
                <div class="activity">
                    <?php
                    locate_template( array( 'activity/activity-loop.php' ), true );
                    ?>
                </div><!-- .activity -->
                
                <?php
                do_action( 'bp_after_directory_activity_content' );
                ?>
                
            </div> <!-- content-middle -->
        
        <?php do_action( 'bp_after_directory_activity_content' ) ?>
            
        <div id="content-bottom"></div>
        
        </div><!-- .padder -->
        
    </div><!-- #content -->
    
    <?php
    locate_template( array( 'sidebar.php' ), true );
    
    get_footer();
    ?>