<?php /*
<div class="item-list-tabs no-ajax" id="subnav">
	<ul>
		<?php bp_get_options_nav() ?>

		<li id="activity-filter-select" class="last">
			<select>
				<option value="-1"><?php _e( 'No Filter', 'buddypress' ) ?></option>
				<option value="activity_update"><?php _e( 'Show Updates', 'buddypress' ) ?></option>

				<?php if ( 'groups' != bp_current_action() ) : ?>
					<?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( 'friends' ) ) : ?>
						<option value="friendship_accepted,friendship_created"><?php _e( 'Show Friendship Connections', 'buddypress' ) ?></option>
					<?php endif; ?>
				<?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 do_action( 'bp_member_activity_filter_options' ) ?>
			</select>
		</li>
	</ul>
</div><!-- .item-list-tabs -->

<?php do_action( 'bp_before_member_activity_post_form' ) ?>

<?php if ( is_user_logged_in() && bp_is_my_profile() && ( '' == bp_current_action() || 'just-me' == bp_current_action() ) ) : ?>
	<?php locate_template( array( 'activity/post-form.php'), true ) ?>
<?php endif; ?>

<?php do_action( 'bp_after_member_activity_post_form' ) ?>
*/ ?>
<?php global $bp; ?>

<div id="iron-encabezado-container" style="clear:both;">
    <ul class="iron-encabezado-ul">
        <li class="iron-encabezado-li">
            <a <?php if (!$_GET['sec'] && $bp->current_action=='just-me' ) echo 'class="selected"'; ?> href="<?php echo bp_displayed_user_domain() . 'activity/' ?>">
                <?php _e( 'Actividad', 'buddypress' ) ?>
            </a>
        </li>
        <li class="iron-encabezado-li">&middot;&nbsp;
            <a <?php if ($bp->current_action == 'mentions' or $_GET['sec'] == 'mentions') echo 'class="selected"'; ?> href="<?php echo bp_displayed_user_domain() . 'activity/mentions' ?>">
                <?php _e( 'Menciones', 'buddypress' ) ?>
            </a>
        </li>
        <li class="iron-encabezado-li">&middot;&nbsp;
            <a <?php if ($bp->current_action == 'favorites') echo 'class="selected"'; ?> href="<?php echo bp_displayed_user_domain() . 'activity/favorites' ?>">
                <?php _e( 'Le gusta', 'buddypress' ) ?>
            </a>
        </li>
        <li class="iron-encabezado-li">&middot;&nbsp;
            <a <?php if ($_GET['sec'] == 'groups') echo 'class="selected"'; ?> href="<?php echo bp_displayed_user_domain() . 'activity/?sec=groups' ?>">
                <?php _e( 'Grupos', 'buddypress' ) ?>
            </a>
        </li>
        <li class="iron-encabezado-li">&middot;&nbsp;
            <a <?php if ($_GET['sec'] == 'questions') echo 'class="selected"'; ?> href="<?php echo bp_displayed_user_domain() . 'activity/?sec=questions' ?>">
                <?php _e( 'Preguntas', 'buddypress' ) ?>
            </a>
        </li>
        <li class="iron-encabezado-li">&middot;&nbsp;
            <a <?php if ($_GET['sec'] == 'testimonies') echo 'class="selected"'; ?> href="<?php echo bp_displayed_user_domain() . 'activity/?sec=testimonies' ?>">
                <?php _e( 'Testimonios', 'buddypress' ) ?>
            </a>
        </li>
    </ul>

</div>

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

<?php if (!$_GET['sec']) : ?>

	<?php do_action( 'bp_before_member_activity_content' ) ?>

	<div class="activity profile-activity">
		<?php locate_template( array( 'activity/activity-loop.php' ), true ) ?>
	</div><!-- .activity -->

	<?php do_action( 'bp_after_member_activity_content' ) ?>

<?php elseif ($_GET['sec'] == 'groups') : ?>

	<div class="content-middle-add">
		<?php locate_template( array( 'groups/groups-loop.php' ), true ) ?>
	</div><!-- .content-middle-add -->

