diff --git a/modules/overview/_includes.php b/modules/overview/_includes.php index 2cc0d0dc..fde288bd 100644 --- a/modules/overview/_includes.php +++ b/modules/overview/_includes.php @@ -27,6 +27,7 @@ include($includePath . './screens/Overview/components/AdminAlerts/AdminAlerts.component.php'); include($includePath . './screens/Overview/components/EmailChangeInfo/EmailChangeInfo.component.php'); include($includePath . './screens/Overview/components/NewMessagesInfo/NewMessagesInfo.component.php'); + include($includePath . './screens/Overview/components/NewSurveysInfo/NewSurveysInfo.component.php'); 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'); diff --git a/modules/overview/screens/Overview/components/NewSurveysInfo/NewSurveysInfo.component.php b/modules/overview/screens/Overview/components/NewSurveysInfo/NewSurveysInfo.component.php new file mode 100644 index 00000000..1c10ce58 --- /dev/null +++ b/modules/overview/screens/Overview/components/NewSurveysInfo/NewSurveysInfo.component.php @@ -0,0 +1,74 @@ + 0); + + return ( + $hasUserVoted ? + 0 : + 1 + ); + }); + $surveysWithoutVotesCount = array_sum($surveysWithoutVotes); + + if ($surveysWithoutVotesCount == 0) { + return [ + 'componentHTML' => '', + ]; + } + + $localTemplateLoader = createLocalTemplateLoader(__DIR__); + + /** + * TODO: Use a better translation system to support more languages. + */ + $content = vsprintf( + $_Lang['PollBox_You_can_vote_in_new_polls'], + ( + $surveysWithoutVotesCount > 1 ? + $_Lang['PollBox_More'] : + $_Lang['PollBox_One'] + ) + ); + + $tplBodyParams = [ + 'content' => $content, + ]; + + $componentHTML = parsetemplate( + $localTemplateLoader('body'), + $tplBodyParams + ); + + return [ + 'componentHTML' => $componentHTML, + ]; +} + +?> diff --git a/modules/overview/screens/Overview/components/NewSurveysInfo/body.tpl b/modules/overview/screens/Overview/components/NewSurveysInfo/body.tpl new file mode 100644 index 00000000..d62e24b1 --- /dev/null +++ b/modules/overview/screens/Overview/components/NewSurveysInfo/body.tpl @@ -0,0 +1,7 @@ +