require_once('../lib/main-class.php');
function list_rss_rubrika($id_box, $id_rubrika = 0, $ret = false)
{
global $db;
$sql = 'SELECT
'.DB_PREFIX.'rubrika.id_rubrika,
'.DB_PREFIX.'rubrika.nazev,
'.DB_PREFIX.'rubrika.rss
FROM '.DB_PREFIX.'rubrika
WHERE '.DB_PREFIX.'rubrika.box_id = '.$id_box.'
AND '.DB_PREFIX.'rubrika.active_state = 1
AND '.DB_PREFIX.'rubrika.rubrika_id = '.$id_rubrika.'
ORDER BY '.DB_PREFIX.'rubrika.priorita DESC';
if($res = $db->get_results($sql))
{
$ret .= '
';
foreach($res as $rubrika)
{
if($rubrika->rss)
{
$ret .= '- '.$rubrika->nazev.'';
}
else
{
$ret .= '
- '.$rubrika->nazev.'';
};
$ret = list_rss_rubrika($id_box, $rubrika->id_rubrika, $ret);
$ret .= '
'."\n";
};
$ret .= '
'."\n";
};
return $ret;
};
$params = array('title' => 'RSS', 'drobky' => 'RSS', 'hiearchie' => '{0}');
$html = new html($params);
$html->head();
echo ''."\n";
$sql = 'SELECT
'.DB_PREFIX.'box.id_box,
'.DB_PREFIX.'box.typ,
'.DB_PREFIX.'box.nazev,
'.DB_PREFIX.'box.rss
FROM '.DB_PREFIX.'box
WHERE '.DB_PREFIX.'box.active_state = 1
AND '.DB_PREFIX.'box.typ IN (1,2)
ORDER BY '.DB_PREFIX.'box.priorita DESC';
if($result = $db->get_results($sql))
{
echo ''."\n";
echo '- Novinky z portálu '.WEB_NAME.'
'."\n";
foreach($result as $box)
{
switch($box->typ)
{
case 1: // rss clanku v rubrikach
echo '- '.$box->nazev.'';
echo list_rss_rubrika($box->id_box);
echo '
'."\n";
break;
case 2: // rss clanku v boxu
if($box->rss)
{
echo '- '.$box->nazev.'
'."\n";
};
break;
};
};
echo '
'."\n";
};
$html->foot();
?>