<?php
  /**
   * Category
   *
   * @package Digital Downloads Pro
   * @author wojoscripts.com
   * @copyright 2010
   * @version $Id: category.php, v2.00 2011-07-10 10:12:05 gewa Exp $
   */
  define("_VALID_PHP", true);
  require_once("init.php");
  
  $catrow = $content->rendertCategories();
  $row = $core->getRowById("categories", $content->cid,'',false);
?>
<?php include("header.php");?>
<!-- Start Category-->
  <?php if(!$row):?>
  <?php $core->msgInfo('<span>!تـوجـه</span>..صفحـه مورد نظـر شمـا يافـت نشـد<br />. لطفـا آدرس وارد شـده را بررسی نمـوده و يا به صفحـه اصـلـی رفتـه و دوبـاره سعی نمائيـد',false);?>
  <?php else:?>
  <h2><span><a href="<?php echo SITEURL; ?>/rss.php?cid=<?php echo $row['id'];?>"><img src="<?php echo SITEURL; ?>/images/rss.png" alt="" class="tooltip" title="Rss"/></a></span><em> <?php echo $row['name'];?> &lt; مـرور دستـه بنـدی </em></h2>
  <?php if($row['description']):?>
  <p><?php echo cleanOut($row['description']);?></p>
  <hr />
  <?php endif;?>
  <div id="catlist">
    <div class="leftblock">
      <?php include( BASEPATH . "plugins/cart.php");?>
      <?php include( BASEPATH . "plugins/popular.php");?>
      <?php include( BASEPATH . "plugins/advert.php");?>
    </div>
    <div class="rightblock">
      <div id="catview">
      <?php if(!$catrow):?>
       <div class="msgAlert"><span>!تـوجـه</span>. با عرض پوزش، هیـچ محصـولی در این دستـه وجـود نـدارد</div>
      <?php else:?>
        <?php foreach($catrow as $crow):?>
        <div class="catview-wrap" id="list_<?php echo $crow['pid'];?>">
          <?php $thumb = ($crow['thumb']) ? PRODIMGURL . 'thumbs/' . $crow['thumb'] : UPLOADURL . 'blank.png';?>
          <?php $url = ($core->seo) ? $core->site_url . '/view-item/' . intval($crow['pid']) . '/' . sanitize($crow['slug']) . '.html' : $core->site_url . '/item.php?pid=' . intval($crow['pid']);?>
          <?php $status = ($crow['price'] == 0) ? '<a href="'.SITEURL.'/download.php?fid='.$crow['pid'].'" class="download-small">دانـلــود</a>' : '<a href="javascript:void(0);" class="add-to-cart" id="item_'.$crow['pid'].'">اضـافـه بـه سبـد خـریـد</a>';?>
          <div class="toolbar">
            <ul>
              <li class="addcart"><?php echo $status;?></li>
              <li><img src="<?php echo SITEURL; ?>/images/calendar.png" alt="" class="tooltip" title="ایـجـاد شـده"/><?php echo $crow['cdate'];?></li>
              <li><img src="<?php echo SITEURL; ?>/images/hits.png" alt="" class="tooltip" title="بـازدیـد شـده"/><?php echo $crow['hits'];?></li>
              <li><img src="<?php echo SITEURL; ?>/images/rate.png" alt="" class="tooltip" title="امتیـاز"/><?php echo $crow['rating'];?></li>
              <li><img src="<?php echo SITEURL; ?>/images/comment-gray.png" alt="" class="tooltip" title="نظـرات"/><?php echo $crow['comments'];?></li>
              <?php if($crow['audio']):?>
              <li><img src="<?php echo SITEURL; ?>/images/audio-gray.png" alt="" class="tooltip" title="پیـش نمـایـش صـوتی"/>a</li>
              <?php endif;?>
              <li><img src="<?php echo SITEURL; ?>/images/dollar-gray.png" alt="" /><?php echo $core->formatMoney($crow['price']);?></li>
            </ul>
            <br clear="right" />
          </div>
          <span class="thumb flright"><a href="<?php echo $url;?>" class="tooltip" title="<?php echo $crow['title'];?>"><img src="<?php echo $thumb;?>" alt=""/></a></span>
          <div class="description">
            <h1><a href="<?php echo $url;?>"><?php echo sanitize($crow['title']);?></a></h1>
            <?php echo sanitize(cleanOut($crow['description']),350);?> <span class="readmore"><a href="<?php echo $url;?>" class="read-more">ادامـه مطلـب</a></span> </div>
          <br clear="right" />
          <div class="ruler"></div>
        </div>
        <?php endforeach;?>
        <?php endif;?>
        <div class="clear"></div>
      </div>
    </div>
    <div class="clear"></div>
    <?php if($pager->items_total >= $pager->items_per_page):?>
    <div class="pagination"><span class="inner"><?php echo $pager->display_pages();?></span></div>
    <?php endif;?>
  </div>
  <?php endif;?>
<!-- End Content/-->
<?php include("footer.php");?>