Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27792 from colemanw/userDashboard
Add user_dashboard core extension (alpha)
- Loading branch information
Showing
15 changed files
with
1,422 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' => 'Dashboard_Tag', | ||
'entity' => 'Tag', | ||
'cleanup' => 'always', | ||
'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', | ||
], | ||
], | ||
], | ||
]; |
175 changes: 175 additions & 0 deletions
175
ext/user_dashboard/managed/SavedSearch_UserDashboard_Activities.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,175 @@ | ||
<?php | ||
use CRM_UserDashboard_ExtensionUtil as E; | ||
|
||
return [ | ||
[ | ||
'name' => 'SavedSearch_UserDashboard_Activities', | ||
'entity' => 'SavedSearch', | ||
'cleanup' => 'always', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Activities', | ||
'label' => E::ts('User Dashboard - Activities'), | ||
'api_entity' => 'Activity', | ||
'api_params' => [ | ||
'version' => 4, | ||
'select' => [ | ||
'subject', | ||
'activity_type_id:label', | ||
'GROUP_CONCAT(DISTINCT Activity_ActivityContact_Contact_01.sort_name) AS GROUP_CONCAT_Activity_ActivityContact_Contact_01_sort_name', | ||
'GROUP_CONCAT(DISTINCT Activity_ActivityContact_Contact_02.sort_name) AS GROUP_CONCAT_Activity_ActivityContact_Contact_02_sort_name', | ||
'activity_date_time', | ||
'status_id:label', | ||
], | ||
'orderBy' => [], | ||
'where' => [ | ||
[ | ||
'status_id:name', | ||
'!=', | ||
'Completed', | ||
], | ||
], | ||
'groupBy' => [ | ||
'id', | ||
], | ||
'join' => [ | ||
[ | ||
'Contact AS Activity_ActivityContact_Contact_01', | ||
'LEFT', | ||
'ActivityContact', | ||
[ | ||
'id', | ||
'=', | ||
'Activity_ActivityContact_Contact_01.activity_id', | ||
], | ||
[ | ||
'Activity_ActivityContact_Contact_01.record_type_id:name', | ||
'=', | ||
'"Activity Source"', | ||
], | ||
], | ||
[ | ||
'Contact AS Activity_ActivityContact_Contact_02', | ||
'LEFT', | ||
'ActivityContact', | ||
[ | ||
'id', | ||
'=', | ||
'Activity_ActivityContact_Contact_02.activity_id', | ||
], | ||
[ | ||
'Activity_ActivityContact_Contact_02.record_type_id:name', | ||
'=', | ||
'"Activity Targets"', | ||
], | ||
], | ||
[ | ||
'Contact AS Activity_ActivityContact_Contact_03', | ||
'INNER', | ||
'ActivityContact', | ||
[ | ||
'id', | ||
'=', | ||
'Activity_ActivityContact_Contact_03.activity_id', | ||
], | ||
[ | ||
'Activity_ActivityContact_Contact_03.record_type_id:name', | ||
'=', | ||
'"Activity Assignees"', | ||
], | ||
[ | ||
'Activity_ActivityContact_Contact_03.id', | ||
'=', | ||
'"user_contact_id"', | ||
], | ||
], | ||
], | ||
'having' => [], | ||
], | ||
], | ||
'match' => [ | ||
'name', | ||
], | ||
], | ||
], | ||
[ | ||
'name' => 'SavedSearch_UserDashboard_Activities_SearchDisplay_UserDashboard_Activities', | ||
'entity' => 'SearchDisplay', | ||
'cleanup' => 'always', | ||
'update' => 'unmodified', | ||
'params' => [ | ||
'version' => 4, | ||
'values' => [ | ||
'name' => 'UserDashboard_Activities', | ||
'label' => E::ts('Your Assigned Activities'), | ||
'saved_search_id.name' => 'UserDashboard_Activities', | ||
'type' => 'table', | ||
'settings' => [ | ||
'description' => NULL, | ||
'sort' => [], | ||
'limit' => 20, | ||
'pager' => [ | ||
'expose_limit' => TRUE, | ||
'hide_single' => TRUE, | ||
], | ||
'placeholder' => 1, | ||
'columns' => [ | ||
[ | ||
'type' => 'field', | ||
'key' => 'activity_type_id:label', | ||
'dataType' => 'Integer', | ||
'label' => E::ts('Type'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'subject', | ||
'dataType' => 'String', | ||
'label' => E::ts('Subject'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'GROUP_CONCAT_Activity_ActivityContact_Contact_01_sort_name', | ||
'dataType' => 'String', | ||
'label' => E::ts('Added by'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'GROUP_CONCAT_Activity_ActivityContact_Contact_02_sort_name', | ||
'dataType' => 'String', | ||
'label' => E::ts('With'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'activity_date_time', | ||
'dataType' => 'Timestamp', | ||
'label' => E::ts('Date'), | ||
'sortable' => TRUE, | ||
], | ||
[ | ||
'type' => 'field', | ||
'key' => 'status_id:label', | ||
'dataType' => 'Integer', | ||
'label' => E::ts('Status'), | ||
'sortable' => TRUE, | ||
], | ||
], | ||
'actions' => FALSE, | ||
'classes' => [ | ||
'table', | ||
'table-striped', | ||
], | ||
], | ||
], | ||
'match' => [ | ||
'name', | ||
'saved_search_id', | ||
], | ||
], | ||
], | ||
]; |
Oops, something went wrong.