<?php /** * Provides the navigation editing capabilities for admins to add pages * and reorganize them in the site tree. */ $this->require_acl('admin', 'navigation'); $page->title = __('Navigation'); $page->layout = 'admin'; $page->add_script('<script src="/js/jquery-ui/jquery-ui.min.js"></script>', 'tail'); $page->add_script('<script src="/apps/navigation/js/tree-drag-drop/tree-drag-drop.js"></script>', 'tail'); $page->add_style('/apps/admin/css/font-awesome/css/font-awesome.min.css'); // get ids already in tree to skip $nav = new Navigation(); $ids = $nav->get_all_ids(); // build other page list require_once 'apps/navigation/lib/Functions.php'; $other_pages = navigation_get_other_pages($ids); echo $tpl->render('navigation/admin', array('other_pages' => $other_pages));
case 'move': $id = $_POST['page']; $ref = $_POST['ref']; $pos = $_POST['pos']; if ($nav->move($id, $ref, $pos) && $nav->save()) { $out = array('msg' => sprintf('Page %s moved to %s %s.', $id, $pos, $ref), 'page' => $id, 'ref' => $ref, 'pos' => $pos); } else { $error = $nav->error; } break; case 'remove': $id = $_POST['page']; if ($nav->remove($id) && $nav->save()) { require_once 'apps/navigation/lib/Functions.php'; $ids = $nav->get_all_ids(); $out = array('msg' => sprintf('Page %s removed.', $id), 'page' => $id, 'other' => navigation_get_other_pages($ids)); } else { $error = $nav->error; } break; default: $error = 'Unknown method'; break; } if (!$error) { require_once 'apps/navigation/lib/Functions.php'; navigation_clear_cache(); } $res = new StdClass(); if ($error) { $res->success = false;