From 17b9c8e29acc9cf87dfecb80f6b70ad2edb84aa5 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 26 Nov 2021 21:15:54 -0500 Subject: [PATCH] CiviGrant - Migrate navigation menu to extension --- Civi/Api4/Navigation.php | 1 + .../managed/Navigation_Grants.mgd.php | 109 ++++++++++++++++++ xml/templates/civicrm_navigation.tpl | 14 --- 3 files changed, 110 insertions(+), 14 deletions(-) create mode 100644 ext/civigrant/managed/Navigation_Grants.mgd.php diff --git a/Civi/Api4/Navigation.php b/Civi/Api4/Navigation.php index 5c8a65c50013..3f3ff86f8ebc 100644 --- a/Civi/Api4/Navigation.php +++ b/Civi/Api4/Navigation.php @@ -18,5 +18,6 @@ * @package Civi\Api4 */ class Navigation extends Generic\DAOEntity { + use Generic\Traits\ManagedEntity; } diff --git a/ext/civigrant/managed/Navigation_Grants.mgd.php b/ext/civigrant/managed/Navigation_Grants.mgd.php new file mode 100644 index 000000000000..9e5ffc99cca5 --- /dev/null +++ b/ext/civigrant/managed/Navigation_Grants.mgd.php @@ -0,0 +1,109 @@ + 'Navigation_Grants', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Grants', + 'name' => 'Grants', + 'url' => NULL, + 'icon' => 'crm-i fa-money', + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'is_active' => TRUE, + 'weight' => 90, + 'parent_id' => NULL, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_Dashboard', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Dashboard', + 'name' => 'Dashboard', + 'url' => 'civicrm/grant?reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_New Grant', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'New Grant', + 'name' => 'New Grant', + 'url' => 'civicrm/grant/add?reset=1&action=add&context=standalone', + 'icon' => NULL, + 'permission' => 'access CiviGrant,edit grants', + 'permission_operator' => 'AND', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_Find Grants', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Find Grants', + 'name' => 'Find Grants', + 'url' => 'civicrm/grant/search?reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator:name' => 'After menu element', + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_Grant Reports', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Grant Reports', + 'name' => 'Grant Reports', + 'url' => 'civicrm/report/list?compid=5&reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator:name' => 'None', + 'domain_id' => 'current_domain', + ], + ], + ], +]; diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index 601f16d38d0b..1666f753cf35 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -248,20 +248,6 @@ VALUES ( @domainID, 'civicrm/case/search?reset=1', '{ts escape="sql" skip="true"}Find Cases{/ts}', 'Find Cases', 'access my cases and activities,access all cases and activities', 'OR', @caselastID, '1', 1, 3 ), ( @domainID, 'civicrm/report/list?compid=7&reset=1', '{ts escape="sql" skip="true"}Case Reports{/ts}', 'Case Reports', 'access my cases and activities,access all cases and activities,administer CiviCase', 'OR', @caselastID, '1', 0, 4 ); -INSERT INTO civicrm_navigation - ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight, icon ) -VALUES - ( @domainID, NULL, '{ts escape="sql" skip="true"}Grants{/ts}', 'Grants', 'access CiviGrant', '', NULL, '1', NULL, 90, 'crm-i fa-money' ); - -SET @grantlastID:=LAST_INSERT_ID(); -INSERT INTO civicrm_navigation - ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) -VALUES - ( @domainID, 'civicrm/grant?reset=1', '{ts escape="sql" skip="true"}Dashboard{/ts}', 'Dashboard', 'access CiviGrant', '', @grantlastID, '1', NULL, 1 ), - ( @domainID, 'civicrm/grant/add?reset=1&action=add&context=standalone', '{ts escape="sql" skip="true"}New Grant{/ts}', 'New Grant', 'access CiviGrant,edit grants', 'AND', @grantlastID, '1', NULL, 2 ), - ( @domainID, 'civicrm/grant/search?reset=1', '{ts escape="sql" skip="true"}Find Grants{/ts}', 'Find Grants', 'access CiviGrant', '', @grantlastID, '1', 1, 3 ), - ( @domainID, 'civicrm/report/list?compid=5&reset=1', '{ts escape="sql" skip="true"}Grant Reports{/ts}', 'Grant Reports', 'access CiviGrant', '', @grantlastID, '1', 0, 4 ); - INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight, icon ) VALUES