<?php $haya_favorite_check_favorite = haya_favorite_find_by_uid_and_tid($uid, $tid); ?>

<style>
.haya-favoriter {
	position: relative;
}
.haya-favorite-show-users {
	position: absolute;
	top: 5px;
	z-index: 100;
	width: 100%;
}
.haya-favorite-show-users .haya-favorite-users {
	max-height: 250px;
	overflow-y: auto;
}
</style>

<div class="haya-favoriter px-2">
	<span class="btn-group haya-favoriter-info" role="group">
		<?php if (!empty($uid)) { ?>
			<?php if($haya_favorite_check_favorite){ ?>
				<button class="btn btn-outline-secondary js-haya-favorite-del" data-tid="<?php echo $tid;?>" title="<?php echo lang('haya_favorite_delete_favorite'); ?>">
					<i class="icon icon-star" aria-label="<?php echo lang('haya_favorite_delete_favorite'); ?>"></i>
					<span class="haya-favorite-btn"><?php echo lang('haya_favorite_delete'); ?></span>
				</button>
			<?php } else { ?>
				<button class="btn btn-outline-secondary js-haya-favorite-add" data-tid="<?php echo $tid;?>" title="<?php echo lang('haya_favorite_add_favorite'); ?>">
					<i class="icon icon-star-o" aria-label="<?php echo lang('haya_favorite_add_favorite'); ?>"></i>
					<span class="haya-favorite-btn"><?php echo lang('haya_favorite_add'); ?></span>
				</button>
			<?php } ?>	
		<?php } else { ?>
			<button class="btn btn-outline-secondary js-haya-favorite-tip" data-tid="<?php echo $tid;?>" title="<?php echo lang('haya_favorite_add_favorite'); ?>">
				<i class="icon icon-star-o" aria-label="<?php echo lang('haya_favorite_add_favorite'); ?>"></i>
				<span class="haya-favorite-btn"><?php echo lang('haya_favorite_add'); ?></span>
			</button>
		<?php } ?>

		<button class="btn btn-outline-secondary js-haya-favorite-show-users" data-tid="<?php echo $tid;?>" title="<?php echo lang('haya_favorite_show_favorite_users'); ?>">
			<span class="haya-favorite-user-count"><?php echo intval($thread['favorites']); ?></span>
		</button>
	</span>
</div>