<?php elseif ($_GET['sec'] == 'testimonies') : ?>

	<div class="content-middle-add">
		<?php
		// Obtenemos el listado de posts
		global $wpdb;
		$list = $wpdb->get_results("SELECT * FROM $wpdb->posts, $wpdb->postmeta
		WHERE ID=post_id AND meta_value='testimonio' AND post_type='post' AND post_status='publish' AND post_author = ". bp_displayed_user_id());

		if (sizeof($list)>0) {
		foreach ($list as $post) {

			// Solo se muestran los testimonios del usuario
			//if ($post->post_author != bp_displayed_user_id()) continue;

			// Calcular estado de animo
			$class=calculate_moodbar( $post->post_author );
			?>
			<div class="post" id="post-<?php the_ID(); ?>">

				<div class="author-box <?php echo $class; ?>">
					<?php echo get_avatar( $post->post_author, '50' ); ?>
				</div>

				<div class="post-content">
				<p class="post-title"><a href="<?php echo $post->guid; ?>" title="<?php echo $post->post_title; ?>"><?php echo $post->post_title; ?></a>
				</p>
				<p class="post-user">
				<?php printf( __( 'por %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?>
				<?php
				// Si es el autor mostramos enlaces "Editar" y "Eliminar"
				if ( get_current_user_id() == $post->post_author ) {
					echo '&middot;&nbsp;<a class="fancybox-testimonies" style="font-size: 11px;" href="'. site_url() .'/testimonies-modal/?action=update&id='. $post->ID .'">Editar</a>';
					echo '&nbsp;&middot;&nbsp;<a style="font-size: 11px;" href="'. site_url() .'/testimonies/?action=delete&id='. $post->ID .'" onClick="if(!confirm(\'Eliminar Testimonio ?\')) {return false;}">Eliminar</a>';
				} ?>
				</p>
				<p class="post-content">
				<?php
				if (strlen(strip_tags($post->post_content))>200) {
					echo strip_tags(substr($post->post_content,0,200));
					echo '<br />&nbsp;<br />...&nbsp;<a href="'. $post->guid .'" title="' . __ ('continuar leyendo','buddypress') . $post->post_title .'">continuar leyendo</a>';
				}
				else
					echo $post->post_content;
				?>
				</p>
				<p class="postmetadata">
				<span class="comments"><?php comments_popup_link( __( 'No Comments &#187;', 'buddypress' ), __( '1 Comment &#187;', 'buddypress' ), __( '% Comments &#187;', 'buddypress' ) ); ?></span>
				</p>
				</div> <!-- .post-content -->

			</div> <!-- .post -->
		<?php }
		}
		else { ?>
			<div id="message" class="info">
			<p>
			<?php  _e ('No se han encontrado testimonios de este usuario.','buddypress'); ?>
			</p>
			</div>
		<?php }
		?>

	</div><!-- .content-middle-add -->

<?php elseif ($_GET['sec'] == 'questions') : ?>

	<div class="content-middle-add">
		<?php
		// Obtenemos el listado de posts
		global $wpdb;
		$list = $wpdb->get_results("SELECT * FROM ".$wpdb->posts.", ".$wpdb->postmeta."
		WHERE ID=post_id AND meta_value='pregunta' AND post_type='post' AND post_status='publish' AND post_author = ". bp_displayed_user_id());

		if (sizeof($list)>0) {
		foreach ($list as $post) {

			// Calcular estado de animo
			$class=calculate_moodbar( $post->post_author );
			?>
			<div class="post" id="post-<?php the_ID(); ?>">

				<div class="author-box <?php echo $class; ?>">
					<?php echo get_avatar( $post->post_author, '50' ); ?>
				</div>

				<div class="post-content">
				<p class="post-title"><a href="<?php echo $post->guid; ?>" title="<?php echo $post->post_title; ?>"><?php echo $post->post_title; ?></a>
				</p>
				<p class="post-user">
				<?php printf( __( 'por %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?>
				<?php
				// Si es el autor mostramos enlaces "Editar" y "Eliminar"
				if ( get_current_user_id() == $post->post_author ) {
					echo '&middot;&nbsp;<a class="fancybox-testimonies" style="font-size: 11px;" href="'. site_url() .'/testimonies-modal/?action=update&id='. $post->ID .'">Editar</a>';
					echo '&nbsp;&middot;&nbsp;<a style="font-size: 11px;" href="'. site_url() .'/testimonies/?action=delete&id='. $post->ID .'" onClick="if(!confirm(\'Eliminar Testimonio ?\')) {return false;}">Eliminar</a>';
				} ?>
				</p>
				<p class="post-content">
				<?php
				if (strlen(strip_tags($post->post_content))>200) {
					echo strip_tags(substr($post->post_content,0,200));
					echo '<br />&nbsp;<br />...&nbsp;<a href="'. $post->guid .'" title="' . __ ('continuar leyendo','buddypress') . $post->post_title .'">continuar leyendo</a>';
				}
				else
					echo $post->post_content;
				?>
				</p>
				<p class="postmetadata">
				<span class="comments"><?php comments_popup_link( __( 'No Comments &#187;', 'buddypress' ), __( '1 Comment &#187;', 'buddypress' ), __( '% Comments &#187;', 'buddypress' ) ); ?></span>
				</p>
				</div> <!-- .post-content -->

			</div> <!-- .post -->
		<?php }
		}
		else { ?>
			<div id="message" class="info">
			<p>
			<?php  _e ('No se han encontrado preguntas de este usuario.','buddypress'); ?>
			</p>
			</div>
		<?php }
		?>

	</div><!-- .content-middle-add -->

<?php endif; ?>
