<? global $lang;?>
<?
$text = $this -> article['language']['text'];
$text = \front\Views\Articles::generateHeadersIds( $text );
?>
<div class="article">
  <?
    $this -> article['language']['seo_link'] ? $url = $this -> article['language']['seo_link'] : $url = 'a-' . $this -> article['id'] . '-' . \Shared\Helpers\Helpers::seo( $this -> article['language']['title'] );

    if ( $this -> article['show_title'] )
      echo '<h2 class="article-title">' . $this -> article['language']['title'] . '</h2>';

    if ( $this -> article['show_date_add'] )
      echo '<div class="date-add">Data publikacji: <b>' . date( 'd.m.Y', strtotime( $this -> article['date_add'] ) ) . '</b></div>';

  ?>
  <? if ( $this -> article['repeat_entry'] ):?>
    <div class="entry">
      <?= $this -> article['language']['entry'];?>
    </div>
  <? endif;?>
  <? if ( $this -> article['show_table_of_contents'] ):?>
    <? if ( $this -> article['language']['table_of_contents'] ):?>
      <div class="table-of-contents">
        <div class="title">
          <?= \Shared\Helpers\Helpers::lang( 'spis-tresci' );?>
        </div>
        <?= $this -> article['language']['table_of_contents'];?>
      </div>
    <? else:?>
      <div class="table-of-contents">
        <div class="title">
          <?= \Shared\Helpers\Helpers::lang( 'spis-tresci' );?>
        </div>
        <?= \front\Views\Articles::generateTableOfContents( $text );?>
      </div>
    <? endif;?>
  <? endif;?>
  <div class="text">
    <?= $text;?>
  </div>
  <?
    if ( is_array( $this -> article['images'] ) ):
      ?>
        <div class="gallery">
          <?
            foreach ( $this -> article['images'] as $img ):
              ?>
                <a rel="article-<?= $this -> article['id'];?>" href="<?= $img['src'];?>" title="">
                  <div style="background: url( '/libraries/thumb.php?img=<?= $img['src'];?>&w=250&h=250' ) no-repeat center;"></div>
                </a>
              <?
            endforeach;
          ?>
        </div>
      <?
    endif;

    if ( is_array( $this -> article['files'] ) ):
      ?>
        <ul class="files">
          <?
            foreach ( $this -> article['files'] as $file ):
              ?>
                <li>
                  <a href="/download.php?file=<?= $file['id'];?>&hash=<?= md5( $file['src'] );?>" title="<?= $file['name'];?>" target="_blank">
                    <?
                      if ( $file['name'] )
                        echo $file['name'];
                      else
                      {
                        $name = explode( '/', $file['src'] );
                        echo $name[ count( $name ) - 1 ];
                      }
                    ?>
                  </a>
                </li>
              <?
            endforeach;
          ?>
        </ul>
      <?
    endif;

    if ( $this -> article['social_icons'] ):
      ?>
      <div class="social-icons">
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <div class="title"><?= ucfirst( \Shared\Helpers\Helpers::lang( 'podziel-sie-z-innymi' ) );?></div>
        <div class="content">
          <a class="fb" href="http://www.facebook.com/sharer.php?u=http://www.<?= $_SERVER['SERVER_NAME'];?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" title="facebook" target="_blank" rel="nofollow">
            <img src="/images/system/logo-facebook.jpg" alt="facebook" />
          </a>
          <a class="pinterest" href="http://pinterest.com/pin/create/button/?url=http://www.<?= $_SERVER['SERVER_NAME'];?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" title="pinterest" target="_blank" rel="nofollow">
            <img src="/images/system/logo-pinterest.jpg" alt="pinterest" />
          </a>
          <a class="twitter" href="http://twitter.com/share?url=http://www.<?= $_SERVER['SERVER_NAME'];?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=600');return false;" title="twitter" target="_blank" rel="nofollow">
            <img src="/images/system/logo-twitter.jpg" alt="twitter" />
          </a>
          <a class="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.<?= $_SERVER['SERVER_NAME'];?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=850');return false;" title="linked in" target="_blank" rel="nofollow">
            <img src="/images/system/logo-linkedin.jpg" alt="linkedin" />
          </a>
          <a class="gp" href="https://plus.google.com/share?url=http://www.<?= $_SERVER['SERVER_NAME'];?>/<?= $url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" title="google+" target="_blank" rel="nofollow">
            <img src="/images/system/logo-google.jpg" alt="google+" />
          </a>
        </div>
      </div>
      <?
    endif;
  ?>
  <a href="javascript:history.go(-1);" class="btn btn-success btn-back"><span class="text"><?= $lang['wstecz'];?></span></a>
</div>
<link class="footer" href="/libraries/fancyBox/jquery.fancybox.css" rel="stylesheet" type="text/css">
<link class="footer" href="/libraries/fancyBox/helpers/jquery.fancybox-buttons.css" rel="stylesheet" type="text/css">
<script class="footer" type="text/javascript" src="/libraries/fancyBox/jquery.fancybox.js"></script>
<script class="footer" type="text/javascript" src="/libraries/fancyBox/helpers/jquery.fancybox-buttons.js"></script>
<script class="footer" type="text/javascript">
  $( document ).ready(function()
  {
    $( ".gallery a" ).fancybox({
      closeBtn		: false,
      helpers		: {
        buttons	: {}
      }
    });
  });
</script>