diff --git a/core/dashboard/index.php b/core/dashboard/index.php index a50bc247dc..ee6a05743e 100644 --- a/core/dashboard/index.php +++ b/core/dashboard/index.php @@ -85,6 +85,40 @@ $dashboard = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); +//get http post variables and set them to php variables + if (count($_POST) > 0 && permission_exists('dashboard_edit')) { + //set the variables from the http values + if (isset($_POST["widget_order"])) { + $widgets = explode(",", $_POST["widget_order"]); + $dashboard_order = '0'; + $x = 0; + foreach($widgets as $widget) { + foreach($dashboard as $row) { + $dashboard_name = strtolower($row['dashboard_name']); + $dashboard_name = str_replace(" ", "_", $dashboard_name); + if ($widget == $dashboard_name) { + $dashboard_order = $dashboard_order + 10; + $array['dashboard'][$x]['dashboard_name'] = $row['dashboard_name']; + $array['dashboard'][$x]['dashboard_uuid'] = $row['dashboard_uuid']; + $array['dashboard'][$x]['dashboard_order'] = $dashboard_order; + $x++; + } + } + } + + //save the data + $database = new database; + $database->app_name = 'dashboard'; + $database->app_uuid = '55533bef-4f04-434a-92af-999c1e9927f7'; + $database->save($array); + + //redirect the browser + message::add($text['message-update']); + header("Location: /core/dashboard/index.php"); + return; + } + } + //add multi-lingual support $language = new text; $text = $language->get(); @@ -93,6 +127,9 @@ $document['title'] = $text['title-dashboard']; require_once "resources/header.php"; +//include sortablejs + echo ""; + //include chart.js echo ""; @@ -133,6 +170,7 @@ \n"; echo "
\n"; + echo "\n"; + echo "\n"; //display login message if (if_group("superadmin") && isset($_SESSION['login']['message']['text']) && $_SESSION['login']['message']['text'] != '') { - echo ""; + echo "\n"; } ?> @@ -208,12 +255,12 @@ \n"; + echo "