<? global $lang; ?>
<fieldset>
  <table class='table_browse' style='margin:0;'>
    <tr>
      <th class='header' style='width:15px;'><?=ucfirst( $lang -> getTrans( 'T_LP' ) );?></th>
      <th class='header' style="width: 150px;"><?=ucfirst( $lang -> getTrans( 'T_TYTUL' ) );?></th>
      <th class='header'><?=ucfirst( $lang -> getTrans( 'T_LINK' ) );?></th>
      <th class='header'><?=ucfirst( $lang -> getTrans( 'T_AKTYWNY' ) );?></th>
      <th class='header' style='width:15px;'></th>
      <th class='header' style='width:15px;'></th>
      <th class='header' style='width:15px;'></th>
      <th class='header' style='width:15px;'></th>
    </tr>
    <?
    $i = 0;
    if ( is_array ( $this -> _banners ) ) foreach ( $this -> _banners as $baner )
    {
      ?>
      <div class="contextMenu" id="menu<?=$i;?>" style="display:none;">
        <ul>
          <li id="open" class="context_menu">
            <a href='index.php?rw=edit&amp;id=<?=$baner['id'];?>' style="display: block; height: 30px; line-height: 30px;">
              <span class='icon edit' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
              <?=$lang -> getTrans( 'T_EDYTUJ' )?>
            </a>
          </li>
          <li id="delete" class="context_menu">
            <a <?=$baner['action'];?> style="display: block; height: 30px; line-height: 30px;">
              <span class='icon delete' style='display: block; float: left; margin: 5px 5px 0 0;'></span>
              <?=$lang -> getTrans( 'T_USUN' );?>
            </a>
          </li>
          <?
          if ( $baner['down'] )
          {
            ?>
            <li id="show" class="context_menu">
              <a href="index.php?rw=down&amp;id=<?=$baner['id'];?>" style="display: block; height: 30px; line-height: 30px;">
                <div class='icon down_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
                <?=$lang -> getTrans( 'T_W_DOL' );?>
              </a>
            </li>
            <?
          }
          if ( $baner['up'] )
          {
            ?>
            <li id="show" class="context_menu">
              <a href="index.php?rw=up&amp;id=<?=$baner['id'];?>" style="display: block; height: 30px; line-height: 30px;">
                <div class='icon up_main' style='display: block; float: left; margin: 5px 5px 0 0;'></div>
                <?=$lang -> getTrans( 'T_W_GORE' );?>
              </a>
            </li>
            <?
          }
          ?>
        </ul>
      </div>
      <script type='text/javascript'>
        $(document).ready(function(){
          $('.menu<?=$i;?>').contextMenu('menu<?=$i;?>', {
          itemStyle: {
            backgroundColor: '#E5E5E5',
            width: '120px',
          },
          itemHoverStyle: {
            backgroundColor: '#FFFFFF',
            border: '1px solid #FFFFF',
          }
          });
        });
      </script>
      <tr class="menu<?=$i;?>">
        <td class='row'><?=$baner['lp'];?>.</td>
        <td class='row'><?=$baner['title'];?></td>
        <td class='row'><? echo mb_substr( $baner['link'] , 0 , 50 ); if ( strlen( $baner['link'] ) > 50 ) echo '...';?></td>
        <td class='row'><?=$baner['enabled'];?></td>
        <td class='row'>
        <?
          if ( $baner['down'] )
          {
            ?><div class='icon down_main' onClick='document.location.href="index.php?rw=down&amp;id=<?=$baner['id'];?>";'></div><?
          }
        ?>
        </td>
        <td class='row' style='text-align:center;'>
        <?
          if ( $baner['up'] )
          {
            ?><div class='icon up_main' onClick='document.location.href="index.php?rw=up&amp;id=<?=$baner['id'];?>";'></div><?
          }
          ?>
        </td>
        <td class='row' style='text-align:center;'>
          <a href='index.php?rw=edit&amp;id=<?=$baner['id'];?>'><span class='icon edit' style='display:block;'></span></a>
        </td>
        <td class='row'><a <?=$baner['action'];?>><span class='icon delete' style='display:block;'></span></a></td>
      </tr>
      <?
      $i++;
    }
    else
    {
      ?><tr><td colspan='8'><div class='alert' style='text-align:center;'><?=$lang -> getTrans( 'T_BRAK_WYNIKOW' );?></div></td></tr><?
    }
    ?>
  </table>
  <? include 'site-paging.php'; ?>
</fieldset>
<script type='text/javascript'>
  $(document).ready(function(){
    var cssObj = {
      'display' : 'block',
      'height' : '30px',
      'line-height' : '30px',
      'color' : '#000000',
      'font-size' : '10px',
      'padding-left' : '5px',
      'text-transform' : 'uppercase'
    }
    $("li.context_menu").children("a").css( cssObj );
    var cssObj2 = {
      'float' : 'left',
      'margin' : '5px 5px 0 0',
      'color' : '#000000',
      'font-size' : '10px',
      'padding-left' : '5px',
      'text-transform' : 'uppercase'
    }
    $("li.context_menu").children("a").children("span.edit").css( cssObj2 );
    $("li.context_menu").children("a").children("span.delete").css( cssObj2 );
    $("li.context_menu").children("a").children("span.show").css( cssObj2 );
    $("li.context_menu").children("a").children("div.down_main").css( cssObj2 );
    $("li.context_menu").children("a").children("div.up_main").css( cssObj2 );
  });
 </script>