<?php
  /**
   * View Downloads
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: viewDownloads.tpl.php, v1.00 2017-05-05 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');
?>
<div class="header">
  <?php if($this->row):?>
  <?php echo ($this->row->price > 0) ? Lang::$word->META_M_MDOWNS : Lang::$word->META_M_FDOWNS;?>
  <?php else:?>
  <?php echo Lang::$word->DOWNLOADS;?>
  <?php endif;?>
</div>
<div class="scrolling content">
  <?php if(!$this->row):?>
  <?php echo Message::msgSingleError(Lang::$word->FM_ERROR);?>
  <?php else:?>
  <div class="wojo icon basic message"><img src="<?php echo Product::hasThumb($this->row->thumb, $this->row->id);?>" alt="" class="wojo basic image">
    <div classs="content">
      <h4>
        <a href="<?php echo Url::url('/product', $this->row->slug);?>"><?php echo $this->row->title;?></a>
      </h4>
      <?php echo Validator::sanitize($this->row->body, "string", 150);?></div>
  </div>
  <div class="wojo space divider"></div>
  <h4><?php echo Lang::$word->FM_FILES;?></h4>
  <div class="wojo space divider"></div>
  <?php if($this->data):?>
  <div class="wojo very relaxed divided flex list align-middle">
    <?php foreach($this->data as $row):?>
    <div class="item">
      <a href="<?php echo SITEURL;?>/download.php?paid=<?php echo $row->token;?>" class="wojo shadow content half-padding shrink" style="background-color:<?php echo Product::fileStyle($row->extension);?>"><?php echo Product::fileIcon($row->extension, "small");?></a>
      <div class="content margin-left">
        <p class="header"><?php echo $row->alias;?></p>
        <p class="wojo small text"><?php echo Date::doDate("long_date", $row->created);?>
          <span class="wojo separator"></span>
          <?php echo File::getSize($row->filesize);?></p>
      </div>
      <div class="content shrink"><a href="<?php echo SITEURL;?>/download.php?<?php echo ($this->row->price > 0) ? "member" : "free";?>=<?php echo Utility::encode($this->row->id);?>&amp;token=<?php echo $row->token;?>" class="wojo tiny primary button"><?php echo Lang::$word->DOWNLOAD;?></a>
      </div>
    </div>
    <?php endforeach;?>
  </div>
  <?php endif;?>
  <?php endif;?>
</div>