summaryrefslogtreecommitdiff
path: root/public/includes/ui-panel.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/includes/ui-panel.php')
-rw-r--r--public/includes/ui-panel.php141
1 files changed, 141 insertions, 0 deletions
diff --git a/public/includes/ui-panel.php b/public/includes/ui-panel.php
new file mode 100644
index 0000000..1f40803
--- /dev/null
+++ b/public/includes/ui-panel.php
@@ -0,0 +1,141 @@
+<!DOCTYPE html>
+<html prefix="og: http://ogp.me/ns#" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB" dir="ltr">
+ <head>
+ <!-- Metas + Title -->
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+
+ <title><?=PROJECT?> : Πίνακας Ελέγχου</title>
+
+ <!-- CSS needed -->
+ <link href="https://fonts.googleapis.com/css?family=Ubuntu:400,700&display=swap" rel="stylesheet">
+ <link rel="stylesheet" href="/css/bootstrap.min.css" /><!-- v4.4.1 -->
+ <link rel="stylesheet" href="/css/select2.min.css" /><!-- v4.0.10 -->
+ <link rel="stylesheet" href="/css/pi.css" />
+ </head>
+ <body>
+
+ <div class="pi-container">
+ <div class="row">
+
+ <div class="col-md-12">
+ <h2><?=PROJECT?></h2>
+ </div>
+
+ <!-- menu section -->
+ <div class="col-md-4 col-lg-3">
+ <h4>Πίνακας Ελέγχου</h4>
+ <hr />
+ <?php
+ include("includes/menu-contents.php")
+ ?>
+ </div>
+ <!-- / menu section -->
+
+ <div class="col-md-8 col-lg-9 panel-sections">
+
+ <!-- statistics section -->
+ <?php if (ROLE > EDITOR) : ?>
+ <p>
+ <a class="btn btn-warning" data-toggle="collapse" href="#collapse-stats" role="button">Στατιστικά</a>
+ </p>
+ <div class="collapse show stats" id="collapse-stats">
+ <div class="card card-body">
+ <table>
+ <?php
+ $stats = get_totals();
+ $ccAr = json_decode(CODEJSON);
+ foreach ($ccAr as $key => $val) {
+ if (isset($stats[$val->id])) {
+ echo "<tr>
+ <td><span>". $val->id ."</span> ". $val->tag . "<a class='btn btn-pi-light' href='/ui-search.php?id=". $val->id ."'>Αναζήτηση</a></td>
+ <td style='width:45px; text-align:right;'>". $stats[$val->id] ."</td>
+ </tr>
+ ";
+ }
+ }
+ ?>
+ <tr class="summary"><td>Σύνολο</td><td style='width:45px; text-align:right;'><?=$stats['all']?></td></tr>
+ </table>
+ </div>
+ </div>
+ <?php endif; ?>
+ <!-- / statistics section -->
+
+ <!-- last items section -->
+
+ <!-- / last items section -->
+
+ <!-- edits history -->
+ <!-- / edits history -->
+
+ </div>
+
+ </div>
+ </div>
+
+
+
+
+
+ <!-- scripts and libraries
+ load and register one by one, so you don't need to worry about if they are ready -->
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/1.4.1/jquery-migrate.min.js"></script>
+ <script src="/js/bootstrap.min.js"></script>
+ <script>
+
+ // functions needed
+ // ---------------------------------------------------------------------------
+
+ // pure JS ajax GET request
+ // return data as JSON
+ // no fancy things like UTF8; if needed use base64 ---------------------------
+ function ajax_get(url, callback) {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+
+ try {
+ var data = JSON.parse(xmlhttp.responseText);
+ } catch(err) {
+ console.log(err.message + " in " + xmlhttp.responseText);
+ return;
+ }
+ callback(data);
+ }
+ };
+
+ xmlhttp.open("GET", url, true);
+ xmlhttp.send();
+ }
+
+ // menu management
+ // ---------------------------------------------------------------------------
+ $('.dropdown-item').on('click', function(e){
+ e.preventDefault();
+
+ // all data-goto have the format: 'method,uri_address'
+ // uri_address is the url to call
+ // method options:
+ // * url : means goto url (redirect)
+ // * ajax : means call url via ajax; if 'success = true' then goto '/' after that
+ // -------------------------------------------------------------------------
+ var opt = $(this).data('goto').split(','); // split data-goto
+
+ if (opt[0] == 'url') { // if method = url
+ window.location.href = opt[1];
+ }
+ else { // else, method = ajax
+ ajax_get(opt[1], function(response) {
+ if (response.success) {
+ window.location.href = '/';
+ }
+ });
+ }
+ });
+ </script>
+
+ </body>
+</html>