Skip to content

Commit

Permalink
GH-230 Move vacation box to its own component
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jul 12, 2022
1 parent 7ec348b commit ef2c939
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
1 change: 1 addition & 0 deletions modules/overview/_includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
include($includePath . './screens/Overview/components/PlanetsListElement/PlanetsListElement.component.php');
include($includePath . './screens/Overview/components/ResourcesTransport/ResourcesTransport.component.php');
include($includePath . './screens/Overview/components/StatsList/StatsList.component.php');
include($includePath . './screens/Overview/components/VacationInfoBox/VacationInfoBox.component.php');

include($includePath . './screens/PlanetNameChange/PlanetNameChange.screen.php');
include($includePath . './screens/PlanetNameChange/PlanetNameChange.utils.php');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace UniEngine\Engine\Modules\Overview\Screens\Overview\Components\VacationInfoBox;

/**
* @param array $props
* @param arrayRef $props['user']
*/
function render($props) {
global $_Lang;

if (!isOnVacation($props['user'])) {
return [
'componentHTML' => '',
];
}

$localTemplateLoader = createLocalTemplateLoader(__DIR__);

$componentHTML = parsetemplate(
$localTemplateLoader('body'),
$_Lang
);

return [
'componentHTML' => $componentHTML,
];
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<tr>
<th class="c pad5 orange" colspan="3">
{VacationModeBox_Text}
</th>
</tr>
<tr>
<th style="visibility: hidden;">&nbsp;</th>
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

header("Location: ../index.php");

?>
8 changes: 3 additions & 5 deletions overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@
InsertJavaScriptChronoApplet(false, false, false);
$InsertJSChronoApplet_GlobalIncluded = true;

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

// --- Activation Box
if (!isUserAccountActivated($_User)) {
Expand Down

0 comments on commit ef2c939

Please sign in to comment.