{include file="$template_path/html/header.html"}
</head>
<body class="">
{include file="$template_path/html/user-header-self.html"}

<div class="space-items clear bg-lgray b-b" id="items">
  <div class="container">
    <div class="row">
      <div class="container m-b-md text-center">
        <ul class="nav navbar-nav space-nav ">
          {include file="$template_path/users/tabsy.html"}
        </ul>

      </div>
    </div>
  </div>
</div>

<section class="clearfix">
  <div class="container pos-rlt p-t-md m-t-sm m-b-lg m-xs-t-none m-xs-b-none">



      {$errorMessage}
    {if $items}
    <div class="m-b-lg m-xs-b h3">
      <span class="font-thin h3-xs text-black">我已购买的作品</span>
      <span class="badge bg-danger lt v-middle">{$smarty.session.user.buy}</span>
    </div>
    {else}
    {/if}
    {if $items}
    <div class="row">
      {foreach from=$items item=i name=foo}
      <div class="col-xs-6 col-sm-6 col-md-3 ">
        <section class="panel mb-col no-radius no-shadow">
          <div class="panel-body no-padder">
            <div class="img-container fx-img-rotate-l">
              <img class="img-responsive" src="{$data_server}uploads/items/{$i.id}/{$i.thumbnail}" alt="{$i.name|escape}">
              <div class="img-options">
                <div class="img-options-content">
                  {if isset($ratedItems[$i.id])}
                  {section name=foo start=1 loop=6 step=1}
                  {if $ratedItems[$i.id].rate >= $smarty.section.foo.index}
                  <i class="fa fa-star text-warning fs-20"></i>
                  {else}
                  <i class="fa fa-star-o text-white-only fs-20"></i>
                  {/if}
                  {/section}
                  {else}
                  <div id="stars_div_{$i.id}" class="stars" data-star-set-id="{$i.id}_star" data-rating="0">
                    {section name=foo start=1 loop=6 step=1}
                    <a href="/{$languageURL}users/downloads/{$i.id}?rating={$smarty.section.foo.index}" data-method="post" data-remote="true" rel="nofollow">
                      <img alt="{$smarty.section.foo.index}" id="{$i.id}_star_{$smarty.section.foo.index}" src="{$template_data}img/custom/star-off.png">
                    </a>
                    {/section}
                  </div>
                  {/if}
                </div>
                {literal}
                <script>
                  seajs.use(["modules/rating"], function(rating){
                    rating.init("stars_div_{/literal}{$i.id}{literal}");
                  });
                </script>
                {/literal}
              </div>
            </div>
            <div class="cate-bg cates-2">
              <form id="download{$i.id}" action="/{$languageURL}download/{$i.id}" method="post">
                <input type="hidden" name="download" id="download" value="regular" />
                <a href="javascript:;" onclick="document.getElementById('download{$i.id}').submit();"><span class="cate-text">点我下载</span></a>
              </form>
            </div>
          </div>
          <div class="panel-footer pos-rlt bg-white-only panel-shadow no-radius">
            <div class="ss-underline">
              <a href="/{$languageURL}users/downloads/{$i.id}/?certificate">
                许可文件下载
              </a>
            </div>
            <div class="clearfix">
              <div class="datetime m-r-sm pull-left hidden-xs">
                <span class="date">{$i.price|escape}</span>
                <span class="month">￥</span>
              </div>
              <h4 class="m-t-none m-b-none-xs"><a href="/{$languageURL}items/{$i.id}" class="height-h4">{$i.name|escape}</a></h4>
            </div>

            <a href="/{$languageURL}user/{$userss[$i.user_id].username}" class="panel-thumb hidden-xs" data-toggle="tooltip" data-placement="bottom" data-original-title="{$userss[$i.user_id].nickname}">
              {if $userss[$i.user_id].avatar != ''}
              <img alt="{$userss[$i.user_id].nickname}" class="img-circle" src="{$data_server}uploads/users/{$i.user_id}/A_{$userss[$i.user_id].avatar}" />
              {else}
              <img alt="{$userss[$i.user_id].nickname}" class="img-circle" src="{$data_server}home/default/img/default-user.jpg" />
              {/if}
            </a>

          </div>
        </section>
      </div>
      {/foreach}

    </div>

    {else}
    <div class="row">
      <div class="col-xs-12 text-center">
        <section class="panel p-t-lg p-b-lg no-shadow no-borders no-bgc">
          <div class="panel-body no-radius">
            <img src="/mbthemes/images/no-buys.png" class="img-full">
          </div>
        </section>
      </div>
    </div>
    {/if}


  </div>
</section>

{include file="$template_path/html/user-footer.html"}
</body>
</html>