<?php
/**
 * The sect view file of score  module of ZDOO.
 *
 * @copyright   Copyright 2009-2022 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      LiuRuoGu <liuruogu@easysoft.cn>
 * @package     User
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../sys/my/view/header.html.php';?>
<?php include '../../common/view/confirmer.html.php';?>
<div id='mainTitle' class='clearfix'>
  <div class='btn-toolbar pull-left'>
    <?php echo html::a(inlink('personal'), '<i class="icon icon-back icon-sm"></i> ' . $lang->goback, "class='btn btn-back'");?>
    <div class='score'> 
      <span class='strong'><?php echo $lang->score->levelScore;?></span><span>：<?php echo $user->levelScore;?></span>
      <div class="divider"></div>
      <span class='strong'><?php echo $lang->score->currentSect;?></span><span>：<?php echo $user->sectInfo->sectName ? $user->sectInfo->sectName : $lang->score->noSect;?></span>
    </div>
  </div>
</div>
<div class='panel'>
  <table class='table table-bordered datatable' data-fixed-left-width='300'>
    <thead>
      <tr>
        <th class='text-center'><?php echo $lang->score->level;?></th>
        <th class='text-center'><?php echo $lang->score->threshold;?></th>
        <?php foreach($sectList as $sect):?>
        <th data-width='180' class='text-center flex-col'><?php echo $sect->name;?></th>
        <?php endforeach;?>
      </tr>
    </thead>
    <tbody>
      <?php foreach($levelList as $index => $threshold):?>
      <tr class='text-center'>
        <td><?php echo $lang->score->level . ($index + 1);?></td>
        <td><?php echo $threshold;?></td>
        <?php foreach($sectList as $sect):?>
        <td><?php echo zget($sect->level, $index, '');?></td>
        <?php endforeach;?>
      </tr>
      <?php endforeach;?>
      <?php /* If there is only one sect and the user has joined, the last line will not be displayed */?>
      <?php if(!(count((array)$sectList) == 1 && $user->sectInfo->sect)):?>
      <tr class='text-center'>
        <td></td>
        <td></td>
        <?php foreach($sectList as $sectCode => $sect):?>
        <?php $confirm = sprintf($lang->score->tip->confirmJoinSect, $sect->name);?>
        <td class='padding'><?php if($user->sectInfo->sect != $sectCode) echo html::commonButton($lang->score->join, 'btn btn-primary join-btn', "data-message='{$confirm}' data-sect='{$sectCode}'");?></td>
        <?php endforeach;?>
      </tr>
      <?php endif;?>
    </tbody>
  </table>
</div>
<?php include '../../common/view/footer.html.php';?>
