<?php
  /**
   * Grid Button
   *
   * @package Wojo Framework
   * @author wojoscripts.com
   * @copyright 2017
   * @version $Id: gridButton.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 ($row->type == "affiliate") {
      echo '<a href="' . $row->affiliate . '" targe="_blank" class="wojo rounded transparent white button"> <i class="icon globe"></i> ' . Lang::$word->VISIT . '</a>';
  } else {
	  if ($row->membership_id == 0) {
		  if ($row->price == 0) {
			  switch ($this->core->allow_free) {
				  case "yes":
					  echo '<a data-set=\'{"option":[{"action": "download", "token": "' . Utility::encode($row->id) . '"}], "buttons":false, "close": true, "url":"/controller.php", "parent":"#none", "complete":"replace","modalclass":"small"}\' class="wojo rounded transparent white 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($row->id) . '"}], "buttons":false, "close": true, "url":"/controller.php", "parent":"#none", "complete":"replace","modalclass":"small"}\' class="wojo rounded transparent white button mAction"> <i class="icon unlock"></i> ' . Lang::$word->PRD_DOWNFREE . '</a>';
					  break;
				  default:
					  echo '<a href="' . Url::url("/login") .
						  '" class="wojo rounded transparent white button"> <i class="icon lock"> </i>' . Lang::$word->LOGIN . '</a>';
					  break;
			  }
		  } else {
			  echo '<a data-id="' . $row->id . '" class="wojo rounded transparent white button add"> <i class="icon basket add"> </i>' . Lang::$word->ADD . '</a>';
		  }
	  } else {
		  if ($row->membership_id and Content::is_valid($row->membership_id)) {
              echo '<a data-set=\'{"option":[{"action": "download", "token": "' . Utility::encode($row->id) . '"}], "buttons":false, "close": true, "url":"/controller.php", "parent":"#none", "complete":"replace","modalclass":"small"}\' class="wojo rounded transparent white button mAction"> <i class="icon membership"></i> ' . Lang::$word->DOWNLOAD . '</a>';
		  } else {
			  echo '<a class="wojo rounded transparent white button disabled"> <i class="icon membership"> </i>' . Lang::$word->VIP . '</a>';
		  }
	  }
  }
?>