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)
92 return array($atleastoneofthislevelafter,$nbofdirinsub,$nbofdocinsub);
116 function tree_recur($tab, $pere, $rang, $iddivjstree=
'iddivjstree', $donoresetalreadyloaded=0, $showfk=0)
118 global $tree_recur_alreadyadded;
120 if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array();
125 print '<script type="text/javascript" language="javascript"> 126 $(document).ready(function(){ 127 $("#'.$iddivjstree.
'").treeview({ 131 control: "#'.$iddivjstree.
'control", 133 /* window.console && console.log("%o was toggled", this); */ 139 print '<ul id="'.$iddivjstree.
'">';
148 $sizeoftab=count($tab);
150 for ($x=0; $x < $sizeoftab; $x++)
154 if ($tab[$x][
'fk_menu'] != -1 && $tab[$x][
'fk_menu'] == $pere[
'rowid'])
157 if (empty($ulprinted) && ! empty($pere[
'rowid']))
159 if (! empty($tree_recur_alreadyadded[$tab[$x][
'rowid']]))
161 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);
165 print '<ul'.(empty($pere[
'rowid'])?
' id="treeData"':
'').
'>'; $ulprinted++;
167 print "\n".
'<li '.($tab[$x][
'statut']?
' class="liuseractive"':
'class="liuserdisabled"').
'>';
170 print '<table class="nobordernopadding centpercent"><tr><td>';
171 print '<strong> ';
172 print $tab[$x][
'title'];
173 print ' (fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')';
174 print '</td><td align="right">';
175 print $tab[$x][
'buttons'];
176 print '</td></tr></table>';
180 print $tab[$x][
'entry'];
183 $tree_recur_alreadyadded[$tab[$x][
'rowid']]=($rang + 1);
185 tree_recur($tab, $tab[$x], $rang+1,
'iddivjstree', 0, $showfk);
188 elseif (! empty($tab[$x][
'rowid']) && $tab[$x][
'fk_menu'] == -1 && $tab[$x][
'fk_mainmenu'] == $pere[
'mainmenu'] && $tab[$x][
'fk_leftmenu'] == $pere[
'leftmenu'])
191 if (empty($ulprinted) && ! empty($pere[
'rowid']))
193 if (! empty($tree_recur_alreadyadded[$tab[$x][
'rowid']]))
195 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);
200 print '<ul'.(empty($pere[
'rowid'])?
' id="treeData"':
'').
'>'; $ulprinted++;
202 print "\n".
'<li '.($tab[$x][
'statut']?
' class="liuseractive"':
'class="liuserdisabled"').
'>';
205 print '<table class="nobordernopadding centpercent"><tr><td>';
206 print '<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.
'&action=edit&menuId='.$menu[
'rowid'].
'">';
207 print $tab[$x][
'title'];
208 print '</a></strong>';
209 print ' (mainmenu='.$tab[$x][
'mainmenu'].
' leftmenu='.$tab[$x][
'leftmenu'].
' - fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')';
210 print '</td><td align="right">';
211 print $tab[$x][
'buttons'];
212 print '</td></tr></table>';
216 print $tab[$x][
'entry'];
219 $tree_recur_alreadyadded[$tab[$x][
'rowid']]=($rang + 1);
222 tree_recur($tab, $tab[$x], $rang+1,
'iddivjstree', 0, $showfk);
226 if (! empty($ulprinted) && ! empty($pere[
'rowid'])) {
print '</ul>'.
"\n"; }
228 if ($rang == 0)
print '</ul>';
print
Draft customers invoices.
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.
tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0)
Recursive function to output a tree.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.