<?php use_helper('I18N', 'tvtl', 'ModalBox') ?>

<div id='doc_content'>
  <?php $baseLink = '/present/same?entry_id='.$entry_id.'&same=' ?>
  <?php $showTitle = array('text'=>$tblpresentation->getObject()->getShortName(), 'options'=>array('style'=>'width:285px; overflow: hidden; white-space: nowrap;')) ?>
  <?php $tabs = array('show'=>$showTitle, 'author'=>'Cùng tác giả', 'downloader'=>'Lịch sử tải về') ?>
  <?php if ($tblpresentation->getPrType()=='sco') {unset($tabs['downloader']); $tabs['scormreport'] = 'Báo cáo SCORM';} ?>
  <?php echo gridTab($tabs, $baseLink, $same, 'doc_content') ?>

  <div class="doc document">
    <?php switch ($same):
      case 'author': ?>
        <h2>Cùng tác giả <?php echo $tblpresentation->getTbluser()->getObject()->getHtmlName() ?></h2>
        <label><?php echo showPageNav13($pager, $baseLink.'&same='.$same, 'doc_content') ?></label>
        <div class="content">
          <?php foreach ($tblblogentrys as $i=>$tblblogentry): ?>
            <?php echo $tblblogentry->getObject()->getGlobalThumb(); ?>
          <?php endforeach; ?>
        </div>
        <?php break; ?>

      <?php case 'downloader': ?>
        <h2>Các thành viên đã tải về</h2>
        <label><?php echo showPageNav13($pager, $baseLink.'&same='.$same, 'doc_content'); ?></label>
        <div class="content">
          <?php foreach ($pager->getResult() as $uspre): ?>
            <div class="userinfo">
              <?php $user = TbluserPeer::retrieveByPk($uspre->getUspreUser()); ?>
              <?php if (!$user) continue; ?>
              <?php echo $user->getObject()->getHtmlName(true) ?><br/>
              tải lúc <?php echo date('H:i d/m/Y', strtotime($uspre->getUspreDate())); ?>
            </div>
          <?php endforeach ?>
        </div>
        <?php break; ?>

      <?php case 'scormreport': ?>
        <?php include_component('present', 'reportsco', array('pr_id'=>$tblpresentation->getPrId())); ?>
        <?php break ?>

      <?php default: ?>
        <h2>
          <div style="width:425px; float:left">
            <?php echo $tblpresentation->getLessonName() ?>
          </div>
          <label>
            <?php echo $tblpresentation->getObject()->getDownloadLink(true) ?>
            <?php echo $tblblogentry->getObject()->getEditLink('/present/edit') ?>
            <?php echo $tblblogentry->getObject()->getDeleteLink('/present/predelete') ?>
          </label>
        </h2>
        <div class="content">
          <?php include_component('block', 'previewadv', array('name'=>'preview_float')) ?>
          <div class="fullthumb"><?php echo $tblpresentation->getObject()->getPreview() ?></div>
          <?php include_component('present', 'confirmlesson', array('tblpresentation'=>$tblpresentation, 'tblblogentry'=>$tblblogentry)) ?>
          <?php include_component('present', 'modtab', array('tblblogentry'=>$tblblogentry)) ?>
          <?php include_component('block', 'advbanner', array('name'=>'preview')) ?>
          <div class="doc-info">
            <div align="right" style="float:right; line-height:170%">
              <b><?php echo $tblpresentation->getObject()->getDownloadLink() ?></b><br>
              <b><?php echo mm_link_need_login('Báo tài liệu có sai sót', 'entry/complain?entry_id='.$entry_id, true) ?></b><br>
              <b><?php echo mm_link_need_login('Nhắn tin cho tác giả', $tblblogentry->getObject()->getMessageLink()) ?></b><br/>
              <?php if (method_exists($tblpresentation->getObject(), 'getPlayerUrl')): ?>
                <b><?php echo link_to('Xem toàn màn hình', $tblpresentation->getObject()->getPlayerUrl(), array('target'=>'_blank')) ?></b><br>
              <?php endif ?>
              <?php if (blogStore::$catTree->getCatItem($tblblogentry->getEntryCategory())->config['listtype'] == 'all'): ?>
                <b><?php echo link_to('Mở thư mục chứa tài liệu này', $tblblogentry->getListUrl()) ?></b><br>
              <?php endif ?>
              <?php if ($tblpresentation->getPrLesson()): ?>
                <b><?php echo link_to('Mở các bài cùng nội dung', '/present/samelesson?cat_id='.$tblblogentry->getEntryCategory().'&lesson='.$tblpresentation->getPrLesson()) ?></b><br>
              <?php endif ?>
            </div>
            <div>
              <?php include_component('entry', 'approve', array('tblblogentry'=>$tblblogentry)) ?>
              <b>Nguồn: </b><?php echo $tblpresentation->getPrSource() ?><br>
              <b>Người gửi: </b><?php echo $tblpresentation->getTbluser()->getObject()->getHtmlName(false, true) ?><br>
              <b>Ngày gửi: </b><?php echo $tblpresentation->getPrDate('H\h:i\' d-m-Y') ?><br>
              <b>Dung lượng: </b><?php echo myUtility::formatFilesize($tblpresentation->getPrFilesize()) ?><br>
              <b>Số lượt tải: </b><?php echo $tblpresentation->getPrHit() ?><br>
              <?php include_component('entry', 'showlike', array('tblblogentry' => $tblblogentry)); ?>
            </div>
            <?php if ($tblblogentry->getEntryType() != -3): ?>
            <div class="present-detail">
              <?php echo html_entity_decode($tblpresentation->getPrContent()) ?>
            </div>
            <?php endif ?>
          </div>
        </div>
      <?php break; ?>
    <?php endswitch; ?>
  </div>
</div>
