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
"\n".
'<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>';
166 print
'<td class="tdoverflowmax300">';
167 print
'<span class="paddingleft paddingright">'.$tab[$x][
'title'].
'</span>';
168 print
'<span class="opacitymedium">(fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')</span>';
170 print
'<td class="right nowraponall">';
171 print $tab[$x][
'buttons'];
172 print
'</td></tr></table>';
175 print $tab[$x][
'entry'];
178 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
180 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
182 } elseif (!empty($tab[$x][
'rowid']) && ((
int) $tab[$x][
'fk_menu']) == -1 && $tab[$x][
'fk_mainmenu'] == $pere[
'mainmenu'] && $tab[$x][
'fk_leftmenu'] == $pere[
'leftmenu']) {
184 if (empty($ulprinted) && !empty($pere[
'rowid'])) {
185 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']])) {
186 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);
191 print
"\n".
'<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>';
194 print
"\n".
'<li '.(!empty($tab[$x][
'statut']) ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
196 print
'<table class="nobordernopadding centpercent"><tr>';
197 print
'<td class="tdoverflowmax200">';
198 print
'<strong class="paddingleft paddingright">';
199 print
'<a href="edit.php?menu_handler='.$menu_handler_to_search.
'&action=edit&token='.newToken().
'&menuId='.$tab[$x][
'rowid'].$moreparam.
'">';
200 print $tab[$x][
'title'];
203 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>';
205 print
'<td class="right nowraponall">';
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'])) {
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.