#12200 Fixed Christmas

This commit is contained in:
Daniel Maya 2023-12-18 16:44:27 +01:00
parent 0ac20717f1
commit e5b513f018
1 changed files with 21 additions and 33 deletions

View File

@ -174,15 +174,14 @@ class GeneralTacticalView
if (is_array($user) === true && count($user) > 0) { if (is_array($user) === true && count($user) > 0) {
$name = $user['fullname']; $name = $user['fullname'];
} else { } else {
$name = '';
$name = $user['firstname']; $name = $user['firstname'];
} }
// 👋 // 👋
if (empty($name) === true) { if (empty($name) === true) {
$message = __('Welcome back! 🎅'); $message = __('Welcome back! 👋');
} else { } else {
$message = __('Welcome back %s! 🎅', $name); $message = __('Welcome back %s! 👋', $name);
} }
} }
@ -228,6 +227,7 @@ class GeneralTacticalView
$emojiOptions = [ $emojiOptions = [
'have_good_day' => __('Have a good day %s ✌', $name), 'have_good_day' => __('Have a good day %s ✌', $name),
'welcome_back' => __('Welcome back! %s 👋', $name), 'welcome_back' => __('Welcome back! %s 👋', $name),
'merry_christmas' => __('Welcome back! %s 🎅', $name),
'good_morning' => __('Good morning, %s! ☕', $name), 'good_morning' => __('Good morning, %s! ☕', $name),
'good_evening' => __('Good evening, %s 🌇', $name), 'good_evening' => __('Good evening, %s 🌇', $name),
'good_night' => __('Good night, %s 🌕', $name), 'good_night' => __('Good night, %s 🌕', $name),
@ -235,7 +235,6 @@ class GeneralTacticalView
'happy_winter' => __('Happy winter, %s ⛄', $name), 'happy_winter' => __('Happy winter, %s ⛄', $name),
'happy_autumn' => __('Happy autumn, %s 🍂', $name), 'happy_autumn' => __('Happy autumn, %s 🍂', $name),
'happy_spring' => __('Happy spring, %s 🌻', $name), 'happy_spring' => __('Happy spring, %s 🌻', $name),
]; ];
// Welcome back. // Welcome back.
@ -243,33 +242,17 @@ class GeneralTacticalView
$user_last_day = date('d', $user_last_connect); $user_last_day = date('d', $user_last_connect);
$day = date('d', strtotime('now')); $day = date('d', strtotime('now'));
if ($user_last_day === $day) { if ($user_last_day === $day) {
if (empty($name) === true) {
$welcome[] = $emojiOptions['welcome_back']; $welcome[] = $emojiOptions['welcome_back'];
} else {
$welcome[] = $emojiOptions['welcome_back'];
}
} }
// Morning, evening, night. // Morning, evening, night.
$date = date('H'); $date = date('H');
if ($date < 13) { if ($date < 13) {
if (empty($name) === true) {
$welcome[] = $emojiOptions['good_morning']; $welcome[] = $emojiOptions['good_morning'];
} else {
$welcome[] = $emojiOptions['good_morning'];
}
} else if ($date < 18) { } else if ($date < 18) {
if (empty($name) === true) {
$welcome[] = $emojiOptions['good_evening']; $welcome[] = $emojiOptions['good_evening'];
} else { } else {
$welcome[] = $emojiOptions['good_evening'];
}
} else {
if (empty($name) === true) {
$welcome[] = $emojiOptions['good_night']; $welcome[] = $emojiOptions['good_night'];
} else {
$welcome[] = $emojiOptions['good_night'];
}
} }
// Seasons. // Seasons.
@ -284,6 +267,11 @@ class GeneralTacticalView
$welcome[] = $emojiOptions['happy_winter']; $welcome[] = $emojiOptions['happy_winter'];
} }
if ($mes === '12' && $day === '25') {
unset($welcome);
$welcome[] = $emojiOptions['merry_christmas'];
}
$length = count($welcome); $length = count($welcome);
$possition = rand(0, ($length - 1)); $possition = rand(0, ($length - 1));