
<?php 
if (isset($light_config['thread_top_ind']) && $light_config['thread_top_ind'] == 1) { 
if($page === 1) {
    $threadlist_forum_top = thread_top_find($fid);
    thread_list_access_filter($threadlist_forum_top, $gid);
    if($threadlist_forum_top) { 
        $have_allowtop = 0;
        foreach($threadlist_forum_top as &$_thread) {
            $_thread['allowtop'] = forum_access_mod($_thread['fid'], $gid, 'allowtop');
            if($_thread['allowtop']) $have_allowtop = 1;
        }
    }
}?>


<?php if($page === 1) { ?>
    <div class="card">
        <div class="card-body">
                <div class="media forum-card-body">	
                <img class="avatar-4 mr-3 rounded" src="<?php echo $forum['icon_url'];?>">
                    <div class="media-body mt-1">
                        <h5 class="font-weight-bold"><?php echo $forum['name'];?><span class="badge badge-primary ml-2"><?php if($forum['todayposts']>0) echo $forum['todayposts'];?></span></h5>
                        <div class="mt-3"><span class="text-gray text-small"><?php echo lang('threads');?>：
                                <span class="badge badge-primary"><?php echo $forum['threads'];?></span></span>
                            <span class="text-gray text-small ml-3"><?php echo lang('today_posts');?>：
                                <span class="badge badge-primary"><?php echo $forum['todayposts'];?></span></span>
                        </div>
                    </div>
            </div>
            <div class="mt-3" style="display: flex; justify-content: space-between;">
                <button type="button" class="btn btn-outline-primary" style="width: 49%;" data-toggle="modal" data-target="#forumInfoModal"><i class="el-icon-chat-square mr-1"></i>关于版块</button>
				<a  class="btn btn-primary" style="width: 49%;" href="<?php echo url('thread-create-'.$fid);?>"><i class="el-icon-edit mr-1"></i><?php echo lang('thread_create_new');?></a>
            </div>
        </div>
<?php if($threadlist_forum_top) { ?>

        <div class="card-footer py-1">
            <ul class="list-unstyled  mb-0">
               <?php if($threadlist_forum_top ) { foreach($threadlist_forum_top as &$_thread) { ?>
                        <li class="tap <?php echo $_thread['top_class'];?>" data-href="<?php echo url("thread-$_thread[tid]");?>" data-tid="<?php echo $_thread['tid'];?>">
                            <div class="d-flex justify-content-between my-2">
                                <div class="break-all text-truncate">
                                    <?php if($_thread['top'] > 0) { ?>
                                        <i class="icon-top-<?php echo $_thread['top']; ?>"></i>
                                    <?php } ?>
                                    <a href="<?php echo url("thread-$_thread[tid]");?>"><?php echo $_thread['subject'];?></a>
                                    <?php if($_thread['closed'] > 0) { ?><i class="icon-lock"></i><?php } ?>
                                </div>
                                <div class="text-nowrap hidden-sm">
                                    <span class="text-muted align-middle"><?php echo $_thread['create_date_fmt'];?></span>
                                </div>
                            </div>
                        </li>
                        <?php }} else { ?>
                        <div class="row justify-content-center">
                            <div class="col-6">
                                <div class="text-center my-5" style="color:gainsboro"><i
                                        class="fa fa-bug display-1"></i><br /><?php echo lang('none');?></div>
                            </div>
                        </div>
                        <?php } ?>
            </ul>
        </div>
        <?php  }?>

    </div>
    <?php } }?>

    <!--{hook forum_top_after.htm}-->


<!-- Modal -->
<div class="modal fade" id="forumInfoModal" tabindex="-1" aria-labelledby="forumInfoModal" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="forumInfoModal">关于板块</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
            <div class="media forum-card-body">	
                <img class="avatar-4 mr-3 rounded" src="<?php echo $forum['icon_url'];?>">
                    <div class="media-body mt-1">
                        <h5 class="font-weight-bold"><?php echo $forum['name'];?><span class="badge badge-primary ml-2"><?php if($forum['todayposts']>0) echo $forum['todayposts'];?></span></h5>
                        <div class="mt-3"><span class="text-gray text-small"><?php echo lang('threads');?>：
                                <span class="badge badge-primary"><?php echo $forum['threads'];?></span></span>
                            <span class="text-gray text-small ml-3"><?php echo lang('today_posts');?>：
                                <span class="badge badge-primary"><?php echo $forum['todayposts'];?></span></span>
                        </div>
                    </div>
            </div>
            <div class="mt-2 text-muted">
                <?php if($forum['brief']) { ?>
                <div class="line-height-2"><?php echo $forum['brief'];?></div>
                <?php  }else {?>
                <span class="text-muted"><?php echo lang('no_forumBrief');?></span>
                <?php  }?>
            </div>
            <div class="mt-3">
                <h6><i class="el-icon-user mr-1"></i><?php echo lang('forum_moderator');?></h6>
                <?php if($forum['modlist']) { ?>
                    <div class="row px-3 mt-3">
                <?php foreach ($forum['modlist'] as $mod) { ?>
                    <div class="col-6">
                        <a href="<?php echo url("user-$mod[uid]");?>"><img src="<?php echo $mod['avatar_url'];?>"
                        class="avatar-2 mr-2" data-toggle="tooltip" data-placement="top"
                        title="<?php echo $mod['username'];?>"><?php echo $mod['username'];?></a>
                    </div>
                <?php } ?>
                </div>
                <?php  } else {?>
                <span class="text-gray"><?php echo lang('no_moderator');?><i class="fa fa-frown"></i></span>
                <?php } ?>
            </div>
            <div class="mt-3">
                <?php if($forum['announcement']) { ?>
                    <h6><i class="el-icon-chat-line-square mr-1"></i><?php echo lang('forum_anouncement');?></h6>
                    <div class="mt-2 text-muted">
                    <?php echo $forum['announcement'];?>
                    </div>        
                    <?php  } ?>
            </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">我已了解</button>
        </div>
      </div>
    </div>
  </div>