<?php
/**
 * The set level view file of score module of ZDOO.
 *
 * @copyright   Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     商业软件，非开源软件
 * @author      LiuRuoGu <liuruogu@cnezsoft.com>
 * @package     score
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('sectCodeUnique', $lang->score->error->sectCodeUnique);?>
<div class='main-row'>
  <?php include 'side.html.php';?>
  <div class='panel'>
    <div class='panel-heading'>
      <strong><?php echo $lang->score->setSect;?></strong>
      <?php echo html::commonButton($lang->score->addSect, 'btn btn-primary addSect');?>
    </div>
    <div class='panel-body'>
      <form id='ajaxForm' method='post' class='text-center'>
        <div class='sect-box'>
          <?php $index = 1;?>
          <?php foreach($sectList as $code => $sect):?>
          <div class='sect-item w-280px'>
            <div class='input-group sect-input'>
              <?php echo html::hidden("code[$index]", $code, "id='code{$index}' maxlength='10'  readonly data-value='{$code}'");?>
              <div class='input-group-addon sect-label'><?php echo $lang->score->sect;?></div>
              <?php echo html::input("name[$index]", $sect->name, "id='name{$index}' class='form-control w-140px' maxlength='10'");?>
              <div class='input-group-addon deleteSect'><i class="icon icon-trash"></i></div>
            </div>
            <?php foreach($levelList as $level => $score):?>
            <div class='input-group sect-input'>
              <div class='input-group-addon'><?php echo $lang->score->level . ($level + 1);?></div>
              <?php echo html::input("level[$index][$level]", zget($sect->level, $level, ''), "id='level{$index}_{$level}' class='form-control w-180px' maxlength='10'");?>
            </div>
            <?php endforeach;?>
          </div>
          <?php $index ++;?>
          <?php endforeach;?>
        </div>
        <?php echo html::submitButton();?>
      </form>
    </div>
  </div>
</div>
<?php
$levelRow = "";
foreach($levelList as $levelIndex => $score)
{
    $level     = $levelIndex + 1;
    $levelRow .= "<div class='input-group sect-input'>
                    <div class='input-group-addon'>{$lang->score->level}{$level}</div>
                    <input type='text' name='level[KEY][]' id='levelKEY_{$levelIndex}' class='form-control w-180px' maxlength='10'>
                  </div>";
}
$itemRow = <<<EOT
    <div class='sect-item w-280px'>
      <div class='input-group sect-input'>
        <input id='codeKEY' value='CODE' type='hidden' name="code[KEY]" maxlength='10'>
        <div class='input-group-addon sect-label'>{$lang->score->sect}</div>
        <input id='nameKEY' type='text' name="name[KEY]" class='form-control w-140px' maxlength='10'>
        <div class='input-group-addon deleteSect'><i class="icon icon-trash"></i></div>
      </div>
      {$levelRow} 
    </div>
EOT;
?>
<?php js::set('itemRow', $itemRow);?>
<?php js::set('key', $index);?>
<?php include '../../common/view/footer.html.php';?>
