Skip to content

Commit ef2c939

Browse files
committed
GH-230 Move vacation box to its own component
1 parent 7ec348b commit ef2c939

File tree

5 files changed

+47
-5
lines changed

5 files changed

+47
-5
lines changed

modules/overview/_includes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
include($includePath . './screens/Overview/components/PlanetsListElement/PlanetsListElement.component.php');
3434
include($includePath . './screens/Overview/components/ResourcesTransport/ResourcesTransport.component.php');
3535
include($includePath . './screens/Overview/components/StatsList/StatsList.component.php');
36+
include($includePath . './screens/Overview/components/VacationInfoBox/VacationInfoBox.component.php');
3637

3738
include($includePath . './screens/PlanetNameChange/PlanetNameChange.screen.php');
3839
include($includePath . './screens/PlanetNameChange/PlanetNameChange.utils.php');
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace UniEngine\Engine\Modules\Overview\Screens\Overview\Components\VacationInfoBox;
4+
5+
/**
6+
* @param array $props
7+
* @param arrayRef $props['user']
8+
*/
9+
function render($props) {
10+
global $_Lang;
11+
12+
if (!isOnVacation($props['user'])) {
13+
return [
14+
'componentHTML' => '',
15+
];
16+
}
17+
18+
$localTemplateLoader = createLocalTemplateLoader(__DIR__);
19+
20+
$componentHTML = parsetemplate(
21+
$localTemplateLoader('body'),
22+
$_Lang
23+
);
24+
25+
return [
26+
'componentHTML' => $componentHTML,
27+
];
28+
}
29+
30+
?>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<tr>
2+
<th class="c pad5 orange" colspan="3">
3+
{VacationModeBox_Text}
4+
</th>
5+
</tr>
6+
<tr>
7+
<th style="visibility: hidden;">&nbsp;</th>
8+
</tr>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
header("Location: ../index.php");
4+
5+
?>

overview.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@
5959
InsertJavaScriptChronoApplet(false, false, false);
6060
$InsertJSChronoApplet_GlobalIncluded = true;
6161

62-
// --- Vacation Mode Box
63-
if(isOnVacation())
64-
{
65-
$parse['VacationModeBox'] = '<tr><th class="c pad5 orange" colspan="3">'.$_Lang['VacationModeBox_Text'].'</th></tr><tr><th style="visibility: hidden;">&nbsp;</th></tr>';
66-
}
62+
$parse['VacationModeBox'] = Overview\Screens\Overview\Components\VacationInfoBox\render([
63+
'user' => &$_User,
64+
])['componentHTML'];
6765

6866
// --- Activation Box
6967
if (!isUserAccountActivated($_User)) {

0 commit comments

Comments
 (0)