<?php
  /**
   * Product Button
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: productButton.tpl.php, v1.00 2017-05-05 10:12:05 gewa Exp $
   */
  if (!defined("_WOJO"))
      die('Direct access to this location is not allowed.');
?>
<?php
  if ($this->row->type == "affiliate") {
      echo '<a href="' . $this->row->affiliate . '" targe="_blank" class="wojo secondary right labeled icon button"> <i class="icon globe"></i> ' . Lang::$word->VISIT . '</a>';
  } else {
      if ($this->row->membership_id == 0) {
          if ($this->row->price == 0) {
              switch ($this->core->allow_free) {
                  case "yes":
					  echo '<a data-set=\'{"option":[{"action": "download", "token": "' . Utility::encode($this->row->id) . '"}], "buttons":false, "close": true, "url":"/controller.php", "parent":"#none", "complete":"replace","modalclass":"small"}\' class="wojo fluid rounded primary button mAction"> <i class="icon unlock"></i> ' . Lang::$word->PRD_DOWNFREE . '</a>';
                      break;
                  case "no" and App::Auth()->logged_in:
					  echo '<a data-set=\'{"option":[{"action": "download", "token": "' . Utility::encode($this->row->id) . '"}], "buttons":false, "close": true, "url":"/controller.php", "parent":"#none", "complete":"replace","modalclass":"small"}\' class="wojo fluid rounded primary button mAction"> <i class="icon unlock"></i> ' . Lang::$word->PRD_DOWNFREE . '</a>';
                      break;
                  default:
                      echo '<a href="' . Url::url("/login") . '" class="wojo fluid rounded primary button"> <i class="icon lock"></i> ' . Lang::$word->LOGIN . '</a>';
                      break;
              }
          } else {
              echo '<a data-id="' . $this->row->id . '" class="wojo fluid rounded primary button add"><i class="icon basket add"></i> ' . Lang::$word->ADD . '</a>';
          }
      } else {
          if ($this->row->membership_id and Content::is_valid($this->row->membership_id)) {
              echo '<a data-set=\'{"option":[{"action": "download", "token": "' . Utility::encode($this->row->id) . '"}], "buttons":false, "close": true, "url":"/controller.php", "parent":"#none", "complete":"replace","modalclass":"small"}\' class="wojo fluid rounded primary button mAction"> <i class="icon membership"></i> ' . Lang::$word->DOWNLOAD . '</a>';
          } else {
              echo '<a class="wojo fluid rounded primary button disabled"> <i class="icon membership"></i> ' . Lang::$word->VIP . '</a>';
          }
      }
  }
?>