Skip to content

Commit

Permalink
CiviGrant - Migrate navigation menu to extension
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Nov 29, 2021
1 parent 0ab8634 commit 17b9c8e
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 14 deletions.
1 change: 1 addition & 0 deletions Civi/Api4/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
* @package Civi\Api4
*/
class Navigation extends Generic\DAOEntity {
use Generic\Traits\ManagedEntity;

}
109 changes: 109 additions & 0 deletions ext/civigrant/managed/Navigation_Grants.mgd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php
return [
[
'name' => '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',
],
],
],
];
14 changes: 0 additions & 14 deletions xml/templates/civicrm_navigation.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 17b9c8e

Please sign in to comment.