Grettings message for Dashboard
This commit is contained in:
parent
7358a7e0e4
commit
fc12ebadc8
3 changed files with 71 additions and 0 deletions
7
bl-plugins/welcome/languages/en.json
Normal file
7
bl-plugins/welcome/languages/en.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "Welcome",
|
||||||
|
"description": "Shows a greeting message in the dashboard."
|
||||||
|
}
|
||||||
|
}
|
11
bl-plugins/welcome/metadata.json
Normal file
11
bl-plugins/welcome/metadata.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"author": "Bludit",
|
||||||
|
"email": "",
|
||||||
|
"website": "https://plugins.bludit.com",
|
||||||
|
"version": "4.0.0",
|
||||||
|
"releaseDate": "2021-03-02",
|
||||||
|
"license": "MIT",
|
||||||
|
"compatible": "4.0",
|
||||||
|
"type": "dashboard",
|
||||||
|
"notes": ""
|
||||||
|
}
|
53
bl-plugins/welcome/plugin.php
Normal file
53
bl-plugins/welcome/plugin.php
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class pluginWelcome extends Plugin {
|
||||||
|
|
||||||
|
private $loadOnViews = array(
|
||||||
|
'dashboard' // Load this plugin only in the Dashboard
|
||||||
|
);
|
||||||
|
|
||||||
|
public function dashboard()
|
||||||
|
{
|
||||||
|
global $L;
|
||||||
|
global $login;
|
||||||
|
|
||||||
|
$username = $login->username();
|
||||||
|
$user = new User($username);
|
||||||
|
$name = '';
|
||||||
|
if ($user->nickname()) {
|
||||||
|
$name = $user->nickname();
|
||||||
|
} elseif ($user->firstName()) {
|
||||||
|
$name = $user->firstName();
|
||||||
|
}
|
||||||
|
|
||||||
|
$labelGoodMorning = $L->g('good-morning');
|
||||||
|
$labelGoodAfternoon = $L->g('good-afternoon');
|
||||||
|
$labelGoodEvening = $L->g('good-evening');
|
||||||
|
$labelGoodNight = $L->g('good-night');
|
||||||
|
|
||||||
|
return <<<EOF
|
||||||
|
<div class="pluginWelcome">
|
||||||
|
<h2 id="hello-message" class="m-0 p-0"><i class="bi bi-emoji-laughing"></i>Welcome</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#hello-message").fadeOut(1000, function() {
|
||||||
|
var date = new Date()
|
||||||
|
var hours = date.getHours()
|
||||||
|
if (hours > 6 && hours < 12) {
|
||||||
|
$(this).html('<i class="bi bi-sunrise"></i>$labelGoodMorning, $name');
|
||||||
|
} else if (hours >= 12 && hours < 18) {
|
||||||
|
$(this).html('<i class="bi bi-sun"></i>$labelGoodAfternoon, $name');
|
||||||
|
} else if (hours >= 18 && hours < 22) {
|
||||||
|
$(this).html('<i class="bi bi-sunset"></i>$labelGoodEvening, $name');
|
||||||
|
} else {
|
||||||
|
$(this).html('<i class="bi bi-moon-stars"></i>$labelGoodNight, $name');
|
||||||
|
}
|
||||||
|
}).fadeIn(1000);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue