<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if ($this->authorize()) { // start tree class $tree = new NestedTree($this->registry->core . 'menu_items', $this->registry->params['id'], 'item'); $rows = $tree->numDecendants(true); $menuBar = array('menus' => '/menu/overview', 'new_link' => '/menu/view/id-' . $this->registry->params['id'] . '/action-new'); $this->content .= $this->makeToolbar($menuBar, 24); if ($rows > 0) { $items = $tree->getDecendants(true); $c = 0; $data = array(); foreach ($items as $row) { if ($row['depth'] > 0) { if ($row['depth'] > 1) { $r = str_repeat(' ', $row['depth'] - 1); $r .= "• " . $row['item']; $data[$c][] = $r; } else { $data[$c][] = $row['item']; } $data[$c][] = '<a href="/menu/view/id-' . $this->registry->params['id'] . '/action-edit/item-' . $row['item_id'] . '"><img src="/images/24x24/Edit3.png" class="Tips" title="Edit Item" rel="Click to edit the ' . $row['item'] . ' menu" /></a>'; $data[$c][] = '<a href="/menu/view/id-' . $this->registry->params['id'] . '/action-delete/item-' . $row['item_id'] . '" ><img src="/images/24x24/DeleteRed.png" class="Tips" title="Delete item" rel="Click to delete the ' . $row['category'] . ' item" /></a>'; $c++; } } $header = array('Menu Item', '', ''); $table = $this->dataTable($data, $header); } else {
<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if ($this->authorize()) { $tree = new NestedTree($this->registry->core . 'menu_items', null, 'item'); $tree->linked_columns = array('menu_type' => $this->registry->core . 'menu_types'); $menus = $tree->getTopLevelTree(); if (count($menus) > 0) { $c = 0; $data = array(); foreach ($menus as $row) { $tree->setId($row['item_id']); $num_items = $tree->numDecendants(true); $data[$c] = array($row['item'], $row['menu_type'], '' . $num_items . '', '<a href="/menu/edit/id-' . $row['item_id'] . '" style="text-decoration:none;" ><img src="/templates/' . $this->get('admin_config.site.template') . '/images/24x24/Edit3.png" class="Tips" title="Edit Menu" rel="Click to edit the ' . $row['item'] . ' menu" /></a>', '<a href="/menu/view/id-' . $row['item_id'] . '" style="text-decoration:none;" ><img src="/templates/' . $this->get('admin_config.site.template') . '/images/24x24/Preview.png" class="Tips" title="View Menu" rel="Click to view the ' . $row['item'] . ' items" /></a>', '<a href="/menu/delete/id-' . $row['item_id'] . '"><img src="/templates/' . $this->get('admin_config.site.template') . '/images/24x24/DeleteRed.png" class="Tips" title="Delete Menu" rel="Click to delete the ' . $row['item'] . ' menu" /></a>'); $c++; } $header = array('Menu', 'Menu Type', 'Items', '', '', ''); $table = $this->dataTable($data, $header); } else { $params = array('TYPE' => 'info', 'MESSAGE' => '<h2>There are currently no records.</h2>'); } $menuBar = array('new_menu' => '/menu/new'); $this->content .= $this->makeToolbar($menuBar, 24); if (count($menus) > 0) { $this->content .= '<div id="tableWrap">'; $this->content .= $table->toHtml(); $this->content .= '</div>'; } else { $this->content .= $this->message($params); }