<?php

function bara_navigare($id_meniu = 0)
{
}

function meniu_sus()
{
    global $scriptroot;
    echo "<p>Conținut site<p>";
    echo "<ul>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=articole'>Articole</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=meniu'>Meniu</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=stiri_medicale'>Știri medicale</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=stiri_it'>Știri IT</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=testimoniale'>Testimoniale</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=optiuni'>Opțiuni site</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=imagini'>Imagini</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=capturi'>Capturi ecran</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=utilizatori'>Utilizatori</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=newsletter'>Abonați newsletter</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=deconectare'>Deconectare</a></li>";
    echo "</ul>";
    echo "<p>Contabilitate<p>";
    echo "<ul>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=produse'>Produse</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=pachete'>Pachete la vânzare</a></li>";
    echo "<li><a href='{$scriptroot}admin/index.php?pagina=comenzi'>Comenzi</a></li>";
    echo "</ul>";
}

function meniu_stanga(&$id_meniu = 0)
{
    global $id_articol, $imagine_meniu;
    $q = mysql_query("SELECT * FROM meniu WHERE id = $id_meniu");
    if ($r = mysql_fetch_assoc($q))
    {
        $mainmenu = ((int)($r['id_parinte']) == 0);
        if (!$mainmenu) $id_parinte = $r['id_parinte'];
                   else $id_parinte = $id_meniu;
    }
    else
    {
        $mainmenu = true;
        $id_parinte = 0;
    }
    $q = mysql_query("SELECT * FROM meniu WHERE meniu = 1 AND id_parinte = $id_parinte ORDER BY nrcrt");
    if (mysql_num_rows($q))
    {
	    echo "<ul>";
    	while ($r = mysql_fetch_assoc($q))
    	{
        	echo "<li><a href='index.php?id_meniu={$r['id']}'";
        	if ($mainmenu)
            {
                echo " class='selectat'";
                $mainmenu = false;
                $id_meniu = $r['id'];
                if ($r['imagine']) $imagine_meniu = $r['imagine'];
            }
            elseif ($r['id'] == $id_meniu)
            {
                echo " class='selectat'";
                if ($r['imagine']) $imagine_meniu = $r['imagine'];
            } 
        	echo ">{$r['denumire']}</a></li>";
        }
	    echo "</ul>";
    }
    else
    {
		echo "<a href='index.php?id_meniu=31' class='link_noutati'>&nbsp;</a>";
	}
}

function linkuri_stanga()
{
    echo "<ul>";
    $q = mysql_query("SELECT * FROM meniu WHERE meniu = 2 ORDER BY nrcrt");
    while ($r = mysql_fetch_assoc($q))
    {
        if (!$r['fundal']) $r['fundal'] = '000000';
        echo "<li style='background-color: #{$r['fundal']}'>";
        if ($r['link']) 
            echo "<a href='{$r['link']}' target='_blank'>{$r['denumire']}</a></li>";
        else
        {
            echo "<a href='index.php?";
            if ($r['id_meniu']) echo "id_meniu={$r['id_meniu']}";
            elseif ($r['id_articol']) echo "id_articol={$r['id_articol']}";
            elseif ($r['id_modul']) echo "id_modul={$r['id_modul']}";
            echo "'>{$r['denumire']}</a></li>";
        }
    }
    echo "</ul>";
}

function linkuri_dreapta()
{
    echo "<ul>";
    $q = mysql_query("SELECT * FROM meniu WHERE meniu = 3 ORDER BY nrcrt");
    while ($r = mysql_fetch_assoc($q))
    {
        echo "<li style='background-image: url(imagini/{$r['imagine']})'>";
        if ($r['link']) 
            echo "<a href='{$r['link']}' target='_blank'>{$r['denumire']}</a>";
        else
        {
            echo "<a href='index.php?";
            if ($r['id_meniu']) echo "id_meniu={$r['id_meniu']}";
            elseif ($r['id_articol']) echo "id_articol={$r['id_articol']}";
            elseif ($r['id_modul']) echo "id_modul={$r['id_modul']}";
            echo "'>{$r['denumire']}</a></li>";
        }
    }
    echo "</ul>";
}

function linkuri_jos($id_meniu = 0)
{
    global $scriptroot;
    echo "<p>";
    $q = mysql_query("SELECT * FROM meniu WHERE meniu = 1 AND (id_parinte = 0 OR id_parinte IS NULL) ORDER BY nrcrt");
    $i = 1;
    while ($r = mysql_fetch_assoc($q))
    {
        if ($r['link']) 
            echo "<a href='{$r['link']}' target='_blank'>{$r['denumire']}</a>";
        else
            echo "<a href='{$scriptroot}index.php?id_meniu={$r['id']}'>{$r['denumire']}</a>";
        if ($i < mysql_num_rows($q)) echo '|';
        $i++;
    }
    echo "</p>";
    $q = mysql_query("SELECT * FROM meniu WHERE id = $id_meniu");
    if ($r = mysql_fetch_assoc($q))
    {
        $mainmenu = ((int)($r['id_parinte']) == 0);
        if (!$mainmenu) $id_parinte = $r['id_parinte'];
                   else $id_parinte = $id_meniu;
    }
    else
    {
        $mainmenu = true;
        $id_parinte = 0;
    }
    $q = mysql_query("SELECT * FROM meniu WHERE meniu = 1 AND id_parinte = $id_parinte ORDER BY nrcrt");
    if (mysql_num_rows($q))
    {
	    echo "<p>";
    	$i = 1;
    	while ($r = mysql_fetch_assoc($q))
    	{
            if ($r['link']) 
                echo "<a href='{$r['link']}' target='_blank'>{$r['denumire']}</a>";
            else
                echo "<a href='{$scriptroot}index.php?id_meniu={$r['id']}'>{$r['denumire']}</a></li>";
        	if ($i < mysql_num_rows($q)) echo '|';
        	$i++;
        }
	    echo "</p>";
    }
    echo "<p>";
    $q = mysql_query("SELECT * FROM meniu WHERE meniu = 2 ORDER BY nrcrt");
    $i = 1;
    while ($r = mysql_fetch_assoc($q))
    {
        if ($r['link']) 
            echo "<a href='{$r['link']}' target='_blank'>{$r['denumire']}</a></li>";
        else
        {
            echo "<a href='{$scriptroot}index.php?";
            if ($r['id_meniu']) echo "id_meniu={$r['id_meniu']}";
            elseif ($r['id_articol']) echo "id_articol={$r['id_articol']}";
            elseif ($r['id_modul']) echo "id_modul={$r['id_modul']}";
            echo "'>{$r['denumire']}</a></li>";
        }
      	if ($i < mysql_num_rows($q)) echo '|';
      	$i++;
    }
    echo "</p>";
}

?>