* Copyright (C) 2007-2008 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. */ /** * \file htdocs/lib/treeview.lib.php * \ingroup core * \brief Libraries for tree views * \version $Id$ */ /** * Show picto of a tree view * * @param unknown_type $tab Array of entries in correct order * @param unknown_type $key Key of value */ function tree_showpad(&$tab,$key) { $pos=1; while ($pos <= $tab[$key]['level'] && $tab[$key]['level'] > 0) { // Process picto for column $pos // \TODO If at least one of this level $atleastonofthislevelafter=1; if ($atleastonofthislevelafter) { if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif'); else print img_picto_common('','treemenu/line.gif'); } else { if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branchbottom.gif'); else print img_picto_common('','treemenu/linebottom.gif'); } $pos++; } } // ------------------------------- Used by enu editor ----------------- /** * \brief Ad javascript tree functions */ function tree_addjs() { print ''; } /* cette fonction gère le décallage des éléments suivant leur position dans l'arborescence */ function tree_showline($tab,$rang) { global $conf, $rangLast, $idLast, $menu_handler; if ($conf->use_javascript_ajax) { if($rang == $rangLast) { print ''; //print 'aa'; } elseif($rang > $rangLast) { print '
  • '; echo "\n"; } } } else { if($rang > $rangLast) { print '
  • '; echo "\n"; } } } print '
  • '; // Content of line print ''.$tab[2].''; print ''; print ''; print ''; print ''; print '
  • '; echo "\n"; $rangLast = $rang; $idLast = $tab[0]; } /*fonction récursive d'affichage de l'arbre $tab :tableau des éléments $pere :index de l'élément courant $rang :décallage de l'élément */ function tree_recur($tab,$pere,$rang) { if ($pere == 0) print '