diff --git a/controller/Controller.class.php b/controller/Controller.class.php index 3d52ae5b..b4658f8a 100644 --- a/controller/Controller.class.php +++ b/controller/Controller.class.php @@ -39,6 +39,8 @@ class Controller { case '/': return ContentActions::executeHome(); + case '/fund': + return CreditActions::executeFund(); case '/get': return ContentActions::executeGet(); case '/postcommit': diff --git a/controller/action/ContentActions.class.php b/controller/action/ContentActions.class.php index dbd92864..7706f2b2 100644 --- a/controller/action/ContentActions.class.php +++ b/controller/action/ContentActions.class.php @@ -9,7 +9,10 @@ class ContentActions extends Actions { public static function executeHome() { - return ['page/home', []]; + return ['page/home', [ + 'totalUSD' => CreditApi::getTotalDollarSales(), + 'totalPeople' => CreditApi::getTotalPeople() + ]]; } public static function executeGet() diff --git a/controller/action/CreditActions.class.php b/controller/action/CreditActions.class.php new file mode 100644 index 00000000..94692977 --- /dev/null +++ b/controller/action/CreditActions.class.php @@ -0,0 +1,19 @@ + CreditApi::getCreditsPerDollar($daysActive), + 'creditsPerDollarTomorrow' => CreditApi::getCreditsPerDollar($daysActive + 1), + ]]; + } +} \ No newline at end of file diff --git a/lib/i18n.class.php b/lib/i18n.class.php index 24df0034..d52eaa9b 100644 --- a/lib/i18n.class.php +++ b/lib/i18n.class.php @@ -3,9 +3,9 @@ /** * i18n dummy we'll be happy to have later */ -function __($msg) +function __($msg, $args = []) { - return $msg; + return strtr($msg, $args); } /** @@ -17,6 +17,16 @@ class i18n { public static function register() /*needed to trigger class include, presumably setup would happen here*/ { - + setlocale(LC_MONETARY, 'en_US.UTF-8'); + } + + public static function formatCurrency($amount, $currency = 'USD') + { + return '' . money_format('%.2n', $amount) . ''; + } + + public static function formatCredits($amount) + { + return '' . number_format($amount, 1) . ' LBC'; } } diff --git a/model/CreditApi.class.php b/model/CreditApi.class.php new file mode 100644 index 00000000..504c228d --- /dev/null +++ b/model/CreditApi.class.php @@ -0,0 +1,27 @@ + + +
+

+ I18n::formatCurrency($goalAmount)]) ?> + See all goals. +

+
+
+
+
+
+
+ % + funded +
+
\ No newline at end of file diff --git a/view/fund/header.php b/view/fund/header.php new file mode 100644 index 00000000..96e269cc --- /dev/null +++ b/view/fund/header.php @@ -0,0 +1,27 @@ + + +
+
+

Fund LBRY

+
+
+
+

+ + people gave + + to + + ', [ + __('build a better future'), + __('eliminate corporate middlemen'), + __('keep art alive'), + __('create a more sustainable internet'), + __('protect freedom of speech'), + __('reduce the cost of education'), + ]) ?> + +

+
+
+
\ No newline at end of file diff --git a/view/layout/basic.php b/view/layout/basic.php index 09438f9c..ad39cd97 100644 --- a/view/layout/basic.php +++ b/view/layout/basic.php @@ -1,90 +1,91 @@ - - - - - - - - - <?php echo $title ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - - -
-
- - + + + + + + + + + <?php echo $title ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + +
+
+ + \ No newline at end of file diff --git a/view/nav/footer.php b/view/nav/footer.php index 9405ef50..c7cfd750 100644 --- a/view/nav/footer.php +++ b/view/nav/footer.php @@ -3,6 +3,9 @@