From: David Thompson Date: Tue, 30 Sep 2014 20:04:07 +0000 (-0400) Subject: Render the CiviMember component on the dashboard. X-Git-Tag: v0.1~65 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c0c13cfa0fddacef891a8150717e8507db6e06b2;p=org.fsf.memberdashboard.git Render the CiviMember component on the dashboard. * CRM/Memberdashboard/Page/MemberDashboard.php (buildDashboard): New method. * templates/CRM/Memberdashboard/Page/MemberDashboard.tpl: Render component. --- diff --git a/CRM/Memberdashboard/Page/MemberDashboard.php b/CRM/Memberdashboard/Page/MemberDashboard.php index 3cc8669..f25a94e 100644 --- a/CRM/Memberdashboard/Page/MemberDashboard.php +++ b/CRM/Memberdashboard/Page/MemberDashboard.php @@ -18,11 +18,30 @@ class CRM_Memberdashboard_Page_MemberDashboard extends CRM_Core_Page { $this->contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults); } + function buildDashboard() { + $components = CRM_Core_Component::getEnabledComponents(); + + // Use the CiviMember component dashboard. + $memberComponent = $components['CiviMember']; + $elem = $memberComponent->getUserDashboardElement(); + $userDashboard = $memberComponent->getUserDashboardObject(); + $userDashboard->run(); + $dashboardElement = array( + 'class' => 'crm-dashboard-' . strtolower($memberComponent->name), + 'sectionTitle' => $elem['title'], + 'templatePath' => $userDashboard->getTemplateFileName(), + 'weight' => $elem['weight'], + ); + $this->assign('element', $dashboardElement); + } + function run() { CRM_Utils_System::setTitle(ts('Welcome, ') . $this->contact->first_name . '!'); $this->assign('contact', $this->contact); + $this->buildDashboard(); + parent::run(); } } diff --git a/templates/CRM/Memberdashboard/Page/MemberDashboard.tpl b/templates/CRM/Memberdashboard/Page/MemberDashboard.tpl index c3d4651..8d51908 100644 --- a/templates/CRM/Memberdashboard/Page/MemberDashboard.tpl +++ b/templates/CRM/Memberdashboard/Page/MemberDashboard.tpl @@ -2,3 +2,10 @@

Your display name is {$contact->display_name}

Your contact ID is #{$contact->id}

+ + + +
{$element.sectionTitle}
+ {include file=$element.templatePath} + +