Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user_dashboard core extension (alpha)
- Loading branch information
Showing
12 changed files
with
945 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ civi_member | |
civi_pledge | ||
civi_report | ||
scheduled_communications | ||
user_dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
use CRM_UserDashboard_ExtensionUtil as E; | ||
|
||
$afform = [ | ||
'type' => 'search', | ||
'title' => E::ts('User Dashboard'), | ||
'server_route' => 'civicrm/user', | ||
'permission' => ['access Contact Dashboard'], | ||
'layout' => '', | ||
// temporary, remove after merging https://github.com/civicrm/civicrm-core/pull/27783 | ||
'requires' => ['af', 'afCore', 'crmSearchDisplayTable'], | ||
]; | ||
|
||
// Add displays for every SavedSearch tagged "UserDashboard" | ||
$searchDisplays = civicrm_api4('SearchDisplay', 'get', [ | ||
'checkPermissions' => FALSE, | ||
'select' => ['name', 'label', 'type:name', 'saved_search_id.name'], | ||
'where' => [ | ||
['saved_search_id.is_current', '=', TRUE], | ||
['saved_search_id.tags:name', 'IN', ['UserDashboard']], | ||
], | ||
'orderBy' => ['name' => 'ASC'], | ||
]); | ||
foreach ($searchDisplays as $display) { | ||
$afform['layout'] .= <<<HTML | ||
<div af-fieldset="" class="af-container-style-pane" af-title="$display[label]"> | ||
<{$display['type:name']} search-name="{$display['saved_search_id.name']}" display-name="$display[name]"></{$display['type:name']}> | ||
</div> | ||
HTML; | ||
} | ||
|
||
return $afform; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<extension key="user_dashboard" type="module"> | ||
<file>user_dashboard</file> | ||
<name>User Dashboard</name> | ||
<description>Adds a page for users to see their contributions, memberships, etc.</description> | ||
<license>AGPL-3.0</license> | ||
<maintainer> | ||
<author>CiviCRM</author> | ||
<email>info@civicrm.org</email> | ||
</maintainer> | ||
<urls> | ||
<url desc="Main Extension Page">http://FIXME</url> | ||
<url desc="Documentation">http://FIXME</url> | ||
<url desc="Support">http://FIXME</url> | ||
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url> | ||
</urls> | ||
<releaseDate>2023-10-07</releaseDate> | ||
<version>1.0</version> | ||
<develStage>alpha</develStage> | ||
<compatibility> | ||
<ver>5.68.alpha1</ver> | ||
</compatibility> | ||
<comments>This extension is still experimental</comments> | ||
<classloader> | ||
<psr0 prefix="CRM_" path="."/> | ||
<psr4 prefix="Civi\" path="Civi"/> | ||
</classloader> | ||
<civix> | ||
<namespace>CRM/UserDashboard</namespace> | ||
<format>23.02.1</format> | ||
<angularModule>crmUserDashboard</angularModule> | ||
</civix> | ||
<mixins> | ||
<mixin>mgd-php@1.0.0</mixin> | ||
</mixins> | ||
</extension> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
use CRM_UserDashboard_ExtensionUtil as E; | ||
|
||
return [ | ||
[ | ||
'name' => 'Tag_UserDashboard', | ||
'entity' => 'Tag', | ||
'cleanup' => 'unused', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'label' => E::ts('User Dashboard'), | ||
'name' => 'UserDashboard', | ||
'description' => E::ts('Search will appear on the User Dashboard page'), | ||
'is_reserved' => TRUE, | ||
'used_for' => [ | ||
'civicrm_saved_search', | ||
], | ||
'color' => '#5d677b', | ||
], | ||
'match' => [ | ||
'name', | ||
], | ||
], | ||
], | ||
]; |
122 changes: 122 additions & 0 deletions
122
ext/user_dashboard/managed/UserDashboard_Contributions.mgd.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
use CRM_UserDashboard_ExtensionUtil as E; | ||
|
||
if (!CRM_Core_Component::isEnabled('CiviContribute')) { | ||
return []; | ||
} | ||
|
||
return [ | ||
[ | ||
'name' => 'SavedSearch_UserDashboard_Contributions', | ||
'entity' => 'SavedSearch', | ||
'cleanup' => 'unused', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Contributions', | ||
'label' => E::ts('User Dashboard - Contributions'), | ||
'api_entity' => 'Contribution', | ||
'api_params' => [ | ||
'version' => 4, | ||
'select' => [ | ||
'total_amount', | ||
'financial_type_id:label', | ||
'contribution_status_id:label', | ||
'receive_date', | ||
'receipt_date', | ||
], | ||
'orderBy' => [], | ||
'where' => [ | ||
['contact_id', '=', 'user_contact_id'], | ||
], | ||
'groupBy' => [], | ||
'join' => [], | ||
'having' => [], | ||
], | ||
], | ||
'match' => [ | ||
'name', | ||
], | ||
'chain' => [ | ||
'tag' => [ | ||
'EntityTag', 'save', [ | ||
'records' => [['entity_table' => 'civicrm_saved_search', 'entity_id' => '$id', 'tag_id:name' => 'UserDashboard']], | ||
'match' => ['entity_id', 'tag_id'], | ||
], | ||
], | ||
], | ||
], | ||
], | ||
[ | ||
'name' => 'SavedSearch_UserDashboard_Contributions_SearchDisplay_UserDashboard_Contributions', | ||
'entity' => 'SearchDisplay', | ||
'cleanup' => 'unused', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Contributions', | ||
'label' => E::ts('Your Contribution(s)'), | ||
'saved_search_id.name' => 'UserDashboard_Contributions', | ||
'type' => 'table', | ||
'settings' => [ | ||
'description' => NULL, | ||
'sort' => [], | ||
'limit' => 50, | ||
'pager' => [ | ||
'hide_single' => TRUE, | ||
'expose_limit' => TRUE, | ||
], | ||
'placeholder' => 1, | ||
'columns' => [ | ||
[ | ||
'type' => 'field', | ||
'key' => 'total_amount', | ||
'dataType' => 'String', | ||
'label' => E::ts('Total Amount'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'financial_type_id:label', | ||
'dataType' => 'String', | ||
'label' => E::ts('Type'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'receive_date', | ||
'dataType' => 'Date', | ||
'label' => E::ts('Date'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'receipt_date', | ||
'dataType' => 'Date', | ||
'label' => E::ts('Receipt Sent'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'contribution_status_id:label', | ||
'dataType' => 'String', | ||
'label' => E::ts('Status'), | ||
'sortable' => TRUE, | ||
], | ||
], | ||
'actions' => FALSE, | ||
'classes' => [ | ||
'table', | ||
'table-striped', | ||
], | ||
], | ||
], | ||
'match' => [ | ||
'name', | ||
'saved_search_id', | ||
], | ||
], | ||
], | ||
]; |
114 changes: 114 additions & 0 deletions
114
ext/user_dashboard/managed/UserDashboard_Events.mgd.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php | ||
use CRM_UserDashboard_ExtensionUtil as E; | ||
|
||
if (!CRM_Core_Component::isEnabled('CiviEvent')) { | ||
return []; | ||
} | ||
|
||
return [ | ||
[ | ||
'name' => 'SavedSearch_UserDashboard_Events', | ||
'entity' => 'SavedSearch', | ||
'cleanup' => 'unused', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Events', | ||
'label' => E::ts('User Dashboard - Events'), | ||
'api_entity' => 'Participant', | ||
'api_params' => [ | ||
'version' => 4, | ||
'select' => [ | ||
'event_id.title', | ||
'role_id:label', | ||
'status_id:label', | ||
'event_id.start_date', | ||
], | ||
'orderBy' => [], | ||
'where' => [ | ||
['contact_id', '=', 'user_contact_id'], | ||
], | ||
'groupBy' => [], | ||
'join' => [], | ||
'having' => [], | ||
], | ||
], | ||
'match' => [ | ||
'name', | ||
], | ||
'chain' => [ | ||
'tag' => [ | ||
'EntityTag', 'save', [ | ||
'records' => [['entity_table' => 'civicrm_saved_search', 'entity_id' => '$id', 'tag_id:name' => 'UserDashboard']], | ||
'match' => ['entity_id', 'tag_id'], | ||
], | ||
], | ||
], | ||
], | ||
], | ||
[ | ||
'name' => 'SavedSearch_UserDashboard_Events_SearchDisplay_UserDashboard_Events', | ||
'entity' => 'SearchDisplay', | ||
'cleanup' => 'unused', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Events', | ||
'label' => E::ts('Your Event(s)'), | ||
'saved_search_id.name' => 'UserDashboard_Events', | ||
'type' => 'table', | ||
'settings' => [ | ||
'description' => NULL, | ||
'sort' => [], | ||
'limit' => 50, | ||
'pager' => [ | ||
'hide_single' => TRUE, | ||
'expose_limit' => TRUE, | ||
], | ||
'placeholder' => 1, | ||
'columns' => [ | ||
[ | ||
'type' => 'field', | ||
'key' => 'event_id.title', | ||
'dataType' => 'String', | ||
'label' => E::ts('Event'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'event_id.start_date', | ||
'dataType' => 'Date', | ||
'label' => E::ts('Event Date'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'role_id:label', | ||
'dataType' => 'String', | ||
'label' => E::ts('Role'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'status_id:label', | ||
'dataType' => 'String', | ||
'label' => E::ts('Status'), | ||
'sortable' => TRUE, | ||
], | ||
], | ||
'actions' => FALSE, | ||
'classes' => [ | ||
'table', | ||
'table-striped', | ||
], | ||
], | ||
], | ||
'match' => [ | ||
'name', | ||
'saved_search_id', | ||
], | ||
], | ||
], | ||
]; |
Oops, something went wrong.