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);
114 function 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 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.
'">';
146 $sizeoftab = count($tab);
148 for ($x = 0; $x < $sizeoftab; $x++) {
151 if ($tab[$x][
'fk_menu'] != -1 && $tab[$x][
'fk_menu'] == $pere[
'rowid']) {
153 if (empty($ulprinted) && !empty($pere[
'rowid'])) {
154 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']])) {
155 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);
159 print
'<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>';
162 print
"\n".
'<li '.(!empty($tab[$x][
'statut']) ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
164 print
'<table class="nobordernopadding centpercent"><tr><td>';
165 print
'<span class="paddingleftonly">'.$tab[$x][
'title'].
'</span>';
166 print
' <span class="opacitymedium">(fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')</span>';
167 print
'</td><td class="right nowraponall">';
168 print $tab[$x][
'buttons'];
169 print
'</td></tr></table>';
171 print $tab[$x][
'entry'];
174 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
176 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
178 } elseif (!empty($tab[$x][
'rowid']) && $tab[$x][
'fk_menu'] == -1 && $tab[$x][
'fk_mainmenu'] == $pere[
'mainmenu'] && $tab[$x][
'fk_leftmenu'] == $pere[
'leftmenu']) {
180 if (empty($ulprinted) && !empty($pere[
'rowid'])) {
181 if (!empty($tree_recur_alreadyadded[$tab[$x][
'rowid']])) {
182 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);
187 print
'<ul'.(empty($pere[
'rowid']) ?
' id="treeData"' :
'').
'>';
190 print
"\n".
'<li '.(!empty($tab[$x][
'statut']) ?
' class="liuseractive"' :
'class="liuserdisabled"').
'>';
192 print
'<table class="nobordernopadding centpercent"><tr><td>';
193 print
'<strong> <a href="edit.php?menu_handler='.$menu_handler_to_search.
'&action=edit&token='.
newToken().
'&menuId='.$tab[$x][
'rowid'].$moreparam.
'">';
194 print $tab[$x][
'title'];
195 print
'</a></strong>';
196 print
' (mainmenu='.$tab[$x][
'mainmenu'].
' leftmenu='.$tab[$x][
'leftmenu'].
' - fk_mainmenu='.$tab[$x][
'fk_mainmenu'].
' fk_leftmenu='.$tab[$x][
'fk_leftmenu'].
')';
197 print
'</td><td class="right">';
198 print $tab[$x][
'buttons'];
199 print
'</td></tr></table>';
201 print $tab[$x][
'entry'];
204 $tree_recur_alreadyadded[$tab[$x][
'rowid']] = ($rang + 1);
207 tree_recur($tab, $tab[$x], $rang + 1,
'iddivjstree', 0, $showfk);
211 if (!empty($ulprinted) && !empty($pere[
'rowid'])) {
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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_showpad(&$fulltree, $key, $silent=0)
Show indent and picto of a tree line.
tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0, $moreparam='')
Recursive function to output a tree.