<?php
/**
 * The admin view file of user module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Yangyang Shi <shiyangyangwork@yahoo.cn>
 * @package     User
 * @version     $Id: admin.html.php 4029 2016-08-26 06:50:41Z liugang $
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../sys/my/view/header.html.php';?>
<div id='menuActions'>
  <div class='score-sect'>
    <div class='score'>
      <?php echo sprintf($lang->score->descList->currentScore, $user->score , $user->giftScore);?>
      <?php if(!$user->sectInfo->hasSetLevel) echo '，' . $lang->score->levelScore . ':' . $user->levelScore;?>
    </div>
    <?php if($user->sectInfo->hasSetLevel):?>
    <div class='sect'>
      <?php if($user->sectInfo->sectName):?>
      <div class='sect-name'><?php echo $user->sectInfo->sectName;?></div>
      <?php endif;?>
      <div class='sect-level-name'>
        <?php echo html::a(inlink('sectList'), $user->sectInfo->level . ' ' . $user->sectInfo->sectLevel);?>
      </div>
    </div>
    <?php endif;?>
  </div>
  <?php
  commonModel::printLink('score', 'gift', '', $lang->score->gift, "class='btn btn-primary' data-toggle='modal'");
  commonModel::printLink('score', 'apply', '', $lang->score->apply, "class='btn btn-primary' data-toggle='modal'");
  ?>
</div>
<div class='main-row'>
  <div class='side-col'>
    <div class='panel panel-block'>
      <div class='panel-heading'></div>
      <div class='panel-body'>
        <div id='treeMenuBox'>
          <ul class='tree'>
            <?php foreach($lang->score->myScoreTypeList as $scoreType => $typeLang):?>
            <li><?php echo html::a($this->createLink('score', 'personal', "type={$scoreType}"), $typeLang, $scoreType == $type ? "class='strong'" : '');?></li>
            <?php endforeach;?>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div class='main-col'>
    <div class='panel main-table' data-ride='table'>
      <table class='table has-sort-head'>
        <thead>
          <tr class='text-center'>
            <?php $vars = "type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
            <th class='w-60px'><?php commonModel::printOrderLink('id', $orderBy, $vars, $lang->score->id);?></th>
            <th class='w-160px'><?php commonModel::printOrderLink('time', $orderBy, $vars, $lang->score->time);?></th>
            <?php if($type == 'common'):?>
            <th class='w-120px'><?php echo $lang->scorerule->type;?></th>
            <th class='w-120px'><?php commonModel::printOrderLink('rule', $orderBy, $vars, $lang->score->behavior);?></th>
            <?php endif;?>
            <th class='w-60px'><?php echo $lang->score->before;?></th>
            <th class='w-60px'><?php commonModel::printOrderLink('score', $orderBy, $vars, $lang->score->score);?></th>
            <th class='w-60px'><?php echo $lang->score->after;?></th>
            <th class='w-140px text-left'><?php echo $lang->score->tradeObject;?></th>
            <th class='text-left'><?php echo $lang->score->desc;?></th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($scores as $score):?>
          <?php $rule     = zget($rules, $score->rule);?>
          <?php $giver    = $score->giver == $app->user->account ? $lang->score->me : zget($users, $score->giver);?>
          <?php $receiver = $score->receiver == $app->user->account ? $lang->score->me : zget($users, $score->receiver);?>
          <?php if($giver == 'system')    $giver    = $lang->score->system;?>
          <?php if($receiver == 'system') $receiver = $lang->score->system;?>
          <tr class='text-center'>
            <td><?php echo $score->id;?></td>
            <td><?php echo $score->time;?></td>
            <?php if($type == 'common'):?>
            <td><?php echo zget($lang->score->typeList, zget($rule, 'type'));?></td>
            <td><?php echo $score->rule ? zget($rule, 'name') : zget(zget($lang->score->methods, $score->module), $score->method);?></td>
            <?php endif;?>
            <td><?php echo $score->before;?></td>
            <td><?php echo $score->score > 0 ? '+' . $score->score : $score->score;?></td>
            <td><?php echo $score->after;?></td>
            <td class='text-left'><?php echo $giver . ' -> ' . $receiver;?></td>
            <td class='text-left text-ellipsis' title="<?php echo $score->desc;?>"><?php echo $score->desc;?></td>
          </tr>
          <?php endforeach;?>
        </tbody>
      </table>
      <div class='table-footer'>
        <?php $pager->show();?>
      </div>
    </div>
  </div>
</div>
<?php include '../../common/view/footer.html.php';?>
