41 while ($pos <= $fulltree[$key][
'level'] && $fulltree[$key][
'level'] > 0) {
44 $atleastoneofthislevelafter = 0;
49 foreach ($fulltree as $key2 => $val2) {
52 if ($fulltree[$key2][
'level'] > $pos) {
54 if (isset($fulltree[$key2][
'cachenbofdoc']) && $fulltree[$key2][
'cachenbofdoc'] > 0) {
55 $nbofdocinsub += $fulltree[$key2][
'cachenbofdoc'];
58 if ($fulltree[$key2][
'level'] == $pos) {
59 $atleastoneofthislevelafter = 1;
61 if ($fulltree[$key2][
'level'] <= $pos) {
72 if ($atleastoneofthislevelafter) {
73 if ($fulltree[$key][
'level'] == $pos) {
79 if ($fulltree[$key][
'level'] == $pos) {
89 return array($atleastoneofthislevelafter, $nbofdirinsub, $nbofdocinsub);
114function tree_recur($tab, $pere, $rang, $iddivjstree =
'iddivjstree', $donoresetalreadyloaded = 0, $showfk = 0, $moreparam =
'')
116 global $tree_recur_alreadyadded, $menu_handler_to_search;
118 if ($rang == 0 && empty($donoresetalreadyloaded)) {
119 $tree_recur_alreadyadded = array();
124 print
'<script nonce="'.getNonce().
'" type="text/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 foreach ($tab as $tmpkey => $tmpval) {
152 if ($tab[$x][
'fk_menu'] != -1 && ((
int) $tab[$x][
'fk_menu']) == $pere[
'rowid']) {
154 if (empty($ulprinted) && !empty($pere[
'rowid'])) {
155 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']])) {
156 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);
160 print
'<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>';
163 print
"\n".
'<li '.(!empty($tab[$x][
'statut']) ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
165 print
'<table class="nobordernopadding centpercent"><tr><td>';
166 print
'<span class="paddingleftonly">'.$tab[$x][
'title'].
'</span>';
167 print
' <span class="opacitymedium">(fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')</span>';
168 print
'</td><td class="right nowraponall">';
169 print $tab[$x][
'buttons'];
170 print
'</td></tr></table>';
172 print $tab[$x][
'entry'];
175 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
177 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
179 } elseif (!empty($tab[$x][
'rowid']) && ((
int) $tab[$x][
'fk_menu']) == -1 && $tab[$x][
'fk_mainmenu'] == $pere[
'mainmenu'] && $tab[$x][
'fk_leftmenu'] == $pere[
'leftmenu']) {
181 if (empty($ulprinted) && !empty($pere[
'rowid'])) {
182 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']])) {
183 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);
188 print
'<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>';
191 print
"\n".
'<li '.(!empty($tab[$x][
'statut']) ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
193 print
'<table class="nobordernopadding centpercent"><tr><td>';
194 print
'<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.
'&action=edit&token='.newToken().
'&menuId='.$tab[$x][
'rowid'].$moreparam.
'">';
195 print $tab[$x][
'title'];
196 print
'</a></strong>';
197 print
' (mainmenu='.$tab[$x][
'mainmenu'].
' leftmenu='.$tab[$x][
'leftmenu'].
' - fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')';
198 print
'</td><td class="right">';
199 print $tab[$x][
'buttons'];
200 print
'</td></tr></table>';
202 print $tab[$x][
'entry'];
205 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
208 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
212 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.