From c0f6c09d1f4a918fceb6440ad9369cc19060db0e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 25 Feb 2013 05:38:26 +0100 Subject: [PATCH] First bits of a dashboard for a campaign --- public_html/modules/campaign/dashboard.php | 46 ++++++++++ public_html/rewrite.php | 5 + public_html/static/css/style.css | 96 +++++++++++++++++++- public_html/templates/campaign/dashboard.tpl | 49 ++++++++++ 4 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 public_html/modules/campaign/dashboard.php create mode 100644 public_html/templates/campaign/dashboard.tpl diff --git a/public_html/modules/campaign/dashboard.php b/public_html/modules/campaign/dashboard.php new file mode 100644 index 0000000..cb69726 --- /dev/null +++ b/public_html/modules/campaign/dashboard.php @@ -0,0 +1,46 @@ + $router->uParameters[1]), 30, true); + +} +catch (NotFoundException $e) +{ + throw new RouterException("Campaign does not exist."); +} + +$sPaymentMethods = array(); + +try +{ + foreach(PaymentMethod::CreateFromQuery("SELECT * FROM payment_methods WHERE `CampaignId` = :CampaignId", + array(":CampaignId" => $sCampaign->sId)) as $sPaymentMethod) + { + $sPaymentMethods[] = $sPaymentMethod->GetLogo(); + } +} +catch (NotFoundException $e) +{ + /* No payment methods...? */ +} + +$sPageTitle = "Dashboard for {$sCampaign->sName}"; +$sPageContents = NewTemplater::Render("campaign/dashboard", $locale->strings, array( + "name" => $sCampaign->sName, + "payment-methods" => $sPaymentMethods +)); + diff --git a/public_html/rewrite.php b/public_html/rewrite.php index 8bab55d..ec46951 100644 --- a/public_html/rewrite.php +++ b/public_html/rewrite.php @@ -37,6 +37,11 @@ $router->routes = array( 'authenticator' => "authenticators/user.php", 'auth_error' => "modules/error/guest.php" ), + "^/dashboard/([a-zA-Z0-9-]+)$" => array( + 'target' => "modules/campaign/dashboard.php", + 'authenticator' => "authenticators/user.php", + 'auth_error' => "modules/error/guest.php" + ), "^/campaign/([a-zA-Z0-9-]+)$" => "modules/landing.php", "^/campaign/([a-zA-Z0-9-]+)/subscribe$" => "modules/subscribe.php" ) diff --git a/public_html/static/css/style.css b/public_html/static/css/style.css index ea351d5..02900a2 100644 --- a/public_html/static/css/style.css +++ b/public_html/static/css/style.css @@ -93,6 +93,12 @@ pre.debug margin-bottom: 24px; } +.main h3 +{ + font-size: 26px; + margin-bottom: 12px; +} + /************************************** * FOOTER * **************************************/ @@ -396,24 +402,39 @@ td.meta * LOGOS * **************************************/ +.logo +{ + margin-right: 17px; +} + .logo.thumb { margin-right: 11px; } +img.logo +{ + vertical-align: bottom; +} + img.logo.thumb { vertical-align: middle; height: 20px; } -div.logo.thumb +div.logo { - font-size: 18px; font-weight: bold; font-style: italic; color: #1F2E0B; display: inline-block; + font-size: 39px; +} + +div.logo.thumb +{ + font-size: 18px; } /************************************** @@ -425,6 +446,77 @@ td.payment-methods max-width: 240px; } +.dashboard-section +{ + margin-top: 18px; +} + +/************************************** + * BAR GRAPH * + **************************************/ + +.bar-graph +{ + margin-top: 12px; + float: left; + height: 80px; + width: 580px; + border: 1px solid silver; +} + +.bar-graph .area +{ + float: left; + height: 80px; +} + +.bar-graph .area.unsubscribed, .graph-legend .item .box.unsubscribed +{ + background-color: #676767; +} + +.bar-graph .area.not-donated, .graph-legend .item .box.not-donated +{ + background-color: #9C9C9C; +} + +.bar-graph .area.donated, .graph-legend .item .box.donated +{ + background-color: #85E142; +} + +.bar-graph .area.subscribed, .graph-legend .item .box.subscribed +{ + background-color: #19D00D; +} + +.graph-legend +{ + float: left; + margin-top: 10px; + margin-left: 24px; +} + +.graph-legend .item +{ + margin-top: 2px; +} + +.graph-legend .item .box +{ + float: left; + width: 16px; + height: 16px; + border: 1px solid gray; +} + +.graph-legend .item .description +{ + float: left; + font-weight: bold; + margin-left: 8px; +} + /************************************** * LANDING * **************************************/ diff --git a/public_html/templates/campaign/dashboard.tpl b/public_html/templates/campaign/dashboard.tpl new file mode 100644 index 0000000..c8099c3 --- /dev/null +++ b/public_html/templates/campaign/dashboard.tpl @@ -0,0 +1,49 @@ +

Dashboard > {%?name}

+ +
+

Past month

+ +
+
+
+
+
+
+ +
+
+
+
23 new subscriptions
+
+
+
+
+
49 donations
+
+
+
+
+
16 non-donations
+
+
+
+
+
12 unsubscriptions
+
+
+
+ +
+
+ +
+

Payment methods

+ + {%foreach method in payment-methods} + {%if isempty|method[image] == false} + + {%else} + + {%/if} + {%/foreach} +