static function menu_complete($user) { $nemo = \App\Models\opciones_perfiles::menu(0, $user); echo "<ul class='nav navbar-nav'>"; foreach ($nemo as $men) { //@foreach() if ($men->Count > 0) { //@if() echo '<li class="dropdown">'; echo "<a href='javascript:void(0)' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false'>" . $men->nombre . "<span class='caret'></span></a>"; if ($men->Count > 0) { //@if() $hijo = \App\Models\opciones_perfiles::menu($men->id, $user); echo '<ul class="dropdown-menu" role="menu">'; foreach ($hijo as $hi) { if ($hi->Count > 0) { echo '<li class="dropdown-submenu">'; echo '<a href="javascript:void(0)">' . $hi->nombre . '</a>'; $nieto = \App\Models\opciones_perfiles::menu($hi->id, $user); echo '<ul class="dropdown-menu">'; foreach ($nieto as $ni) { echo '<li><a href="' . url($ni->url) . '">' . $ni->nombre . '</a></li>'; } echo '</ul>'; } else { echo '<li>'; echo '<a href="' . url($hi->url) . '">' . $hi->nombre . '</a>'; } echo '</li>'; } //endforeach echo '</ul>'; } //endif echo '</li>'; } else { echo "<li>"; echo $men->nombre == 'INICIO' ? '<a href="' . "javascript:void(0)" . '">' . $men->nombre . "</a>" : '<a href="' . url($men->url) . '">' . $men->nombre . "</a>"; echo "</li>"; } //@endif } //endforeach echo "</ul>"; }
static function display_children($parent, $level) { $clases = [1 => 'dropdown-toggle', 2 => 'dropdown-menu', 3 => 'dropdown-toggle']; $data = opciones_perfiles::menu($parent); echo '<ul class="nav navbar-nav">'; foreach ($data as $que) { if ($que->Count > 0) { echo "<li class='dropdown'>\n <a class='" . $clases[$level] . "' href='" . $que->url . "'>" . $level . " " . $que->nombre . "</a> <span class='caret'></span></a>"; opciones_perfiles::display_children($que->id, $level + 1); echo "</li>"; } elseif ($que->Count == 0) { echo "<li><a href='" . $que->url . "'>" . $que->nombre . "</a></li>"; } else { } } echo "</ul>"; }