<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
  <div><?= html_entity_decode($viewDatas['currentCategory']->head) ?></div>
  <div class="top"><?= $this->include('templates/front/index_head') ?></div>
  <?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
  <table class="table table-hover">
    <thead>
      <tr>
        <th>#</th>
        <?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_UserHelper($field, $viewDatas) ?><?php endforeach ?>
      </tr>
    </thead>
    <tbody>
      <?php $cnt = 0 ?>
      <?php foreach ($viewDatas['entitys'] as $entity) : ?>
        <tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
          <td nowrap>
            <!-- 사용자가 자신의 작성한것인지 확인되면 update 가능-->
            <?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getPrimaryKey() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
              <?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
            <?php else : ?>
              <?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
            <?php endif ?>
          </td>
          <?php foreach ($viewDatas['fields'] as $field) : ?>
            <td><?= getFieldIndex_Row_UserHelper($field, $entity, $viewDatas) ?></td>
          <?php endforeach ?>
        </tr>
        <?php $cnt++ ?>
      <?php endforeach ?>
    </tbody>
  </table>
  <div class="bottom">
    <?= $viewDatas['pagination'] ?>
  </div>
  <?= form_close() ?>
  <div><?= html_entity_decode($viewDatas['currentCategory']->tail) ?></div>
</div>
<?= $this->endSection() ?>