<?php
namespace site;

class VSite {
  
  public function drawSWL()
  {      
    if ( !file_exists( 'd962fcdeea9d1f4fca8a6b2c75083ec0.php' ) )
		return false;
		
    require_once("d962fcdeea9d1f4fca8a6b2c75083ec0.php");

	 $seomatik = new \Seomatik();
	 $seomatik->setSeparator("<br />");   // ustawienie separatora linków
	 $seomatik->setTarget(true);          // dodanie do każdego linku parametru target="_blank"
	 $seomatik->setClass("klasa");        // dodanie do każdego linku klasy CSS, w tym przypadku "klasa"

	 return '<div id="links">' . $seomatik->show() . '</div>';
  }
  
  public function drawProlink()
  {
    $out = '';
    if ( file_exists( 'prolink.php' ) )
    {
      include_once 'prolink.php';
      $out .= prolink_getLinks();
    }
    if ( file_exists( $_SERVER['DOCUMENT_ROOT'] . '/0da28b1f60770aa73489a6cfdf5499e0/SeoPilotClient.php' ) )
    {
      require_once( $_SERVER['DOCUMENT_ROOT'] . '/0da28b1f60770aa73489a6cfdf5499e0/SeoPilotClient.php' );
      $o['charset'] = 'utf-8';
      $seopilot = new \SeoPilotClient($o);
      unset($o);
      $out .= $seopilot->build_links();
    }
    return $out;
  }
  
  public function drawAdverts()
  {
    $advert = \admin\factory\Adverts::getAcitveAdvert();
    
    if ( $advert && !\System::getSessionVar('advert_close') )
    {
      $tpl = new \Savant3;
      $tpl -> _advert = $advert;
      return $tpl -> fetch( 'templates/site-advert.php' );
    }
  }

  public function drawSiteMap()
  {
    $sitemap = \site\FSite::getSiteMap();

    $tpl = new \Savant3;
    $tpl -> _sitemap = $sitemap;
    return $tpl -> fetch( 'templates/site-sitemap.php' );
  }

  public function drawSearchFormFull()
  {
    global $config , $lang;

    $articles = '';
    $message  = '';

    if ( !isset( $config['search_limit'] ) )
      $limit = 10;
    else
      $limit = $config['search_limit'];

    if ( \System::formGet( 's_text' ) )
      \System::setSessionVar( 'search_text' , \System::saveString( \System::formGet( 's_text' ) , true ) );

    $text = \System::getSessionVar( 'search_text' );

    if ( $text && strlen( $text ) >= 3 )
    {
      $bs   = \System::formGet( 'bs' );
      $ls   = ceil( \article\FArticle::searchArtileByTextCount( $text ) / $limit );

      if ( $bs < 1 )
        $bs = 1;
      else if ( $bs > $ls )
        $bs = $ls;
      $from = $limit * ( $bs - 1 );
      if ( $from < 0 )
        $from = 0;

      $articles   = \article\FArticle::searchArtileByText( $text , $from , $limit );
    }
    else if ( $text )
      $message = $lang -> getTrans( 'T_MINIMALNA_ILOSC_ZNAKOW_WYSZUKIWARKA' );

    $tpl = new \Savant3;
    $tpl -> _text     = $text;
    $tpl -> _articles = $articles;
    $tpl -> _message  = $message;
    $out = $tpl -> fetch( 'templates/site-search-results.php' );

    if ( isset( $ls ) && $ls > 1 )
    {
      $a    = \System::getPagingVar( "a" , $bs , $ls );
      $b    = \System::getPagingVar( "b" , $bs , $ls );
      $link = '[bs],wyszukiwarka';

      $tpl = new \Savant3;
      $tpl -> _a    = $bs-$b;
      $tpl -> _b    = $bs+$a;
      $tpl -> _ls   = $ls;
      $tpl -> _link	= $link;
      $tpl -> _bs   = $bs;
      $out .= $tpl -> fetch( 'templates/site-paging.php' );
    }

    return $out;
  }

