<?php use_helper('I18N', 'Object', 'Validation', 'Javascript', 'tvtl','ModalBox'); ?>
<?php use_javascript('/js/blog/admin.js');?>
<?php echo form_tag('/admin/reactive','name=invalid')?>
<table class="table-content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <th width="5%"><input type="checkbox" name="all" id = "all" onclick="checkAll(document.invalid.entry);" /></th>
    <th width="20%">Tiêu đề</th>
    <th width="15%">Người duyệt</th>
    <th width="15%">Người gửi</th>
    <th width="10%">Ngày duyệt</th>
    <th>Lý do không duyệt</th>
  </tr>
  <?php foreach($pager->getResult() as $i=>$tblentryinvalid): ?>
  <tr class="row<?php echo $i%2;?>">
  	<td width="5%">
  	 <input type="checkbox" name="entry[]" onclick="setCheckAll(document.invalid.entry);"
     id="entry" value="<?php echo $tblentryinvalid->getEiEntry()?>" />
  	</td>
  	<td>
    	<?php
      $tblentry = TblblogentryPeer::retrieveByPK($tblentryinvalid->getEiEntry());
    	echo link_to($tblentry->getObject()->getName(), '/admin/showentryinvalid?id='.$tblentryinvalid->getEiEntry(),'Xem chi tiết')?>
  	</td>
    <td>
      <?php echo TbluserPeer::retrieveByPk($tblentryinvalid->getEiFrom())->getObject()->getHtmlname()?>
    </td>
    <td>
      <?php echo TbluserPeer::retrieveByPk($tblentryinvalid->getEiTo())->getObject()->getHtmlname()?>
    </td>
    <td><?php echo $tblentryinvalid->getEiDatesent('d-m-Y')?></td>
    <td>
      <?php echo $tblentryinvalid->getEiContent()?>
    </td>

  </tr>
  <?php endforeach;?>

</table>

</form>
<div style="height:50px;">
  <div style="margin-left:5px;">
    <?php echo link_to('Hoạt động trở lại','#','onclick=isCheck(document.invalid.entry);')?>
  </div>
  <div style="margin-top: 10px;text-align:center;">
    <?php $pageNav = showPageNav13($pager,'/admin/listentryinvalid?'); ?>
    <?php echo $pageNav ?>
  </div>
</div>
<?php $sf_context->getResponse()->addJavascriptCommand(<<<EOD
function isCheck(users) {
  var result = false;
  if(users.type == 'checkbox') {
    if(users.checked == true) {
      result = true;
    }
  } else {
    for (var i = 0; i < users.length; i++) {
        if (users[i].checked == true) {
          result = true;
          break;
        }
    }
  }
  if(result == false ) {
    alert('Bạn phải chọn ít nhất một Id');
    return false;
  }
  if(confirm('Bạn có chắc chắn không') == true) {
    document.invalid.submit();
  } else {
    return false;
  }
}
EOD
); ?>