41 while ($pos <= $fulltree[$key][
'level'] && $fulltree[$key][
'level'] > 0)
45 $atleastoneofthislevelafter = 0;
50 foreach ($fulltree as $key2 => $val2)
55 if ($fulltree[$key2][
'level'] > $pos)
58 if (isset($fulltree[$key2][
'cachenbofdoc']) && $fulltree[$key2][
'cachenbofdoc'] > 0) $nbofdocinsub += $fulltree[$key2][
'cachenbofdoc'];
60 if ($fulltree[$key2][
'level'] == $pos)
62 $atleastoneofthislevelafter = 1;
64 if ($fulltree[$key2][
'level'] <= $pos)
78 if ($atleastoneofthislevelafter)
90 return array($atleastoneofthislevelafter, $nbofdirinsub, $nbofdocinsub);
115 function tree_recur($tab, $pere, $rang, $iddivjstree =
'iddivjstree', $donoresetalreadyloaded = 0, $showfk = 0, $moreparam =
'')
117 global $tree_recur_alreadyadded, $menu_handler_to_search;
119 if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded = array();
124 print '<script type="text/javascript" language="javascript">
125 $(document).ready(function(){
126 $("#'.$iddivjstree.
'").treeview({
130 control: "#'.$iddivjstree.
'control",
132 /* window.console && console.log("%o was toggled", this); */
138 print '<ul id="'.$iddivjstree.
'">';
147 $sizeoftab = count($tab);
149 for ($x = 0; $x < $sizeoftab; $x++)
153 if ($tab[$x][
'fk_menu'] != -1 && $tab[$x][
'fk_menu'] == $pere[
'rowid'])
156 if (empty($ulprinted) && !empty($pere[
'rowid']))
158 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']]))
160 dol_syslog(
'Error, record with id '.$tab[$x][
'rowid'].
' seems to be a child of record with id '.$pere[
'rowid'].
' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING);
164 print '<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>'; $ulprinted++;
166 print "\n".
'<li '.($tab[$x][
'statut'] ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
169 print '<table class="nobordernopadding centpercent"><tr><td>';
170 print '<strong> ';
171 print $tab[$x][
'title'];
172 print ' (fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')';
173 print '</td><td class="right">';
174 print $tab[$x][
'buttons'];
175 print '</td></tr></table>';
177 print $tab[$x][
'entry'];
180 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
182 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
184 } elseif (!empty($tab[$x][
'rowid']) && $tab[$x][
'fk_menu'] == -1 && $tab[$x][
'fk_mainmenu'] == $pere[
'mainmenu'] && $tab[$x][
'fk_leftmenu'] == $pere[
'leftmenu']) {
186 if (empty($ulprinted) && !empty($pere[
'rowid']))
188 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']]))
190 dol_syslog(
'Error, record with id '.$tab[$x][
'rowid'].
' seems to be a child of record with id '.$pere[
'rowid'].
' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING);
195 print '<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>'; $ulprinted++;
197 print "\n".
'<li '.($tab[$x][
'statut'] ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
200 print '<table class="nobordernopadding centpercent"><tr><td>';
201 print '<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.
'&action=edit&menuId='.$tab[$x][
'rowid'].$moreparam.
'">';
202 print $tab[$x][
'title'];
203 print '</a></strong>';
204 print ' (mainmenu='.$tab[$x][
'mainmenu'].
' leftmenu='.$tab[$x][
'leftmenu'].
' - fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')';
205 print '</td><td class="right">';
206 print $tab[$x][
'buttons'];
207 print '</td></tr></table>';
209 print $tab[$x][
'entry'];
212 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
215 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
219 if (!empty($ulprinted) && !empty($pere[
'rowid'])) {
print '</ul>'.
"\n"; }
221 if ($rang == 0)
print '</ul>';
img_picto_common($titlealt, $picto, $moreatt= '', $pictoisfullpath=0)
Show picto (generic function)
tree_showpad(&$fulltree, $key, $silent=0)
Show indent and picto of a tree line.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
print
Draft customers invoices.
tree_recur($tab, $pere, $rang, $iddivjstree= 'iddivjstree', $donoresetalreadyloaded=0, $showfk=0, $moreparam= '')
Recursive function to output a tree.