# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Kategorienliste
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
sub topcat {
$sektionstitel = "Verwaltung der Shopmenütopkategorien";
&Headerout;
print &tparser("$cgipfad/templates/user/header.html");
print &tparser("$cgipfad/templates/user/contentkopf.html");
print qq~
~;
# mid, shopid, mtitel, tid, rf, aktiv
my $shopmenues = $prefix . "shopmenues";
my $shopmenuessub = $prefix . "shopmenues";
$menutopquery = "SELECT a.mid, a.shopid, a.mtitel, a.tid, a.rf, a.aktiv, COUNT(b.tid) AS total
FROM $shopmenues a
LEFT JOIN $shopmenuessub b
ON 'a.mid' = b.tid
WHERE a.shopid = '$usersid' AND a.tid = '0'
GROUP BY a.mid
ORDER BY a.rf ASC";
my $sth = $dbh->prepare($menutopquery);
my $success = $sth->execute or die DBI->errstr;
$summe = $success eq "0E0" ? 0 : $success;
$stcount = 0;
while (my @inhalt = $sth->fetchrow_array()){
if ($stcount != 0) {
$linkoutup = "
";
} else {
$linkoutup = "
";
}
if ($stcount != ($summe-1)) {
$linkoutdown = "
";
} else {
$linkoutdown = "
";
}
$cssclass = $cssclass eq "innenh" ? "innenh2" : "innenh";
$aktiv_or_not = $inhalt[5] == 0 ? "•" : "•";
$trout .=qq~
$linkoutup |
$linkoutdown |
 |
$aktiv_or_not $inhalt[2] [$inhalt[6]] Neue Subkategorie erstellen |
![Kategorie $inhalt[2] mit allen Daten löschen Kategorie $inhalt[2] mit allen Daten löschen]($htmlverz/misc/sdel.gif) |
![Kategorie $inhalt[2] Content anlegen Kategorie $inhalt[2] Content anlegen]($htmlverz/misc/sedit.gif) |
~;
$stcount++;
}
$trout = getcategories(0, 0);
print qq~
Kategorien: Symbol klicken um Kategorien zu bearbeiten. |
• » Topkategorien neu zählen « Nur nötig wenn sich die Topkategorien nicht ordnen lassen, z.B. nach Löschaktionen |
Legende: • Kategorie deaktiviert • Kategorie aktiv - [n] = Anzahl Artikel |
~;
print $trout;
print &tparser("$cgipfad/templates/user/contentfuss.html");
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Kategorien mit angegebener ParentKategorie ausgeben (Rekursiv)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
sub getcategories
{
my $shopmenues = $prefix . "shopmenues";
my $shopmenuessub = $prefix . "shopmenues";
$menutopquery = "SELECT a.mid, a.shopid, a.mtitel, a.tid, a.rf, a.aktiv AS total
FROM $shopmenues a
WHERE a.shopid = '$usersid' AND a.tid = '".@_[0]."'
ORDER BY a.rf ASC";
my $sth = $dbh->prepare($menutopquery);
my $success = $sth->execute or die DBI->errstr;
my $count = 0;
my $tree = "";
if (@_[1] == 0)
{
$tree .= "";
}
while (my @inhalt = $sth->fetchrow_array())
{
my $artnrsql = "SELECT COUNT(*) AS number FROM ".$prefix."artikel WHERE subkat='$inhalt[0]'";
my $artnrsth = $dbh->prepare($artnrsql);
$artnrsth->execute or die DBI->errstr;
my @artcount = $artnrsth->fetchrow_array();
$aktiv_or_not = $inhalt[5] == 0 ? "•" : "•";
if (@_[1] == 0)
{
if ($count % 2 == 0)
{
$tree .= "";
}
else
{
$tree .= " |
";
}
#$tree .= "";
}
elsif (@_[1] == 1)
{
#$tree .= " ";
}
else
{
#$tree .= " ";
$tree .= ' ';
$tree .= ' ';
$tree .= getcategories($inhalt[0], @_[1]+1);
if (@_[1] == 0)
{
$tree .= " |
";
}
$count++;
}
if (@_[1] == 0)
{
$tree .= "
";
}
return $tree;
}