42 $atleastoneofthislevelafter = 0;
47 while ($pos <= $fulltree[$key][
'level'] && $fulltree[$key][
'level'] > 0) {
50 $atleastoneofthislevelafter = 0;
55 foreach ($fulltree as $key2 => $val2) {
58 if ($fulltree[$key2][
'level'] > $pos) {
60 if (isset($fulltree[$key2][
'cachenbofdoc']) && $fulltree[$key2][
'cachenbofdoc'] > 0) {
61 $nbofdocinsub += $fulltree[$key2][
'cachenbofdoc'];
64 if ($fulltree[$key2][
'level'] == $pos) {
65 $atleastoneofthislevelafter = 1;
67 if ($fulltree[$key2][
'level'] <= $pos) {
78 if ($atleastoneofthislevelafter) {
79 if ($fulltree[$key][
'level'] == $pos) {
85 if ($fulltree[$key][
'level'] == $pos) {
95 return array($atleastoneofthislevelafter, $nbofdirinsub, $nbofdocinsub);
120function tree_recur($tab, $pere, $rang, $iddivjstree =
'iddivjstree', $donoresetalreadyloaded = 0, $showfk = 0, $moreparam =
'')
122 global $tree_recur_alreadyadded, $menu_handler_to_search;
124 if ($rang == 0 && empty($donoresetalreadyloaded)) {
125 $tree_recur_alreadyadded = array();
130 print
'<script nonce="'.getNonce().
'" type="text/javascript">
131 $(document).ready(function(){
132 $("#'.$iddivjstree.
'").treeview({
136 control: "#'.$iddivjstree.
'control",
138 /* window.console && console.log("%o was toggled", this); */
144 print
'<ul id="'.$iddivjstree.
'">';
153 foreach ($tab as $tmpkey => $tmpval) {
158 if ($tab[$x][
'fk_menu'] != -1 && ((
int) $tab[$x][
'fk_menu']) == $pere[
'rowid']) {
160 if (empty($ulprinted) && !empty($pere[
'rowid'])) {
161 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']])) {
162 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);
166 print
"\n".
'<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>';
169 print
"\n".
'<li '.(!empty($tab[$x][
'statut']) ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
171 print
'<table class="nobordernopadding centpercent"><tr>';
172 print
'<td class="tdoverflowmax300">';
173 print
'<span class="paddingleft paddingright">'.$tab[$x][
'title'].
'</span>';
174 print
'<span class="opacitymedium">(fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')</span>';
176 print
'<td class="right nowraponall">';
177 print $tab[$x][
'buttons'];
178 print
'</td></tr></table>';
181 print $tab[$x][
'entry'];
184 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
186 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
188 } elseif (!empty($tab[$x][
'rowid']) && ((
int) $tab[$x][
'fk_menu']) == -1 && $tab[$x][
'fk_mainmenu'] == $pere[
'mainmenu'] && $tab[$x][
'fk_leftmenu'] == $pere[
'leftmenu']) {
190 if (empty($ulprinted) && !empty($pere[
'rowid'])) {
191 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']])) {
192 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);
197 print
"\n".
'<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>';
200 print
"\n".
'<li '.(!empty($tab[$x][
'statut']) ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
202 print
'<table class="nobordernopadding centpercent"><tr>';
203 print
'<td class="tdoverflowmax200">';
204 print
'<strong class="paddingleft paddingright">';
205 print
'<a href="edit.php?menu_handler='.$menu_handler_to_search.
'&action=edit&token='.
newToken().
'&menuId='.$tab[$x][
'rowid'].$moreparam.
'">';
206 print $tab[$x][
'title'];
209 print
'<span class="small opacitymedium">(mainmenu='.$tab[$x][
'mainmenu'].
' - leftmenu='.$tab[$x][
'leftmenu'].
', fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')</small>';
211 print
'<td class="right nowraponall">';
212 print $tab[$x][
'buttons'];
213 print
'</td></tr></table>';
215 print $tab[$x][
'entry'];
218 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
221 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
225 if (!empty($ulprinted) && !empty($pere[
'rowid'])) {
img_picto_common($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $notitle=0)
Show picto (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0, $moreparam='')
Recursive function to output a tree.