Minor changes in visits stats and fix notifications in dahsboard
This commit is contained in:
parent
3c97a31b1b
commit
9fb07d918a
3 changed files with 24 additions and 130 deletions
|
@ -24,148 +24,38 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
<div id="dashboard" class="container">
|
||||
<div id="dashboard" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
|
||||
<!-- Good message -->
|
||||
<div>
|
||||
<h2 id="hello-message" class="pt-0">
|
||||
<span class="bi-hand-spock-o"></span><span><?php echo $L->g('hello') ?></span>
|
||||
</h2>
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$("#hello-message").fadeOut(1000, function() {
|
||||
var date = new Date()
|
||||
var hours = date.getHours()
|
||||
if (hours > 6 && hours < 12) {
|
||||
$(this).html('<span class="bi-sun-o"></span><?php echo $L->g('good-morning') ?>');
|
||||
} else if (hours > 12 && hours < 18) {
|
||||
$(this).html('<span class="bi-sun-o"></span><?php echo $L->g('good-afternoon') ?>');
|
||||
} else if (hours > 18 && hours < 22) {
|
||||
$(this).html('<span class="bi-moon-o"></span><?php echo $L->g('good-evening') ?>');
|
||||
} else {
|
||||
$(this).html('<span class="bi-moon-o"></span><span><?php echo $L->g('good-night') ?></span>');
|
||||
}
|
||||
}).fadeIn(1000);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Quick Links -->
|
||||
<div class="container border-bottom pb-5" id="jsclippyContainer">
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<select id="jsclippy" class="clippy" name="state"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
var clippy = $("#jsclippy").select2({
|
||||
placeholder: "<?php $L->p('Start typing to see a list of suggestions') ?>",
|
||||
allowClear: true,
|
||||
width: "100%",
|
||||
theme: "bootstrap4",
|
||||
minimumInputLength: 2,
|
||||
dropdownParent: "#jsclippyContainer",
|
||||
language: {
|
||||
inputTooShort: function () { return ''; }
|
||||
},
|
||||
ajax: {
|
||||
url: HTML_PATH_ADMIN_ROOT+"ajax/clippy",
|
||||
data: function (params) {
|
||||
var query = { query: params.term }
|
||||
return query;
|
||||
},
|
||||
processResults: function (data) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
templateResult: function(data) {
|
||||
// console.log(data);
|
||||
var html = '';
|
||||
if (data.type=='menu') {
|
||||
html += '<a href="'+data.url+'"><div class="search-suggestion">';
|
||||
html += '<span class="bi-'+data.icon+'"></span>'+data.text+'</div></a>';
|
||||
} else {
|
||||
if (typeof data.id === 'undefined') {
|
||||
return '';
|
||||
}
|
||||
html += '<div class="search-suggestion">';
|
||||
html += '<div class="search-suggestion-item">'+data.text+' <span class="badge badge-pill badge-light">'+data.type+'</span></div>';
|
||||
html += '<div class="search-suggestion-options">';
|
||||
html += '<a target="_blank" href="'+DOMAIN_PAGES+data.id+'"><?php $L->p('view') ?></a>';
|
||||
html += '<a class="ms-2" href="'+DOMAIN_ADMIN+'editor/'+data.id+'"><?php $L->p('edit') ?></a>';
|
||||
html += '</div></div>';
|
||||
}
|
||||
|
||||
return html;
|
||||
},
|
||||
escapeMarkup: function(markup) {
|
||||
return markup;
|
||||
}
|
||||
}).on("select2:closing", function(e) {
|
||||
e.preventDefault();
|
||||
}).on("select2:closed", function(e) {
|
||||
clippy.select2("open");
|
||||
});
|
||||
clippy.select2("open");
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<a class="quick-links text-center" target="_blank" href="https://docs.bludit.com">
|
||||
<div class="bi-compass quick-links-icons"></div>
|
||||
<div><?php $L->p('Documentation') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col border-left border-right">
|
||||
<a class="quick-links text-center" target="_blank" href="https://forum.bludit.org">
|
||||
<div class="bi-support quick-links-icons"></div>
|
||||
<div><?php $L->p('Forum support') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="quick-links text-center" target="_blank" href="https://gitter.im/bludit/support">
|
||||
<div class="bi-comments quick-links-icons"></div>
|
||||
<div><?php $L->p('Chat support') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-7">
|
||||
<?php Theme::plugins('dashboard') ?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
|
||||
<div class="col-5">
|
||||
|
||||
<!-- Notifications -->
|
||||
<ul class="list-group list-group-striped b-0">
|
||||
<li class="list-group-item pt-0"><h4><?php $L->p('Notifications') ?></h4></li>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<h4 class="m-0 p-0"><i class="bi bi-bell"></i><?php $L->p('Notifications') ?></h4>
|
||||
</li>
|
||||
<?php
|
||||
$logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT);
|
||||
foreach ($logs as $log) {
|
||||
$phrase = $L->g($log['dictionaryKey']);
|
||||
echo '<li class="list-group-item">';
|
||||
echo $phrase;
|
||||
echo '<div>';
|
||||
echo $L->g($log['dictionaryKey']);
|
||||
if (!empty($log['notes'])) {
|
||||
echo ' « <b>'.$log['notes'].'</b> »';
|
||||
}
|
||||
echo '<br><span class="notification-date"><small>';
|
||||
echo '</div>';
|
||||
echo '<div class="form-text">';
|
||||
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
|
||||
echo ' [ '.$log['username'] .' ]';
|
||||
echo '</div></span>';
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<!-- End Notifications -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
class API {
|
||||
|
||||
constructor(apiURL, apiToken, apiAuth) {
|
||||
this.apiURL = "http://localhost:9000/api/";
|
||||
this.apiURL = "http://localhost:8000/api/";
|
||||
this.body = {
|
||||
token: '45643a4071fad6a12261bb0763550feb',
|
||||
authentication: '18a8410f0043d004c2e87f404170e112'
|
||||
authentication: '02707c99183896203b41d4a9b5c42692'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,22 +51,26 @@ class pluginVisitsStats extends Plugin {
|
|||
$labelUnique = $L->g('Unique');
|
||||
|
||||
return <<<EOF
|
||||
<div class="simple-stats-plugin">
|
||||
<h3>$label</h3>
|
||||
<canvas id="simple-stats-chart"></canvas>
|
||||
<div class="pluginVisitsStats">
|
||||
<h3 class="m-0 p-0"><i class="bi bi-bar-chart"></i>$label</h3>
|
||||
<canvas id="visits-stats"></canvas>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var ctx = document.getElementById('simple-stats-chart');
|
||||
var ctx = document.getElementById('visits-stats');
|
||||
new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [$labels],
|
||||
datasets: [{
|
||||
backgroundColor: 'rgb(13,110,253)',
|
||||
borderColor: 'rgb(13,110,253)',
|
||||
label: '$labelUnique',
|
||||
data: [$seriesUnique]
|
||||
},
|
||||
{
|
||||
backgroundColor: 'rgb(61,139,253)',
|
||||
borderColor: 'rgb(61,139,253)',
|
||||
label: '$labelVisits',
|
||||
data: [$seriesVisits]
|
||||
}]
|
||||
|
|
Loading…
Add table
Reference in a new issue