<?php //prevent direct activation if (!isset($module)) { die("403: Not authorized to call this page directly"); } $GLOBALS["addjs_modules"] .= ",main-menu.js"; if (!isset($_GET["arg"])) { DrawEditGUI(); } else { switch ($_GET["arg"]) { case "json": $GLOBALS["addjs_assets"] .= ",ace-editor/ace.js"; $GLOBALS["addjs_modules"] .= ",main-menu-json.js"; DrawEditJSON(); break; case "save": SaveMainMenu(); break; case "ajax-load-cscope-pages-datalist": LoadScopeDatalist($connection->real_escape_string($_POST["container"])); break; } } function DrawEditGUI() { global $connection, $module; //get JSON file describing menu structure and parse it $json_stream = file_get_contents("../core/menu-structure.json"); $json_decoded = json_decode($json_stream); echo "<div class='page-header'><h1>Modifica menu principale <small>(Editor grafico)</small></h1></div>\n";
saveMenu($id, $container, $type, $title, $json); break; case "ajax-manual-editor": $id = $connection->real_escape_string($_POST["id"]); GetEditorContent($id); break; case "ajax-delete": $id = $connection->real_escape_string($_POST["id"]); DeleteMenu($id); break; case "ajax-load-cscope-pages-datalist": LoadScopeDatalist($connection->real_escape_string($_POST["container"])); break; default: $arg = $connection->real_escape_string($_GET["arg"]); DrawEditGUI($arg); } } function DrawMenulist() { global $connection, $module; echo "<div class='page-header'><h1>Gestisci menu secondari </h1></div>\n"; include "modules/php/sec-menu-modals.php"; echo "<div class='btn-group'>\n <button type='button' class='btn btn-success' id='new-menu'><span class='fa fa-plus'></span> Nuovo menu</button>\n </div>\n <br><br><div id='gui-container'>\n <table class='table table-hover'>\n <thead><tr>\n <th>Titolo</th>\n <th>Contenitore</th>\n <th>Tipo</th>\n <th>Id</th>\n </tr></thead>"; $request = "SELECT * FROM menu_content ORDER BY title ASC"; $result = $connection->query($request); while ($line = $result->fetch_assoc()) { //Draw table row $title = $line["title"]; $container = $line["container"]; $type = $line["type"];