<?php

include_once('../global.php');

class NewsRSSChannelPage extends Page
{
  var $FullTitle = 'Sestavéní RSS kanálu';
  var $ShortTitle = 'RSS kanál';	
	
  function Show()
  {	
    if(array_key_exists('build', $_GET))
    {
      $Select = '';
      foreach($_POST as $Index => $Item)
      {
        if(substr($Index, 0, 8) == 'category') $Select .= '-'.substr($Index, 8);
      }
      $Select = $this->System->Config['Web']['RootFolder'].'/aktuality/rss.php?select='.substr($Select, 1);
      $Output = 'Výsledný RSS kanál: <a href="'.$Select.'">'.$Select.'</a>';
    } else 
    {
      $Output = 'Vytvořte si vlastní RSS kanál, díky kterému budete moci automaticky sledovat novinky pomocí vaší RSS čtečky. Informace o technologii RSS a programech pro čtení kanálů najdete např. <a href="http://www.lupa.cz/clanky/prehled-rss-ctecek/">zde</a><br />'.
      '<br />Kategorie:<br />';
      $Output .= '<form action="subscription.php?build=1" method="post">';
      $DbResult = $this->Database->select('NewsCategory', '*', '1 ORDER BY Caption');
      while($Category = $DbResult->fetch_array())
      {
        $Output .= '<input type="checkbox" name="category'.$Category['Id'].'" />'.$Category['Caption'].'<br />';
      }
      $Output.= '<input type="submit" value="Sestavit " />'.
        '</form>';
    }  
    return($Output);
  }
}

$System->AddModule(new NewsRSSChannelPage());
$System->Modules['NewsRSSChannelPage']->GetOutput();

?>
