{include file="public/header" /}
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>

<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.adv_index_manage}</h3>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    
    <form method="get" name="formSearch" id="formSearch">
        <table class="search-form">
            <tbody>
                <tr>
                    <th><label for="store_name">{$Think.lang.adv_ap_id}</label></th>
                    <td>
                        <select name="ap_id">
                            <option value="">{$Think.lang.ds_please_choose}...</option>
                            {foreach name="ap_list" item="ap_v"}
                            <option value="{$ap_v.ap_id}" {if condition="$Think.get.ap_id eq $ap_v.ap_id"}selected{/if}>{$ap_v.ap_name}[{$ap_v.ap_width}X{$ap_v.ap_height}]</option>
                            {/foreach}
                        </select>
                    </td>
                    <td>
                        <input type="submit" class="submit" value="搜索">
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    
  <div class="fixed-empty"></div>
  <form method="post" id="store_form">
    <table class="ds-default-table">
      <thead>
        <tr class="thead">
          <th></th>
          <th>{$Think.lang.adv_name}</th>
          <th>{$Think.lang.adv_ap_id}</th>
          <th class="align-center">{$Think.lang.adv_start_time}</th>
          <th class="align-center">{$Think.lang.adv_end_time}</th>
          <th class="align-center">{$Think.lang.ds_handle}</th>
        </tr>
      </thead>
      <tbody>
        <?php if(!empty($adv_info) && is_array($adv_info)){ ?>
        <?php foreach($adv_info as $k => $v){ ?>
        <tr class="hover">
          <td class="w24"><input type="checkbox" class="checkitem" name="del_id[]" value="<?php echo $v['adv_id']; ?>" /></td>
          <td><span title="<?php echo $v['adv_title']; ?>"><?php echo str_cut($v['adv_title'], '36'); ?></span></td>
          <td>
              {foreach name="ap_list" item="ap_v"}
              {if $ap_v.ap_id === $v.ap_id }
              <span title="<?php echo $ap_v['ap_name']; ?>"><?php echo str_cut($ap_v['ap_name'], '22'); ?></span>
              {/if}
              {/foreach}
          </td>
          <td class="align-center nowrap"><?php echo date('Y-m-d',$v['adv_start_date']); ?></td>
          <td class="align-center nowrap"><?php echo date('Y-m-d',$v['adv_end_date']); ?></td>
          <td class="w72 align-center">
              <a href="{:url('/Admin/Adv/adv_edit',['adv_id'=>$v.adv_id])}">{$Think.lang.adv_edit}</a>&nbsp;|&nbsp;
              <a href="javascript:if(confirm('{$Think.lang.ds_ensure_del}'))window.location = '{:url('/Admin/Adv/adv_del',['adv_id'=>$v.adv_id])}';">{$Think.lang.ds_del}</a>
          </td>
        </tr>
        <?php } ?>
        <?php }else { ?>
        <tr class="no_data">
          <td colspan="15">{$ap_name}{$Think.lang.ds_no_record}</td>
        </tr>
        <?php } ?>
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td><input type="checkbox" class="checkall" id="checkall"/></td>
          <td id="batchAction" colspan="15"><span class="all_checkbox">
            <label for="checkall">{$Think.lang.ds_select_all}</label>
            </span>&nbsp;&nbsp;<a href="JavaScript:void(0);" class="btn" onclick="if(confirm('{$Think.lang.adv_del_sure}')){$('#store_form').submit();}"><span>{$Think.lang.ds_del}</span></a>
            </td>
        </tr>
      </tfoot>
    </table>
      <div class="pagination">{$page}</div>
  </form>
</div>