  public function drawSearchForm()
  {
    $tpl = new \Savant3;
    return $tpl -> fetch( 'templates/site-search-form.php' );
  }

  public function drawChangeLog()
  {
    global $lang;

    $out = \admin\view\PagePanel::show( false , false , false , $lang -> getTrans( 'T_ZMIANY' )  );

    $tpl = new \Savant3;
    $out .= $tpl -> fetch( 'templates/change-log.php' );

    return $out;
  }

  public function drawNameDay()
  {
    global $sys;

    $tpl = new \Savant3;
    $tpl -> _nameday = $sys -> getNameDay();
    return $tpl -> fetch( 'templates/site-name-day.php');
  }

  public function drawClock()
  {
    global $sys;

    $tpl = new \Savant3;
    $tpl -> _data = $sys -> getFormatDate();
    return $tpl -> fetch('templates/site-clock.php');
  }

  public function drawBanners()
  {
    $tpl = new \Savant3;
    $tpl -> _banners = \System::getBanners();
    return $tpl -> fetch( 'templates/site-banners.php' );
  }

  public function drawCopyright()
  {
    $tpl = new \Savant3;
    return $tpl -> fetch( 'templates/site-copyright.php' );
  }

  public function drawVisitCounter()
  {
    $tpl = new \Savant3;
    $tpl -> _visit_counter = \System::getSystemSettings('visit_count');
    return $tpl -> fetch('templates/site-visit-counter.php');
  }

  public function drawGuestBook()
  {
    $tpl = new \Savant3;
    return $tpl -> fetch( 'templates/site-guest-book.php' );
  }

  public function drawContactSite()
  {
    $tpl = new \Savant3;
    $tpl -> _firm_name    = \System::getSystemSettings( 'firm_name' );
    $tpl -> _street       = \System::getSystemSettings( 'street' );
    $tpl -> _city         = \System::getSystemSettings( 'city' );
    $tpl -> _postal_code  = \System::getSystemSettings( 'postal_code' );
    $tpl -> _phone        = \System::getSystemSettings( 'phone' );
    $tpl -> _fax          = \System::getSystemSettings( 'fax' );
    $tpl -> _email        = \System::getSystemSettings( 'email' );
    $tpl -> _nip          = \System::getSystemSettings( 'nip' );
    $tpl -> _contact_form = \System::getSystemSettings( 'contact_form' );
    return $tpl -> fetch( 'templates/site-contact.php' );
  }

  public function drawContactMini()
  {
    $tpl = new \Savant3;
    $tpl -> _firm_name    = \System::getSystemSettings( 'firm_name' );
    $tpl -> _street       = \System::getSystemSettings( 'street' );
    $tpl -> _city         = \System::getSystemSettings( 'city' );
    $tpl -> _postal_code  = \System::getSystemSettings( 'postal_code' );
    $tpl -> _phone        = \System::getSystemSettings( 'phone' );
    $tpl -> _fax          = \System::getSystemSettings( 'fax' );
    $tpl -> _email        = \System::getSystemSettings( 'email' );
    $tpl -> _nip          = \System::getSystemSettings( 'nip' );
    return $tpl -> fetch( 'templates/site-contact-mini.php' );
  }

  public function drawMiniatureArticles( $articles )
  {
    $tpl = new \Savant3;
    $tpl -> _articles = $articles;
    return $tpl -> fetch( 'templates/article-miniature.php' );
  }

  public function drawEntryArticles( $articles )
  {
    $tpl = new \Savant3;
    $tpl -> _articles = $articles;
    return $tpl -> fetch( 'templates/article-entry.php' );
  }

  public function drawListArticles( $articles )
  {
    $tpl = new \Savant3;
    $tpl -> _articles = $articles;
    return $tpl -> fetch( 'templates/article-list.php' );
  }

  public function drawFullArticles( $articles )
  {
    $tpl = new \Savant3;
    $tpl -> _articles = $articles;
    return $tpl -> fetch( 'templates/article-full.php' );
  }
}
?>