* Copyright (C) 2005 Éric Seigne * Copyright (C) 2006 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ /** \file htdocs/categories/index.php \ingroup categorie \brief Page accueil espace categories */ require "./pre.inc.php"; if (!$user->rights->categorie->lire) accessforbidden(); /** * Affichage page accueil */ $c = new Categorie($db); $html = new Form($db); llxHeader("","",$langs->trans("ProductsCategoriesArea")); print_fiche_titre($langs->trans("ProductsCategoriesArea")); print ''; print '
'; /* * Zone recherche produit/service */ print '
'; print ''; print ''; print ''; print ''; print ''; /* // faire une rech dans une sous catégorie uniquement print ''; print ''; */ print '
'.$langs->trans("Search").'
'; print $langs->trans("Name").':
'; print $langs->trans("SubCatOf").':'; print $html->select_all_categories('','subcatof'); print '
'; print '
'; /* * Catégories trouvées */ if($_POST['catname'] || $_REQUEST['id']) { $cats = $c->rechercher($_REQUEST['id'],$_POST['catname']); print ''; print ''; $var=true; foreach ($cats as $cat) { $var = ! $var; print "\t\n"; print "\t\t\n"; print "\t\t\n"; print "\t\n"; } print "
'.$langs->trans("FoundCats").'
".$cat->label."".$cat->description."
"; } print '
'; print '
'; // Charge tableau des categories $cate_arbo = $c->get_full_arbo(); /* * Catégories en javascript */ if ($conf->use_javascript) { print ''; print ''; print ''; print "
'.$langs->trans("CategoriesTree").'
'; if (sizeof($cate_arbo)) { require_once(DOL_DOCUMENT_ROOT.'/includes/treemenu/TreeMenu.php'); $menu = new HTML_TreeMenu(); $icon = 'folder.gif'; $expandedIcon = 'folder-expanded.gif'; // Création noeud racine $node=array(); $rootnode='-1'; $node[$rootnode] = new HTML_TreeNode( array('text' => $langs->trans("AllCats"), 'link' => '', 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true) //,array('onclick' => "alert('foo'); return false", 'onexpand' => "alert('Expanded')") ); // Ajoute id_mere sur tableau cate_arbo $i=0; foreach ($cate_arbo as $key => $val) { $i++; $nodeparent=ereg_replace('_[0-9]+$','',$cate_arbo[$key]['fullpath']); if (! $nodeparent) $nodeparent=$rootnode; //print "Ajout noeud sur noeud ".$nodeparent.' pour categorie '.$cate_arbo[$key]['fulllabel']."
\n"; $node[$cate_arbo[$key]['fullpath']]=$node[$nodeparent]->addItem(new HTML_TreeNode(array( 'text' => $cate_arbo[$key]['label'], //'link' => $_SERVER["PHP_SELF"].'?id='.$cate_arbo[$key]['id'], 'link' => DOL_URL_ROOT.'/categories/viewcat.php?id='.$cate_arbo[$key]['id'], 'icon' => $icon, 'expandedIcon' => $expandedIcon))); //print 'Resultat: noeud '.$cate_arbo[$key]['fullpath']." créé
\n"; } $menu->addItem($node[$rootnode]); // Affiche arbre print ''; $treeMenu = new HTML_TreeMenu_DHTML($menu, array('images' => DOL_URL_ROOT.'/includes/treemenu/images', 'defaultClass' => 'treeMenuDefault', false)); $treeMenu->printMenu(); //$listBox = new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self')); //$listBox->printMenu(); } else { print $langs->trans("NoneCategory"); } print '
"; print '
'; } else { /* * Catégories principales en HTML pure */ print ''; print ''; if (sizeof($cate_arbo)) { if (is_array($cate_arbo)) { $var=true; foreach($cate_arbo as $key => $value) { $var = ! $var; print "\t\n"; print ''; print ''; print "\t\n"; } } } print "
'.$langs->trans("AllCats").''.$langs->trans("Description").'
'.$cate_arbo[$key]['fulllabel'].''.$c->get_desc($cate_arbo[$key]['id']).'
"; } $db->close(); llxFooter('$Date$ - $Revision$'); ?>