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
14 changed files
with
1,256 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', | ||
], | ||
], | ||
], | ||
]; |
157 changes: 157 additions & 0 deletions
157
ext/user_dashboard/managed/SavedSearch_UserDashboard_Groups.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,157 @@ | ||
<?php | ||
use CRM_UserDashboard_ExtensionUtil as E; | ||
|
||
return [ | ||
[ | ||
'name' => 'SavedSearch_UserDashboard_Groups', | ||
'entity' => 'SavedSearch', | ||
'cleanup' => 'unused', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Groups', | ||
'label' => E::ts('User Dashboard - Groups'), | ||
'api_entity' => 'Group', | ||
'api_params' => [ | ||
'version' => 4, | ||
'select' => [ | ||
'frontend_title', | ||
'Group_GroupContact_Contact_01.status:label', | ||
'MAX(Group_SubscriptionHistory_group_id_01.date) AS MAX_Group_SubscriptionHistory_group_id_01_date', | ||
], | ||
'orderBy' => [], | ||
'where' => [ | ||
[ | ||
'Group_GroupContact_Contact_01.id', | ||
'=', | ||
'user_contact_id', | ||
], | ||
[ | ||
'visibility:name', | ||
'=', | ||
'Public Pages', | ||
], | ||
[ | ||
'is_active', | ||
'=', | ||
TRUE, | ||
], | ||
], | ||
'groupBy' => [ | ||
'id', | ||
'Group_GroupContact_Contact_01.id', | ||
], | ||
'join' => [ | ||
[ | ||
'Contact AS Group_GroupContact_Contact_01', | ||
'LEFT', | ||
'GroupContact', | ||
[ | ||
'id', | ||
'=', | ||
'Group_GroupContact_Contact_01.group_id', | ||
], | ||
], | ||
[ | ||
'SubscriptionHistory AS Group_SubscriptionHistory_group_id_01', | ||
'LEFT', | ||
[ | ||
'id', | ||
'=', | ||
'Group_SubscriptionHistory_group_id_01.group_id', | ||
], | ||
[ | ||
'Group_SubscriptionHistory_group_id_01.contact_id', | ||
'=', | ||
'"user_contact_id"', | ||
], | ||
], | ||
], | ||
'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_Groups_SearchDisplay_UserDashboard_Groups', | ||
'entity' => 'SearchDisplay', | ||
'cleanup' => 'unused', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Groups', | ||
'label' => E::ts('Your Group(s)'), | ||
'saved_search_id.name' => 'UserDashboard_Groups', | ||
'type' => 'table', | ||
'settings' => [ | ||
'description' => NULL, | ||
'sort' => [ | ||
[ | ||
'Group_GroupContact_Contact_01.status', | ||
'ASC', | ||
], | ||
], | ||
'limit' => 50, | ||
'pager' => [ | ||
'expose_limit' => TRUE, | ||
'hide_single' => TRUE, | ||
], | ||
'placeholder' => 1, | ||
'columns' => [ | ||
[ | ||
'type' => 'field', | ||
'key' => 'frontend_title', | ||
'dataType' => 'String', | ||
'label' => E::ts('Group'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'Group_GroupContact_Contact_01.status:label', | ||
'dataType' => 'String', | ||
'label' => E::ts('Status'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'MAX_Group_SubscriptionHistory_group_id_01_date', | ||
'dataType' => 'Timestamp', | ||
'label' => E::ts('Since'), | ||
'sortable' => TRUE, | ||
], | ||
], | ||
'actions' => FALSE, | ||
'classes' => [ | ||
'table', | ||
'table-striped', | ||
], | ||
'cssRules' => [ | ||
[ | ||
'disabled', | ||
'Group_GroupContact_Contact_01.status', | ||
'=', | ||
'Removed', | ||
], | ||
], | ||
], | ||
], | ||
'match' => [ | ||
'name', | ||
'saved_search_id', | ||
], | ||
], | ||
], | ||
]; |
Oops, something went wrong.