<?php
   /**
    * gridButton
    *
    * @package Wojo Framework
    * @author wojoscripts.com
    * @copyright 2023
    * @var object $row
    * @version 5.50: gridButton.tpl.php, v1.00 11/18/2023 12:23 PM Gewa Exp $
    *
    */
   if (!defined('_WOJO')) {
      die('Direct access to this location is not allowed.');
   }
   
   if ($row->type == 'affiliate') {
      echo '<a href="' . $row->affiliate . '" target="_blank" class="wojo simple white button"> <i class="icon globe"></i> ' . Language::$word->VISIT . '</a>';
   } else {
      if ($row->membership_id == '-1') {
         if ($row->price == 0) {
            if ($this->core->allow_free == 'yes') {
               echo '<a data-set=\'{"option":[{"action":"download", "token":"' . Utility::encode($row->id) . '"}],"url":"/controller.php", "parent":"#item_' . $row->id . '", "buttons": false, "complete":"replace", "modalclass":"medium"}\' class="wojo simple white button button action"><i class="icon unlock"></i> ' . Language::$word->PRD_DOWNFREE . '</a>';
            } else {
               if (App::Auth()->logged_in) {
                  echo '<a data-set=\'{"option":[{"action":"download", "token":"' . Utility::encode($row->id) . '"}],"url":"/controller.php", "parent":"#item_' . $row->id . '", "buttons": false, "complete":"replace", "modalclass":"medium"}\' class="wojo simple white button button action"><i class="icon unlock"></i> ' . Language::$word->PRD_DOWNFREE . '</a>';
               } else {
                  echo '<a href="' . Url::url('/login') . '" class="wojo simple white button"> <i class="icon lock"> </i>' . Language::$word->LOGIN . '</a>';
               }
            }
         } else {
            echo '<a data-id="' . $row->id . '" class="wojo simple white button add"> <i class="icon bag add"> </i>' . Language::$word->ADD . '</a>';
         }
      } else {
         if (!$row->membership_id == '-1' and Membership::is_valid($row->membership_id)) {
            echo '<a data-set=\'{"option":[{"action":"download", "token":"' . Utility::encode($row->id) . '"}],"url":"/controller.php", "parent":"#item_' . $row->id . '", "buttons": false, "complete":"replace", "modalclass":"medium"}\' class="wojo simple white button button action"><i class="icon package"></i> ' . Language::$word->DOWNLOAD . '</a>';
         } else {
            echo '<a class="wojo simple white button disabled"> <i class="icon bookmark"> </i>' . Language::$word->VIP . '</a>';
         }
      }
   }