From ea88b7a772df6f7fa3ca75ac320367a6e386a1e8 Mon Sep 17 00:00:00 2001 From: Alexandre Gain <270117159+alexandregain-xprl@users.noreply.github.com> Date: Sun, 15 Nov 2026 17:48:01 +0100 Subject: [PATCH] refactor(plugin): rebrand as MT3SMarketingProgram, release 0.17.0 Rename the plugin's vendor/namespace from experiential/Program to mt3s/MT3SMarketingProgram (composer: mt3s/mautic-marketing-program-bundle): - ProgramBundle -> MT3SMarketingProgramBundle; extension, integration, config support, permissions, events and twig extension renamed likewise - Initiative* -> Program*: controller (InitiativeController -> ProgramController), model, entities, repositories, form types and views (new _tabs/_task_table/_tab_table_filter partials, details page) - Settings config form theme -> _config_mt3smarketingprogramconfig_widget; routes and translations re-prefixed (mt3s_marketing_program_*) - Assets: icon.svg -> mt3s-mp-icon.svg; program.js -> mt3s-mp-program.js (OnLoad hooks renamed mt3sMpProgram*) - Add Command/RefreshStatsCommand; Migrations/Version_0_17_0.php renames the tables to mt3s_mp_program_* --- Assets/img/{icon.svg => mt3s-mp-icon.svg} | 0 Assets/js/{program.js => mt3s-mp-program.js} | 148 ++--- Command/RefreshStatsCommand.php | 135 ++++ Config/config.php | 203 +++--- Config/services.php | 24 +- Controller/AudienceController.php | 26 +- Controller/ItemTypesController.php | 26 +- ...veController.php => ProgramController.php} | 56 +- Controller/StakeholderController.php | 18 +- Controller/TaskController.php | 76 +-- Controller/UtmTaxonomyController.php | 13 +- ....php => MT3SMarketingProgramExtension.php} | 4 +- Entity/Audience.php | 68 +- Entity/AudiencePriority.php | 6 +- Entity/AudienceRepository.php | 6 +- Entity/AudienceType.php | 6 +- Entity/CountsItemsByTypeTrait.php | 4 +- Entity/DateRangeInterface.php | 2 +- Entity/DependencyType.php | 4 +- Entity/{Initiative.php => Program.php} | 116 ++-- ...tionItem.php => ProgramAllocationItem.php} | 30 +- ...hp => ProgramAllocationItemRepository.php} | 6 +- ...iativeAudience.php => ProgramAudience.php} | 30 +- ...tory.php => ProgramAudienceRepository.php} | 6 +- ...ionItem.php => ProgramDescriptionItem.php} | 30 +- ...p => ProgramDescriptionItemRepository.php} | 6 +- ...tiveObjective.php => ProgramObjective.php} | 34 +- ...ory.php => ProgramObjectiveRepository.php} | 6 +- ...veRepository.php => ProgramRepository.php} | 6 +- ...Stakeholder.php => ProgramStakeholder.php} | 44 +- ...y.php => ProgramStakeholderRepository.php} | 6 +- ...InitiativeStatus.php => ProgramStatus.php} | 8 +- Entity/RaciRole.php | 4 +- Entity/Stakeholder.php | 38 +- Entity/StakeholderRepository.php | 2 +- Entity/Task.php | 40 +- Entity/TaskDependency.php | 4 +- Entity/TaskDependencyRepository.php | 2 +- Entity/TaskKind.php | 4 +- Entity/TaskRaci.php | 6 +- Entity/TaskRaciRepository.php | 2 +- Entity/TaskRepository.php | 14 +- Entity/TaskStatus.php | 4 +- Event/MT3SMarketingProgramEvents.php | 32 + Event/ProgramEvent.php | 30 + EventListener/ConfigSubscriber.php | 10 +- EventListener/PluginInstallSubscriber.php | 4 +- Form/Type/AudienceType.php | 46 +- Form/Type/ConfigType.php | 24 +- Form/Type/ItemTypeConfigType.php | 24 +- Form/Type/ItemTypesType.php | 8 +- ...Type.php => ProgramAllocationItemType.php} | 38 +- ...dienceType.php => ProgramAudienceType.php} | 30 +- ...ype.php => ProgramDescriptionItemType.php} | 32 +- ...ctiveType.php => ProgramObjectiveType.php} | 42 +- ...derType.php => ProgramStakeholderType.php} | 26 +- .../{InitiativeType.php => ProgramType.php} | 76 +-- Form/Type/StakeholderType.php | 24 +- Form/Type/TaskDependencyType.php | 36 +- Form/Type/TaskRaciType.php | 42 +- Form/Type/TaskType.php | 56 +- ...hp => MT3SMarketingProgramIntegration.php} | 10 +- .../MT3SMarketingProgramConfigSupport.php | 14 + Integration/Support/ProgramConfigSupport.php | 14 - MT3SMarketingProgramBundle.php | 11 + Migrations/Version_0_10_0.php | 8 +- Migrations/Version_0_10_1.php | 8 +- Migrations/Version_0_11_0.php | 20 +- Migrations/Version_0_12_0.php | 24 +- Migrations/Version_0_13_0.php | 24 +- Migrations/Version_0_14_0.php | 15 +- Migrations/Version_0_15_0.php | 8 +- Migrations/Version_0_16_0.php | 5 +- Migrations/Version_0_17_0.php | 218 +++++++ Migrations/Version_0_2_0.php | 10 +- Migrations/Version_0_3_0.php | 13 +- Migrations/Version_0_4_0.php | 15 +- Migrations/Version_0_5_0.php | 8 +- Migrations/Version_0_6_0.php | 19 +- Migrations/Version_0_7_0.php | 17 +- Migrations/Version_0_8_0.php | 9 +- Migrations/Version_0_9_0.php | 6 +- Model/AudienceModel.php | 16 +- Model/InitiativeModel.php | 77 --- Model/ProgramModel.php | 113 ++++ Model/StakeholderModel.php | 16 +- Model/TaskModel.php | 20 +- ProgramBundle.php | 11 - Resources/views/Audience/details.html.twig | 86 +-- Resources/views/Audience/form.html.twig | 16 +- Resources/views/Audience/list.html.twig | 96 +-- ...t3smarketingprogramconfig_widget.html.twig | 24 + .../_config_programconfig_widget.html.twig | 24 - .../Initiative/_tab_table_filter.html.twig | 11 - Resources/views/Initiative/_tabs.html.twig | 32 - .../views/Initiative/_task_table.html.twig | 93 --- Resources/views/Initiative/details.html.twig | 449 ------------- Resources/views/ItemTypes/form.html.twig | 70 +-- .../_description_read_more.html.twig | 14 +- .../views/Program/_tab_table_filter.html.twig | 11 + Resources/views/Program/_tabs.html.twig | 32 + Resources/views/Program/_task_table.html.twig | 93 +++ Resources/views/Program/details.html.twig | 449 +++++++++++++ .../{Initiative => Program}/form.html.twig | 156 ++--- .../{Initiative => Program}/list.html.twig | 84 +-- Resources/views/Stakeholder/details.html.twig | 60 +- Resources/views/Stakeholder/form.html.twig | 16 +- Resources/views/Stakeholder/list.html.twig | 108 ++-- Resources/views/Task/form.html.twig | 68 +- Resources/views/Task/list.html.twig | 94 +-- Resources/views/UtmTaxonomy/list.html.twig | 10 +- .../MT3SMarketingProgramPermissions.php | 53 ++ Security/Permissions/ProgramPermissions.php | 53 -- Service/AudienceAttributes.php | 26 +- Service/CurrencyProvider.php | 8 +- Service/ItemTypeInUseGuard.php | 18 +- Service/ItemTypeProvider.php | 32 +- Service/Pictograms.php | 2 +- Translations/en_US/flashes.ini | 2 +- Translations/en_US/messages.ini | 595 +++++++++--------- Translations/en_US/validators.ini | 46 +- Twig/MT3SMarketingProgramExtension.php | 151 +++++ Twig/ProgramExtension.php | 151 ----- .../Constraints/EndDateAfterStartDate.php | 4 +- .../EndDateAfterStartDateValidator.php | 4 +- Validator/Constraints/TaskDates.php | 4 +- Validator/Constraints/TaskDatesValidator.php | 6 +- Validator/Constraints/ValidTaskDependency.php | 8 +- .../ValidTaskDependencyValidator.php | 8 +- composer.json | 10 +- readme.md | 215 +++---- 131 files changed, 3238 insertions(+), 2836 deletions(-) rename Assets/img/{icon.svg => mt3s-mp-icon.svg} (100%) rename Assets/js/{program.js => mt3s-mp-program.js} (72%) create mode 100644 Command/RefreshStatsCommand.php rename Controller/{InitiativeController.php => ProgramController.php} (66%) rename DependencyInjection/{ProgramExtension.php => MT3SMarketingProgramExtension.php} (82%) rename Entity/{Initiative.php => Program.php} (82%) rename Entity/{InitiativeAllocationItem.php => ProgramAllocationItem.php} (82%) rename Entity/{InitiativeAllocationItemRepository.php => ProgramAllocationItemRepository.php} (54%) rename Entity/{InitiativeAudience.php => ProgramAudience.php} (79%) rename Entity/{InitiativeAudienceRepository.php => ProgramAudienceRepository.php} (51%) rename Entity/{InitiativeDescriptionItem.php => ProgramDescriptionItem.php} (75%) rename Entity/{InitiativeDescriptionItemRepository.php => ProgramDescriptionItemRepository.php} (53%) rename Entity/{InitiativeObjective.php => ProgramObjective.php} (82%) rename Entity/{InitiativeObjectiveRepository.php => ProgramObjectiveRepository.php} (55%) rename Entity/{InitiativeRepository.php => ProgramRepository.php} (89%) rename Entity/{InitiativeStakeholder.php => ProgramStakeholder.php} (64%) rename Entity/{InitiativeStakeholderRepository.php => ProgramStakeholderRepository.php} (50%) rename Entity/{InitiativeStatus.php => ProgramStatus.php} (80%) create mode 100644 Event/MT3SMarketingProgramEvents.php create mode 100644 Event/ProgramEvent.php rename Form/Type/{InitiativeAllocationItemType.php => ProgramAllocationItemType.php} (67%) rename Form/Type/{InitiativeAudienceType.php => ProgramAudienceType.php} (70%) rename Form/Type/{InitiativeDescriptionItemType.php => ProgramDescriptionItemType.php} (60%) rename Form/Type/{InitiativeObjectiveType.php => ProgramObjectiveType.php} (64%) rename Form/Type/{InitiativeStakeholderType.php => ProgramStakeholderType.php} (65%) rename Form/Type/{InitiativeType.php => ProgramType.php} (70%) rename Integration/{ProgramIntegration.php => MT3SMarketingProgramIntegration.php} (58%) create mode 100644 Integration/Support/MT3SMarketingProgramConfigSupport.php delete mode 100644 Integration/Support/ProgramConfigSupport.php create mode 100644 MT3SMarketingProgramBundle.php create mode 100644 Migrations/Version_0_17_0.php delete mode 100644 Model/InitiativeModel.php create mode 100644 Model/ProgramModel.php delete mode 100644 ProgramBundle.php create mode 100644 Resources/views/FormTheme/Config/_config_mt3smarketingprogramconfig_widget.html.twig delete mode 100644 Resources/views/FormTheme/Config/_config_programconfig_widget.html.twig delete mode 100644 Resources/views/Initiative/_tab_table_filter.html.twig delete mode 100644 Resources/views/Initiative/_tabs.html.twig delete mode 100644 Resources/views/Initiative/_task_table.html.twig delete mode 100644 Resources/views/Initiative/details.html.twig rename Resources/views/{Initiative => Program}/_description_read_more.html.twig (51%) create mode 100644 Resources/views/Program/_tab_table_filter.html.twig create mode 100644 Resources/views/Program/_tabs.html.twig create mode 100644 Resources/views/Program/_task_table.html.twig create mode 100644 Resources/views/Program/details.html.twig rename Resources/views/{Initiative => Program}/form.html.twig (54%) rename Resources/views/{Initiative => Program}/list.html.twig (66%) create mode 100644 Security/Permissions/MT3SMarketingProgramPermissions.php delete mode 100644 Security/Permissions/ProgramPermissions.php create mode 100644 Twig/MT3SMarketingProgramExtension.php delete mode 100644 Twig/ProgramExtension.php diff --git a/Assets/img/icon.svg b/Assets/img/mt3s-mp-icon.svg similarity index 100% rename from Assets/img/icon.svg rename to Assets/img/mt3s-mp-icon.svg diff --git a/Assets/js/program.js b/Assets/js/mt3s-mp-program.js similarity index 72% rename from Assets/js/program.js rename to Assets/js/mt3s-mp-program.js index f1aa32c..07f73d6 100644 --- a/Assets/js/program.js +++ b/Assets/js/mt3s-mp-program.js @@ -2,26 +2,26 @@ * Plan plugin scripts. * * - Plan form: editable, sortable rows (objectives, description items, allocation items), the selected - * item type's description, and tab error markers. Started by Mautic.programOnLoad(), which Mautic calls after - * it loads any page whose mauticContent is "initiative", including pages loaded through Ajax. - * - Task form (mauticContent "programTask", started by Mautic.programTaskOnLoad()): the dependencies and - * the RACI rows work like the initiative form's collections; the selected kind enslaves a milestone's + * item type's description, and tab error markers. Started by Mautic.mt3sMpProgramOnLoad(), which Mautic calls after + * it loads any page whose mauticContent is "program", including pages loaded through Ajax. + * - Task form (mauticContent "mt3sMpProgramTask", started by Mautic.mt3sMpProgramTaskOnLoad()): the dependencies and + * the RACI rows work like the program form's collections; the selected kind enslaves a milestone's * end date; the selected type's description and pictogram sit next to the type dropdown. - * - Audience form (mauticContent "programAudience", started by Mautic.programAudienceOnLoad()): the selected + * - Audience form (mauticContent "mt3sMpProgramAudience", started by Mautic.mt3sMpProgramAudienceOnLoad()): the selected * type's pictogram next to the type dropdown (fixed per type, not admin-configured). * - Settings > Configuration > Plan: adding and removing item types (delegated handlers, - * because that page isn't a "initiative" page). + * because that page isn't a "program" page). */ -Mautic.programAudienceOnLoad = function (container) { +Mautic.mt3sMpProgramAudienceOnLoad = function (container) { // The type dropdown's pictogram is fixed per type (AudienceType), not admin-configured: it is - // rendered from the value server-side (the program_audience_type_icon filter), and updated here. + // rendered from the value server-side (the mt3s_marketing_program_audience_type_icon filter), and updated here. mQuery(container).find('select[name$="[audienceType]"]').each(function () { var $select = mQuery(this); - if ($select.data('programAudienceInitialized')) { + if ($select.data('mt3sMpProgramAudienceInitialized')) { return; } - $select.data('programAudienceInitialized', true); + $select.data('mt3sMpProgramAudienceInitialized', true); // The same icons as AudienceType::getIcon(). var icons = { @@ -34,30 +34,30 @@ Mautic.programAudienceOnLoad = function (container) { $select.on('change', function () { var icon = icons[mQuery(this).val()] || 'ri-user-heart-line'; - mQuery(this).closest('form').find('.initiative-item-type-icon').first() - .attr('class', 'initiative-item-type-icon ' + icon); + mQuery(this).closest('form').find('.program-item-type-icon').first() + .attr('class', 'program-item-type-icon ' + icon); }); }); }; -Mautic.programTaskOnLoad = function (container) { - // The dependencies and RACI rows work like the initiative form's collections. - mQuery(container).find('.initiative-collection').each(function () { - Mautic.programInitCollection(mQuery(this)); +Mautic.mt3sMpProgramTaskOnLoad = function (container) { + // The dependencies and RACI rows work like the program form's collections. + mQuery(container).find('.program-collection').each(function () { + Mautic.mt3sMpProgramInitCollection(mQuery(this)); }); - // The type dropdown works the same way as in the initiative form. - mQuery(container).find('select.initiative-item-type').each(function () { + // The type dropdown works the same way as in the program form. + mQuery(container).find('select.program-item-type').each(function () { var $select = mQuery(this); - if ($select.data('programTaskInitialized')) { + if ($select.data('mt3sMpProgramTaskInitialized')) { return; } - $select.data('programTaskInitialized', true); + $select.data('mt3sMpProgramTaskInitialized', true); $select.on('change', function () { var $option = $select.find('option:selected'); var $scope = $select.closest('form'); - $scope.find('.initiative-item-type-help').first().text($option.attr('data-description') || ''); - $scope.find('.initiative-item-type-icon').first().attr('class', 'initiative-item-type-icon ' + ($option.attr('data-icon') || '')); + $scope.find('.program-item-type-help').first().text($option.attr('data-description') || ''); + $scope.find('.program-item-type-icon').first().attr('class', 'program-item-type-icon ' + ($option.attr('data-icon') || '')); }); }); @@ -93,20 +93,20 @@ Mautic.programTaskOnLoad = function (container) { enslave.call($kind.get(0)); }); }; -Mautic.programOnLoad = function (container) { - mQuery(container).find('.initiative-collection').each(function () { - Mautic.programInitCollection(mQuery(this)); +Mautic.mt3sMpProgramOnLoad = function (container) { + mQuery(container).find('.program-collection').each(function () { + Mautic.mt3sMpProgramInitCollection(mQuery(this)); }); - mQuery(container).find('.initiative-tabs').each(function () { - Mautic.programInitTabs(mQuery(this), mQuery(container)); + mQuery(container).find('.program-tabs').each(function () { + Mautic.mt3sMpProgramInitTabs(mQuery(this), mQuery(container)); }); // Detail page: the four tab tables (description items, objectives, allocation items, tasks). - mQuery(container).find('table[data-initiative-tab-table]').each(function () { - Mautic.programInitTabTable(mQuery(this)); + mQuery(container).find('table[data-program-tab-table]').each(function () { + Mautic.mt3sMpProgramInitTabTable(mQuery(this)); }); // Detail page: long description item texts, clamped to 10 lines with a read-more toggle. - mQuery(container).find('.initiative-read-more').each(function () { - Mautic.programInitReadMore(mQuery(this)); + mQuery(container).find('.program-read-more').each(function () { + Mautic.mt3sMpProgramInitReadMore(mQuery(this)); }); }; @@ -119,14 +119,14 @@ Mautic.programOnLoad = function (container) { * (Mautic reopens the tab last used) has no layout, so its scrollHeight is 0. The wrapper is rechecked * on every tab activation until the measurement could run. */ -Mautic.programInitReadMore = function ($wrapper) { +Mautic.mt3sMpProgramInitReadMore = function ($wrapper) { if ($wrapper.data('planReadMoreInitialized')) { return; } $wrapper.data('planReadMoreInitialized', true); - var $text = $wrapper.find('.initiative-read-more-text').first(); - var $toggle = $wrapper.find('.initiative-read-more-toggle').first(); + var $text = $wrapper.find('.program-read-more-text').first(); + var $toggle = $wrapper.find('.program-read-more-toggle').first(); var clampLines = 10; var measure = function () { @@ -158,16 +158,16 @@ Mautic.programInitReadMore = function ($wrapper) { if (!measure()) { // The pane holding this text is hidden: recheck each time a tab of this page is shown. - mQuery(document).on('shown.bs.tab.initiative-read-more', function () { + mQuery(document).on('shown.bs.tab.program-read-more', function () { if (measure()) { - mQuery(document).off('shown.bs.tab.initiative-read-more'); + mQuery(document).off('shown.bs.tab.program-read-more'); } }); } }; /** - * A initiative detail page tab table: one filter box filtering every column (case-insensitive substring), + * A program detail page tab table: one filter box filtering every column (case-insensitive substring), * and every column header sorting the rows asc/desc on click. Filtering and sorting are done on the * client, instantly: these tables hold one plan's items, never many. * @@ -175,16 +175,16 @@ Mautic.programInitReadMore = function ($wrapper) { * Sorting the tree by another column can interleave a sub-task before its parent; the depth marker * stays attached to its own row, so it just indents wherever it lands. */ -Mautic.programInitTabTable = function ($table) { +Mautic.mt3sMpProgramInitTabTable = function ($table) { if ($table.data('planTabTableInitialized')) { return; } $table.data('planTabTableInitialized', true); var $panes = $table.closest('.tab-pane'); - var $filterBox = $panes.find('.initiative-tab-table-filter').first(); - var $input = $filterBox.find('.initiative-tab-table-filter-input'); - var $noMatch = $panes.find('.initiative-tab-table-nomatch').first(); + var $filterBox = $panes.find('.program-tab-table-filter').first(); + var $input = $filterBox.find('.program-tab-table-filter-input'); + var $noMatch = $panes.find('.program-tab-table-nomatch').first(); var $rows = $table.find('tbody tr'); var apply = function () { @@ -212,7 +212,7 @@ Mautic.programInitTabTable = function ($table) { $th.css('cursor', 'pointer').attr('title', $table.attr('data-sort-hint') || ''); $th.on('click', function () { - var direction = $th.hasClass('initiative-sorted-asc') ? -1 : 1; + var direction = $th.hasClass('program-sorted-asc') ? -1 : 1; var cells = []; $rows.each(function () { @@ -243,8 +243,8 @@ Mautic.programInitTabTable = function ($table) { this.$row.appendTo($table.find('tbody')); }); - $table.find('thead th').removeClass('initiative-sorted-asc initiative-sorted-desc'); - $th.addClass(direction > 0 ? 'initiative-sorted-asc' : 'initiative-sorted-desc'); + $table.find('thead th').removeClass('program-sorted-asc program-sorted-desc'); + $th.addClass(direction > 0 ? 'program-sorted-asc' : 'program-sorted-desc'); $rows = $table.find('tbody tr'); }); }); @@ -268,7 +268,7 @@ Mautic.planParseNumber = function (text) { /** * Plan tabs (detail page and form): - * - the tab last used for a plan is remembered for the browser session, and reopened when the initiative's + * - the tab last used for a plan is remembered for the browser session, and reopened when the program's * detail page or form loads, so that Edit, Save and Cancel keep the same tab; * - after a failed save, the tabs whose pane has an error get an icon, and the first of them is * opened instead. @@ -280,18 +280,18 @@ Mautic.planParseNumber = function (text) { * the tab under the user. The plan's tab panes have no "fade" class: with fade, two tab('show') calls * within the 150 ms transition left two panes visible. */ -Mautic.programInitTabs = function ($tabs, $container) { - var initiativeId = $tabs.attr('data-initiative-id'); - var storageKey = initiativeId ? 'mautic.program.tab.' + initiativeId : null; +Mautic.mt3sMpProgramInitTabs = function ($tabs, $container) { + var programId = $tabs.attr('data-program-id'); + var storageKey = programId ? 'mt3s.marketing_program.tab.' + programId : null; var $target = null; $tabs.find('a[data-toggle="tab"]').each(function () { var $link = mQuery(this); var hasError = Mautic.planPaneHasError($container.find($link.attr('href'))); $link.toggleClass('text-danger', hasError); - $link.find('.initiative-tab-error').remove(); + $link.find('.program-tab-error').remove(); if (hasError) { - $link.append(' '); + $link.append(' '); if ($target === null) { $target = $link; } @@ -340,7 +340,7 @@ Mautic.planApplyPendingTab = function () { } }; -// Run after core's tab restore, so that the initiative's choice wins (see Mautic.programInitTabs). +// Run after core's tab restore, so that the program's choice wins (see Mautic.mt3sMpProgramInitTabs). if (typeof Mautic.rememberActiveTabs === 'function' && !Mautic.rememberActiveTabs.planWrapped) { (function (coreRememberActiveTabs) { Mautic.rememberActiveTabs = function () { @@ -368,34 +368,34 @@ Mautic.planPaneHasError = function ($pane) { /** * An editable list of rows built from a Symfony collection: - * .initiative-collection[data-prototype][data-prototype-name] - * .initiative-collection-empty, .initiative-collection-list > .initiative-collection-row, .initiative-collection-add - * in each row: .initiative-collection-handle (drag), .initiative-collection-remove, input.initiative-row-position + * .program-collection[data-prototype][data-prototype-name] + * .program-collection-empty, .program-collection-list > .program-collection-row, .program-collection-add + * in each row: .program-collection-handle (drag), .program-collection-remove, input.program-row-position * * The hidden position of every row is rewritten to its display index after each change, so the saved * order is the displayed order. */ -Mautic.programInitCollection = function ($editor) { - if ($editor.data('programInitialized')) { +Mautic.mt3sMpProgramInitCollection = function ($editor) { + if ($editor.data('mt3sMpProgramInitialized')) { return; } - $editor.data('programInitialized', true); + $editor.data('mt3sMpProgramInitialized', true); - var $list = $editor.find('.initiative-collection-list').first(); + var $list = $editor.find('.program-collection-list').first(); var prototypeName = new RegExp($editor.attr('data-prototype-name'), 'g'); // New rows get indexes that were never used on this page, so they can't collide with existing ones. - var nextIndex = $list.children('.initiative-collection-row').length; + var nextIndex = $list.children('.program-collection-row').length; var refresh = function () { - var $rows = $list.children('.initiative-collection-row'); + var $rows = $list.children('.program-collection-row'); $rows.each(function (index) { - mQuery(this).find('input.initiative-row-position').val(index); + mQuery(this).find('input.program-row-position').val(index); }); - $editor.find('.initiative-collection-empty').first().toggleClass('hide', $rows.length > 0); + $editor.find('.program-collection-empty').first().toggleClass('hide', $rows.length > 0); }; - $editor.on('click', '.initiative-collection-add', function (event) { + $editor.on('click', '.program-collection-add', function (event) { event.preventDefault(); var $row = mQuery($editor.attr('data-prototype').replace(prototypeName, nextIndex++)); $list.append($row); @@ -403,25 +403,25 @@ Mautic.programInitCollection = function ($editor) { $row.find('select, input[type="text"], textarea').first().trigger('focus'); }); - $editor.on('click', '.initiative-collection-remove', function (event) { + $editor.on('click', '.program-collection-remove', function (event) { event.preventDefault(); - mQuery(this).closest('.initiative-collection-row').remove(); + mQuery(this).closest('.program-collection-row').remove(); refresh(); }); // Typed items (description, allocation): show the selected type's description under the dropdown, and - // its pictogram next to it. Works within a initiative-collection row. - $editor.on('change', 'select.initiative-item-type', function () { + // its pictogram next to it. Works within a program-collection row. + $editor.on('change', 'select.program-item-type', function () { var $option = mQuery(this).find('option:selected'); - var $row = mQuery(this).closest('.initiative-collection-row'); - $row.find('.initiative-item-type-help').first().text($option.attr('data-description') || ''); - $row.find('.initiative-item-type-icon').first().attr('class', 'initiative-item-type-icon ' + ($option.attr('data-icon') || '')); + var $row = mQuery(this).closest('.program-collection-row'); + $row.find('.program-item-type-help').first().text($option.attr('data-description') || ''); + $row.find('.program-item-type-icon').first().attr('class', 'program-item-type-icon ' + ($option.attr('data-icon') || '')); }); if (typeof $list.sortable === 'function') { $list.sortable({ - items: '> .initiative-collection-row', - handle: '.initiative-collection-handle', + items: '> .program-collection-row', + handle: '.program-collection-handle', axis: 'y', update: refresh }); @@ -452,9 +452,9 @@ Mautic.programInitCollection = function ($editor) { }); // Pictogram of an item type (description, allocation): preview the chosen icon. - mQuery(document).on('change', '.program-config-types select.initiative-type-icon-select', function () { + mQuery(document).on('change', '.program-config-types select.program-type-icon-select', function () { var icon = mQuery(this).find('option:selected').attr('data-icon') || ''; - mQuery(this).closest('.program-config-type').find('.initiative-type-icon-preview').first().attr('class', 'initiative-type-icon-preview ' + icon); + mQuery(this).closest('.program-config-type').find('.program-type-icon-preview').first().attr('class', 'program-type-icon-preview ' + icon); }); mQuery(document).on('click', '.program-config-types .program-config-type-remove', function (event) { diff --git a/Command/RefreshStatsCommand.php b/Command/RefreshStatsCommand.php new file mode 100644 index 0000000..9747fa0 --- /dev/null +++ b/Command/RefreshStatsCommand.php @@ -0,0 +1,135 @@ +addOption('program', null, InputOption::VALUE_REQUIRED, 'Limit the report to one program ID.'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + $programId = $input->getOption('program'); + + $programs = $this->entityManager->getRepository(Program::class)->findBy( + null !== $programId ? ['id' => (int) $programId] : [] + ); + + if ([] === $programs) { + $io->warning(null !== $programId ? sprintf('No program with the ID %s.', $programId) : 'No programs.'); + + return Command::SUCCESS; + } + + $counts = [ + 'tasks' => $this->countByProgram(Task::class), + 'objectives' => $this->countByProgram(ProgramObjective::class), + 'insights' => $this->countByProgram(ProgramDescriptionItem::class), + 'allocations' => $this->countByProgram(ProgramAllocationItem::class), + 'stakeholders' => $this->countByProgram(ProgramStakeholder::class), + 'audiences' => $this->countByProgram(ProgramAudience::class), + ]; + + $done = $this->doneByProgram(); + + $rows = []; + foreach ($programs as $program) { + $id = (string) $program->getId(); + $rows[] = [ + $id, + $program->getName(), + sprintf('%d / %d', $done[$id] ?? 0, $counts['tasks'][$id] ?? 0), + $counts['objectives'][$id] ?? 0, + $counts['insights'][$id] ?? 0, + $counts['allocations'][$id] ?? 0, + $counts['stakeholders'][$id] ?? 0, + $counts['audiences'][$id] ?? 0, + ]; + } + + $io->title('MT3S Marketing Program statistics'); + $io->table( + ['ID', 'Name', 'Done / tasks', 'Objectives', 'Insights', 'Allocations', 'Stakeholders', 'Audiences'], + $rows + ); + + return Command::SUCCESS; + } + + /** + * Rows of the given entity class grouped by their program: [program id => count]. + * + * @param class-string $entityClass + * + * @return array + */ + private function countByProgram(string $entityClass): array + { + $rows = $this->entityManager->getRepository($entityClass) + ->createQueryBuilder('c') + ->select('IDENTITY(c.program) AS program_id, COUNT(c.id) AS total') + ->groupBy('program_id') + ->getQuery() + ->getArrayResult(); + + $counts = []; + foreach ($rows as $row) { + $counts[(string) $row['program_id']] = (int) $row['total']; + } + + return $counts; + } + + /** + * Done tasks per program: [program id => done count]. + * + * @return array + */ + private function doneByProgram(): array + { + $rows = $this->entityManager->getRepository(Task::class) + ->createQueryBuilder('t') + ->select('IDENTITY(t.program) AS program_id, SUM(CASE WHEN t.status = :done THEN 1 ELSE 0 END) AS done') + ->setParameter('done', TaskStatus::Done) + ->groupBy('program_id') + ->getQuery() + ->getArrayResult(); + + $done = []; + foreach ($rows as $row) { + $done[(string) $row['program_id']] = (int) $row['done']; + } + + return $done; + } +} \ No newline at end of file diff --git a/Config/config.php b/Config/config.php index 268af53..b4f5a57 100644 --- a/Config/config.php +++ b/Config/config.php @@ -3,106 +3,101 @@ declare(strict_types=1); return [ - 'name' => 'Program', - 'description' => 'Program plugin for Mautic.', - 'version' => '0.16.0', + 'name' => 'MT3S Marketing Program', + 'description' => 'Marketing Program for Mautic.', + 'version' => '0.17.0', 'author' => 'Experiential', 'routes' => [ 'main' => [ - 'initiative_index' => [ - 'path' => '/programs/{page}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\InitiativeController::indexAction', + 'mt3s_marketing_program_index' => [ + 'path' => '/marketing-programs/{page}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\ProgramController::indexAction', ], // objectAction: view, new, edit, delete, batchDelete. - 'initiative_action' => [ - 'path' => '/programs/{objectAction}/{objectId}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\InitiativeController::executeAction', + 'mt3s_marketing_program_action' => [ + 'path' => '/marketing-programs/{objectAction}/{objectId}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\ProgramController::executeAction', ], - 'initiative_task_index' => [ - 'path' => '/program-tasks/{page}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\TaskController::indexAction', + 'mt3s_marketing_program_task_index' => [ + 'path' => '/marketing-program-tasks/{page}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\TaskController::indexAction', ], - // objectAction: new (optional ?initiative=ID), edit, delete, batchDelete. - 'initiative_task_action' => [ - 'path' => '/program-tasks/{objectAction}/{objectId}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\TaskController::executeAction', + // objectAction: new (optional ?program=ID), edit, delete, batchDelete. + 'mt3s_marketing_program_task_action' => [ + 'path' => '/marketing-program-tasks/{objectAction}/{objectId}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\TaskController::executeAction', ], - 'initiative_stakeholder_index' => [ - 'path' => '/program-stakeholders/{page}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\StakeholderController::indexAction', + 'mt3s_marketing_program_stakeholder_index' => [ + 'path' => '/marketing-program-stakeholders/{page}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\StakeholderController::indexAction', ], // objectAction: new, edit, delete, batchDelete. - 'initiative_stakeholder_action' => [ - 'path' => '/program-stakeholders/{objectAction}/{objectId}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\StakeholderController::executeAction', + 'mt3s_marketing_program_stakeholder_action' => [ + 'path' => '/marketing-program-stakeholders/{objectAction}/{objectId}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\StakeholderController::executeAction', ], - 'initiative_audience_index' => [ - 'path' => '/program-audiences/{page}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\AudienceController::indexAction', + 'mt3s_marketing_program_audience_index' => [ + 'path' => '/marketing-program-audiences/{page}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\AudienceController::indexAction', ], // objectAction: new, edit, delete, batchDelete. - 'initiative_audience_action' => [ - 'path' => '/program-audiences/{objectAction}/{objectId}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\AudienceController::executeAction', + 'mt3s_marketing_program_audience_action' => [ + 'path' => '/marketing-program-audiences/{objectAction}/{objectId}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\AudienceController::executeAction', ], - // UTM Taxonomies: a placeholder page under Programs for now. - 'program_utm_taxonomy_index' => [ - 'path' => '/program-utm-taxonomies/{page}', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\UtmTaxonomyController::indexAction', + // UTM Taxonomies: a placeholder page for the coming feature, kept out of the menu + // (the route stays; the page is reachable at /s/marketing-program-utm-taxonomies). + 'mt3s_marketing_program_utm_taxonomy_index' => [ + 'path' => '/marketing-program-utm-taxonomies/{page}', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\UtmTaxonomyController::indexAction', ], // The type lists of the plugin's items (Insights, allocations, objectives, tasks, // stakeholders, audience values), moved out of Settings > Configuration. - 'program_item_types_index' => [ - 'path' => '/program-item-types', - 'controller' => 'MauticPlugin\ProgramBundle\Controller\ItemTypesController::indexAction', + 'mt3s_marketing_program_item_types_index' => [ + 'path' => '/marketing-program-item-types', + 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\ItemTypesController::indexAction', ], ], ], - // Top-level "Programs" menu. Future program objects go in its children, after Initiatives. + // Top-level "Programs" menu. Future program objects go in its children, after Programs. 'menu' => [ 'main' => [ - 'mautic.program.menu.root' => [ - 'id' => 'program_root', + 'mt3s.marketing_program.menu.root' => [ + 'id' => 'mt3s_marketing_program_root', 'iconClass' => 'ri-calendar-line', - 'access' => ['program:initiatives:viewown', 'program:initiatives:viewother', 'program:tasks:viewown', 'program:tasks:viewother', 'program:stakeholders:viewown', 'program:stakeholders:viewother', 'program:audiences:viewown', 'program:audiences:viewother', 'program:itemtypes:view'], + 'access' => ['mt3smarketingprogram:programs:viewown', 'mt3smarketingprogram:programs:viewother', 'mt3smarketingprogram:tasks:viewown', 'mt3smarketingprogram:tasks:viewother', 'mt3smarketingprogram:stakeholders:viewown', 'mt3smarketingprogram:stakeholders:viewother', 'mt3smarketingprogram:audiences:viewown', 'mt3smarketingprogram:audiences:viewother', 'mt3smarketingprogram:itemtypes:view'], 'priority' => 5, 'children' => [ - 'mautic.program.menu.index' => [ - 'id' => 'initiative_index', - 'route' => 'initiative_index', - 'access' => ['program:initiatives:viewown', 'program:initiatives:viewother'], + 'mt3s.marketing_program.menu.index' => [ + 'id' => 'mt3s_marketing_program_index', + 'route' => 'mt3s_marketing_program_index', + 'access' => ['mt3smarketingprogram:programs:viewown', 'mt3smarketingprogram:programs:viewother'], 'priority' => 100, ], - 'mautic.program.task.menu.index' => [ - 'id' => 'initiative_task_index', - 'route' => 'initiative_task_index', - 'access' => ['program:tasks:viewown', 'program:tasks:viewother'], + 'mt3s.marketing_program.task.menu.index' => [ + 'id' => 'mt3s_marketing_program_task_index', + 'route' => 'mt3s_marketing_program_task_index', + 'access' => ['mt3smarketingprogram:tasks:viewown', 'mt3smarketingprogram:tasks:viewother'], 'priority' => 90, ], - 'mautic.program.stakeholder.menu.index' => [ - 'id' => 'initiative_stakeholder_index', - 'route' => 'initiative_stakeholder_index', - 'access' => ['program:stakeholders:viewown', 'program:stakeholders:viewother'], + 'mt3s.marketing_program.stakeholder.menu.index' => [ + 'id' => 'mt3s_marketing_program_stakeholder_index', + 'route' => 'mt3s_marketing_program_stakeholder_index', + 'access' => ['mt3smarketingprogram:stakeholders:viewown', 'mt3smarketingprogram:stakeholders:viewother'], 'priority' => 80, ], - 'mautic.program.audience.menu.index' => [ - 'id' => 'initiative_audience_index', - 'route' => 'initiative_audience_index', - 'access' => ['program:audiences:viewown', 'program:audiences:viewother'], + 'mt3s.marketing_program.audience.menu.index' => [ + 'id' => 'mt3s_marketing_program_audience_index', + 'route' => 'mt3s_marketing_program_audience_index', + 'access' => ['mt3smarketingprogram:audiences:viewown', 'mt3smarketingprogram:audiences:viewother'], 'priority' => 70, ], - 'mautic.program.utm_taxonomy.menu.index' => [ - 'id' => 'program_utm_taxonomy_index', - 'route' => 'program_utm_taxonomy_index', - 'access' => ['program:initiatives:viewown', 'program:initiatives:viewother'], - 'priority' => 60, - ], - 'mautic.program.menu.item_types' => [ - 'id' => 'program_item_types_index', - 'route' => 'program_item_types_index', - 'access' => ['program:itemtypes:view'], + 'mt3s.marketing_program.menu.item_types' => [ + 'id' => 'mt3s_marketing_program_item_types_index', + 'route' => 'mt3s_marketing_program_item_types_index', + 'access' => ['mt3smarketingprogram:itemtypes:view'], 'priority' => 55, ], ], @@ -112,15 +107,15 @@ return [ 'services' => [ 'integrations' => [ - 'mautic.program.integration' => [ - 'class' => MauticPlugin\ProgramBundle\Integration\ProgramIntegration::class, + 'mt3s.marketing_program.integration' => [ + 'class' => MauticPlugin\MT3SMarketingProgramBundle\Integration\MT3SMarketingProgramIntegration::class, 'tags' => [ 'mautic.integration', 'mautic.basic_integration', ], ], - 'mautic.program.integration.configuration' => [ - 'class' => MauticPlugin\ProgramBundle\Integration\Support\ProgramConfigSupport::class, + 'mt3s.marketing_program.integration.configuration' => [ + 'class' => MauticPlugin\MT3SMarketingProgramBundle\Integration\Support\MT3SMarketingProgramConfigSupport::class, 'tags' => [ 'mautic.config_integration', ], @@ -128,73 +123,51 @@ return [ ], ], - // Registers "initiative" as a category type (Settings > Categories), used by Initiative::$category. + // Registers "program" as a category type (Settings > Categories), used by Program::$category. 'categories' => [ - 'initiative' => [ - 'class' => MauticPlugin\ProgramBundle\Entity\Initiative::class, - 'label' => 'mautic.program.category.type', + 'program' => [ + 'class' => MauticPlugin\MT3SMarketingProgramBundle\Entity\Program::class, + 'label' => 'mt3s.marketing_program.category.type', ], ], 'parameters' => [ // The currency of every amount in the plugin (ISO 4217), edited in Settings > Configuration > // Program Settings. Read it through CurrencyProvider. - 'program_currency' => 'EUR', + 'mt3s_marketing_program_currency' => 'EUR', // Item types, edited on the Item types page (Programs > Item types). Read them through // ItemTypeProvider. Each is a list of ['key' => …, 'names' => [locale => …], 'descriptions' => [locale => …]], // plus 'icon' => a Remix Icon class for description, allocation, objective, task and stakeholder types. - 'program_description_item_types' => [], - 'program_allocation_item_types' => [], - 'program_objective_types' => [], - 'program_task_types' => [], - 'program_stakeholder_types' => [], + 'mt3s_marketing_program_description_item_types' => [], + 'mt3s_marketing_program_allocation_item_types' => [], + 'mt3s_marketing_program_objective_types' => [], + 'mt3s_marketing_program_task_types' => [], + 'mt3s_marketing_program_stakeholder_types' => [], // Default region (ISO 3166-1 alpha-2, e.g. FR) used to parse stakeholder phone numbers typed // without a country prefix, on save. Read through StakeholderModel. - 'program_stakeholder_phone_region' => 'FR', + 'mt3s_marketing_program_stakeholder_phone_region' => 'FR', // Which audience persona attributes are offered on the audience forms, one toggle per attribute // (Settings > Configuration > Program Settings). Read through AudienceAttributes; a parameter set // to false turns the attribute off, and one that was never saved means enabled. - 'program_audience_attribute_tagline' => true, - 'program_audience_attribute_profile' => true, - 'program_audience_attribute_motivations' => true, - 'program_audience_attribute_barriers' => true, - 'program_audience_attribute_frustrations' => true, - 'program_audience_attribute_triggers' => true, - 'program_audience_attribute_decision_role' => true, - 'program_audience_attribute_tones' => true, - 'program_audience_attribute_channels' => true, - 'program_audience_attribute_stages' => true, - 'program_audience_attribute_size' => true, + 'mt3s_marketing_program_audience_attribute_tagline' => true, + 'mt3s_marketing_program_audience_attribute_profile' => true, + 'mt3s_marketing_program_audience_attribute_motivations' => true, + 'mt3s_marketing_program_audience_attribute_barriers' => true, + 'mt3s_marketing_program_audience_attribute_frustrations' => true, + 'mt3s_marketing_program_audience_attribute_triggers' => true, + 'mt3s_marketing_program_audience_attribute_decision_role' => true, + 'mt3s_marketing_program_audience_attribute_tones' => true, + 'mt3s_marketing_program_audience_attribute_channels' => true, + 'mt3s_marketing_program_audience_attribute_stages' => true, + 'mt3s_marketing_program_audience_attribute_size' => true, // The values of an audience's closed attributes, edited in Settings > Configuration > Program // Settings. Each is a list of ['key' => …, 'names' => [locale => …]], read through // ItemTypeProvider (kinds "audience_decision_role" and "audience_tone"). - 'program_audience_decision_roles' => [], - 'program_audience_tones' => [], - - // Which audience persona attributes are offered on the audience forms, one toggle per attribute - // (Settings > Configuration > Program Settings). The parameter names follow - // AudienceAttributes::toggleParameter(); a parameter set to false turns the attribute off. - // Defaults are handled by AudienceAttributes (enabled unless set to false). - 'program_audience_attribute_tagline' => true, - 'program_audience_attribute_profile' => true, - 'program_audience_attribute_motivations' => true, - 'program_audience_attribute_barriers' => true, - 'program_audience_attribute_frustrations' => true, - 'program_audience_attribute_triggers' => true, - 'program_audience_attribute_decision_role' => true, - 'program_audience_attribute_tones' => true, - 'program_audience_attribute_channels' => true, - 'program_audience_attribute_stages' => true, - 'program_audience_attribute_size' => true, - - // The values of an audience's closed attributes, edited in Settings > Configuration > Program - // Settings. Each is a list of ['key' => …, 'names' => [locale => …]], read through - // ItemTypeProvider (kinds "audience_decision_role" and "audience_tone"). - 'program_audience_decision_roles' => [], - 'program_audience_tones' => [], + 'mt3s_marketing_program_audience_decision_roles' => [], + 'mt3s_marketing_program_audience_tones' => [], ], ]; diff --git a/Config/services.php b/Config/services.php index 9107659..aeb5792 100644 --- a/Config/services.php +++ b/Config/services.php @@ -16,19 +16,23 @@ return function (ContainerConfigurator $configurator): void { 'Tests', ]; - $services->load('MauticPlugin\\ProgramBundle\\', '../') + $services->load('MauticPlugin\\MT3SMarketingProgramBundle\\', '../') ->exclude('../{'.implode(',', array_merge(MauticCoreExtension::DEFAULT_EXCLUDES, $excludes)).'}'); // Entity/ is excluded above; repositories must still be services for Doctrine to build them. - $services->load('MauticPlugin\\ProgramBundle\\Entity\\', '../Entity/*Repository.php') + $services->load('MauticPlugin\\MT3SMarketingProgramBundle\\Entity\\', '../Entity/*Repository.php') ->tag(Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG); - // Lets core resolve the model with getModel('program'). - $services->alias('mautic.program.model.initiative', MauticPlugin\ProgramBundle\Model\InitiativeModel::class); - // getModel('program.task'). - $services->alias('mautic.program.model.task', MauticPlugin\ProgramBundle\Model\TaskModel::class); - // getModel('program.stakeholder'). - $services->alias('mautic.program.model.stakeholder', MauticPlugin\ProgramBundle\Model\StakeholderModel::class); - // getModel('program.audience'). - $services->alias('mautic.program.model.audience', MauticPlugin\ProgramBundle\Model\AudienceModel::class); + // Lets core resolve the model with getModel('mt3smp.program'). + $services->alias('mt3s.marketing_program.model.program', MauticPlugin\MT3SMarketingProgramBundle\Model\ProgramModel::class); + $services->alias('mautic.mt3smp.model.program', MauticPlugin\MT3SMarketingProgramBundle\Model\ProgramModel::class); + // getModel('mt3smp.task'). + $services->alias('mt3s.marketing_program.model.task', MauticPlugin\MT3SMarketingProgramBundle\Model\TaskModel::class); + $services->alias('mautic.mt3smp.model.task', MauticPlugin\MT3SMarketingProgramBundle\Model\TaskModel::class); + // getModel('mt3smp.stakeholder'). + $services->alias('mt3s.marketing_program.model.stakeholder', MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel::class); + $services->alias('mautic.mt3smp.model.stakeholder', MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel::class); + // getModel('mt3smp.audience'). + $services->alias('mt3s.marketing_program.model.audience', MauticPlugin\MT3SMarketingProgramBundle\Model\AudienceModel::class); + $services->alias('mautic.mt3smp.model.audience', MauticPlugin\MT3SMarketingProgramBundle\Model\AudienceModel::class); }; diff --git a/Controller/AudienceController.php b/Controller/AudienceController.php index bf7ca14..0e4e2bb 100644 --- a/Controller/AudienceController.php +++ b/Controller/AudienceController.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Controller; +namespace MauticPlugin\MT3SMarketingProgramBundle\Controller; use Mautic\CoreBundle\Controller\AbstractStandardFormController; use Symfony\Component\HttpFoundation\Request; @@ -10,26 +10,26 @@ use Symfony\Component\HttpFoundation\Response; /** * List, create, edit and delete audiences (Programs > Audiences), the global directory of who the - * initiatives are aimed at, using core's standard CRUD flow. Audiences are independent of initiatives; initiatives - * link to them from their Audiences tab (InitiativeAudience carries the audience's priority in that - * initiative). + * programs are aimed at, using core's standard CRUD flow. Audiences are independent of programs; programs + * link to them from their Audiences tab (ProgramAudience carries the audience's priority in that + * program). * - * Model program.audience (mautic.program.model.audience), permission base program:audiences, translation - * base mautic.program.audience. + * Model mt3smp.audience (mt3s.marketing_program.model.audience), permission base mt3smarketingprogram:audiences, translation + * base mt3s.marketing_program.audience. */ class AudienceController extends AbstractStandardFormController { - public const ROUTE_INDEX = 'initiative_audience_index'; - public const ROUTE_ACTION = 'initiative_audience_action'; + public const ROUTE_INDEX = 'mt3s_marketing_program_audience_index'; + public const ROUTE_ACTION = 'mt3s_marketing_program_audience_action'; protected function getModelName(): string { - return 'program.audience'; + return 'mt3smp.audience'; } protected function getTemplateBase(): string { - return '@Program/Audience'; + return '@MT3SMarketingProgram/Audience'; } protected function getIndexRoute(): string @@ -44,7 +44,7 @@ class AudienceController extends AbstractStandardFormController protected function getJsLoadMethodPrefix(): string { - return 'programAudience'; + return 'mt3sMpProgramAudience'; } /** @@ -62,14 +62,14 @@ class AudienceController extends AbstractStandardFormController /** * The audience's detail page (the directory entry, its persona attributes, its segments and - * the initiatives it is assigned to). The standard controller has no view action of its own, so it + * the programs it is assigned to). The standard controller has no view action of its own, so it * is routed here. * * @param int $objectId */ public function viewAction(Request $request, $objectId): Response { - return $this->viewStandard($request, $objectId, 'audience', 'initiative'); + return $this->viewStandard($request, $objectId, 'audience', 'program'); } /** diff --git a/Controller/ItemTypesController.php b/Controller/ItemTypesController.php index 92c1a96..9db8e34 100644 --- a/Controller/ItemTypesController.php +++ b/Controller/ItemTypesController.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Controller; +namespace MauticPlugin\MT3SMarketingProgramBundle\Controller; use Mautic\CoreBundle\Configurator\Configurator; use Mautic\CoreBundle\Controller\AbstractFormController; use Mautic\CoreBundle\Helper\CacheHelper; -use MauticPlugin\ProgramBundle\Form\Type\ItemTypesType; -use MauticPlugin\ProgramBundle\Service\ItemTypeInUseGuard; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\ItemTypesType; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeInUseGuard; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -20,18 +20,18 @@ use Symfony\Component\HttpFoundation\Response; * The Item types page (Programs > Item types): the type lists of the plugin's items — insights * (description items), allocations, objectives, tasks, stakeholders, and the values offered for * an audience's decision roles and tones. Formerly part of Settings > Configuration > Program - * Settings; now on its own page under Programs, so a user with the program:itemtypes permissions + * Settings; now on its own page under Programs, so a user with the mt3smarketingprogram:itemtypes permissions * manages the types without being an administrator. * * Each list is a local.php parameter (ItemTypeProvider::PARAMETERS), saved through core's * Configurator exactly like Settings > Configuration saves its own forms: merge, write, refresh * the config. A type that items still use cannot be removed (ItemTypeInUseGuard). * - * Permissions: program:itemtypes:view shows the page, program:itemtypes:edit saves it. + * Permissions: mt3smarketingprogram:itemtypes:view shows the page, mt3smarketingprogram:itemtypes:edit saves it. */ class ItemTypesController extends AbstractFormController { - public const ROUTE_INDEX = 'program_item_types_index'; + public const ROUTE_INDEX = 'mt3s_marketing_program_item_types_index'; /** * Shows the lists, and saves them on POST. @@ -44,7 +44,7 @@ class ItemTypesController extends AbstractFormController Configurator $configurator, CacheHelper $cacheHelper, ): Response { - if (!$this->security->isGranted('program:itemtypes:view')) { + if (!$this->security->isGranted('mt3smarketingprogram:itemtypes:view')) { $this->throwAccessDenied(); } @@ -60,7 +60,7 @@ class ItemTypesController extends AbstractFormController $isWritable = $configurator->isFileWritable(); if ('POST' === $request->getMethod()) { - if (!$this->security->isGranted('program:itemtypes:edit')) { + if (!$this->security->isGranted('mt3smarketingprogram:itemtypes:edit')) { $this->throwAccessDenied(); } @@ -78,7 +78,7 @@ class ItemTypesController extends AbstractFormController if ([] !== $removedInUse) { foreach ($removedInUse as $names) { $form->addError(new FormError( - $this->translator->trans('mautic.program.config.type.in_use', ['%types%' => implode(', ', $names)], 'validators') + $this->translator->trans('mt3s.marketing_program.config.type.in_use', ['%types%' => implode(', ', $names)], 'validators') )); } } else { @@ -92,7 +92,7 @@ class ItemTypesController extends AbstractFormController $configurator->write(); - $this->addFlashMessage('mautic.program.item_type.saved'); + $this->addFlashMessage('mt3s.marketing_program.item_type.saved'); // local.php changed: the cached container is stale until refreshed. $cacheHelper->refreshConfig(); @@ -107,10 +107,10 @@ class ItemTypesController extends AbstractFormController 'form' => $form->createView(), 'isWritable' => $isWritable, ], - 'contentTemplate' => '@Program/ItemTypes/form.html.twig', + 'contentTemplate' => '@MT3SMarketingProgram/ItemTypes/form.html.twig', 'passthroughVars' => [ 'activeLink' => '#'.self::ROUTE_INDEX, - 'mauticContent' => 'programItemTypes', + 'mauticContent' => 'mt3sMpProgramItemTypes', 'route' => $action, ], ]); diff --git a/Controller/InitiativeController.php b/Controller/ProgramController.php similarity index 66% rename from Controller/InitiativeController.php rename to Controller/ProgramController.php index 7acfe83..bb6e8ff 100644 --- a/Controller/InitiativeController.php +++ b/Controller/ProgramController.php @@ -2,37 +2,37 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Controller; +namespace MauticPlugin\MT3SMarketingProgramBundle\Controller; use Mautic\CoreBundle\Controller\AbstractStandardFormController; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Model\TaskModel; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program; +use MauticPlugin\MT3SMarketingProgramBundle\Model\TaskModel; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; /** * List, view, create, edit and delete plans, using core's standard CRUD flow. * - * Core derives most names from the model name "initiative": model mautic.program.model.initiative, permission base - * program:initiatives (from InitiativeModel), translation base mautic.program, session base mautic.program. + * Core derives most names from the model name "program": model mt3s.marketing_program.model.program, permission base + * mt3smarketingprogram:programs (from ProgramModel), translation base mt3s.marketing_program, session base mt3s.marketing_program. */ -class InitiativeController extends AbstractStandardFormController +class ProgramController extends AbstractStandardFormController { - public const ROUTE_INDEX = 'initiative_index'; - public const ROUTE_ACTION = 'initiative_action'; + public const ROUTE_INDEX = 'mt3s_marketing_program_index'; + public const ROUTE_ACTION = 'mt3s_marketing_program_action'; protected function getModelName(): string { - return 'program.initiative'; + return 'mt3smp.program'; } protected function getTemplateBase(): string { - return '@Program/Initiative'; + return '@MT3SMarketingProgram/Program'; } /** - * Core would build mautic_initiative_index; the plugin's routes use the plan_ prefix. + * Core would build mautic_mt3s_marketing_program_index; the plugin's routes use the plan_ prefix. */ protected function getIndexRoute(): string { @@ -53,7 +53,7 @@ class InitiativeController extends AbstractStandardFormController } /** - * The initiative detail page (tabs: Details, Description, Objectives, Allocations, Audiences, Stakeholders, Tasks). + * The program detail page (tabs: Details, Description, Objectives, Allocations, Audiences, Stakeholders, Tasks). * * Core's viewStandard() isn't used: for users who aren't administrators it checks an * ":export:enable" permission, which plans don't have. @@ -62,13 +62,13 @@ class InitiativeController extends AbstractStandardFormController */ public function viewAction(Request $request, $objectId): Response { - $initiative = $this->getModel($this->getModelName())->getEntity((int) $objectId); + $program = $this->getModel($this->getModelName())->getEntity((int) $objectId); - if (!$initiative instanceof Initiative) { - return $this->notFound('mautic.program.error.notfound'); + if (!$program instanceof Program) { + return $this->notFound('mt3s.marketing_program.error.notfound'); } - if (!$this->checkActionPermission('view', $initiative)) { + if (!$this->checkActionPermission('view', $program)) { return $this->accessDenied(); } @@ -88,9 +88,9 @@ class InitiativeController extends AbstractStandardFormController $taskPermissions = $this->security->isGranted( [ - 'program:tasks:create', - 'program:tasks:editown', - 'program:tasks:editother', + 'mt3smarketingprogram:tasks:create', + 'mt3smarketingprogram:tasks:editown', + 'mt3smarketingprogram:tasks:editother', ], 'RETURN_ARRAY', null, @@ -99,9 +99,9 @@ class InitiativeController extends AbstractStandardFormController return $this->delegateView([ 'viewParameters' => [ - 'item' => $initiative, + 'item' => $program, 'permissions' => $permissions, - 'taskTree' => $this->getTaskModel()->getTaskTree($initiative), + 'taskTree' => $this->getTaskModel()->getTaskTree($program), 'taskPermissions' => $taskPermissions, // Core's page_actions helper would otherwise build mautic_plan_* route names. 'indexRoute' => self::ROUTE_INDEX, @@ -110,15 +110,15 @@ class InitiativeController extends AbstractStandardFormController ], 'contentTemplate' => $this->getTemplateName('details.html.twig'), 'passthroughVars' => [ - 'activeLink' => '#initiative_index', + 'activeLink' => '#mt3s_marketing_program_index', 'mauticContent' => $this->getJsLoadMethodPrefix(), - 'route' => $this->generateUrl(self::ROUTE_ACTION, ['objectAction' => 'view', 'objectId' => $initiative->getId()]), + 'route' => $this->generateUrl(self::ROUTE_ACTION, ['objectAction' => 'view', 'objectId' => $program->getId()]), ], ]); } /** - * Adds the initiative's task tree to the form, for the read-only Tasks tab. + * Adds the program's task tree to the form, for the read-only Tasks tab. * * @param array $args * @param string $action @@ -127,10 +127,10 @@ class InitiativeController extends AbstractStandardFormController */ protected function getViewArguments(array $args, $action): array { - $initiative = $args['viewParameters']['entity'] ?? null; + $program = $args['viewParameters']['entity'] ?? null; - if (in_array($action, ['new', 'edit'], true) && $initiative instanceof Initiative && null !== $initiative->getId()) { - $args['viewParameters']['taskTree'] = $this->getTaskModel()->getTaskTree($initiative); + if (in_array($action, ['new', 'edit'], true) && $program instanceof Program && null !== $program->getId()) { + $args['viewParameters']['taskTree'] = $this->getTaskModel()->getTaskTree($program); } return parent::getViewArguments($args, $action); @@ -138,7 +138,7 @@ class InitiativeController extends AbstractStandardFormController private function getTaskModel(): TaskModel { - $model = $this->getModel('program.task'); + $model = $this->getModel('mt3smp.task'); \assert($model instanceof TaskModel); return $model; diff --git a/Controller/StakeholderController.php b/Controller/StakeholderController.php index d118c76..d6c431b 100644 --- a/Controller/StakeholderController.php +++ b/Controller/StakeholderController.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Controller; +namespace MauticPlugin\MT3SMarketingProgramBundle\Controller; use Mautic\CoreBundle\Controller\AbstractStandardFormController; use Symfony\Component\HttpFoundation\Request; @@ -10,25 +10,25 @@ use Symfony\Component\HttpFoundation\Response; /** * List, create, edit and delete stakeholders (Programs > Stakeholders), the global directory, using - * core's standard CRUD flow. Stakeholders are independent of initiatives; initiatives link to them from their + * core's standard CRUD flow. Stakeholders are independent of programs; programs link to them from their * Stakeholders tab. * - * Model program.stakeholder (mautic.program.model.stakeholder), permission base program:stakeholders, - * translation base mautic.program.stakeholder. + * Model mt3smp.stakeholder (mt3s.marketing_program.model.stakeholder), permission base mt3smarketingprogram:stakeholders, + * translation base mt3s.marketing_program.stakeholder. */ class StakeholderController extends AbstractStandardFormController { - public const ROUTE_INDEX = 'initiative_stakeholder_index'; - public const ROUTE_ACTION = 'initiative_stakeholder_action'; + public const ROUTE_INDEX = 'mt3s_marketing_program_stakeholder_index'; + public const ROUTE_ACTION = 'mt3s_marketing_program_stakeholder_action'; protected function getModelName(): string { - return 'program.stakeholder'; + return 'mt3smp.stakeholder'; } protected function getTemplateBase(): string { - return '@Program/Stakeholder'; + return '@MT3SMarketingProgram/Stakeholder'; } protected function getIndexRoute(): string @@ -43,7 +43,7 @@ class StakeholderController extends AbstractStandardFormController protected function getJsLoadMethodPrefix(): string { - return 'programStakeholder'; + return 'mt3sMpProgramStakeholder'; } /** diff --git a/Controller/TaskController.php b/Controller/TaskController.php index 438e937..76a7dcf 100644 --- a/Controller/TaskController.php +++ b/Controller/TaskController.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Controller; +namespace MauticPlugin\MT3SMarketingProgramBundle\Controller; use Mautic\CoreBundle\Controller\AbstractStandardFormController; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -14,30 +14,30 @@ use Symfony\Component\HttpFoundation\Response; /** * List, create, edit and delete tasks (Programs > Tasks), using core's standard CRUD flow. * - * Model program.task (mautic.program.model.task), permission base program:tasks, translation base mautic.program.task. + * Model mt3smp.task (mt3s.marketing_program.model.task), permission base mt3smarketingprogram:tasks, translation base mt3s.marketing_program.task. * * Where the user lands after Save or Cancel depends on where the task form was opened from: * - from Programs > Tasks: back to the task list (core's default); - * - from an initiative's Tasks tab (links with ?returnTo=initiative): back to that initiative. + * - from an program's Tasks tab (links with ?returnTo=program): back to that program. * The origin is kept in the session when the form is opened, because the form posts to a URL * without the query string. */ class TaskController extends AbstractStandardFormController { - public const ROUTE_INDEX = 'initiative_task_index'; - public const ROUTE_ACTION = 'initiative_task_action'; + public const ROUTE_INDEX = 'mt3s_marketing_program_task_index'; + public const ROUTE_ACTION = 'mt3s_marketing_program_task_action'; /** - * Value of the returnTo query parameter that sends the user back to the initiative. + * Value of the returnTo query parameter that sends the user back to the program. */ - public const RETURN_TO_PLAN = 'initiative'; + public const RETURN_TO_PLAN = 'program'; - private const SESSION_RETURN_PLAN = 'mautic.program.task.return_initiative.'; + private const SESSION_RETURN_PLAN = 'mt3s.marketing_program.task.return_program.'; /** - * Initiative to preselect on a new task (from ?initiative=ID, used by the initiative's "Add task" button). + * Program to preselect on a new task (from ?program=ID, used by the program's "Add task" button). */ - private ?int $preselectedInitiativeId = null; + private ?int $preselectedProgramId = null; /** * The task saved during this request, if any. @@ -45,18 +45,18 @@ class TaskController extends AbstractStandardFormController private ?Task $savedTask = null; /** - * Initiative to go back to after Save or Cancel, or null for the task list. + * Program to go back to after Save or Cancel, or null for the task list. */ - private ?int $returnInitiativeId = null; + private ?int $returnProgramId = null; protected function getModelName(): string { - return 'program.task'; + return 'mt3smp.task'; } protected function getTemplateBase(): string { - return '@Program/Task'; + return '@MT3SMarketingProgram/Task'; } protected function getIndexRoute(): string @@ -71,7 +71,7 @@ class TaskController extends AbstractStandardFormController protected function getJsLoadMethodPrefix(): string { - return 'programTask'; + return 'mt3sMpProgramTask'; } /** @@ -84,9 +84,9 @@ class TaskController extends AbstractStandardFormController public function newAction(Request $request): Response { - $initiativeId = $request->query->getInt('initiative'); - $this->preselectedInitiativeId = $initiativeId > 0 ? $initiativeId : null; - $this->returnInitiativeId = $this->resolveReturnInitiative($request, 'new', $this->preselectedInitiativeId); + $programId = $request->query->getInt('program'); + $this->preselectedProgramId = $programId > 0 ? $programId : null; + $this->returnProgramId = $this->resolveReturnProgram($request, 'new', $this->preselectedProgramId); return $this->newStandard($request); } @@ -98,24 +98,24 @@ class TaskController extends AbstractStandardFormController public function editAction(Request $request, $objectId, $ignorePost = false): Response { $task = $this->getModel($this->getModelName())->getEntity((int) $objectId); - $initiativeId = $task instanceof Task ? $task->getInitiative()?->getId() : null; - $this->returnInitiativeId = $this->resolveReturnInitiative($request, (string) (int) $objectId, $initiativeId); + $programId = $task instanceof Task ? $task->getProgram()?->getId() : null; + $this->returnProgramId = $this->resolveReturnProgram($request, (string) (int) $objectId, $programId); return $this->editStandard($request, $objectId, $ignorePost); } /** - * When the form is opened (GET), records whether it came from an initiative (?returnTo=initiative); when it is + * When the form is opened (GET), records whether it came from an program (?returnTo=program); when it is * submitted (POST), reads that record back. Opening the same form from the task list clears it. */ - private function resolveReturnInitiative(Request $request, string $formKey, ?int $initiativeId): ?int + private function resolveReturnProgram(Request $request, string $formKey, ?int $programId): ?int { $session = $request->getSession(); $key = self::SESSION_RETURN_PLAN.$formKey; if (!$request->isMethod('POST')) { - $fromInitiative = self::RETURN_TO_PLAN === $request->query->get('returnTo') && null !== $initiativeId; - $session->set($key, $fromInitiative ? $initiativeId : null); + $fromProgram = self::RETURN_TO_PLAN === $request->query->get('returnTo') && null !== $programId; + $session->set($key, $fromProgram ? $programId : null); } $value = $session->get($key); @@ -143,10 +143,10 @@ class TaskController extends AbstractStandardFormController { $entity = parent::getFormEntity($action, $objectId, $isClone); - if ('new' === $action && $entity instanceof Task && null === $entity->getInitiative() && null !== $this->preselectedInitiativeId) { - $initiative = $this->getModel('program.initiative')->getEntity($this->preselectedInitiativeId); - if ($initiative instanceof Initiative) { - $entity->setInitiative($initiative); + if ('new' === $action && $entity instanceof Task && null === $entity->getProgram() && null !== $this->preselectedProgramId) { + $program = $this->getModel('mt3smp.program')->getEntity($this->preselectedProgramId); + if ($program instanceof Program) { + $entity->setProgram($program); } } @@ -163,8 +163,8 @@ class TaskController extends AbstractStandardFormController } /** - * After Save or Cancel (not Apply) on a form opened from an initiative, go back to that initiative. If the task - * was moved to another initiative, go to its new initiative. Otherwise keep core's default: the task list. + * After Save or Cancel (not Apply) on a form opened from an program, go back to that program. If the task + * was moved to another program, go to its new program. Otherwise keep core's default: the task list. * * @param array $args * @@ -172,13 +172,13 @@ class TaskController extends AbstractStandardFormController */ protected function getPostActionRedirectArguments(array $args, $action): array { - if (in_array($action, ['new', 'edit'], true) && null !== $this->returnInitiativeId) { - $initiativeId = $this->savedTask?->getInitiative()?->getId() ?? $this->returnInitiativeId; + if (in_array($action, ['new', 'edit'], true) && null !== $this->returnProgramId) { + $programId = $this->savedTask?->getProgram()?->getId() ?? $this->returnProgramId; - $args['returnUrl'] = $this->generateUrl(InitiativeController::ROUTE_ACTION, ['objectAction' => 'view', 'objectId' => $initiativeId]); - $args['contentTemplate'] = InitiativeController::class.'::viewAction'; - $args['viewParameters'] = ['objectId' => $initiativeId]; - $args['passthroughVars'] = array_merge($args['passthroughVars'] ?? [], ['mauticContent' => 'initiative']); + $args['returnUrl'] = $this->generateUrl(ProgramController::ROUTE_ACTION, ['objectAction' => 'view', 'objectId' => $programId]); + $args['contentTemplate'] = ProgramController::class.'::viewAction'; + $args['viewParameters'] = ['objectId' => $programId]; + $args['passthroughVars'] = array_merge($args['passthroughVars'] ?? [], ['mauticContent' => 'program']); } return parent::getPostActionRedirectArguments($args, $action); diff --git a/Controller/UtmTaxonomyController.php b/Controller/UtmTaxonomyController.php index 7bbcd3d..16e6558 100644 --- a/Controller/UtmTaxonomyController.php +++ b/Controller/UtmTaxonomyController.php @@ -2,20 +2,21 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Controller; +namespace MauticPlugin\MT3SMarketingProgramBundle\Controller; use Mautic\CoreBundle\Controller\CommonController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; /** - * UTM Taxonomies (Programs > UTM Taxonomies): a placeholder for now, so the menu entry has a - * page. The content (classifying the UTM parameters of the programs' campaigns and links) comes + * UTM Taxonomies: a placeholder page for the coming feature, kept out of the menu since + * 0.17.0 (the route stays; the page is reachable at /s/marketing-program-utm-taxonomies). + * The content (classifying the UTM parameters of the programs' campaigns and links) comes * later; until then the page shows an empty content block. */ class UtmTaxonomyController extends CommonController { - public const ROUTE_INDEX = 'program_utm_taxonomy_index'; + public const ROUTE_INDEX = 'mt3s_marketing_program_utm_taxonomy_index'; /** * @param int $page @@ -28,10 +29,10 @@ class UtmTaxonomyController extends CommonController 'viewParameters' => [ 'tmpl' => $tmpl, ], - 'contentTemplate' => '@Program/UtmTaxonomy/list.html.twig', + 'contentTemplate' => '@MT3SMarketingProgram/UtmTaxonomy/list.html.twig', 'passthroughVars' => [ 'activeLink' => '#'.self::ROUTE_INDEX, - 'mauticContent' => 'programUtmTaxonomy', + 'mauticContent' => 'mt3sMpProgramUtmTaxonomy', 'route' => $this->generateUrl(self::ROUTE_INDEX), ], ]); diff --git a/DependencyInjection/ProgramExtension.php b/DependencyInjection/MT3SMarketingProgramExtension.php similarity index 82% rename from DependencyInjection/ProgramExtension.php rename to DependencyInjection/MT3SMarketingProgramExtension.php index fb6c750..c9243f0 100644 --- a/DependencyInjection/ProgramExtension.php +++ b/DependencyInjection/MT3SMarketingProgramExtension.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\DependencyInjection; +namespace MauticPlugin\MT3SMarketingProgramBundle\DependencyInjection; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -12,7 +12,7 @@ use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; /** * Loads Config/services.php (Symfony finds this class by naming convention). */ -final class ProgramExtension extends Extension +final class MT3SMarketingProgramExtension extends Extension { /** * @param mixed[] $configs diff --git a/Entity/Audience.php b/Entity/Audience.php index 03f2f6d..a8e8118 100644 --- a/Entity/Audience.php +++ b/Entity/Audience.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -19,11 +19,11 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; /** * One audience of the global directory (Programs > Audiences): who the plan is aimed at, and how. - * Audiences are independent of plans; a plan links to them from its Audiences tab through InitiativeAudience, - * which carries the audience's priority in that plan, and possibly a initiative-specific message. + * Audiences are independent of plans; a plan links to them from its Audiences tab through ProgramAudience, + * which carries the audience's priority in that plan, and possibly a program-specific message. * * Which attributes are offered on the forms is set up by the admin in Settings > Configuration > - * Initiative Settings (per-attribute toggles, so a b2b install and a b2c install define their personas + * Program Settings (per-attribute toggles, so a b2b install and a b2c install define their personas * differently); the decision roles and the tones are lists edited there too. See AudienceAttributes. * * The stages are the Mautic stages (Settings > Stages) this audience maps to; an audience can have @@ -33,26 +33,26 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; * informational: the user may assign none, one or several; the list view shows their names and * their contact counts. Deleting a segment removes the link, not the audience. * - * isPublished (from FormEntity) means "active": an unpublished audience is hidden from the initiative - * form's audience picker, but keeps its history on the initiatives it is already linked to. + * isPublished (from FormEntity) means "active": an unpublished audience is hidden from the program + * form's audience picker, but keeps its history on the mt3s_mp_programs it is already linked to. */ class Audience extends FormEntity { - public const TABLE_NAME = 'initiative_audiences'; + public const TABLE_NAME = 'mt3s_mp_program_audiences'; /** * Keys offered for preferredChannels, in display order. */ public const CHANNELS = [ - 'email' => 'mautic.program.audience.channel.email', - 'sms' => 'mautic.program.audience.channel.sms', - 'web' => 'mautic.program.audience.channel.web', - 'social_organic' => 'mautic.program.audience.channel.social_organic', - 'paid_social' => 'mautic.program.audience.channel.paid_social', - 'paid_search' => 'mautic.program.audience.channel.paid_search', - 'events_webinar' => 'mautic.program.audience.channel.events_webinar', - 'outbound_sales' => 'mautic.program.audience.channel.outbound_sales', - 'partners' => 'mautic.program.audience.channel.partners', + 'email' => 'mt3s.marketing_program.audience.channel.email', + 'sms' => 'mt3s.marketing_program.audience.channel.sms', + 'web' => 'mt3s.marketing_program.audience.channel.web', + 'social_organic' => 'mt3s.marketing_program.audience.channel.social_organic', + 'paid_social' => 'mt3s.marketing_program.audience.channel.paid_social', + 'paid_search' => 'mt3s.marketing_program.audience.channel.paid_search', + 'events_webinar' => 'mt3s.marketing_program.audience.channel.events_webinar', + 'outbound_sales' => 'mt3s.marketing_program.audience.channel.outbound_sales', + 'partners' => 'mt3s.marketing_program.audience.channel.partners', ]; private ?int $id = null; @@ -92,13 +92,13 @@ class Audience extends FormEntity private ?string $triggers = null; /** - * Key of a decision role set up in Settings > Configuration > Initiative Settings + * Key of a decision role set up in Settings > Configuration > Program Settings * (parameter program_audience_decision_roles), or null when the attribute is unused. */ private ?string $decisionRole = null; /** - * Keys of tones set up in Settings > Configuration > Initiative Settings + * Keys of tones set up in Settings > Configuration > Program Settings * (parameter program_audience_tones), or null/[] when the attribute is unused. * * @var list|null @@ -106,7 +106,7 @@ class Audience extends FormEntity private ?array $preferredTones = null; /** - * Keys of self::CHANNELS the initiative means to use for this audience. + * Keys of self::CHANNELS the program means to use for this audience. * * @var list|null */ @@ -132,18 +132,18 @@ class Audience extends FormEntity private ?int $estimatedSize = null; /** - * The links to the initiatives this audience is assigned to. Inverse side, read-only from here: the - * links are managed from the plans (Initiative::addAudience/removeAudience). + * The links to the mt3s_mp_programs this audience is assigned to. Inverse side, read-only from here: the + * links are managed from the plans (Program::addAudience/removeAudience). * - * @var Collection + * @var Collection */ - private Collection $initiativeLinks; + private Collection $programLinks; public function __construct() { $this->stages = new ArrayCollection(); $this->segments = new ArrayCollection(); - $this->initiativeLinks = new ArrayCollection(); + $this->programLinks = new ArrayCollection(); } public function __clone() @@ -151,7 +151,7 @@ class Audience extends FormEntity $this->id = null; $this->stages = new ArrayCollection(); $this->segments = new ArrayCollection(); - $this->initiativeLinks = new ArrayCollection(); + $this->programLinks = new ArrayCollection(); parent::__clone(); } @@ -213,13 +213,13 @@ class Audience extends FormEntity ->build(); $builder->createManyToMany('stages', Stage::class) - ->setJoinTable('initiative_audiences_stages') + ->setJoinTable('mt3s_mp_program_audiences_stages') ->addJoinColumn('audience_id', 'id', false, false, 'CASCADE') ->addInverseJoinColumn('stage_id', 'id', false, false, 'CASCADE') ->build(); $builder->createManyToMany('segments', LeadList::class) - ->setJoinTable('initiative_audiences_segments') + ->setJoinTable('mt3s_mp_program_audiences_segments') ->addJoinColumn('audience_id', 'id', false, false, 'CASCADE') ->addInverseJoinColumn('leadlist_id', 'id', false, false, 'CASCADE') ->build(); @@ -230,8 +230,8 @@ class Audience extends FormEntity ->option('unsigned', true) ->build(); - // The links to the initiatives, managed from the initiatives. - $builder->createOneToMany('initiativeLinks', InitiativeAudience::class) + // The links to the mt3s_mp_programs, managed from the mt3s_mp_programs. + $builder->createOneToMany('programLinks', ProgramAudience::class) ->mappedBy('audience') ->fetchExtraLazy() ->build(); @@ -239,9 +239,9 @@ class Audience extends FormEntity public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.program.audience.name.required')); + $metadata->addPropertyConstraint('name', new NotBlank(message: 'mt3s.marketing_program.audience.name.required')); $metadata->addPropertyConstraint('name', new Length(max: 191)); - $metadata->addPropertyConstraint('estimatedSize', new PositiveOrZero(message: 'mautic.program.audience.estimated_size.invalid')); + $metadata->addPropertyConstraint('estimatedSize', new PositiveOrZero(message: 'mt3s.marketing_program.audience.estimated_size.invalid')); $metadata->addPropertyConstraint('decisionRole', new Length(max: 64)); } @@ -470,10 +470,10 @@ class Audience extends FormEntity } /** - * @return Collection + * @return Collection */ - public function getInitiativeLinks(): Collection + public function getProgramLinks(): Collection { - return $this->initiativeLinks; + return $this->programLinks; } } diff --git a/Entity/AudiencePriority.php b/Entity/AudiencePriority.php index 54629cc..ecf668f 100644 --- a/Entity/AudiencePriority.php +++ b/Entity/AudiencePriority.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** - * How important an initiative's audience is to the initiative. The order of the cases is the order of the dropdown. + * How important an program's audience is to the program. The order of the cases is the order of the dropdown. */ enum AudiencePriority: string { @@ -15,7 +15,7 @@ enum AudiencePriority: string public function getLabelKey(): string { - return 'mautic.program.audience.priority.'.$this->value; + return 'mt3s.marketing_program.audience.priority.'.$this->value; } public function getLabelClass(): string diff --git a/Entity/AudienceRepository.php b/Entity/AudienceRepository.php index f608097..80deecf 100644 --- a/Entity/AudienceRepository.php +++ b/Entity/AudienceRepository.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Connection; use Mautic\CoreBundle\Entity\CommonRepository; @@ -40,7 +40,7 @@ class AudienceRepository extends CommonRepository { $rows = $this->getEntityManager()->getConnection()->fetchAllAssociative( 'SELECT s.leadlist_id, COUNT(ll.lead_id) AS cnt - FROM initiative_audiences_segments s + FROM mt3s_mp_program_audiences_segments s JOIN lead_lists_leads ll ON ll.leadlist_id = s.leadlist_id AND ll.manually_removed = 0 WHERE s.audience_id = :audienceId GROUP BY s.leadlist_id', @@ -72,7 +72,7 @@ class AudienceRepository extends CommonRepository $connection = $this->getEntityManager()->getConnection(); $rows = $connection->fetchAllAssociative( 'SELECT s.audience_id, s.leadlist_id, COUNT(ll.lead_id) AS cnt - FROM initiative_audiences_segments s + FROM mt3s_mp_program_audiences_segments s JOIN lead_lists_leads ll ON ll.leadlist_id = s.leadlist_id AND ll.manually_removed = 0 WHERE s.audience_id IN (:audienceIds) GROUP BY s.audience_id, s.leadlist_id', diff --git a/Entity/AudienceType.php b/Entity/AudienceType.php index b8486fa..e585ee7 100644 --- a/Entity/AudienceType.php +++ b/Entity/AudienceType.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** - * The kind of audience an initiative's audience entry describes. The order of the cases is the order of the dropdown. + * The kind of audience an program's audience entry describes. The order of the cases is the order of the dropdown. */ enum AudienceType: string { @@ -17,7 +17,7 @@ enum AudienceType: string public function getLabelKey(): string { - return 'mautic.program.audience.type.'.$this->value; + return 'mt3s.marketing_program.audience.type.'.$this->value; } /** diff --git a/Entity/CountsItemsByTypeTrait.php b/Entity/CountsItemsByTypeTrait.php index 7e8c102..b95b04f 100644 --- a/Entity/CountsItemsByTypeTrait.php +++ b/Entity/CountsItemsByTypeTrait.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** - * For repositories of typed initiative items (description items, allocation items, objectives, tasks). + * For repositories of typed program items (description items, allocation items, objectives, tasks). */ trait CountsItemsByTypeTrait { diff --git a/Entity/DateRangeInterface.php b/Entity/DateRangeInterface.php index 27c5803..53ffca8 100644 --- a/Entity/DateRangeInterface.php +++ b/Entity/DateRangeInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** * An object with an optional start and end date. Checked by the EndDateAfterStartDate constraint. diff --git a/Entity/DependencyType.php b/Entity/DependencyType.php index 5263d62..6e655b2 100644 --- a/Entity/DependencyType.php +++ b/Entity/DependencyType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** * The type of a task dependency edge. The order of the cases is the order of the dropdown. @@ -16,6 +16,6 @@ enum DependencyType: string public function getLabelKey(): string { - return 'mautic.program.task.dependency_type.'.$this->value; + return 'mt3s.marketing_program.task.dependency_type.'.$this->value; } } diff --git a/Entity/Initiative.php b/Entity/Program.php similarity index 82% rename from Entity/Initiative.php rename to Entity/Program.php index 31cbaad..a79f952 100644 --- a/Entity/Initiative.php +++ b/Entity/Program.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -12,16 +12,16 @@ use Mautic\CategoryBundle\Entity\Category; use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; use Mautic\CoreBundle\Entity\FormEntity; use Mautic\UserBundle\Entity\User; -use MauticPlugin\ProgramBundle\Validator\Constraints\EndDateAfterStartDate; +use MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints\EndDateAfterStartDate; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\Mapping\ClassMetadata; -class Initiative extends FormEntity implements DateRangeInterface +class Program extends FormEntity implements DateRangeInterface { - public const TABLE_NAME = 'initiatives'; + public const TABLE_NAME = 'mt3s_mp_programs'; public const VERSION_MIN = 1; public const VERSION_MAX = 99; @@ -29,51 +29,51 @@ class Initiative extends FormEntity implements DateRangeInterface private ?int $id = null; /** - * Initiative version, 1 to 99. Edited by hand; not related to Doctrine optimistic locking. + * Program version, 1 to 99. Edited by hand; not related to Doctrine optimistic locking. */ private ?int $version = self::VERSION_MIN; /** - * @var Collection + * @var Collection */ private Collection $objectives; /** * The content of the Description tab. Each item has a type set up by the admin in - * Settings > Configuration > Initiative. + * Settings > Configuration > Program. * - * @var Collection + * @var Collection */ private Collection $descriptionItems; /** * The cost lines of the Allocations tab. Each item has a type set up by the admin in - * Settings > Configuration > Initiative. + * Settings > Configuration > Program. * - * @var Collection + * @var Collection */ private Collection $allocationItems; /** * The audiences of the Audiences tab: links to the audiences of the global directory * (Programs > Audiences), each with the audience's priority in this plan and possibly a - * initiative-specific message. See InitiativeAudience. + * program-specific message. See ProgramAudience. * - * @var Collection + * @var Collection */ private Collection $audiences; /** * The links to the stakeholders of the global directory (Programs > Stakeholders), each with the - * stakeholder's role in this plan. See InitiativeStakeholder. + * stakeholder's role in this plan. See ProgramStakeholder. * - * @var Collection + * @var Collection */ private Collection $stakeholders; /** * Tasks are managed on their own pages (TaskController). - * Read-only from the initiative: deleting an initiative + * Read-only from the program: deleting an program * deletes its tasks through the database (ON DELETE CASCADE). * * @var Collection @@ -82,7 +82,7 @@ class Initiative extends FormEntity implements DateRangeInterface private ?string $name = null; - private InitiativeStatus $status = InitiativeStatus::Draft; + private ProgramStatus $status = ProgramStatus::Draft; /** * Required in the form. The column is nullable only so that deleting the user doesn't delete the plan (SET NULL). @@ -160,7 +160,7 @@ class Initiative extends FormEntity implements DateRangeInterface $builder = new ClassMetadataBuilder($metadata); $builder->setTable(self::TABLE_NAME) - ->setCustomRepositoryClass(InitiativeRepository::class) + ->setCustomRepositoryClass(ProgramRepository::class) ->addIndex(['status'], 'program_status'); // id and name; no description column (replaced by description items). @@ -171,7 +171,7 @@ class Initiative extends FormEntity implements DateRangeInterface 'fieldName' => 'status', 'type' => Types::STRING, 'length' => 20, - 'enumType' => InitiativeStatus::class, + 'enumType' => ProgramStatus::class, ]); $builder->createManyToOne('owner', User::class) @@ -197,8 +197,8 @@ class Initiative extends FormEntity implements DateRangeInterface ->option('default', self::VERSION_MIN) ->build(); - $builder->createOneToMany('objectives', InitiativeObjective::class) - ->mappedBy('initiative') + $builder->createOneToMany('objectives', ProgramObjective::class) + ->mappedBy('program') ->cascadePersist() ->cascadeRemove() ->orphanRemoval() @@ -206,8 +206,8 @@ class Initiative extends FormEntity implements DateRangeInterface ->fetchExtraLazy() ->build(); - $builder->createOneToMany('descriptionItems', InitiativeDescriptionItem::class) - ->mappedBy('initiative') + $builder->createOneToMany('descriptionItems', ProgramDescriptionItem::class) + ->mappedBy('program') ->cascadePersist() ->cascadeRemove() ->orphanRemoval() @@ -215,8 +215,8 @@ class Initiative extends FormEntity implements DateRangeInterface ->fetchExtraLazy() ->build(); - $builder->createOneToMany('allocationItems', InitiativeAllocationItem::class) - ->mappedBy('initiative') + $builder->createOneToMany('allocationItems', ProgramAllocationItem::class) + ->mappedBy('program') ->cascadePersist() ->cascadeRemove() ->orphanRemoval() @@ -224,8 +224,8 @@ class Initiative extends FormEntity implements DateRangeInterface ->fetchExtraLazy() ->build(); - $builder->createOneToMany('audiences', InitiativeAudience::class) - ->mappedBy('initiative') + $builder->createOneToMany('audiences', ProgramAudience::class) + ->mappedBy('program') ->cascadePersist() ->cascadeRemove() ->orphanRemoval() @@ -233,8 +233,8 @@ class Initiative extends FormEntity implements DateRangeInterface ->fetchExtraLazy() ->build(); - $builder->createOneToMany('stakeholders', InitiativeStakeholder::class) - ->mappedBy('initiative') + $builder->createOneToMany('stakeholders', ProgramStakeholder::class) + ->mappedBy('program') ->cascadePersist() ->cascadeRemove() ->orphanRemoval() @@ -243,7 +243,7 @@ class Initiative extends FormEntity implements DateRangeInterface ->build(); $builder->createOneToMany('tasks', Task::class) - ->mappedBy('initiative') + ->mappedBy('program') ->setOrderBy(['name' => 'ASC']) ->fetchExtraLazy() ->build(); @@ -251,9 +251,9 @@ class Initiative extends FormEntity implements DateRangeInterface public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('version', new NotNull(message: 'mautic.program.version.range')); + $metadata->addPropertyConstraint('version', new NotNull(message: 'mt3s.marketing_program.version.range')); $metadata->addPropertyConstraint('version', new Range( - notInRangeMessage: 'mautic.program.version.range', + notInRangeMessage: 'mt3s.marketing_program.version.range', min: self::VERSION_MIN, max: self::VERSION_MAX, )); @@ -263,7 +263,7 @@ class Initiative extends FormEntity implements DateRangeInterface $metadata->addPropertyConstraint('audiences', new Valid()); $metadata->addPropertyConstraint('stakeholders', new Valid()); $metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.core.name.required')); - $metadata->addPropertyConstraint('owner', new NotBlank(message: 'mautic.program.owner.required')); + $metadata->addPropertyConstraint('owner', new NotBlank(message: 'mt3s.marketing_program.owner.required')); $metadata->addConstraint(new EndDateAfterStartDate()); } @@ -295,12 +295,12 @@ class Initiative extends FormEntity implements DateRangeInterface * Sorted here, not only by the mapping's orderBy: after a reorder, positions change in memory while the * loaded collection keeps its old order, and the page shown right after saving uses that collection. * - * @return Collection + * @return Collection */ public function getObjectives(): Collection { $objectives = self::sortedByPosition($this->objectives)->toArray(); - usort($objectives, function (InitiativeObjective $a, InitiativeObjective $b): int { + usort($objectives, function (ProgramObjective $a, ProgramObjective $b): int { // An objective without a priority yet sorts last; ties keep the position order. $pa = $a->getPriority() ?? PHP_INT_MAX; $pb = $b->getPriority() ?? PHP_INT_MAX; @@ -322,17 +322,17 @@ class Initiative extends FormEntity implements DateRangeInterface /** * The audience links sorted by position, as a new collection; see getObjectives(). * - * @return Collection + * @return Collection */ public function getAudiences(): Collection { return self::sortedByPosition($this->audiences); } - public function addAudience(InitiativeAudience $audience): static + public function addAudience(ProgramAudience $audience): static { if (!$this->audiences->contains($audience)) { - $audience->setInitiative($this); + $audience->setProgram($this); $this->audiences->add($audience); } @@ -343,7 +343,7 @@ class Initiative extends FormEntity implements DateRangeInterface * Removing an audience link from the plan deletes it (orphanRemoval). The audience itself stays * in the global directory. */ - public function removeAudience(InitiativeAudience $audience): static + public function removeAudience(ProgramAudience $audience): static { $this->audiences->removeElement($audience); @@ -353,17 +353,17 @@ class Initiative extends FormEntity implements DateRangeInterface /** * The stakeholder links sorted by position, as a new collection; see getObjectives(). * - * @return Collection + * @return Collection */ public function getStakeholders(): Collection { return self::sortedByPosition($this->stakeholders); } - public function addStakeholder(InitiativeStakeholder $stakeholder): static + public function addStakeholder(ProgramStakeholder $stakeholder): static { if (!$this->stakeholders->contains($stakeholder)) { - $stakeholder->setInitiative($this); + $stakeholder->setProgram($this); $this->stakeholders->add($stakeholder); } @@ -374,17 +374,17 @@ class Initiative extends FormEntity implements DateRangeInterface * Removing a stakeholder link from the plan deletes it (orphanRemoval). The stakeholder itself * stays in the global directory. */ - public function removeStakeholder(InitiativeStakeholder $stakeholder): static + public function removeStakeholder(ProgramStakeholder $stakeholder): static { $this->stakeholders->removeElement($stakeholder); return $this; } - public function addObjective(InitiativeObjective $objective): static + public function addObjective(ProgramObjective $objective): static { if (!$this->objectives->contains($objective)) { - $objective->setInitiative($this); + $objective->setProgram($this); $this->objectives->add($objective); } @@ -394,7 +394,7 @@ class Initiative extends FormEntity implements DateRangeInterface /** * Removing an objective from the plan deletes it (orphanRemoval). */ - public function removeObjective(InitiativeObjective $objective): static + public function removeObjective(ProgramObjective $objective): static { $this->objectives->removeElement($objective); @@ -404,7 +404,7 @@ class Initiative extends FormEntity implements DateRangeInterface /** * The description items sorted by position, as a new collection; see getObjectives(). * - * @return Collection + * @return Collection */ public function getDescriptionItems(): Collection { @@ -414,17 +414,17 @@ class Initiative extends FormEntity implements DateRangeInterface /** * The allocation items sorted by position, as a new collection; see getObjectives(). * - * @return Collection + * @return Collection */ public function getAllocationItems(): Collection { return self::sortedByPosition($this->allocationItems); } - public function addAllocationItem(InitiativeAllocationItem $allocationItem): static + public function addAllocationItem(ProgramAllocationItem $allocationItem): static { if (!$this->allocationItems->contains($allocationItem)) { - $allocationItem->setInitiative($this); + $allocationItem->setProgram($this); $this->allocationItems->add($allocationItem); } @@ -434,7 +434,7 @@ class Initiative extends FormEntity implements DateRangeInterface /** * Removing an allocation item from the plan deletes it (orphanRemoval). */ - public function removeAllocationItem(InitiativeAllocationItem $allocationItem): static + public function removeAllocationItem(ProgramAllocationItem $allocationItem): static { $this->allocationItems->removeElement($allocationItem); @@ -468,7 +468,7 @@ class Initiative extends FormEntity implements DateRangeInterface } /** - * @template T of InitiativeObjective|InitiativeDescriptionItem|InitiativeAllocationItem|Audience|InitiativeStakeholder + * @template T of ProgramObjective|ProgramDescriptionItem|ProgramAllocationItem|Audience|ProgramStakeholder * * @param Collection $collection * @@ -482,10 +482,10 @@ class Initiative extends FormEntity implements DateRangeInterface return new ArrayCollection($rows); } - public function addDescriptionItem(InitiativeDescriptionItem $descriptionItem): static + public function addDescriptionItem(ProgramDescriptionItem $descriptionItem): static { if (!$this->descriptionItems->contains($descriptionItem)) { - $descriptionItem->setInitiative($this); + $descriptionItem->setProgram($this); $this->descriptionItems->add($descriptionItem); } @@ -495,7 +495,7 @@ class Initiative extends FormEntity implements DateRangeInterface /** * Removing a description item from the plan deletes it (orphanRemoval). */ - public function removeDescriptionItem(InitiativeDescriptionItem $descriptionItem): static + public function removeDescriptionItem(ProgramDescriptionItem $descriptionItem): static { $this->descriptionItems->removeElement($descriptionItem); @@ -531,7 +531,7 @@ class Initiative extends FormEntity implements DateRangeInterface return $this; } - public function getStatus(): InitiativeStatus + public function getStatus(): ProgramStatus { return $this->status; } @@ -540,7 +540,7 @@ class Initiative extends FormEntity implements DateRangeInterface * Sets completedAt when the plan moves to "completed" from another status, * and clears it when the plan leaves "completed". */ - public function setStatus(InitiativeStatus $status): static + public function setStatus(ProgramStatus $status): static { if ($status === $this->status) { return $this; @@ -549,9 +549,9 @@ class Initiative extends FormEntity implements DateRangeInterface // isChanged() can't log enums (they aren't stringable), so log the backing values. $this->addChange('status', [$this->status->value, $status->value]); - if (InitiativeStatus::Completed === $status) { + if (ProgramStatus::Completed === $status) { $this->setCompletedAt(new \DateTime()); - } elseif (InitiativeStatus::Completed === $this->status) { + } elseif (ProgramStatus::Completed === $this->status) { $this->setCompletedAt(null); } diff --git a/Entity/InitiativeAllocationItem.php b/Entity/ProgramAllocationItem.php similarity index 82% rename from Entity/InitiativeAllocationItem.php rename to Entity/ProgramAllocationItem.php index e613e8d..11e2cc2 100644 --- a/Entity/InitiativeAllocationItem.php +++ b/Entity/ProgramAllocationItem.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata; @@ -13,21 +13,21 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; /** * One item of a plan's Allocations tab: a typed cost line with a planned and a real cost, both in - * the general currency (CurrencyProvider). Initiative::$allocationItems owns the lifecycle: items are saved + * the general currency (CurrencyProvider). Program::$allocationItems owns the lifecycle: items are saved * and deleted with their plan, and are ordered by position. * - * The type is the key of an allocation item type set up in Settings > Configuration > Initiative Settings + * The type is the key of an allocation item type set up in Settings > Configuration > Program Settings * (parameter program_allocation_item_types); see ItemTypeProvider. */ -class InitiativeAllocationItem +class ProgramAllocationItem { - public const TABLE_NAME = 'initiative_allocation_items'; + public const TABLE_NAME = 'mt3s_mp_program_allocation_items'; public const TYPE_MAX_LENGTH = 64; private ?int $id = null; - private ?Initiative $initiative = null; + private ?Program $program = null; private ?string $type = null; @@ -50,7 +50,7 @@ class InitiativeAllocationItem public function __clone() { $this->id = null; - $this->initiative = null; + $this->program = null; } public static function loadMetadata(OrmClassMetadata $metadata): void @@ -58,13 +58,13 @@ class InitiativeAllocationItem $builder = new ClassMetadataBuilder($metadata); $builder->setTable(self::TABLE_NAME) - ->setCustomRepositoryClass(InitiativeAllocationItemRepository::class); + ->setCustomRepositoryClass(ProgramAllocationItemRepository::class); $builder->addId(); - $builder->createManyToOne('initiative', Initiative::class) + $builder->createManyToOne('program', Program::class) ->inversedBy('allocationItems') - ->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE') + ->addJoinColumn('program_id', 'id', false, false, 'CASCADE') ->build(); $builder->createField('type', Types::STRING) @@ -96,7 +96,7 @@ class InitiativeAllocationItem public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.allocation_item.type.required')); + $metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.allocation_item.type.required')); $metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH)); $metadata->addPropertyConstraint('name', new Length(max: 255)); } @@ -106,14 +106,14 @@ class InitiativeAllocationItem return $this->id; } - public function getInitiative(): ?Initiative + public function getProgram(): ?Program { - return $this->initiative; + return $this->program; } - public function setInitiative(?Initiative $initiative): static + public function setProgram(?Program $program): static { - $this->initiative = $initiative; + $this->program = $program; return $this; } diff --git a/Entity/InitiativeAllocationItemRepository.php b/Entity/ProgramAllocationItemRepository.php similarity index 54% rename from Entity/InitiativeAllocationItemRepository.php rename to Entity/ProgramAllocationItemRepository.php index 47d09fe..bdc9cca 100644 --- a/Entity/InitiativeAllocationItemRepository.php +++ b/Entity/ProgramAllocationItemRepository.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; /** - * @extends CommonRepository + * @extends CommonRepository */ -class InitiativeAllocationItemRepository extends CommonRepository +class ProgramAllocationItemRepository extends CommonRepository { use CountsItemsByTypeTrait; diff --git a/Entity/InitiativeAudience.php b/Entity/ProgramAudience.php similarity index 79% rename from Entity/InitiativeAudience.php rename to Entity/ProgramAudience.php index 418c7e4..87f4413 100644 --- a/Entity/InitiativeAudience.php +++ b/Entity/ProgramAudience.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata; @@ -13,19 +13,19 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; /** * The link between a plan and an audience of the global directory, with the audience's priority - * in that plan and possibly a initiative-specific message ("Key message for this plan"): the same + * in that plan and possibly a program-specific message ("Key message for this plan"): the same * audience can be primary in one plan and secondary in another. * - * Initiative::$audiences owns the lifecycle: links are saved and deleted with their plan. Deleting an + * Program::$audiences owns the lifecycle: links are saved and deleted with their plan. Deleting an * audience deletes its links (ON DELETE CASCADE on both sides). */ -class InitiativeAudience +class ProgramAudience { - public const TABLE_NAME = 'initiative_audiences_initiative'; + public const TABLE_NAME = 'mt3s_mp_program_audiences_program'; private ?int $id = null; - private ?Initiative $initiative = null; + private ?Program $program = null; private ?Audience $audience = null; @@ -44,7 +44,7 @@ class InitiativeAudience public function __clone() { $this->id = null; - $this->initiative = null; + $this->program = null; } public static function loadMetadata(OrmClassMetadata $metadata): void @@ -52,13 +52,13 @@ class InitiativeAudience $builder = new ClassMetadataBuilder($metadata); $builder->setTable(self::TABLE_NAME) - ->setCustomRepositoryClass(InitiativeAudienceRepository::class); + ->setCustomRepositoryClass(ProgramAudienceRepository::class); $builder->addId(); - $builder->createManyToOne('initiative', Initiative::class) + $builder->createManyToOne('program', Program::class) ->inversedBy('audiences') - ->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE') + ->addJoinColumn('program_id', 'id', false, false, 'CASCADE') ->build(); $builder->createManyToOne('audience', Audience::class) @@ -86,7 +86,7 @@ class InitiativeAudience public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('audience', new NotBlank(message: 'mautic.program.audience_link.audience.required')); + $metadata->addPropertyConstraint('audience', new NotBlank(message: 'mt3s.marketing_program.audience_link.audience.required')); $metadata->addPropertyConstraint('valueProposition', new Length(max: 1000)); } @@ -95,14 +95,14 @@ class InitiativeAudience return $this->id; } - public function getInitiative(): ?Initiative + public function getProgram(): ?Program { - return $this->initiative; + return $this->program; } - public function setInitiative(?Initiative $initiative): static + public function setProgram(?Program $program): static { - $this->initiative = $initiative; + $this->program = $program; return $this; } diff --git a/Entity/InitiativeAudienceRepository.php b/Entity/ProgramAudienceRepository.php similarity index 51% rename from Entity/InitiativeAudienceRepository.php rename to Entity/ProgramAudienceRepository.php index ff11611..a9699a7 100644 --- a/Entity/InitiativeAudienceRepository.php +++ b/Entity/ProgramAudienceRepository.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; /** - * @extends CommonRepository + * @extends CommonRepository */ -class InitiativeAudienceRepository extends CommonRepository +class ProgramAudienceRepository extends CommonRepository { public function getTableAlias(): string { diff --git a/Entity/InitiativeDescriptionItem.php b/Entity/ProgramDescriptionItem.php similarity index 75% rename from Entity/InitiativeDescriptionItem.php rename to Entity/ProgramDescriptionItem.php index c9c54d5..a9e9473 100644 --- a/Entity/InitiativeDescriptionItem.php +++ b/Entity/ProgramDescriptionItem.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata; @@ -12,21 +12,21 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Mapping\ClassMetadata; /** - * One item of a plan's Description tab. Initiative::$descriptionItems owns the lifecycle: items are saved and + * One item of a plan's Description tab. Program::$descriptionItems owns the lifecycle: items are saved and * deleted with their plan, and are ordered by position. * - * The type is the key of a type set up in Settings > Configuration > Initiative (parameter + * The type is the key of a type set up in Settings > Configuration > Program (parameter * program_description_item_types); see ItemTypeProvider (kind "description") for its name and description. */ -class InitiativeDescriptionItem +class ProgramDescriptionItem { - public const TABLE_NAME = 'initiative_description_items'; + public const TABLE_NAME = 'mt3s_mp_program_description_items'; public const TYPE_MAX_LENGTH = 64; private ?int $id = null; - private ?Initiative $initiative = null; + private ?Program $program = null; private ?string $type = null; @@ -40,7 +40,7 @@ class InitiativeDescriptionItem public function __clone() { $this->id = null; - $this->initiative = null; + $this->program = null; } public static function loadMetadata(OrmClassMetadata $metadata): void @@ -48,13 +48,13 @@ class InitiativeDescriptionItem $builder = new ClassMetadataBuilder($metadata); $builder->setTable(self::TABLE_NAME) - ->setCustomRepositoryClass(InitiativeDescriptionItemRepository::class); + ->setCustomRepositoryClass(ProgramDescriptionItemRepository::class); $builder->addId(); - $builder->createManyToOne('initiative', Initiative::class) + $builder->createManyToOne('program', Program::class) ->inversedBy('descriptionItems') - ->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE') + ->addJoinColumn('program_id', 'id', false, false, 'CASCADE') ->build(); $builder->createField('type', Types::STRING) @@ -72,7 +72,7 @@ class InitiativeDescriptionItem public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.description_item.type.required')); + $metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.description_item.type.required')); $metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH)); } @@ -81,14 +81,14 @@ class InitiativeDescriptionItem return $this->id; } - public function getInitiative(): ?Initiative + public function getProgram(): ?Program { - return $this->initiative; + return $this->program; } - public function setInitiative(?Initiative $initiative): static + public function setProgram(?Program $program): static { - $this->initiative = $initiative; + $this->program = $program; return $this; } diff --git a/Entity/InitiativeDescriptionItemRepository.php b/Entity/ProgramDescriptionItemRepository.php similarity index 53% rename from Entity/InitiativeDescriptionItemRepository.php rename to Entity/ProgramDescriptionItemRepository.php index 78b1213..ac56b78 100644 --- a/Entity/InitiativeDescriptionItemRepository.php +++ b/Entity/ProgramDescriptionItemRepository.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; /** - * @extends CommonRepository + * @extends CommonRepository */ -class InitiativeDescriptionItemRepository extends CommonRepository +class ProgramDescriptionItemRepository extends CommonRepository { use CountsItemsByTypeTrait; diff --git a/Entity/InitiativeObjective.php b/Entity/ProgramObjective.php similarity index 82% rename from Entity/InitiativeObjective.php rename to Entity/ProgramObjective.php index fc309d1..64e907a 100644 --- a/Entity/InitiativeObjective.php +++ b/Entity/ProgramObjective.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata; @@ -14,12 +14,12 @@ use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Mapping\ClassMetadata; /** - * An objective of a plan. Initiative::$objectives owns the lifecycle: objectives are saved and deleted with + * An objective of a plan. Program::$objectives owns the lifecycle: objectives are saved and deleted with * their plan, and are ordered by position. */ -class InitiativeObjective +class ProgramObjective { - public const TABLE_NAME = 'initiative_objectives'; + public const TABLE_NAME = 'mt3s_mp_program_objectives'; public const TYPE_MAX_LENGTH = 64; @@ -28,7 +28,7 @@ class InitiativeObjective private ?int $id = null; - private ?Initiative $initiative = null; + private ?Program $program = null; private ?string $type = null; @@ -54,7 +54,7 @@ class InitiativeObjective public function __clone() { $this->id = null; - $this->initiative = null; + $this->program = null; } public static function loadMetadata(OrmClassMetadata $metadata): void @@ -62,13 +62,13 @@ class InitiativeObjective $builder = new ClassMetadataBuilder($metadata); $builder->setTable(self::TABLE_NAME) - ->setCustomRepositoryClass(InitiativeObjectiveRepository::class); + ->setCustomRepositoryClass(ProgramObjectiveRepository::class); $builder->addId(); - $builder->createManyToOne('initiative', Initiative::class) + $builder->createManyToOne('program', Program::class) ->inversedBy('objectives') - ->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE') + ->addJoinColumn('program_id', 'id', false, false, 'CASCADE') ->build(); $builder->createField('type', Types::STRING) @@ -100,13 +100,13 @@ class InitiativeObjective public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('title', new NotBlank(message: 'mautic.program.objective.title.required')); + $metadata->addPropertyConstraint('title', new NotBlank(message: 'mt3s.marketing_program.objective.title.required')); $metadata->addPropertyConstraint('title', new Length(max: 255)); - $metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.objective.type.required')); + $metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.objective.type.required')); $metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH)); - $metadata->addPropertyConstraint('priority', new NotNull(message: 'mautic.program.objective.priority.range')); + $metadata->addPropertyConstraint('priority', new NotNull(message: 'mt3s.marketing_program.objective.priority.range')); $metadata->addPropertyConstraint('priority', new Range( - notInRangeMessage: 'mautic.program.objective.priority.range', + notInRangeMessage: 'mt3s.marketing_program.objective.priority.range', min: self::PRIORITY_MIN, max: self::PRIORITY_MAX, )); @@ -117,14 +117,14 @@ class InitiativeObjective return $this->id; } - public function getInitiative(): ?Initiative + public function getProgram(): ?Program { - return $this->initiative; + return $this->program; } - public function setInitiative(?Initiative $initiative): static + public function setProgram(?Program $program): static { - $this->initiative = $initiative; + $this->program = $program; return $this; } diff --git a/Entity/InitiativeObjectiveRepository.php b/Entity/ProgramObjectiveRepository.php similarity index 55% rename from Entity/InitiativeObjectiveRepository.php rename to Entity/ProgramObjectiveRepository.php index 0460466..9ddc84c 100644 --- a/Entity/InitiativeObjectiveRepository.php +++ b/Entity/ProgramObjectiveRepository.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; /** - * @extends CommonRepository + * @extends CommonRepository */ -class InitiativeObjectiveRepository extends CommonRepository +class ProgramObjectiveRepository extends CommonRepository { use CountsItemsByTypeTrait; diff --git a/Entity/InitiativeRepository.php b/Entity/ProgramRepository.php similarity index 89% rename from Entity/InitiativeRepository.php rename to Entity/ProgramRepository.php index 7b8914f..de35a37 100644 --- a/Entity/InitiativeRepository.php +++ b/Entity/ProgramRepository.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; /** - * @extends CommonRepository + * @extends CommonRepository */ -class InitiativeRepository extends CommonRepository +class ProgramRepository extends CommonRepository { public function getTableAlias(): string { diff --git a/Entity/InitiativeStakeholder.php b/Entity/ProgramStakeholder.php similarity index 64% rename from Entity/InitiativeStakeholder.php rename to Entity/ProgramStakeholder.php index 6e41732..440fc94 100644 --- a/Entity/InitiativeStakeholder.php +++ b/Entity/ProgramStakeholder.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata; @@ -15,23 +15,23 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; * that plan ("Approves budget", "Media buyer"): free text, because the same person can have a * different role on each plan. * - * Initiative::$stakeholders owns the lifecycle: links are saved and deleted with their plan. Deleting a + * Program::$stakeholders owns the lifecycle: links are saved and deleted with their plan. Deleting a * stakeholder deletes its links (ON DELETE CASCADE on both sides). */ -class InitiativeStakeholder +class ProgramStakeholder { - public const TABLE_NAME = 'initiative_stakeholders_initiative'; + public const TABLE_NAME = 'mt3s_mp_program_stakeholders_program'; private ?int $id = null; - private ?Initiative $initiative = null; + private ?Program $program = null; private ?Stakeholder $stakeholder = null; /** * The stakeholder's role in this plan, free text. */ - private ?string $roleInInitiative = null; + private ?string $roleInProgram = null; /** * Display order within the plan, from 0. Set by drag and drop in the form. @@ -41,7 +41,7 @@ class InitiativeStakeholder public function __clone() { $this->id = null; - $this->initiative = null; + $this->program = null; } public static function loadMetadata(OrmClassMetadata $metadata): void @@ -49,21 +49,21 @@ class InitiativeStakeholder $builder = new ClassMetadataBuilder($metadata); $builder->setTable(self::TABLE_NAME) - ->setCustomRepositoryClass(InitiativeStakeholderRepository::class); + ->setCustomRepositoryClass(ProgramStakeholderRepository::class); $builder->addId(); - $builder->createManyToOne('initiative', Initiative::class) + $builder->createManyToOne('program', Program::class) ->inversedBy('stakeholders') - ->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE') + ->addJoinColumn('program_id', 'id', false, false, 'CASCADE') ->build(); $builder->createManyToOne('stakeholder', Stakeholder::class) ->addJoinColumn('stakeholder_id', 'id', false, false, 'CASCADE') ->build(); - $builder->createField('roleInInitiative', Types::STRING) - ->columnName('role_in_initiative') + $builder->createField('roleInProgram', Types::STRING) + ->columnName('role_in_program') ->length(191) ->nullable() ->build(); @@ -75,8 +75,8 @@ class InitiativeStakeholder public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('stakeholder', new \Symfony\Component\Validator\Constraints\NotBlank(message: 'mautic.program.stakeholder_link.stakeholder.required')); - $metadata->addPropertyConstraint('roleInInitiative', new Length(max: 191)); + $metadata->addPropertyConstraint('stakeholder', new \Symfony\Component\Validator\Constraints\NotBlank(message: 'mt3s.marketing_program.stakeholder_link.stakeholder.required')); + $metadata->addPropertyConstraint('roleInProgram', new Length(max: 191)); } public function getId(): ?int @@ -84,14 +84,14 @@ class InitiativeStakeholder return $this->id; } - public function getInitiative(): ?Initiative + public function getProgram(): ?Program { - return $this->initiative; + return $this->program; } - public function setInitiative(?Initiative $initiative): static + public function setProgram(?Program $program): static { - $this->initiative = $initiative; + $this->program = $program; return $this; } @@ -108,14 +108,14 @@ class InitiativeStakeholder return $this; } - public function getRoleInInitiative(): ?string + public function getRoleInProgram(): ?string { - return $this->roleInInitiative; + return $this->roleInProgram; } - public function setRoleInInitiative(?string $roleInInitiative): static + public function setRoleInProgram(?string $roleInProgram): static { - $this->roleInInitiative = $roleInInitiative; + $this->roleInProgram = $roleInProgram; return $this; } diff --git a/Entity/InitiativeStakeholderRepository.php b/Entity/ProgramStakeholderRepository.php similarity index 50% rename from Entity/InitiativeStakeholderRepository.php rename to Entity/ProgramStakeholderRepository.php index 7e4af58..0d59471 100644 --- a/Entity/InitiativeStakeholderRepository.php +++ b/Entity/ProgramStakeholderRepository.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; /** - * @extends CommonRepository + * @extends CommonRepository */ -class InitiativeStakeholderRepository extends CommonRepository +class ProgramStakeholderRepository extends CommonRepository { public function getTableAlias(): string { diff --git a/Entity/InitiativeStatus.php b/Entity/ProgramStatus.php similarity index 80% rename from Entity/InitiativeStatus.php rename to Entity/ProgramStatus.php index 697b8e4..86ee5bc 100644 --- a/Entity/InitiativeStatus.php +++ b/Entity/ProgramStatus.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; -enum InitiativeStatus: string +enum ProgramStatus: string { case Draft = 'draft'; case Planned = 'planned'; @@ -15,11 +15,11 @@ enum InitiativeStatus: string public function getLabelKey(): string { - return 'mautic.program.status.'.$this->value; + return 'mt3s.marketing_program.status.'.$this->value; } /** - * The Bootstrap class of the status label in the tables (the initiative's Status column). + * The Bootstrap class of the status label in the tables (the program's Status column). */ public function getLabelClass(): string { diff --git a/Entity/RaciRole.php b/Entity/RaciRole.php index 1763751..14f8936 100644 --- a/Entity/RaciRole.php +++ b/Entity/RaciRole.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** * The RACI roles of a task assignment. The order of the cases is the order of the dropdown. @@ -16,7 +16,7 @@ enum RaciRole: string public function getLabelKey(): string { - return 'mautic.program.task.raci_role.'.$this->value; + return 'mt3s.marketing_program.task.raci_role.'.$this->value; } public function getLabelClass(): string diff --git a/Entity/Stakeholder.php b/Entity/Stakeholder.php index dd09199..f7785a4 100644 --- a/Entity/Stakeholder.php +++ b/Entity/Stakeholder.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -16,20 +16,20 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Mapping\ClassMetadata; /** - * A stakeholder of the program: a person, a company or a team involved in the initiatives ("Agency XYZ", + * A stakeholder of the program: a person, a company or a team involved in the mt3s_mp_programs ("Agency XYZ", * "Exec committee"). Stakeholders are a global directory (Programs > Stakeholders), independent of - * initiatives; an initiative links to them through InitiativeStakeholder, which carries the stakeholder's role in that - * initiative. + * mt3s_mp_programs; an program links to them through ProgramStakeholder, which carries the stakeholder's role in that + * program. * - * The type is the key of a stakeholder type set up in Settings > Configuration > Initiative Settings + * The type is the key of a stakeholder type set up in Settings > Configuration > Program Settings * (parameter program_stakeholder_types); see ItemTypeProvider (kind "stakeholder"). * - * isPublished (from FormEntity) means "active": an unpublished stakeholder is hidden from the initiative - * form's stakeholder picker, but keeps its history on the initiatives it is already linked to. + * isPublished (from FormEntity) means "active": an unpublished stakeholder is hidden from the program + * form's stakeholder picker, but keeps its history on the mt3s_mp_programs it is already linked to. */ class Stakeholder extends FormEntity { - public const TABLE_NAME = 'initiative_stakeholders'; + public const TABLE_NAME = 'mt3s_mp_program_stakeholders'; public const TYPE_MAX_LENGTH = 64; @@ -50,16 +50,16 @@ class Stakeholder extends FormEntity private ?string $type = null; /** - * The links to the initiatives this stakeholder is assigned to. Inverse side, read-only from here: the - * links are managed from the plans (Initiative::addStakeholder/removeStakeholder). + * The links to the mt3s_mp_programs this stakeholder is assigned to. Inverse side, read-only from here: the + * links are managed from the plans (Program::addStakeholder/removeStakeholder). * - * @var Collection + * @var Collection */ - private Collection $initiativeLinks; + private Collection $programLinks; public function __construct() { - $this->initiativeLinks = new ArrayCollection(); + $this->programLinks = new ArrayCollection(); } public static function loadMetadata(OrmClassMetadata $metadata): void @@ -96,7 +96,7 @@ class Stakeholder extends FormEntity ->nullable() ->build(); - $builder->createOneToMany('initiativeLinks', InitiativeStakeholder::class) + $builder->createOneToMany('programLinks', ProgramStakeholder::class) ->mappedBy('stakeholder') ->fetchExtraLazy() ->build(); @@ -108,7 +108,7 @@ class Stakeholder extends FormEntity { $metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.core.name.required')); $metadata->addPropertyConstraint('name', new Length(max: 191)); - $metadata->addPropertyConstraint('email', new Email(mode: Email::VALIDATION_MODE_HTML5, message: 'mautic.program.stakeholder.email.invalid')); + $metadata->addPropertyConstraint('email', new Email(mode: Email::VALIDATION_MODE_HTML5, message: 'mt3s.marketing_program.stakeholder.email.invalid')); $metadata->addPropertyConstraint('email', new Length(max: 191)); $metadata->addPropertyConstraint('phone', new Length(max: 50)); $metadata->addPropertyConstraint('role', new Length(max: 191)); @@ -178,13 +178,13 @@ class Stakeholder extends FormEntity } /** - * The links to the initiatives this stakeholder is assigned to, each with its role in that initiative. + * The links to the mt3s_mp_programs this stakeholder is assigned to, each with its role in that program. * - * @return Collection + * @return Collection */ - public function getInitiativeLinks(): Collection + public function getProgramLinks(): Collection { - return $this->initiativeLinks; + return $this->programLinks; } public function setType(?string $type): static diff --git a/Entity/StakeholderRepository.php b/Entity/StakeholderRepository.php index 0ef881d..0a22e21 100644 --- a/Entity/StakeholderRepository.php +++ b/Entity/StakeholderRepository.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; diff --git a/Entity/Task.php b/Entity/Task.php index ce72054..2d30509 100644 --- a/Entity/Task.php +++ b/Entity/Task.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; @@ -10,9 +10,9 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata; use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; use Mautic\CoreBundle\Entity\FormEntity; -use MauticPlugin\ProgramBundle\Validator\Constraints\EndDateAfterStartDate; -use MauticPlugin\ProgramBundle\Validator\Constraints\TaskDates; -use MauticPlugin\ProgramBundle\Validator\Constraints\ValidTaskDependency; +use MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints\EndDateAfterStartDate; +use MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints\TaskDates; +use MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints\ValidTaskDependency; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\PositiveOrZero; @@ -20,7 +20,7 @@ use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Mapping\ClassMetadata; /** - * A task of an initiative. Every task belongs to exactly one initiative. + * A task of an program. Every task belongs to exactly one program. * * Kinds (taskKind): a regular task; a milestone, whose end date is enslaved to its start date; or a * phase, which has no status of its own — it is a collection of tasks. @@ -29,15 +29,15 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; * End2End, Start2Start or Start2End. The former parent/child tree is replaced by this dependency * graph. * - * RACI: a task is assigned to the initiative's stakeholders through TaskRaci rows (R/A/C/I), several + * RACI: a task is assigned to the program's stakeholders through TaskRaci rows (R/A/C/I), several * stakeholders per role. * - * Database rules: deleting the initiative deletes its tasks (ON DELETE CASCADE); deleting a task deletes + * Database rules: deleting the program deletes its tasks (ON DELETE CASCADE); deleting a task deletes * its dependencies and RACI rows (ON DELETE CASCADE). */ class Task extends FormEntity implements DateRangeInterface { - public const TABLE_NAME = 'initiative_tasks'; + public const TABLE_NAME = 'mt3s_mp_program_tasks'; public const TYPE_MAX_LENGTH = 64; @@ -48,7 +48,7 @@ class Task extends FormEntity implements DateRangeInterface private ?int $id = null; - private ?Initiative $initiative = null; + private ?Program $program = null; /** * Key of a task type set up in Settings > Configuration > Program Settings (parameter program_task_types); @@ -106,9 +106,9 @@ class Task extends FormEntity implements DateRangeInterface $builder->addId(); - $builder->createManyToOne('initiative', Initiative::class) + $builder->createManyToOne('program', Program::class) ->inversedBy('tasks') - ->addJoinColumn('initiative_id', 'id', false, false, 'CASCADE') + ->addJoinColumn('program_id', 'id', false, false, 'CASCADE') ->build(); $builder->createField('type', Types::STRING) @@ -191,11 +191,11 @@ class Task extends FormEntity implements DateRangeInterface { $metadata->addPropertyConstraint('name', new NotBlank(message: 'mautic.core.name.required')); $metadata->addPropertyConstraint('name', new Length(max: 255)); - $metadata->addPropertyConstraint('initiative', new NotBlank(message: 'mautic.program.task.initiative.required')); - $metadata->addPropertyConstraint('type', new NotBlank(message: 'mautic.program.task.type.required')); + $metadata->addPropertyConstraint('program', new NotBlank(message: 'mt3s.marketing_program.task.program.required')); + $metadata->addPropertyConstraint('type', new NotBlank(message: 'mt3s.marketing_program.task.type.required')); $metadata->addPropertyConstraint('type', new Length(max: self::TYPE_MAX_LENGTH)); - $metadata->addPropertyConstraint('plannedWork', new PositiveOrZero(message: 'mautic.program.task.planned_work.invalid')); - $metadata->addPropertyConstraint('plannedWork', new Range(notInRangeMessage: 'mautic.program.task.planned_work.range', min: 0, max: self::PLANNED_WORK_MAX)); + $metadata->addPropertyConstraint('plannedWork', new PositiveOrZero(message: 'mt3s.marketing_program.task.planned_work.invalid')); + $metadata->addPropertyConstraint('plannedWork', new Range(notInRangeMessage: 'mt3s.marketing_program.task.planned_work.range', min: 0, max: self::PLANNED_WORK_MAX)); $metadata->addConstraint(new EndDateAfterStartDate()); $metadata->addConstraint(new TaskDates()); $metadata->addConstraint(new ValidTaskDependency()); @@ -206,15 +206,15 @@ class Task extends FormEntity implements DateRangeInterface return $this->id; } - public function getInitiative(): ?Initiative + public function getProgram(): ?Program { - return $this->initiative; + return $this->program; } - public function setInitiative(?Initiative $initiative): static + public function setProgram(?Program $program): static { - $this->isChanged('initiative', $initiative); - $this->initiative = $initiative; + $this->isChanged('program', $program); + $this->program = $program; return $this; } diff --git a/Entity/TaskDependency.php b/Entity/TaskDependency.php index 0244e54..d6648d3 100644 --- a/Entity/TaskDependency.php +++ b/Entity/TaskDependency.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata; @@ -17,7 +17,7 @@ use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; */ class TaskDependency { - public const TABLE_NAME = 'initiative_task_dependencies'; + public const TABLE_NAME = 'mt3s_mp_program_task_dependencies'; private ?int $id = null; diff --git a/Entity/TaskDependencyRepository.php b/Entity/TaskDependencyRepository.php index 550bd94..1dc7408 100644 --- a/Entity/TaskDependencyRepository.php +++ b/Entity/TaskDependencyRepository.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; diff --git a/Entity/TaskKind.php b/Entity/TaskKind.php index 5b0d0c5..545e879 100644 --- a/Entity/TaskKind.php +++ b/Entity/TaskKind.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** * The kind of a task. The order of the cases is the order of the dropdown. @@ -15,7 +15,7 @@ enum TaskKind: string public function getLabelKey(): string { - return 'mautic.program.task.kind.'.$this->value; + return 'mt3s.marketing_program.task.kind.'.$this->value; } /** diff --git a/Entity/TaskRaci.php b/Entity/TaskRaci.php index 3f682d5..85e671f 100644 --- a/Entity/TaskRaci.php +++ b/Entity/TaskRaci.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Doctrine\DBAL\Types\Types; use Doctrine\Common\Collections\ArrayCollection; @@ -19,12 +19,12 @@ use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; */ class TaskRaci { - public const TABLE_NAME = 'initiative_task_raci'; + public const TABLE_NAME = 'mt3s_mp_program_task_raci'; /** * The join table carrying the stakeholders of a RACI row (TaskRaci -> Stakeholder). */ - public const JOIN_TABLE_NAME = 'initiative_task_raci_stakeholders'; + public const JOIN_TABLE_NAME = 'mt3s_mp_program_task_raci_stakeholders'; private ?int $id = null; diff --git a/Entity/TaskRaciRepository.php b/Entity/TaskRaciRepository.php index 960a9f9..978955b 100644 --- a/Entity/TaskRaciRepository.php +++ b/Entity/TaskRaciRepository.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; diff --git a/Entity/TaskRepository.php b/Entity/TaskRepository.php index 1ec0808..af9b8af 100644 --- a/Entity/TaskRepository.php +++ b/Entity/TaskRepository.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; @@ -19,7 +19,7 @@ class TaskRepository extends CommonRepository } /** - * Loads the initiative, the dependencies (with their depends-on task) and the RACI rows (with their + * Loads the program, the dependencies (with their depends-on task) and the RACI rows (with their * stakeholders) with the tasks, so that the list doesn't query them one by one. * * @param array $args @@ -30,7 +30,7 @@ class TaskRepository extends CommonRepository $args['qb'] = $this->createQueryBuilder($alias) ->select($alias, 'init', 'dep', 'depTask', 'raci', 'raciStakeholder') - ->leftJoin($alias.'.initiative', 'init') + ->leftJoin($alias.'.program', 'init') ->leftJoin($alias.'.dependencies', 'dep') ->leftJoin('dep.dependsOn', 'depTask') ->leftJoin($alias.'.raci', 'raci') @@ -40,11 +40,11 @@ class TaskRepository extends CommonRepository } /** - * All tasks of an initiative, ordered by name, with their dependencies and RACI rows loaded. + * All tasks of an program, ordered by name, with their dependencies and RACI rows loaded. * * @return Task[] */ - public function findByInitiative(Initiative $initiative): array + public function findByProgram(Program $program): array { return $this->createQueryBuilder('t') ->select('t', 'dep', 'depTask', 'raci', 'raciStakeholder') @@ -52,8 +52,8 @@ class TaskRepository extends CommonRepository ->leftJoin('dep.dependsOn', 'depTask') ->leftJoin('t.raci', 'raci') ->leftJoin('raci.stakeholders', 'raciStakeholder') - ->where('t.initiative = :initiative') - ->setParameter('initiative', $initiative) + ->where('t.program = :program') + ->setParameter('program', $program) ->orderBy('t.name', 'ASC') ->addOrderBy('t.id', 'ASC') ->getQuery() diff --git a/Entity/TaskStatus.php b/Entity/TaskStatus.php index 5e01b39..2421000 100644 --- a/Entity/TaskStatus.php +++ b/Entity/TaskStatus.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Entity; +namespace MauticPlugin\MT3SMarketingProgramBundle\Entity; /** * Task status. The order of the cases is the order of the dropdown on the task form. @@ -16,7 +16,7 @@ enum TaskStatus: string public function getLabelKey(): string { - return 'mautic.program.task.status.'.$this->value; + return 'mt3s.marketing_program.task.status.'.$this->value; } /** diff --git a/Event/MT3SMarketingProgramEvents.php b/Event/MT3SMarketingProgramEvents.php new file mode 100644 index 0000000..2d3e37f --- /dev/null +++ b/Event/MT3SMarketingProgramEvents.php @@ -0,0 +1,32 @@ +program; + } + + public function isNew(): bool + { + return $this->isNew; + } +} \ No newline at end of file diff --git a/EventListener/ConfigSubscriber.php b/EventListener/ConfigSubscriber.php index a327a51..5b0295c 100644 --- a/EventListener/ConfigSubscriber.php +++ b/EventListener/ConfigSubscriber.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\EventListener; +namespace MauticPlugin\MT3SMarketingProgramBundle\EventListener; use Mautic\ConfigBundle\ConfigEvents; use Mautic\ConfigBundle\Event\ConfigBuilderEvent; -use MauticPlugin\ProgramBundle\Form\Type\ConfigType; +use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\ConfigType; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -27,11 +27,11 @@ class ConfigSubscriber implements EventSubscriberInterface public function onConfigGenerate(ConfigBuilderEvent $event): void { $event->addForm([ - 'bundle' => 'ProgramBundle', + 'bundle' => 'MT3SMarketingProgramBundle', 'formAlias' => ConfigType::FORM_ALIAS, 'formType' => ConfigType::class, - 'formTheme' => '@Program/FormTheme/Config/_config_programconfig_widget.html.twig', - 'parameters' => $event->getParametersFromConfig('ProgramBundle'), + 'formTheme' => '@MT3SMarketingProgram/FormTheme/Config/_config_mt3smarketingprogramconfig_widget.html.twig', + 'parameters' => $event->getParametersFromConfig('MT3SMarketingProgramBundle'), ]); } } diff --git a/EventListener/PluginInstallSubscriber.php b/EventListener/PluginInstallSubscriber.php index dc4ddac..8c39471 100644 --- a/EventListener/PluginInstallSubscriber.php +++ b/EventListener/PluginInstallSubscriber.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\EventListener; +namespace MauticPlugin\MT3SMarketingProgramBundle\EventListener; use Mautic\PluginBundle\Bundle\PluginDatabase; use Mautic\PluginBundle\Event\PluginInstallEvent; @@ -15,7 +15,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class PluginInstallSubscriber implements EventSubscriberInterface { - private const BUNDLE = 'ProgramBundle'; + private const BUNDLE = 'MT3SMarketingProgramBundle'; public function __construct( private PluginDatabase $pluginDatabase, diff --git a/Form/Type/AudienceType.php b/Form/Type/AudienceType.php index adfd3f4..b7c661e 100644 --- a/Form/Type/AudienceType.php +++ b/Form/Type/AudienceType.php @@ -2,17 +2,17 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Doctrine\ORM\EntityRepository; use Mautic\CoreBundle\Form\Type\FormButtonsType; use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType; use Mautic\LeadBundle\Entity\LeadList; use Mautic\StageBundle\Entity\Stage; -use MauticPlugin\ProgramBundle\Entity\Audience; -use MauticPlugin\ProgramBundle\Entity\AudienceType as AudienceTypeEnum; -use MauticPlugin\ProgramBundle\Service\AudienceAttributes; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\AudienceType as AudienceTypeEnum; +use MauticPlugin\MT3SMarketingProgramBundle\Service\AudienceAttributes; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -26,7 +26,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; /** * The create and edit form of an audience of the global directory (Programs > Audiences): name, a * fixed type (persona, ICP, …), the segments (purely informational), then the persona attributes - * the admin switched on in Settings > Configuration > Initiative Settings (AudienceAttributes): one + * the admin switched on in Settings > Configuration > Program Settings (AudienceAttributes): one * toggle per attribute, so a b2b install and a b2c install define their personas differently. * * @extends AbstractType @@ -45,13 +45,13 @@ class AudienceType extends AbstractType // Name and type are always offered; everything else is a togglable attribute. $builder->add('name', TextType::class, [ - 'label' => 'mautic.program.audience.field.name', + 'label' => 'mt3s.marketing_program.audience.field.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 191], ]); $builder->add('audienceType', EnumType::class, [ - 'label' => 'mautic.program.audience.field.type', + 'label' => 'mt3s.marketing_program.audience.field.type', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => AudienceTypeEnum::class, @@ -59,9 +59,9 @@ class AudienceType extends AbstractType ]); // The Mautic segments this audience maps to; any number, or none. Purely informational: the - // segments are not required, and nothing in the initiative depends on them. + // segments are not required, and nothing in the program depends on them. $builder->add('segments', EntityType::class, [ - 'label' => 'mautic.program.audience.field.segments', + 'label' => 'mt3s.marketing_program.audience.field.segments', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => LeadList::class, @@ -77,7 +77,7 @@ class AudienceType extends AbstractType if (in_array('tagline', $enabled, true)) { $builder->add('tagline', TextareaType::class, [ - 'label' => 'mautic.program.audience.field.tagline', + 'label' => 'mt3s.marketing_program.audience.field.tagline', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 2, 'maxlength' => 500], 'required' => false, @@ -86,7 +86,7 @@ class AudienceType extends AbstractType if (in_array('profile', $enabled, true)) { $builder->add('profileCriteria', TextareaType::class, [ - 'label' => 'mautic.program.audience.field.profile_criteria', + 'label' => 'mt3s.marketing_program.audience.field.profile_criteria', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 3], 'required' => false, @@ -95,7 +95,7 @@ class AudienceType extends AbstractType if (in_array('motivations', $enabled, true)) { $builder->add('motivations', TextareaType::class, [ - 'label' => 'mautic.program.audience.field.motivations', + 'label' => 'mt3s.marketing_program.audience.field.motivations', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 3], 'required' => false, @@ -104,7 +104,7 @@ class AudienceType extends AbstractType if (in_array('barriers', $enabled, true)) { $builder->add('barriers', TextareaType::class, [ - 'label' => 'mautic.program.audience.field.barriers', + 'label' => 'mt3s.marketing_program.audience.field.barriers', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 3], 'required' => false, @@ -113,7 +113,7 @@ class AudienceType extends AbstractType if (in_array('frustrations', $enabled, true)) { $builder->add('frustrations', TextareaType::class, [ - 'label' => 'mautic.program.audience.field.frustrations', + 'label' => 'mt3s.marketing_program.audience.field.frustrations', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 3], 'required' => false, @@ -122,7 +122,7 @@ class AudienceType extends AbstractType if (in_array('triggers', $enabled, true)) { $builder->add('triggers', TextareaType::class, [ - 'label' => 'mautic.program.audience.field.triggers', + 'label' => 'mt3s.marketing_program.audience.field.triggers', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 3], 'required' => false, @@ -132,7 +132,7 @@ class AudienceType extends AbstractType if (in_array('decision_role', $enabled, true)) { $kind = ItemTypeProvider::KIND_AUDIENCE_DECISION_ROLE; $builder->add('decisionRole', ChoiceType::class, [ - 'label' => 'mautic.program.audience.field.decision_role', + 'label' => 'mt3s.marketing_program.audience.field.decision_role', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'choices' => $this->typeProvider->getChoices($kind), @@ -144,7 +144,7 @@ class AudienceType extends AbstractType if (in_array('tones', $enabled, true)) { $kind = ItemTypeProvider::KIND_AUDIENCE_TONE; $builder->add('preferredTones', ChoiceType::class, [ - 'label' => 'mautic.program.audience.field.preferred_tones', + 'label' => 'mt3s.marketing_program.audience.field.preferred_tones', 'label_attr' => ['class' => 'control-label'], 'choices' => $this->typeProvider->getChoices($kind), 'expanded' => true, @@ -156,7 +156,7 @@ class AudienceType extends AbstractType if (in_array('channels', $enabled, true)) { // One checkbox per channel, in the order of Audience::CHANNELS. $builder->add('preferredChannels', ChoiceType::class, [ - 'label' => 'mautic.program.audience.field.preferred_channels', + 'label' => 'mt3s.marketing_program.audience.field.preferred_channels', 'label_attr' => ['class' => 'control-label'], 'choices' => array_flip(Audience::CHANNELS), 'expanded' => true, @@ -167,7 +167,7 @@ class AudienceType extends AbstractType if (in_array('stages', $enabled, true)) { $builder->add('stages', EntityType::class, [ - 'label' => 'mautic.program.audience.field.stages', + 'label' => 'mt3s.marketing_program.audience.field.stages', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => Stage::class, @@ -181,7 +181,7 @@ class AudienceType extends AbstractType if (in_array('size', $enabled, true)) { $builder->add('estimatedSize', IntegerType::class, [ - 'label' => 'mautic.program.audience.field.estimated_size', + 'label' => 'mt3s.marketing_program.audience.field.estimated_size', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'min' => 0, 'step' => 1], 'required' => false, @@ -189,7 +189,7 @@ class AudienceType extends AbstractType } $builder->add('isPublished', YesNoButtonGroupType::class, [ - 'label' => 'mautic.program.audience.field.active', + 'label' => 'mt3s.marketing_program.audience.field.active', ]); $builder->add('buttons', FormButtonsType::class); @@ -208,6 +208,6 @@ class AudienceType extends AbstractType public function getBlockPrefix(): string { - return 'program_audience'; + return 'mt3s_marketing_program_audience'; } } \ No newline at end of file diff --git a/Form/Type/ConfigType.php b/Form/Type/ConfigType.php index 5f2b540..f384ae2 100644 --- a/Form/Type/ConfigType.php +++ b/Form/Type/ConfigType.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; -use MauticPlugin\ProgramBundle\Model\StakeholderModel; -use MauticPlugin\ProgramBundle\Service\CurrencyProvider; -use MauticPlugin\ProgramBundle\Service\AudienceAttributes; +use MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel; +use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Service\AudienceAttributes; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -17,8 +17,8 @@ use Symfony\Component\Validator\Constraints\NotBlank; /** * The "Program Settings" tab of Settings > Configuration: the plugin's general settings only. * Each child is a local.php parameter: - * - program_currency: the currency of every amount in the plugin (general setting); - * - program_stakeholder_phone_region: default region for stakeholder phone numbers typed without a prefix; + * - mt3s_marketing_program_currency: the currency of every amount in the plugin (general setting); + * - mt3s_marketing_program_stakeholder_phone_region: default region for stakeholder phone numbers typed without a prefix; * - one toggle per audience persona attribute (AudienceAttributes), so each install defines its * personas as it needs (b2b, b2c…). * @@ -29,7 +29,7 @@ use Symfony\Component\Validator\Constraints\NotBlank; */ class ConfigType extends AbstractType { - public const FORM_ALIAS = 'programconfig'; + public const FORM_ALIAS = 'mt3smarketingprogramconfig'; public function __construct( private CurrencyProvider $currencyProvider, @@ -40,9 +40,9 @@ class ConfigType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add(CurrencyProvider::CONFIG_PARAMETER, ChoiceType::class, [ - 'label' => 'mautic.program.config.currency', + 'label' => 'mt3s.marketing_program.config.currency', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.program.config.currency.tooltip'], + 'attr' => ['class' => 'form-control', 'tooltip' => 'mt3s.marketing_program.config.currency.tooltip'], 'choices' => $this->currencyProvider->getChoices(), 'placeholder' => false, 'required' => true, @@ -53,9 +53,9 @@ class ConfigType extends AbstractType // Default region for stakeholder phone numbers typed without a country prefix (ISO 3166-1 // alpha-2, e.g. FR). Read by StakeholderModel on save. $builder->add(StakeholderModel::PHONE_REGION_PARAMETER, TextType::class, [ - 'label' => 'mautic.program.config.stakeholder_phone_region', + 'label' => 'mt3s.marketing_program.config.stakeholder_phone_region', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.program.config.stakeholder_phone_region.tooltip', 'maxlength' => 2], + 'attr' => ['class' => 'form-control', 'tooltip' => 'mt3s.marketing_program.config.stakeholder_phone_region.tooltip', 'maxlength' => 2], 'required' => true, 'constraints' => [new NotBlank()], 'empty_data' => StakeholderModel::DEFAULT_PHONE_REGION, @@ -64,7 +64,7 @@ class ConfigType extends AbstractType // One toggle per audience persona attribute (AudienceAttributes), defaults to enabled. foreach (AudienceAttributes::ATTRIBUTES as $attribute => $field) { $builder->add(AudienceAttributes::toggleParameter($attribute), YesNoButtonGroupType::class, [ - 'label' => 'mautic.program.audience.attribute.'.$attribute, + 'label' => 'mt3s.marketing_program.audience.attribute.'.$attribute, 'label_attr' => ['class' => 'control-label'], 'data' => $this->audienceAttributes->isEnabled($attribute), 'required' => false, diff --git a/Form/Type/ItemTypeConfigType.php b/Form/Type/ItemTypeConfigType.php index 2f22f49..0ea9c4c 100644 --- a/Form/Type/ItemTypeConfigType.php +++ b/Form/Type/ItemTypeConfigType.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; -use MauticPlugin\ProgramBundle\Service\Pictograms; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Service\Pictograms; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\FormType; @@ -40,7 +40,7 @@ class ItemTypeConfigType extends AbstractType $default = $this->typeProvider->getDefaultLocale(); $builder->add('key', HiddenType::class, [ - 'attr' => ['class' => 'initiative-type-key'], + 'attr' => ['class' => 'program-type-key'], ]); $names = $builder->create('names', FormType::class, ['label' => false]); @@ -50,17 +50,17 @@ class ItemTypeConfigType extends AbstractType $isDefault = $locale === $default; $names->add($locale, TextType::class, [ - 'label' => 'mautic.program.config.type.name', + 'label' => 'mt3s.marketing_program.config.type.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 191, 'data-locale' => $locale, 'data-language' => $language], 'required' => $isDefault, 'constraints' => $isDefault - ? [new NotBlank(message: 'mautic.program.config.type.name.required'), new Length(max: 191)] + ? [new NotBlank(message: 'mt3s.marketing_program.config.type.name.required'), new Length(max: 191)] : [new Length(max: 191)], ]); $descriptions->add($locale, TextareaType::class, [ - 'label' => 'mautic.program.config.type.description', + 'label' => 'mt3s.marketing_program.config.type.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 2, 'data-locale' => $locale], 'required' => false, @@ -70,15 +70,15 @@ class ItemTypeConfigType extends AbstractType $builder->add($names); $builder->add($descriptions); - // Pictogram; the preview next to the dropdown is updated by program.js. + // Pictogram; the preview next to the dropdown is updated by mt3s-mp-program.js. if ($options['with_icon']) { $builder->add('icon', ChoiceType::class, [ - 'label' => 'mautic.program.config.type.icon', + 'label' => 'mt3s.marketing_program.config.type.icon', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control initiative-type-icon-select'], + 'attr' => ['class' => 'form-control program-type-icon-select'], 'choices' => Pictograms::getChoices(), 'choice_attr' => fn (?string $icon): array => ['data-icon' => (string) $icon], - 'placeholder' => 'mautic.program.config.type.icon.none', + 'placeholder' => 'mt3s.marketing_program.config.type.icon.none', 'required' => false, ]); } @@ -104,6 +104,6 @@ class ItemTypeConfigType extends AbstractType public function getBlockPrefix(): string { - return 'program_item_type_config'; + return 'mt3s_marketing_program_item_type_config'; } } diff --git a/Form/Type/ItemTypesType.php b/Form/Type/ItemTypesType.php index 236fabe..2f4de18 100644 --- a/Form/Type/ItemTypesType.php +++ b/Form/Type/ItemTypesType.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Mautic\CoreBundle\Form\Type\FormButtonsType; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\CollectionType; @@ -52,7 +52,7 @@ class ItemTypesType extends AbstractType public function getBlockPrefix(): string { - // The POST data keys: program_item_types[][][…]. - return 'program_item_types'; + // The POST data keys: mt3s_marketing_program_item_types[][][…]. + return 'mt3s_marketing_program_item_types'; } } \ No newline at end of file diff --git a/Form/Type/InitiativeAllocationItemType.php b/Form/Type/ProgramAllocationItemType.php similarity index 67% rename from Form/Type/InitiativeAllocationItemType.php rename to Form/Type/ProgramAllocationItemType.php index 2354c0d..2673a22 100644 --- a/Form/Type/InitiativeAllocationItemType.php +++ b/Form/Type/ProgramAllocationItemType.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; -use MauticPlugin\ProgramBundle\Entity\InitiativeAllocationItem; -use MauticPlugin\ProgramBundle\Service\CurrencyProvider; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramAllocationItem; +use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; @@ -17,14 +17,14 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * One row of the allocation items collection in InitiativeType: type, name, description, planned cost and - * real cost (both in the general currency). Works like InitiativeDescriptionItemType (type description shown + * One row of the allocation items collection in ProgramType: type, name, description, planned cost and + * real cost (both in the general currency). Works like ProgramDescriptionItemType (type description shown * under the dropdown and its pictogram next to it, hidden position kept in display order by - * Assets/js/program.js). + * Assets/js/mt3s-mp-program.js). * - * @extends AbstractType + * @extends AbstractType */ -class InitiativeAllocationItemType extends AbstractType +class ProgramAllocationItemType extends AbstractType { public function __construct( private ItemTypeProvider $typeProvider, @@ -37,11 +37,11 @@ class InitiativeAllocationItemType extends AbstractType $kind = ItemTypeProvider::KIND_ALLOCATION; $builder->add('type', ChoiceType::class, [ - 'label' => 'mautic.program.allocation_item.field.type', + 'label' => 'mt3s.marketing_program.allocation_item.field.type', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control initiative-item-type'], + 'attr' => ['class' => 'form-control program-item-type'], 'choices' => $this->typeProvider->getChoices($kind), - // The type's description and pictogram, shown next to the dropdown by program.js. + // The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js. 'choice_attr' => fn (?string $key): array => [ 'data-description' => (string) $this->typeProvider->getDescription($kind, $key), 'data-icon' => (string) $this->typeProvider->getIcon($kind, $key), @@ -51,23 +51,23 @@ class InitiativeAllocationItemType extends AbstractType ]); $builder->add('name', TextType::class, [ - 'label' => 'mautic.program.allocation_item.field.name', + 'label' => 'mt3s.marketing_program.allocation_item.field.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 255], 'required' => false, ]); $builder->add('description', TextareaType::class, [ - 'label' => 'mautic.program.allocation_item.field.description', + 'label' => 'mt3s.marketing_program.allocation_item.field.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 3], 'required' => false, ]); - // Costs are in the general currency (Settings > Configuration > Initiative Settings), shown next to the field. + // Costs are in the general currency (Settings > Configuration > Program Settings), shown next to the field. foreach (['planned', 'real'] as $cost) { $builder->add($cost.'Cost', NumberType::class, [ - 'label' => 'mautic.program.allocation_item.field.'.$cost.'_cost', + 'label' => 'mt3s.marketing_program.allocation_item.field.'.$cost.'_cost', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'postaddon_text' => $this->currencyProvider->getCurrency()], 'input' => 'string', @@ -77,19 +77,19 @@ class InitiativeAllocationItemType extends AbstractType } $builder->add('position', HiddenType::class, [ - 'attr' => ['class' => 'initiative-row-position'], + 'attr' => ['class' => 'program-row-position'], ]); } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'data_class' => InitiativeAllocationItem::class, + 'data_class' => ProgramAllocationItem::class, ]); } public function getBlockPrefix(): string { - return 'program_allocation_item'; + return 'mt3s_marketing_program_allocation_item'; } } diff --git a/Form/Type/InitiativeAudienceType.php b/Form/Type/ProgramAudienceType.php similarity index 70% rename from Form/Type/InitiativeAudienceType.php rename to Form/Type/ProgramAudienceType.php index dde973f..bd57e56 100644 --- a/Form/Type/InitiativeAudienceType.php +++ b/Form/Type/ProgramAudienceType.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Doctrine\ORM\EntityRepository; -use MauticPlugin\ProgramBundle\Entity\Audience; -use MauticPlugin\ProgramBundle\Entity\AudiencePriority; -use MauticPlugin\ProgramBundle\Entity\InitiativeAudience; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\AudiencePriority; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramAudience; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EnumType; @@ -17,18 +17,18 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * One row of the audiences collection in InitiativeType: an audience of the global directory (only the - * active ones are offered), the audience's priority in this plan, and possibly a initiative-specific - * message. The position field is hidden and kept in display order by Assets/js/program.js. + * One row of the audiences collection in ProgramType: an audience of the global directory (only the + * active ones are offered), the audience's priority in this plan, and possibly a program-specific + * message. The position field is hidden and kept in display order by Assets/js/mt3s-mp-program.js. * - * @extends AbstractType + * @extends AbstractType */ -class InitiativeAudienceType extends AbstractType +class ProgramAudienceType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('audience', EntityType::class, [ - 'label' => 'mautic.program.audience.field.name', + 'label' => 'mt3s.marketing_program.audience.field.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => Audience::class, @@ -43,7 +43,7 @@ class InitiativeAudienceType extends AbstractType // Dropdown in the order of the AudiencePriority cases. $builder->add('priority', EnumType::class, [ - 'label' => 'mautic.program.audience.field.priority', + 'label' => 'mt3s.marketing_program.audience.field.priority', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => AudiencePriority::class, @@ -51,26 +51,26 @@ class InitiativeAudienceType extends AbstractType ]); $builder->add('valueProposition', TextareaType::class, [ - 'label' => 'mautic.program.audience.field.value_proposition', + 'label' => 'mt3s.marketing_program.audience.field.value_proposition', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 2], 'required' => false, ]); $builder->add('position', HiddenType::class, [ - 'attr' => ['class' => 'initiative-row-position'], + 'attr' => ['class' => 'program-row-position'], ]); } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'data_class' => InitiativeAudience::class, + 'data_class' => ProgramAudience::class, ]); } public function getBlockPrefix(): string { - return 'program_initiative_audience'; + return 'mt3s_marketing_program_program_audience'; } } \ No newline at end of file diff --git a/Form/Type/InitiativeDescriptionItemType.php b/Form/Type/ProgramDescriptionItemType.php similarity index 60% rename from Form/Type/InitiativeDescriptionItemType.php rename to Form/Type/ProgramDescriptionItemType.php index db80e7e..6c42489 100644 --- a/Form/Type/InitiativeDescriptionItemType.php +++ b/Form/Type/ProgramDescriptionItemType.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; -use MauticPlugin\ProgramBundle\Entity\InitiativeDescriptionItem; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramDescriptionItem; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; @@ -14,14 +14,14 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * One row of the description items collection in InitiativeType. The type dropdown lists the description item - * types set up in Settings > Configuration > Initiative; each option carries the type's description, which - * Assets/js/program.js shows under the dropdown. The position field is hidden and kept in display order by - * program.js. + * One row of the description items collection in ProgramType. The type dropdown lists the description item + * types set up in Settings > Configuration > Program; each option carries the type's description, which + * Assets/js/mt3s-mp-program.js shows under the dropdown. The position field is hidden and kept in display order by + * mt3s-mp-program.js. * - * @extends AbstractType + * @extends AbstractType */ -class InitiativeDescriptionItemType extends AbstractType +class ProgramDescriptionItemType extends AbstractType { public function __construct( private ItemTypeProvider $typeProvider, @@ -33,11 +33,11 @@ class InitiativeDescriptionItemType extends AbstractType $kind = ItemTypeProvider::KIND_DESCRIPTION; $builder->add('type', ChoiceType::class, [ - 'label' => 'mautic.program.description_item.field.type', + 'label' => 'mt3s.marketing_program.description_item.field.type', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control initiative-item-type'], + 'attr' => ['class' => 'form-control program-item-type'], 'choices' => $this->typeProvider->getChoices($kind), - // The type's description and pictogram, shown next to the dropdown by program.js. + // The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js. 'choice_attr' => fn (?string $key): array => [ 'data-description' => (string) $this->typeProvider->getDescription($kind, $key), 'data-icon' => (string) $this->typeProvider->getIcon($kind, $key), @@ -47,26 +47,26 @@ class InitiativeDescriptionItemType extends AbstractType ]); $builder->add('description', TextareaType::class, [ - 'label' => 'mautic.program.description_item.field.description', + 'label' => 'mt3s.marketing_program.description_item.field.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 5], 'required' => false, ]); $builder->add('position', HiddenType::class, [ - 'attr' => ['class' => 'initiative-row-position'], + 'attr' => ['class' => 'program-row-position'], ]); } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'data_class' => InitiativeDescriptionItem::class, + 'data_class' => ProgramDescriptionItem::class, ]); } public function getBlockPrefix(): string { - return 'program_description_item'; + return 'mt3s_marketing_program_description_item'; } } diff --git a/Form/Type/InitiativeObjectiveType.php b/Form/Type/ProgramObjectiveType.php similarity index 64% rename from Form/Type/InitiativeObjectiveType.php rename to Form/Type/ProgramObjectiveType.php index af7c3b6..ca15703 100644 --- a/Form/Type/InitiativeObjectiveType.php +++ b/Form/Type/ProgramObjectiveType.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; -use MauticPlugin\ProgramBundle\Entity\InitiativeObjective; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramObjective; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -17,13 +17,13 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * One row of the objectives collection in InitiativeType: type, title, priority, description and the achieved - * flag. Works like InitiativeDescriptionItemType (type description shown under the dropdown and its pictogram - * next to it, hidden position kept in display order by Assets/js/program.js). + * One row of the objectives collection in ProgramType: type, title, priority, description and the achieved + * flag. Works like ProgramDescriptionItemType (type description shown under the dropdown and its pictogram + * next to it, hidden position kept in display order by Assets/js/mt3s-mp-program.js). * - * @extends AbstractType + * @extends AbstractType */ -class InitiativeObjectiveType extends AbstractType +class ProgramObjectiveType extends AbstractType { public function __construct( private ItemTypeProvider $typeProvider, @@ -35,11 +35,11 @@ class InitiativeObjectiveType extends AbstractType $kind = ItemTypeProvider::KIND_OBJECTIVE; $builder->add('type', ChoiceType::class, [ - 'label' => 'mautic.program.objective.field.type', + 'label' => 'mt3s.marketing_program.objective.field.type', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control initiative-item-type'], + 'attr' => ['class' => 'form-control program-item-type'], 'choices' => $this->typeProvider->getChoices($kind), - // The type's description and pictogram, shown next to the dropdown by program.js. + // The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js. 'choice_attr' => fn (?string $key): array => [ 'data-description' => (string) $this->typeProvider->getDescription($kind, $key), 'data-icon' => (string) $this->typeProvider->getIcon($kind, $key), @@ -49,36 +49,36 @@ class InitiativeObjectiveType extends AbstractType ]); $builder->add('title', TextType::class, [ - 'label' => 'mautic.program.objective.field.title', + 'label' => 'mt3s.marketing_program.objective.field.title', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 255], ]); $builder->add('priority', IntegerType::class, [ - 'label' => 'mautic.program.objective.field.priority', + 'label' => 'mt3s.marketing_program.objective.field.priority', 'label_attr' => ['class' => 'control-label'], - 'invalid_message' => 'mautic.program.objective.priority.range', + 'invalid_message' => 'mt3s.marketing_program.objective.priority.range', 'attr' => [ 'class' => 'form-control', - 'min' => InitiativeObjective::PRIORITY_MIN, - 'max' => InitiativeObjective::PRIORITY_MAX, + 'min' => ProgramObjective::PRIORITY_MIN, + 'max' => ProgramObjective::PRIORITY_MAX, 'step' => 1, ], ]); $builder->add('description', TextareaType::class, [ - 'label' => 'mautic.program.objective.field.description', + 'label' => 'mt3s.marketing_program.objective.field.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 2], 'required' => false, ]); $builder->add('position', HiddenType::class, [ - 'attr' => ['class' => 'initiative-row-position'], + 'attr' => ['class' => 'program-row-position'], ]); $builder->add('isAchieved', CheckboxType::class, [ - 'label' => 'mautic.program.objective.field.is_achieved', + 'label' => 'mt3s.marketing_program.objective.field.is_achieved', 'required' => false, ]); } @@ -86,12 +86,12 @@ class InitiativeObjectiveType extends AbstractType public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'data_class' => InitiativeObjective::class, + 'data_class' => ProgramObjective::class, ]); } public function getBlockPrefix(): string { - return 'program_objective'; + return 'mt3s_marketing_program_objective'; } } diff --git a/Form/Type/InitiativeStakeholderType.php b/Form/Type/ProgramStakeholderType.php similarity index 65% rename from Form/Type/InitiativeStakeholderType.php rename to Form/Type/ProgramStakeholderType.php index fb98ddb..1189c1e 100644 --- a/Form/Type/InitiativeStakeholderType.php +++ b/Form/Type/ProgramStakeholderType.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Doctrine\ORM\EntityRepository; -use MauticPlugin\ProgramBundle\Entity\InitiativeStakeholder; -use MauticPlugin\ProgramBundle\Entity\Stakeholder; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramStakeholder; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; @@ -15,18 +15,18 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * One row of the stakeholders collection in InitiativeType: a stakeholder of the global directory (only the + * One row of the stakeholders collection in ProgramType: a stakeholder of the global directory (only the * active ones are offered) and the stakeholder's role in this plan. The position field is hidden and - * kept in display order by Assets/js/program.js. + * kept in display order by Assets/js/mt3s-mp-program.js. * - * @extends AbstractType + * @extends AbstractType */ -class InitiativeStakeholderType extends AbstractType +class ProgramStakeholderType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('stakeholder', EntityType::class, [ - 'label' => 'mautic.program.stakeholder.field.name', + 'label' => 'mt3s.marketing_program.stakeholder.field.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => Stakeholder::class, @@ -39,27 +39,27 @@ class InitiativeStakeholderType extends AbstractType 'required' => true, ]); - $builder->add('roleInInitiative', TextType::class, [ - 'label' => 'mautic.program.stakeholder.field.role_in_initiative', + $builder->add('roleInProgram', TextType::class, [ + 'label' => 'mt3s.marketing_program.stakeholder.field.role_in_program', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 191], 'required' => false, ]); $builder->add('position', HiddenType::class, [ - 'attr' => ['class' => 'initiative-row-position'], + 'attr' => ['class' => 'program-row-position'], ]); } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'data_class' => InitiativeStakeholder::class, + 'data_class' => ProgramStakeholder::class, ]); } public function getBlockPrefix(): string { - return 'program_initiative_stakeholder'; + return 'mt3s_marketing_program_program_stakeholder'; } } diff --git a/Form/Type/InitiativeType.php b/Form/Type/ProgramType.php similarity index 70% rename from Form/Type/InitiativeType.php rename to Form/Type/ProgramType.php index 41268c5..5bbd8d1 100644 --- a/Form/Type/InitiativeType.php +++ b/Form/Type/ProgramType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Doctrine\ORM\EntityManagerInterface; use Mautic\CategoryBundle\Form\Type\CategoryListType; @@ -13,11 +13,11 @@ use Mautic\CoreBundle\Form\Type\FormButtonsType; use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType; use Mautic\UserBundle\Entity\User; use Mautic\UserBundle\Form\Type\UserListType; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\InitiativeStatus; -use MauticPlugin\ProgramBundle\Service\CurrencyProvider; -use MauticPlugin\ProgramBundle\Form\Type\InitiativeAudienceType; -use MauticPlugin\ProgramBundle\Form\Type\InitiativeStakeholderType; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramStatus; +use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\ProgramAudienceType; +use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\ProgramStakeholderType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\EnumType; @@ -28,9 +28,9 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** - * @extends AbstractType + * @extends AbstractType */ -class InitiativeType extends AbstractType +class ProgramType extends AbstractType { public function __construct( private CurrencyProvider $currencyProvider, @@ -47,15 +47,15 @@ class InitiativeType extends AbstractType $builder->addEventSubscriber(new CleanFormSubscriber(['name' => 'filter'])); $builder->add('name', TextType::class, [ - 'label' => 'mautic.program.field.name', + 'label' => 'mt3s.marketing_program.field.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], ]); - // The Description tab. by_reference false: Symfony calls Initiative::addDescriptionItem()/removeDescriptionItem(). + // The Description tab. by_reference false: Symfony calls Program::addDescriptionItem()/removeDescriptionItem(). $builder->add('descriptionItems', CollectionType::class, [ - 'label' => 'mautic.program.field.description_items', - 'entry_type' => InitiativeDescriptionItemType::class, + 'label' => 'mt3s.marketing_program.field.description_items', + 'entry_type' => ProgramDescriptionItemType::class, 'entry_options' => ['label' => false], 'allow_add' => true, 'allow_delete' => true, @@ -67,8 +67,8 @@ class InitiativeType extends AbstractType // The Allocations tab's cost lines, in the general currency. $builder->add('allocationItems', CollectionType::class, [ - 'label' => 'mautic.program.field.allocation_items', - 'entry_type' => InitiativeAllocationItemType::class, + 'label' => 'mt3s.marketing_program.field.allocation_items', + 'entry_type' => ProgramAllocationItemType::class, 'entry_options' => ['label' => false], 'allow_add' => true, 'allow_delete' => true, @@ -79,10 +79,10 @@ class InitiativeType extends AbstractType ]); // The Audiences tab's links to the global directory. by_reference false: Symfony calls - // Initiative::addAudience()/removeAudience(). + // Program::addAudience()/removeAudience(). $builder->add('audiences', CollectionType::class, [ - 'label' => 'mautic.program.field.audiences', - 'entry_type' => InitiativeAudienceType::class, + 'label' => 'mt3s.marketing_program.field.audiences', + 'entry_type' => ProgramAudienceType::class, 'entry_options' => ['label' => false], 'allow_add' => true, 'allow_delete' => true, @@ -93,10 +93,10 @@ class InitiativeType extends AbstractType ]); // The Stakeholders tab's links to the global directory. by_reference false: Symfony calls - // Initiative::addStakeholder()/removeStakeholder(). + // Program::addStakeholder()/removeStakeholder(). $builder->add('stakeholders', CollectionType::class, [ - 'label' => 'mautic.program.field.stakeholders', - 'entry_type' => InitiativeStakeholderType::class, + 'label' => 'mt3s.marketing_program.field.stakeholders', + 'entry_type' => ProgramStakeholderType::class, 'entry_options' => ['label' => false], 'allow_add' => true, 'allow_delete' => true, @@ -107,21 +107,21 @@ class InitiativeType extends AbstractType ]); $builder->add('version', IntegerType::class, [ - 'label' => 'mautic.program.field.version', + 'label' => 'mt3s.marketing_program.field.version', 'label_attr' => ['class' => 'control-label'], - 'invalid_message' => 'mautic.program.version.range', + 'invalid_message' => 'mt3s.marketing_program.version.range', 'attr' => [ 'class' => 'form-control', - 'min' => Initiative::VERSION_MIN, - 'max' => Initiative::VERSION_MAX, + 'min' => Program::VERSION_MIN, + 'max' => Program::VERSION_MAX, 'step' => 1, ], ]); - // by_reference false: Symfony calls Initiative::addObjective()/removeObjective(), which keep both sides in sync. + // by_reference false: Symfony calls Program::addObjective()/removeObjective(), which keep both sides in sync. $builder->add('objectives', CollectionType::class, [ - 'label' => 'mautic.program.field.objectives', - 'entry_type' => InitiativeObjectiveType::class, + 'label' => 'mt3s.marketing_program.field.objectives', + 'entry_type' => ProgramObjectiveType::class, 'entry_options' => ['label' => false], 'allow_add' => true, 'allow_delete' => true, @@ -132,9 +132,9 @@ class InitiativeType extends AbstractType ]); $builder->add('status', EnumType::class, [ - 'class' => InitiativeStatus::class, - 'choice_label' => fn (InitiativeStatus $status): string => $status->getLabelKey(), - 'label' => 'mautic.program.field.status', + 'class' => ProgramStatus::class, + 'choice_label' => fn (ProgramStatus $status): string => $status->getLabelKey(), + 'label' => 'mt3s.marketing_program.field.status', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], ]); @@ -142,7 +142,7 @@ class InitiativeType extends AbstractType // Required here; the column is nullable only because of onDelete SET NULL. $builder->add( $builder->create('owner', UserListType::class, [ - 'label' => 'mautic.program.field.owner', + 'label' => 'mt3s.marketing_program.field.owner', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => true, @@ -151,16 +151,16 @@ class InitiativeType extends AbstractType ); $builder->add('startDate', DatePickerType::class, [ - 'label' => 'mautic.program.field.start_date', + 'label' => 'mt3s.marketing_program.field.start_date', ]); $builder->add('endDate', DatePickerType::class, [ - 'label' => 'mautic.program.field.end_date', + 'label' => 'mt3s.marketing_program.field.end_date', ]); - // In the general currency (Settings > Configuration > Initiative Settings), shown next to the field. + // In the general currency (Settings > Configuration > Program Settings), shown next to the field. $builder->add('budgetPlanned', NumberType::class, [ - 'label' => 'mautic.program.field.budget_planned', + 'label' => 'mt3s.marketing_program.field.budget_planned', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'postaddon_text' => $this->currencyProvider->getCurrency()], 'input' => 'string', @@ -169,7 +169,7 @@ class InitiativeType extends AbstractType ]); $builder->add('category', CategoryListType::class, [ - 'bundle' => 'initiative', + 'bundle' => 'program', ]); $builder->add('isPublished', YesNoButtonGroupType::class, [ @@ -186,12 +186,12 @@ class InitiativeType extends AbstractType public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'data_class' => Initiative::class, + 'data_class' => Program::class, ]); } public function getBlockPrefix(): string { - return 'initiative'; + return 'program'; } } diff --git a/Form/Type/StakeholderType.php b/Form/Type/StakeholderType.php index 6d41935..4fecc38 100644 --- a/Form/Type/StakeholderType.php +++ b/Form/Type/StakeholderType.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; -use MauticPlugin\ProgramBundle\Entity\Stakeholder; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Mautic\CoreBundle\Form\Type\FormButtonsType; use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType; use Symfony\Component\Form\AbstractType; @@ -33,38 +33,38 @@ class StakeholderType extends AbstractType $kind = ItemTypeProvider::KIND_STAKEHOLDER; $builder->add('name', TextType::class, [ - 'label' => 'mautic.program.stakeholder.field.name', + 'label' => 'mt3s.marketing_program.stakeholder.field.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 191], ]); $builder->add('email', EmailType::class, [ - 'label' => 'mautic.program.stakeholder.field.email', + 'label' => 'mt3s.marketing_program.stakeholder.field.email', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 191], 'required' => false, ]); $builder->add('phone', TelType::class, [ - 'label' => 'mautic.program.stakeholder.field.phone', + 'label' => 'mt3s.marketing_program.stakeholder.field.phone', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 50], 'required' => false, ]); $builder->add('role', TextType::class, [ - 'label' => 'mautic.program.stakeholder.field.role', + 'label' => 'mt3s.marketing_program.stakeholder.field.role', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 191], 'required' => false, ]); $builder->add('type', ChoiceType::class, [ - 'label' => 'mautic.program.stakeholder.field.type', + 'label' => 'mt3s.marketing_program.stakeholder.field.type', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control initiative-item-type'], + 'attr' => ['class' => 'form-control program-item-type'], 'choices' => $this->typeProvider->getChoices($kind), - // The type's description and pictogram, shown next to the dropdown by program.js. + // The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js. 'choice_attr' => fn (?string $key): array => [ 'data-description' => (string) $this->typeProvider->getDescription($kind, $key), 'data-icon' => (string) $this->typeProvider->getIcon($kind, $key), @@ -74,7 +74,7 @@ class StakeholderType extends AbstractType ]); $builder->add('isPublished', YesNoButtonGroupType::class, [ - 'label' => 'mautic.program.stakeholder.field.active', + 'label' => 'mt3s.marketing_program.stakeholder.field.active', ]); $builder->add('buttons', FormButtonsType::class); @@ -93,6 +93,6 @@ class StakeholderType extends AbstractType public function getBlockPrefix(): string { - return 'program_stakeholder'; + return 'mt3s_marketing_program_stakeholder'; } } diff --git a/Form/Type/TaskDependencyType.php b/Form/Type/TaskDependencyType.php index 05be56c..3e81689 100644 --- a/Form/Type/TaskDependencyType.php +++ b/Form/Type/TaskDependencyType.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Doctrine\ORM\EntityRepository; -use MauticPlugin\ProgramBundle\Entity\DependencyType; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\Task; -use MauticPlugin\ProgramBundle\Entity\TaskDependency; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\DependencyType; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskDependency; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EnumType; @@ -18,7 +18,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; /** * One row of the dependencies collection in TaskType: the task this one depends on, and the type of - * the relation. Only the tasks of the same initiative are offered; cycles and self-edges are refused by + * the relation. Only the tasks of the same program are offered; cycles and self-edges are refused by * ValidTaskDependency. * * @extends AbstractType @@ -27,23 +27,23 @@ class TaskDependencyType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { - /** @var Initiative|null $initiative */ - $initiative = $options['initiative']; + /** @var Program|null $program */ + $program = $options['program']; /** @var Task|null $task */ $task = $options['task']; $builder->add('dependsOn', EntityType::class, [ - 'label' => 'mautic.program.task.dependency.field.depends_on', + 'label' => 'mt3s.marketing_program.task.dependency.field.depends_on', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => Task::class, 'choice_label' => 'name', - 'query_builder' => function (EntityRepository $er) use ($initiative, $task) { + 'query_builder' => function (EntityRepository $er) use ($program, $task) { $qb = $er->createQueryBuilder('t') ->orderBy('t.name', 'ASC'); - if (null !== $initiative) { - $qb->andWhere('t.initiative = :initiative')->setParameter('initiative', $initiative); + if (null !== $program) { + $qb->andWhere('t.program = :program')->setParameter('program', $program); } if (null !== $task?->getId()) { @@ -57,16 +57,16 @@ class TaskDependencyType extends AbstractType ]); $builder->add('dependencyType', EnumType::class, [ - 'label' => 'mautic.program.task.dependency.field.type', + 'label' => 'mt3s.marketing_program.task.dependency.field.type', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => DependencyType::class, 'choice_label' => fn (DependencyType $type): string => $type->getLabelKey(), ]); - // The row's order in the collection, rewritten by program.js after each change. + // The row's order in the collection, rewritten by mt3s-mp-program.js after each change. $builder->add('position', HiddenType::class, [ - 'attr' => ['class' => 'initiative-row-position'], + 'attr' => ['class' => 'program-row-position'], ]); } @@ -75,13 +75,13 @@ class TaskDependencyType extends AbstractType $resolver->setDefaults([ 'data_class' => TaskDependency::class, ]); - $resolver->setDefined(['initiative', 'task']); - $resolver->setAllowedTypes('initiative', [Initiative::class, 'null']); + $resolver->setDefined(['program', 'task']); + $resolver->setAllowedTypes('program', [Program::class, 'null']); $resolver->setAllowedTypes('task', [Task::class, 'null']); } public function getBlockPrefix(): string { - return 'program_task_dependency'; + return 'mt3s_marketing_program_task_dependency'; } } diff --git a/Form/Type/TaskRaciType.php b/Form/Type/TaskRaciType.php index 2f7756d..09eaaa7 100644 --- a/Form/Type/TaskRaciType.php +++ b/Form/Type/TaskRaciType.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Doctrine\ORM\EntityRepository; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\RaciRole; -use MauticPlugin\ProgramBundle\Entity\Stakeholder; -use MauticPlugin\ProgramBundle\Entity\TaskRaci; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\RaciRole; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskRaci; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EnumType; @@ -18,7 +18,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; /** * One row of the RACI collection in TaskType: a role (R/A/C/I) and the stakeholders carrying it. - * The stakeholders are picked from the initiative's assigned stakeholders; several may share a role. + * The stakeholders are picked from the program's assigned stakeholders; several may share a role. * * @extends AbstractType */ @@ -26,11 +26,11 @@ class TaskRaciType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { - /** @var Initiative|null $initiative */ - $initiative = $options['initiative']; + /** @var Program|null $program */ + $program = $options['program']; $builder->add('role', EnumType::class, [ - 'label' => 'mautic.program.task.raci.field.role', + 'label' => 'mt3s.marketing_program.task.raci.field.role', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => RaciRole::class, @@ -38,20 +38,20 @@ class TaskRaciType extends AbstractType ]); $builder->add('stakeholders', EntityType::class, [ - 'label' => 'mautic.program.task.raci.field.stakeholders', + 'label' => 'mt3s.marketing_program.task.raci.field.stakeholders', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => Stakeholder::class, 'choice_label' => 'name', - 'query_builder' => function (EntityRepository $er) use ($initiative) { + 'query_builder' => function (EntityRepository $er) use ($program) { $qb = $er->createQueryBuilder('s') ->orderBy('s.name', 'ASC'); - // The initiative's assigned stakeholders, when the initiative is known. - if (null !== $initiative) { - $qb->join('s.initiativeLinks', 'l') - ->andWhere('l.initiative = :initiative') - ->setParameter('initiative', $initiative); + // The program's assigned stakeholders, when the program is known. + if (null !== $program) { + $qb->join('s.programLinks', 'l') + ->andWhere('l.program = :program') + ->setParameter('program', $program); } return $qb; @@ -61,9 +61,9 @@ class TaskRaciType extends AbstractType 'required' => false, ]); - // The row's order in the collection, rewritten by program.js after each change. + // The row's order in the collection, rewritten by mt3s-mp-program.js after each change. $builder->add('position', HiddenType::class, [ - 'attr' => ['class' => 'initiative-row-position'], + 'attr' => ['class' => 'program-row-position'], ]); } @@ -72,12 +72,12 @@ class TaskRaciType extends AbstractType $resolver->setDefaults([ 'data_class' => TaskRaci::class, ]); - $resolver->setDefined(['initiative']); - $resolver->setAllowedTypes('initiative', [Initiative::class, 'null']); + $resolver->setDefined(['program']); + $resolver->setAllowedTypes('program', [Program::class, 'null']); } public function getBlockPrefix(): string { - return 'program_task_raci'; + return 'mt3s_marketing_program_task_raci'; } } diff --git a/Form/Type/TaskType.php b/Form/Type/TaskType.php index 79c7303..e396574 100644 --- a/Form/Type/TaskType.php +++ b/Form/Type/TaskType.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Form\Type; +namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type; use Doctrine\ORM\EntityRepository; use Mautic\CoreBundle\Form\EventListener\CleanFormSubscriber; use Mautic\CoreBundle\Form\Type\FormButtonsType; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\Task; -use MauticPlugin\ProgramBundle\Entity\TaskKind; -use MauticPlugin\ProgramBundle\Entity\TaskStatus; -use MauticPlugin\ProgramBundle\Service\ItemTypeProvider; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskKind; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskStatus; +use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -46,7 +46,7 @@ class TaskType extends AbstractType /** @var Task $task */ $task = $options['data']; - $initiative = $task->getInitiative(); + $program = $task->getProgram(); $kind = ItemTypeProvider::KIND_TASK; @@ -54,7 +54,7 @@ class TaskType extends AbstractType $taskKind = $task->getTaskKind(); $builder->add('taskKind', EnumType::class, [ - 'label' => 'mautic.program.task.field.kind', + 'label' => 'mt3s.marketing_program.task.field.kind', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => TaskKind::class, @@ -62,11 +62,11 @@ class TaskType extends AbstractType ]); $builder->add('type', ChoiceType::class, [ - 'label' => 'mautic.program.task.field.type', + 'label' => 'mt3s.marketing_program.task.field.type', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control initiative-item-type'], + 'attr' => ['class' => 'form-control program-item-type'], 'choices' => $this->typeProvider->getChoices($kind), - // The type's description and pictogram, shown next to the dropdown by program.js. + // The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js. 'choice_attr' => fn (?string $key): array => [ 'data-description' => (string) $this->typeProvider->getDescription($kind, $key), 'data-icon' => (string) $this->typeProvider->getIcon($kind, $key), @@ -76,23 +76,23 @@ class TaskType extends AbstractType ]); $builder->add('name', TextType::class, [ - 'label' => 'mautic.program.task.field.name', + 'label' => 'mt3s.marketing_program.task.field.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'maxlength' => 255], ]); $builder->add('description', TextareaType::class, [ - 'label' => 'mautic.program.task.field.description', + 'label' => 'mt3s.marketing_program.task.field.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 6], 'required' => false, ]); - $builder->add('initiative', EntityType::class, [ - 'label' => 'mautic.program.task.field.initiative', + $builder->add('program', EntityType::class, [ + 'label' => 'mt3s.marketing_program.task.field.program', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], - 'class' => Initiative::class, + 'class' => Program::class, 'choice_label' => 'name', 'query_builder' => fn (EntityRepository $er) => $er->createQueryBuilder('p')->orderBy('p.name', 'ASC'), 'placeholder' => 'mautic.core.form.chooseone', @@ -101,7 +101,7 @@ class TaskType extends AbstractType // Simple dates, no time (the columns are DATE since 0.13.0). $builder->add('startDate', DateType::class, [ - 'label' => 'mautic.program.task.field.start_date', + 'label' => 'mt3s.marketing_program.task.field.start_date', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'html5' => true, @@ -112,7 +112,7 @@ class TaskType extends AbstractType $isMilestone = TaskKind::Milestone === $task->getTaskKind(); $isPhase = TaskKind::Phase === $task->getTaskKind(); $builder->add('endDate', DateType::class, [ - 'label' => 'mautic.program.task.field.end_date', + 'label' => 'mt3s.marketing_program.task.field.end_date', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'html5' => true, @@ -123,7 +123,7 @@ class TaskType extends AbstractType // Status: a phase has none of its own — it comes from its tasks. if (!$isPhase) { $builder->add('status', EnumType::class, [ - 'label' => 'mautic.program.task.field.status', + 'label' => 'mt3s.marketing_program.task.field.status', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'class' => TaskStatus::class, @@ -132,26 +132,26 @@ class TaskType extends AbstractType } $builder->add('definitionOfDone', TextareaType::class, [ - 'label' => 'mautic.program.task.field.definition_of_done', + 'label' => 'mt3s.marketing_program.task.field.definition_of_done', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 3], 'required' => false, ]); $builder->add('plannedWork', IntegerType::class, [ - 'label' => 'mautic.program.task.field.planned_work', + 'label' => 'mt3s.marketing_program.task.field.planned_work', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'min' => 0, 'step' => 1, 'postaddon_text' => 'h'], 'required' => false, ]); - // Dependencies: several edges, each another task of the initiative with the relation type. The + // Dependencies: several edges, each another task of the program with the relation type. The // rows are added and removed by the form template; cycles and self-edges are refused by // ValidTaskDependency. $builder->add('dependencies', CollectionType::class, [ - 'label' => 'mautic.program.task.field.dependencies', + 'label' => 'mt3s.marketing_program.task.field.dependencies', 'entry_type' => TaskDependencyType::class, - 'entry_options' => ['label' => false, 'initiative' => $initiative, 'task' => $task], + 'entry_options' => ['label' => false, 'program' => $program, 'task' => $task], 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, @@ -160,11 +160,11 @@ class TaskType extends AbstractType 'required' => false, ]); - // RACI: one row per role, several stakeholders per role, picked from the initiative's stakeholders. + // RACI: one row per role, several stakeholders per role, picked from the program's stakeholders. $builder->add('raci', CollectionType::class, [ - 'label' => 'mautic.program.task.field.raci', + 'label' => 'mt3s.marketing_program.task.field.raci', 'entry_type' => TaskRaciType::class, - 'entry_options' => ['label' => false, 'initiative' => $initiative], + 'entry_options' => ['label' => false, 'program' => $program], 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, @@ -189,6 +189,6 @@ class TaskType extends AbstractType public function getBlockPrefix(): string { - return 'program_task'; + return 'mt3s_marketing_program_task'; } } diff --git a/Integration/ProgramIntegration.php b/Integration/MT3SMarketingProgramIntegration.php similarity index 58% rename from Integration/ProgramIntegration.php rename to Integration/MT3SMarketingProgramIntegration.php index 9c750a1..d0acdce 100644 --- a/Integration/ProgramIntegration.php +++ b/Integration/MT3SMarketingProgramIntegration.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Integration; +namespace MauticPlugin\MT3SMarketingProgramBundle\Integration; use Mautic\IntegrationsBundle\Integration\BasicIntegration; use Mautic\IntegrationsBundle\Integration\ConfigurationTrait; use Mautic\IntegrationsBundle\Integration\Interfaces\BasicInterface; -class ProgramIntegration extends BasicIntegration implements BasicInterface +class MT3SMarketingProgramIntegration extends BasicIntegration implements BasicInterface { use ConfigurationTrait; - public const NAME = 'Program'; - public const DISPLAY_NAME = 'Program'; + public const NAME = 'MT3SMarketingProgram'; + public const DISPLAY_NAME = 'Marketing Programs'; public function getName(): string { @@ -27,6 +27,6 @@ class ProgramIntegration extends BasicIntegration implements BasicInterface public function getIcon(): string { - return 'plugins/ProgramBundle/Assets/img/icon.svg'; + return 'plugins/MT3SMarketingProgramBundle/Assets/img/mt3s-mp-icon.svg'; } } diff --git a/Integration/Support/MT3SMarketingProgramConfigSupport.php b/Integration/Support/MT3SMarketingProgramConfigSupport.php new file mode 100644 index 0000000..dfb7032 --- /dev/null +++ b/Integration/Support/MT3SMarketingProgramConfigSupport.php @@ -0,0 +1,14 @@ + * Configuration > Plan Settings (parameter plan_objective_types). Adds initiative_objectives.type for @@ -28,11 +26,11 @@ class Version_0_10_0 extends AbstractMigration protected function up(): void { - $objectives = $this->concatPrefix(InitiativeObjective::TABLE_NAME); + $objectives = $this->concatPrefix('initiative_objectives'); $table = $this->entityManager->getConnection()->createSchemaManager()->introspectTable($objectives); if (!$table->hasColumn('type')) { - $this->addSql(sprintf('ALTER TABLE %s ADD type VARCHAR(%d) DEFAULT NULL', $objectives, InitiativeObjective::TYPE_MAX_LENGTH)); + $this->addSql(sprintf('ALTER TABLE %s ADD type VARCHAR(%d) DEFAULT NULL', $objectives, 64)); } } } diff --git a/Migrations/Version_0_10_1.php b/Migrations/Version_0_10_1.php index 95d9bd8..3148ff9 100644 --- a/Migrations/Version_0_10_1.php +++ b/Migrations/Version_0_10_1.php @@ -2,12 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\InitiativeObjective; - /** * Since 0.10.1 objectives have a priority, a whole number from 1 (highest) to 99 (lowest). Adds * initiative_objectives.priority for installs created before 0.10.1: NOT NULL with the default 1, and the @@ -26,14 +24,14 @@ class Version_0_10_1 extends AbstractMigration protected function up(): void { - $objectives = $this->concatPrefix(InitiativeObjective::TABLE_NAME); + $objectives = $this->concatPrefix('initiative_objectives'); $table = $this->entityManager->getConnection()->createSchemaManager()->introspectTable($objectives); if (!$table->hasColumn('priority')) { $this->addSql(sprintf( "ALTER TABLE %s ADD priority INT NOT NULL DEFAULT %d", $objectives, - InitiativeObjective::PRIORITY_MIN + 1 )); } } diff --git a/Migrations/Version_0_11_0.php b/Migrations/Version_0_11_0.php index fdcd460..e8b1b2b 100644 --- a/Migrations/Version_0_11_0.php +++ b/Migrations/Version_0_11_0.php @@ -2,15 +2,13 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\ORM\Tools\SchemaTool; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Audience; -use MauticPlugin\ProgramBundle\Entity\AudienceType as AudienceTypeEnum; -use MauticPlugin\ProgramBundle\Entity\Initiative; - +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\AudienceType as AudienceTypeEnum; /** * Since 0.11.0 a plan has audiences (table initiative_audiences, initiative_audiences_stages before 0.15.0) with any * number of Mautic stages (join table initiative_audiences_stages). Creates both tables for installs created @@ -53,8 +51,8 @@ class Version_0_11_0 extends AbstractMigration // An install created before 0.11.0 that somehow never got the tables: create the current // (0.15.0) ones from the entity mapping directly. - if (!$schema->hasTable($this->concatPrefix(Audience::TABLE_NAME))) { - $this->addSql($this->getCreateTableSql(Audience::TABLE_NAME)); + if (!$schema->hasTable($this->concatPrefix('initiative_audiences'))) { + $this->addSql($this->getCreateTableSql('initiative_audiences')); } if (!$schema->hasTable($this->concatPrefix('initiative_audiences_stages')) @@ -65,7 +63,7 @@ class Version_0_11_0 extends AbstractMigration foreach ($this->getColumnsToRename($schema) as $field => $column) { $this->addSql(sprintf( 'ALTER TABLE %s CHANGE %s %s', - $this->concatPrefix(Audience::TABLE_NAME), + $this->concatPrefix('initiative_audiences'), $field, $this->getColumnDefinition($field, $column) )); @@ -77,11 +75,11 @@ class Version_0_11_0 extends AbstractMigration */ private function getColumnsToRename(Schema $schema): array { - if (!$schema->hasTable($this->concatPrefix(Audience::TABLE_NAME))) { + if (!$schema->hasTable($this->concatPrefix('initiative_audiences'))) { return []; } - $table = $schema->getTable($this->concatPrefix(Audience::TABLE_NAME)); + $table = $schema->getTable($this->concatPrefix('initiative_audiences')); $rename = []; foreach (self::COLUMNS as $field => $column) { @@ -95,7 +93,7 @@ class Version_0_11_0 extends AbstractMigration private function hasForeignKeys(Schema $schema): bool { - $audiences = $this->concatPrefix(Audience::TABLE_NAME); + $audiences = $this->concatPrefix('initiative_audiences'); if (!$schema->hasTable($audiences)) { return false; diff --git a/Migrations/Version_0_12_0.php b/Migrations/Version_0_12_0.php index 67673a8..a80ead0 100644 --- a/Migrations/Version_0_12_0.php +++ b/Migrations/Version_0_12_0.php @@ -2,14 +2,12 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\ORM\Tools\SchemaTool; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\InitiativeStakeholder; -use MauticPlugin\ProgramBundle\Entity\Stakeholder; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder; /** * Since 0.12.0 planning has a global stakeholder directory (table initiative_stakeholders), and each plan @@ -33,26 +31,26 @@ class Version_0_12_0 extends AbstractMigration { $schema = $this->entityManager->getConnection()->createSchemaManager()->introspectSchema(); - if (!$schema->hasTable($this->concatPrefix(Stakeholder::TABLE_NAME))) { - $this->addSql($this->getCreateTableSql(Stakeholder::class, Stakeholder::TABLE_NAME)); + if (!$schema->hasTable($this->concatPrefix('initiative_stakeholders'))) { + $this->addSql($this->getCreateTableSql(Stakeholder::class, 'initiative_stakeholders')); } - if (!$schema->hasTable($this->concatPrefix(InitiativeStakeholder::TABLE_NAME))) { - $this->addSql($this->getCreateTableSql(InitiativeStakeholder::class, InitiativeStakeholder::TABLE_NAME)); + if (!$schema->hasTable($this->concatPrefix('initiative_stakeholders_initiative'))) { + $this->addSql($this->getCreateTableSql(InitiativeStakeholder::class, 'initiative_stakeholders_initiative')); } if (!$this->hasForeignKeys($schema)) { $this->addSql($this->generateAlterTableForeignKeyStatement( - InitiativeStakeholder::TABLE_NAME, + 'initiative_stakeholders_initiative', ['plan_id'], - Initiative::TABLE_NAME, + 'initiatives', ['id'], 'ON DELETE CASCADE' )); $this->addSql($this->generateAlterTableForeignKeyStatement( - InitiativeStakeholder::TABLE_NAME, + 'initiative_stakeholders_initiative', ['stakeholder_id'], - Stakeholder::TABLE_NAME, + 'initiative_stakeholders', ['id'], 'ON DELETE CASCADE' )); @@ -64,7 +62,7 @@ class Version_0_12_0 extends AbstractMigration */ private function hasForeignKeys(Schema $schema): bool { - $links = $this->concatPrefix(InitiativeStakeholder::TABLE_NAME); + $links = $this->concatPrefix('initiative_stakeholders_initiative'); if (!$schema->hasTable($links)) { return false; diff --git a/Migrations/Version_0_13_0.php b/Migrations/Version_0_13_0.php index 8dda520..9b7eb8b 100644 --- a/Migrations/Version_0_13_0.php +++ b/Migrations/Version_0_13_0.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\ORM\Tools\SchemaTool; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Task; -use MauticPlugin\ProgramBundle\Entity\TaskDependency; -use MauticPlugin\ProgramBundle\Entity\TaskRaci; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskDependency; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskRaci; /** * Since 0.13.0 tasks are reworked: @@ -35,7 +35,7 @@ class Version_0_13_0 extends AbstractMigration protected function up(): void { - $tasks = $this->concatPrefix(Task::TABLE_NAME); + $tasks = $this->concatPrefix('initiative_tasks'); $table = $this->entityManager->getConnection()->createSchemaManager()->introspectTable($tasks); // New columns. @@ -43,7 +43,7 @@ class Version_0_13_0 extends AbstractMigration $this->addSql(sprintf( "ALTER TABLE %s ADD task_kind VARCHAR(20) NOT NULL DEFAULT '%s'", $tasks, - \MauticPlugin\ProgramBundle\Entity\TaskKind::Task->value + \MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskKind::Task->value )); } if (!$table->hasColumn('definition_of_done')) { @@ -71,20 +71,20 @@ class Version_0_13_0 extends AbstractMigration } // New tables. Each is created when missing on its own, so a partial earlier run is repaired. - if (!$this->introspectSchema()->hasTable($this->concatPrefix(TaskDependency::TABLE_NAME))) { - foreach ($this->getCreateTableSqls(TaskDependency::class, TaskDependency::TABLE_NAME) as $sql) { + if (!$this->introspectSchema()->hasTable($this->concatPrefix('initiative_task_dependencies'))) { + foreach ($this->getCreateTableSqls(TaskDependency::class, 'initiative_task_dependencies') as $sql) { $this->addSql($sql); } } - if (!$this->introspectSchema()->hasTable($this->concatPrefix(TaskRaci::TABLE_NAME))) { - foreach ($this->getCreateTableSqls(TaskRaci::class, TaskRaci::TABLE_NAME) as $sql) { + if (!$this->introspectSchema()->hasTable($this->concatPrefix('initiative_task_raci'))) { + foreach ($this->getCreateTableSqls(TaskRaci::class, 'initiative_task_raci') as $sql) { $this->addSql($sql); } } // The RACI join table comes with the TaskRaci entity's SQL (CREATE TABLE initiative_task_raci_stakeholders), // but it may be missing while initiative_task_raci exists (a partial earlier run). - if (!$this->introspectSchema()->hasTable($this->concatPrefix(TaskRaci::JOIN_TABLE_NAME))) { - foreach ($this->getCreateTableSqls(TaskRaci::class, TaskRaci::JOIN_TABLE_NAME) as $sql) { + if (!$this->introspectSchema()->hasTable($this->concatPrefix('initiative_task_raci_stakeholders'))) { + foreach ($this->getCreateTableSqls(TaskRaci::class, 'initiative_task_raci_stakeholders') as $sql) { $this->addSql($sql); } } diff --git a/Migrations/Version_0_14_0.php b/Migrations/Version_0_14_0.php index 9e12e88..a4621ab 100644 --- a/Migrations/Version_0_14_0.php +++ b/Migrations/Version_0_14_0.php @@ -2,14 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Audience; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\InitiativeAudience; - +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience; /** * Since 0.14.0 audiences are a global directory (Planning > Audiences, called Targets before 0.15.0), * like stakeholders: @@ -147,9 +144,9 @@ class Version_0_14_0 extends AbstractMigration // core tables, such as plans, at install time). if (!$this->hasForeignKeys($schema)) { $this->addSql($this->generateAlterTableForeignKeyStatement( - $oldNaming ? 'initiative_audiences_initiative' : InitiativeAudience::TABLE_NAME, + $oldNaming ? 'initiative_audiences_initiative' : 'initiative_audiences_initiative', ['plan_id'], - Initiative::TABLE_NAME, + 'initiatives', ['id'], 'ON DELETE CASCADE' )); @@ -166,7 +163,7 @@ class Version_0_14_0 extends AbstractMigration private function getTableNames(Schema $schema): ?array { foreach ([ - [Audience::TABLE_NAME, InitiativeAudience::TABLE_NAME], + ['initiative_audiences', 'initiative_audiences_initiative'], ['initiative_audiences', 'initiative_audiences_initiative'], ] as [$directory, $links]) { if ($schema->hasTable($this->concatPrefix($directory))) { @@ -184,7 +181,7 @@ class Version_0_14_0 extends AbstractMigration */ private function hasForeignKeys(Schema $schema): bool { - foreach (['initiative_audiences_initiative', InitiativeAudience::TABLE_NAME] as $links) { + foreach (['initiative_audiences_initiative', 'initiative_audiences_initiative'] as $links) { $links = $this->concatPrefix($links); if (!$schema->hasTable($links)) { diff --git a/Migrations/Version_0_15_0.php b/Migrations/Version_0_15_0.php index 968c76b..e4e4b47 100644 --- a/Migrations/Version_0_15_0.php +++ b/Migrations/Version_0_15_0.php @@ -2,13 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Audience; -use MauticPlugin\ProgramBundle\Entity\Initiative; - +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience; /** * Historical migration (from 0.15.0, when the bundle was still PlanBundle): it renamed "targets" * to "audiences" — plan_targets became plan_audiences (its target_type column audience_type), @@ -23,7 +21,7 @@ class Version_0_15_0 extends AbstractMigration { protected function isApplicable(Schema $schema): bool { - if (!$schema->hasTable($this->concatPrefix(Initiative::TABLE_NAME)) + if (!$schema->hasTable($this->concatPrefix('initiatives')) && !$schema->hasTable($this->concatPrefix('plans'))) { return false; } diff --git a/Migrations/Version_0_16_0.php b/Migrations/Version_0_16_0.php index d7762fa..37861f4 100644 --- a/Migrations/Version_0_16_0.php +++ b/Migrations/Version_0_16_0.php @@ -2,14 +2,13 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; /** - * Since 0.16.0 the PlanBundle is the ProgramBundle, and a plan is an initiative: the Planning + * Since 0.16.0 the PlanBundle is the MT3SMarketingProgramBundle, and a plan is an initiative: the Planning * menu is Programs, the Plans page is Initiatives. The database follows: * - plans becomes initiatives; * - plan_objectives, plan_description_items, plan_allocation_items become initiative_*; diff --git a/Migrations/Version_0_17_0.php b/Migrations/Version_0_17_0.php new file mode 100644 index 0000000..5c8c833 --- /dev/null +++ b/Migrations/Version_0_17_0.php @@ -0,0 +1,218 @@ + new table name, in dependency order. + */ + private const TABLES = [ + 'initiatives' => 'mt3s_mp_programs', + 'initiative_objectives' => 'mt3s_mp_program_objectives', + 'initiative_description_items' => 'mt3s_mp_program_description_items', + 'initiative_allocation_items' => 'mt3s_mp_program_allocation_items', + 'initiative_tasks' => 'mt3s_mp_program_tasks', + 'initiative_task_dependencies' => 'mt3s_mp_program_task_dependencies', + 'initiative_task_raci' => 'mt3s_mp_program_task_raci', + 'initiative_task_raci_stakeholders' => 'mt3s_mp_program_task_raci_stakeholders', + 'initiative_stakeholders' => 'mt3s_mp_program_stakeholders', + 'initiative_stakeholders_initiative' => 'mt3s_mp_program_stakeholders_program', + 'initiative_audiences' => 'mt3s_mp_program_audiences', + 'initiative_audiences_initiative' => 'mt3s_mp_program_audiences_program', + 'initiative_audiences_segments' => 'mt3s_mp_program_audiences_segments', + 'initiative_audiences_stages' => 'mt3s_mp_program_audiences_stages', + ]; + + /** + * Table (any of its names) => [old column => new column, definition]. + */ + private const COLUMNS = [ + ['initiative_objectives', 'mt3s_mp_program_objectives', 'initiative_id', 'program_id', 'INT UNSIGNED NOT NULL'], + ['initiative_description_items', 'mt3s_mp_program_description_items', 'initiative_id', 'program_id', 'INT UNSIGNED NOT NULL'], + ['initiative_allocation_items', 'mt3s_mp_program_allocation_items', 'initiative_id', 'program_id', 'INT UNSIGNED NOT NULL'], + ['initiative_tasks', 'mt3s_mp_program_tasks', 'initiative_id', 'program_id', 'INT UNSIGNED NOT NULL'], + ['initiative_stakeholders_initiative', 'mt3s_mp_program_stakeholders_program', 'initiative_id', 'program_id', 'INT UNSIGNED NOT NULL'], + ['initiative_stakeholders_initiative', 'mt3s_mp_program_stakeholders_program', 'role_in_initiative', 'role_in_program', 'VARCHAR(191) DEFAULT NULL'], + ['initiative_audiences_initiative', 'mt3s_mp_program_audiences_program', 'initiative_id', 'program_id', 'INT UNSIGNED NOT NULL'], + ]; + + protected function isApplicable(Schema $schema): bool + { + foreach (self::TABLES as $from => $to) { + if ($schema->hasTable($this->concatPrefix($from))) { + return true; + } + } + + foreach (self::COLUMNS as [$fromTable, $toTable, $fromColumn]) { + $table = $this->getTableName($schema, [$fromTable, $toTable]); + if (null !== $table) { + foreach ($schema->getTable($table)->getColumns() as $name => $column) { + if (strtolower($name) === strtolower($fromColumn)) { + return true; + } + } + } + } + + // The pre-rename plugins row: the update target of an installed 0.16.0. + try { + $row = $this->entityManager->getConnection()->fetchOne( + sprintf("SELECT id FROM %s WHERE bundle = 'ProgramBundle'", $this->concatPrefix('plugins')) + ); + } catch (\Throwable) { + $row = false; + } + + return false !== $row; + } + + protected function up(): void + { + // Tables, one rename at a time; stable database names unique. + foreach (self::TABLES as $from => $to) { + $this->renameTableIfExists($from, $to); + } + + // Columns, resolving each table to whichever name it has now. + foreach (self::COLUMNS as [$fromTable, $toTable, $fromColumn, $toColumn, $definition]) { + $this->renameColumnIfExists([$fromTable, $toTable], $fromColumn, $toColumn, $definition); + } + + $this->carryRowsOver(); + } + + /** + * The rows the rename orphans: the plugin's own, the roles' permissions, the categories and + * the audit log. + */ + private function carryRowsOver(): void + { + $connection = $this->entityManager->getConnection(); + + // The plugins row: keep the install an update of the same plugin, not a new one. + $oldBundle = $connection->fetchOne( + sprintf("SELECT id FROM %s WHERE bundle = 'ProgramBundle'", $this->concatPrefix('plugins')) + ); + if (false !== $oldBundle) { + $connection->executeStatement(sprintf( + "UPDATE %s SET bundle = 'MT3SMarketingProgramBundle', name = 'MT3S Marketing Program' WHERE bundle = 'ProgramBundle'", + $this->concatPrefix('plugins') + )); + } + + // The roles' permission rows: the permission base follows the bundle name, and + // initiatives became programs (the 0.16.0 rename missed these). + $connection->executeStatement(sprintf( + "UPDATE %s SET name = 'programs' WHERE bundle = 'program' AND name = 'initiatives'", + $this->concatPrefix('permissions') + )); + $connection->executeStatement(sprintf( + "UPDATE %s SET bundle = 'mt3smarketingprogram' WHERE bundle = 'program'", + $this->concatPrefix('permissions') + )); + + // The categories of the program category type (bundle column), plan-era rows included: + // the 0.16.0 rename left those behind too. + $connection->executeStatement(sprintf( + "UPDATE %s SET bundle = 'program' WHERE bundle IN ('plan', 'initiative')", + $this->concatPrefix('categories') + )); + + // The audit log rows about this plugin's entities. + $connection->executeStatement(sprintf( + "UPDATE %s SET bundle = 'MT3SMarketingProgramBundle' WHERE bundle IN ('PlanBundle', 'ProgramBundle')", + $this->concatPrefix('audit_logs') + )); + } + + /** + * Renames a table when the old name still exists and the new one doesn't. + */ + private function renameTableIfExists(string $from, string $to): void + { + $connection = $this->entityManager->getConnection(); + + if ($this->getTableName($connection->createSchemaManager()->introspectSchema(), [$from, $to]) === $this->concatPrefix($from)) { + $connection->executeStatement(sprintf( + 'RENAME TABLE %1$s TO %2$s', + $this->concatPrefix($from), + $this->concatPrefix($to) + )); + } + } + + /** + * @param list $tables the table's possible names, oldest first: the first that exists is used + */ + private function renameColumnIfExists(array $tables, string $fromColumn, string $toColumn, string $definition): void + { + $connection = $this->entityManager->getConnection(); + $table = $this->getTableName($connection->createSchemaManager()->introspectSchema(), $tables); + + if (null === $table) { + return; + } + + foreach ($connection->createSchemaManager()->introspectTable($table)->getColumns() as $name => $column) { + if (strtolower($name) === strtolower($fromColumn)) { + $connection->executeStatement(sprintf( + 'ALTER TABLE %s CHANGE %s %s %s', + $table, + $name, + $toColumn, + $definition + )); + + return; + } + } + } + + /** + * The first of the given table names that exists, prefixed. + * + * @param list $tables + */ + private function getTableName(Schema $schema, array $tables): ?string + { + foreach ($tables as $table) { + if ($schema->hasTable($this->concatPrefix($table))) { + return $this->concatPrefix($table); + } + } + + return null; + } +} \ No newline at end of file diff --git a/Migrations/Version_0_2_0.php b/Migrations/Version_0_2_0.php index 541145e..631f087 100644 --- a/Migrations/Version_0_2_0.php +++ b/Migrations/Version_0_2_0.php @@ -2,13 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Table; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; - /** * Brings the plans table in line with the entity mapping. * @@ -50,14 +48,14 @@ class Version_0_2_0 extends AbstractMigration if ($this->statusNeedsResize($table)) { $this->addSql(sprintf( 'ALTER TABLE %s MODIFY status VARCHAR(%d) NOT NULL', - $this->concatPrefix(Initiative::TABLE_NAME), + $this->concatPrefix('initiatives'), self::STATUS_LENGTH )); } foreach ($this->getMissingForeignKeys($table) as $column => $referenceTable) { $this->addSql($this->generateAlterTableForeignKeyStatement( - Initiative::TABLE_NAME, + 'initiatives', [$column], $referenceTable, ['id'], @@ -68,7 +66,7 @@ class Version_0_2_0 extends AbstractMigration private function getTable(Schema $schema): ?Table { - $name = $this->concatPrefix(Initiative::TABLE_NAME); + $name = $this->concatPrefix('initiatives'); return $schema->hasTable($name) ? $schema->getTable($name) : null; } diff --git a/Migrations/Version_0_3_0.php b/Migrations/Version_0_3_0.php index f0116e7..f99e941 100644 --- a/Migrations/Version_0_3_0.php +++ b/Migrations/Version_0_3_0.php @@ -2,13 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\InitiativeObjective; - /** * Adds plans.version and the initiative_objectives table to installs created before 0.3.0. * @@ -28,16 +25,16 @@ class Version_0_3_0 extends AbstractMigration protected function up(): void { $schema = $this->entityManager->getConnection()->createSchemaManager()->introspectSchema(); - $plans = $this->concatPrefix(Initiative::TABLE_NAME); - $objectives = $this->concatPrefix(InitiativeObjective::TABLE_NAME); + $plans = $this->concatPrefix('initiatives'); + $objectives = $this->concatPrefix('initiative_objectives'); if (!$schema->getTable($plans)->hasColumn('version')) { $this->addSql("ALTER TABLE {$plans} ADD version SMALLINT UNSIGNED DEFAULT 1 NOT NULL"); } if (!$schema->hasTable($objectives)) { - $index = $this->generatePropertyName(InitiativeObjective::TABLE_NAME, 'idx', ['plan_id']); - $foreignKey = $this->generatePropertyName(InitiativeObjective::TABLE_NAME, 'fk', ['plan_id']); + $index = $this->generatePropertyName('initiative_objectives', 'idx', ['plan_id']); + $foreignKey = $this->generatePropertyName('initiative_objectives', 'fk', ['plan_id']); $this->addSql("CREATE TABLE {$objectives} ( id INT UNSIGNED AUTO_INCREMENT NOT NULL, diff --git a/Migrations/Version_0_4_0.php b/Migrations/Version_0_4_0.php index d3e4230..cf2dcc8 100644 --- a/Migrations/Version_0_4_0.php +++ b/Migrations/Version_0_4_0.php @@ -2,14 +2,13 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Table; use Doctrine\ORM\Tools\SchemaTool; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; /** * Adds the initiative_tasks table and its foreign keys to installs created before 0.4.0. @@ -31,7 +30,7 @@ class Version_0_4_0 extends AbstractMigration * so only plan_id is repaired here. */ private const FOREIGN_KEYS = [ - 'plan_id' => [Initiative::TABLE_NAME, 'CASCADE'], + 'plan_id' => ['initiatives', 'CASCADE'], ]; protected function isApplicable(Schema $schema): bool @@ -46,7 +45,7 @@ class Version_0_4_0 extends AbstractMigration protected function up(): void { $schema = $this->entityManager->getConnection()->createSchemaManager()->introspectSchema(); - $tasks = $this->concatPrefix(Task::TABLE_NAME); + $tasks = $this->concatPrefix('initiative_tasks'); $missingFk = self::FOREIGN_KEYS; if (!$schema->hasTable($tasks)) { @@ -57,7 +56,7 @@ class Version_0_4_0 extends AbstractMigration foreach ($missingFk as $column => [$referenceTable, $onDelete]) { $this->addSql($this->generateAlterTableForeignKeyStatement( - Task::TABLE_NAME, + 'initiative_tasks', [$column], $referenceTable, ['id'], @@ -69,7 +68,7 @@ class Version_0_4_0 extends AbstractMigration private function getCreateTableSql(): string { $schemaTool = new SchemaTool($this->entityManager); - $prefix = 'CREATE TABLE '.$this->concatPrefix(Task::TABLE_NAME).' '; + $prefix = 'CREATE TABLE '.$this->concatPrefix('initiative_tasks').' '; foreach ($schemaTool->getCreateSchemaSql([$this->entityManager->getClassMetadata(Task::class)]) as $sql) { if (str_starts_with($sql, $prefix)) { @@ -77,7 +76,7 @@ class Version_0_4_0 extends AbstractMigration } } - throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.Task::TABLE_NAME.'.'); + throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.'initiative_tasks'.'.'); } /** diff --git a/Migrations/Version_0_5_0.php b/Migrations/Version_0_5_0.php index 1d257b9..8ed3476 100644 --- a/Migrations/Version_0_5_0.php +++ b/Migrations/Version_0_5_0.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Task; -use MauticPlugin\ProgramBundle\Entity\TaskStatus; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskStatus; /** * Adds start_date, end_date and status (default "new", indexed) to initiative_tasks, for installs created @@ -28,7 +28,7 @@ class Version_0_5_0 extends AbstractMigration protected function up(): void { - $tasks = $this->concatPrefix(Task::TABLE_NAME); + $tasks = $this->concatPrefix('initiative_tasks'); $table = $this->entityManager->getConnection()->createSchemaManager()->introspectTable($tasks); if (!$table->hasColumn('start_date')) { diff --git a/Migrations/Version_0_6_0.php b/Migrations/Version_0_6_0.php index e06111a..be7d4d1 100644 --- a/Migrations/Version_0_6_0.php +++ b/Migrations/Version_0_6_0.php @@ -2,14 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\ORM\Tools\SchemaTool; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\InitiativeDescriptionItem; - /** * For installs created before 0.6.0: * - creates initiative_description_items (and its foreign key to plans, ON DELETE CASCADE); @@ -33,8 +30,8 @@ class Version_0_6_0 extends AbstractMigration protected function up(): void { $schema = $this->entityManager->getConnection()->createSchemaManager()->introspectSchema(); - $plans = $this->concatPrefix(Initiative::TABLE_NAME); - $items = $this->concatPrefix(InitiativeDescriptionItem::TABLE_NAME); + $plans = $this->concatPrefix('initiatives'); + $items = $this->concatPrefix('initiative_description_items'); if (!$schema->hasTable($items)) { $this->addSql($this->getCreateTableSql()); @@ -42,9 +39,9 @@ class Version_0_6_0 extends AbstractMigration if (!$schema->hasTable($items) || !$this->hasPlanForeignKey($schema)) { $this->addSql($this->generateAlterTableForeignKeyStatement( - InitiativeDescriptionItem::TABLE_NAME, + 'initiative_description_items', ['plan_id'], - Initiative::TABLE_NAME, + 'initiatives', ['id'], 'ON DELETE CASCADE' )); @@ -57,7 +54,7 @@ class Version_0_6_0 extends AbstractMigration private function hasPlanForeignKey(Schema $schema): bool { - $items = $this->concatPrefix(InitiativeDescriptionItem::TABLE_NAME); + $items = $this->concatPrefix('initiative_description_items'); if (!$schema->hasTable($items)) { return false; @@ -75,7 +72,7 @@ class Version_0_6_0 extends AbstractMigration private function getCreateTableSql(): string { $schemaTool = new SchemaTool($this->entityManager); - $prefix = 'CREATE TABLE '.$this->concatPrefix(InitiativeDescriptionItem::TABLE_NAME).' '; + $prefix = 'CREATE TABLE '.$this->concatPrefix('initiative_description_items').' '; foreach ($schemaTool->getCreateSchemaSql([$this->entityManager->getClassMetadata(InitiativeDescriptionItem::class)]) as $sql) { if (str_starts_with($sql, $prefix)) { @@ -83,6 +80,6 @@ class Version_0_6_0 extends AbstractMigration } } - throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.InitiativeDescriptionItem::TABLE_NAME.'.'); + throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.'initiative_description_items'.'.'); } } diff --git a/Migrations/Version_0_7_0.php b/Migrations/Version_0_7_0.php index a4793c2..f8d83d8 100644 --- a/Migrations/Version_0_7_0.php +++ b/Migrations/Version_0_7_0.php @@ -2,14 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\ORM\Tools\SchemaTool; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\InitiativeAllocationItem; - /** * Creates initiative_allocation_items (and its foreign key to plans, ON DELETE CASCADE) for installs created * before 0.7.0. Each step runs only if needed. As in Version_0_4_0, only the CREATE TABLE statement for @@ -29,7 +26,7 @@ class Version_0_7_0 extends AbstractMigration protected function up(): void { $schema = $this->entityManager->getConnection()->createSchemaManager()->introspectSchema(); - $items = $this->concatPrefix(InitiativeAllocationItem::TABLE_NAME); + $items = $this->concatPrefix('initiative_allocation_items'); if (!$schema->hasTable($items)) { $this->addSql($this->getCreateTableSql()); @@ -37,9 +34,9 @@ class Version_0_7_0 extends AbstractMigration if (!$this->hasPlanForeignKey($schema)) { $this->addSql($this->generateAlterTableForeignKeyStatement( - InitiativeAllocationItem::TABLE_NAME, + 'initiative_allocation_items', ['plan_id'], - Initiative::TABLE_NAME, + 'initiatives', ['id'], 'ON DELETE CASCADE' )); @@ -48,7 +45,7 @@ class Version_0_7_0 extends AbstractMigration private function hasPlanForeignKey(Schema $schema): bool { - $items = $this->concatPrefix(InitiativeAllocationItem::TABLE_NAME); + $items = $this->concatPrefix('initiative_allocation_items'); if (!$schema->hasTable($items)) { return false; @@ -66,7 +63,7 @@ class Version_0_7_0 extends AbstractMigration private function getCreateTableSql(): string { $schemaTool = new SchemaTool($this->entityManager); - $prefix = 'CREATE TABLE '.$this->concatPrefix(InitiativeAllocationItem::TABLE_NAME).' '; + $prefix = 'CREATE TABLE '.$this->concatPrefix('initiative_allocation_items').' '; foreach ($schemaTool->getCreateSchemaSql([$this->entityManager->getClassMetadata(InitiativeAllocationItem::class)]) as $sql) { if (str_starts_with($sql, $prefix)) { @@ -74,6 +71,6 @@ class Version_0_7_0 extends AbstractMigration } } - throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.InitiativeAllocationItem::TABLE_NAME.'.'); + throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.'initiative_allocation_items'.'.'); } } diff --git a/Migrations/Version_0_8_0.php b/Migrations/Version_0_8_0.php index 3a09413..239d2c8 100644 --- a/Migrations/Version_0_8_0.php +++ b/Migrations/Version_0_8_0.php @@ -2,13 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\InitiativeAllocationItem; - /** * Since 0.8.0 every amount is in one general currency (Settings > Configuration > Plan Settings, parameter * program_currency), so the per-record currency columns are dropped: plans.currency, @@ -21,8 +18,8 @@ class Version_0_8_0 extends AbstractMigration * Table => columns to drop. */ private const COLUMNS = [ - Initiative::TABLE_NAME => ['currency'], - InitiativeAllocationItem::TABLE_NAME => ['planned_currency', 'real_currency'], + 'initiatives' => ['currency'], + 'initiative_allocation_items' => ['planned_currency', 'real_currency'], ]; protected function isApplicable(Schema $schema): bool diff --git a/Migrations/Version_0_9_0.php b/Migrations/Version_0_9_0.php index e975198..d5d8aad 100644 --- a/Migrations/Version_0_9_0.php +++ b/Migrations/Version_0_9_0.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Migrations; +namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations; use Doctrine\DBAL\Schema\Schema; use Mautic\IntegrationsBundle\Migration\AbstractMigration; -use MauticPlugin\ProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; /** * Since 0.9.0 tasks have a type, the key of a task type set up in Settings > Configuration > Plan @@ -27,7 +27,7 @@ class Version_0_9_0 extends AbstractMigration protected function up(): void { - $tasks = $this->concatPrefix(Task::TABLE_NAME); + $tasks = $this->concatPrefix('initiative_tasks'); $table = $this->entityManager->getConnection()->createSchemaManager()->introspectTable($tasks); if (!$table->hasColumn('type')) { diff --git a/Model/AudienceModel.php b/Model/AudienceModel.php index e8e3934..cb668cc 100644 --- a/Model/AudienceModel.php +++ b/Model/AudienceModel.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Model; +namespace MauticPlugin\MT3SMarketingProgramBundle\Model; use Mautic\CoreBundle\Model\FormModel; -use MauticPlugin\ProgramBundle\Entity\Audience; -use MauticPlugin\ProgramBundle\Entity\AudienceRepository; -use MauticPlugin\ProgramBundle\Form\Type\AudienceType; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\AudienceRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\AudienceType; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; /** - * Available as mautic.program.model.audience, or getModel('program.audience'). + * Available as mt3s.marketing_program.model.audience, or getModel('mt3smp.audience'). * * Audiences are a global directory (Programs > Audiences), independent of plans; plans link to - * them from their Audiences tab through InitiativeAudience (which carries the audience's priority in - * that initiative). + * them from their Audiences tab through ProgramAudience (which carries the audience's priority in + * that program). */ class AudienceModel extends FormModel { @@ -31,7 +31,7 @@ class AudienceModel extends FormModel public function getPermissionBase(): string { - return 'program:audiences'; + return 'mt3smarketingprogram:audiences'; } public function getEntity($id = null): ?Audience diff --git a/Model/InitiativeModel.php b/Model/InitiativeModel.php deleted file mode 100644 index 5f6a764..0000000 --- a/Model/InitiativeModel.php +++ /dev/null @@ -1,77 +0,0 @@ - - */ -class InitiativeModel extends FormModel -{ - public function getRepository(): InitiativeRepository - { - $repository = $this->em->getRepository(Initiative::class); - \assert($repository instanceof InitiativeRepository); - - return $repository; - } - - public function getPermissionBase(): string - { - return 'program:initiatives'; - } - - /** - * With no ID, returns a new initiative with the current user as owner. - */ - public function getEntity($id = null): ?Initiative - { - if (null === $id) { - $initiative = new Initiative(); - $initiative->setOwner($this->userHelper->getUser(true)); - - return $initiative; - } - - $initiative = parent::getEntity($id); - - return $initiative instanceof Initiative ? $initiative : null; - } - - /** - * Keeps objective and description item positions contiguous (0..n-1) before saving. - */ - public function saveEntity($entity, $unlock = true): void - { - if ($entity instanceof Initiative) { - $entity->normalizePositions(); - } - - parent::saveEntity($entity, $unlock); - } - - /** - * @param array $options - */ - public function createForm($entity, FormFactoryInterface $formFactory, $action = null, $options = []): FormInterface - { - if (!$entity instanceof Initiative) { - throw new MethodNotAllowedHttpException(['Initiative']); - } - - if (!empty($action)) { - $options['action'] = $action; - } - - return $formFactory->create(InitiativeType::class, $entity, $options); - } -} diff --git a/Model/ProgramModel.php b/Model/ProgramModel.php new file mode 100644 index 0000000..78970a9 --- /dev/null +++ b/Model/ProgramModel.php @@ -0,0 +1,113 @@ + + */ +class ProgramModel extends FormModel +{ + public function getRepository(): ProgramRepository + { + $repository = $this->em->getRepository(Program::class); + \assert($repository instanceof ProgramRepository); + + return $repository; + } + + public function getPermissionBase(): string + { + return 'mt3smarketingprogram:programs'; + } + + /** + * With no ID, returns a new program with the current user as owner. + */ + public function getEntity($id = null): ?Program + { + if (null === $id) { + $program = new Program(); + $program->setOwner($this->userHelper->getUser(true)); + + return $program; + } + + $program = parent::getEntity($id); + + return $program instanceof Program ? $program : null; + } + + /** + * Keeps objective and description item positions contiguous (0..n-1) before saving, and + * dispatches the plugin's pre/post save events (created vs updated by the entity's ID). + */ + public function saveEntity($entity, $unlock = true): void + { + if ($entity instanceof Program) { + $isNew = null === $entity->getId(); + + $this->dispatcher->dispatch(new ProgramEvent($entity, $isNew), MT3SMarketingProgramEvents::PROGRAM_PRE_SAVE); + + $entity->normalizePositions(); + + parent::saveEntity($entity, $unlock); + + $this->dispatcher->dispatch(new ProgramEvent($entity, $isNew), MT3SMarketingProgramEvents::PROGRAM_POST_SAVE); + $this->dispatcher->dispatch( + new ProgramEvent($entity, $isNew), + $isNew ? MT3SMarketingProgramEvents::PROGRAM_CREATED : MT3SMarketingProgramEvents::PROGRAM_UPDATED + ); + + return; + } + + parent::saveEntity($entity, $unlock); + } + + /** + * Dispatches the plugin's delete events around the removal. + */ + public function deleteEntity($entity): void + { + if ($entity instanceof Program) { + $this->dispatcher->dispatch(new ProgramEvent($entity, false), MT3SMarketingProgramEvents::PROGRAM_PRE_DELETE); + + parent::deleteEntity($entity); + + $this->dispatcher->dispatch(new ProgramEvent($entity, false), MT3SMarketingProgramEvents::PROGRAM_POST_DELETE); + $this->dispatcher->dispatch(new ProgramEvent($entity, false), MT3SMarketingProgramEvents::PROGRAM_DELETED); + + return; + } + + parent::deleteEntity($entity); + } + + /** + * @param array $options + */ + public function createForm($entity, FormFactoryInterface $formFactory, $action = null, $options = []): FormInterface + { + if (!$entity instanceof Program) { + throw new MethodNotAllowedHttpException(['Program']); + } + + if (!empty($action)) { + $options['action'] = $action; + } + + return $formFactory->create(ProgramType::class, $entity, $options); + } +} diff --git a/Model/StakeholderModel.php b/Model/StakeholderModel.php index 4413db8..8f03a36 100644 --- a/Model/StakeholderModel.php +++ b/Model/StakeholderModel.php @@ -2,24 +2,24 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Model; +namespace MauticPlugin\MT3SMarketingProgramBundle\Model; use libphonenumber\NumberParseException; use libphonenumber\PhoneNumberFormat; use libphonenumber\PhoneNumberUtil; use Mautic\CoreBundle\Model\FormModel; -use MauticPlugin\ProgramBundle\Entity\Stakeholder; -use MauticPlugin\ProgramBundle\Entity\StakeholderRepository; -use MauticPlugin\ProgramBundle\Form\Type\StakeholderType; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\StakeholderRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\StakeholderType; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; /** - * Available as mautic.program.model.stakeholder, or getModel('program.stakeholder'). + * Available as mt3s.marketing_program.model.stakeholder, or getModel('mt3smp.stakeholder'). * * On save, the phone number is normalized to E.164 using the default region from Settings > - * Configuration > Initiative Settings (parameter program_stakeholder_phone_region, FR by default). A number that + * Configuration > Program Settings (parameter mt3s_marketing_program_stakeholder_phone_region, FR by default). A number that * doesn't parse (free input, extensions…) is kept exactly as typed: the save is never blocked. */ class StakeholderModel extends FormModel @@ -27,7 +27,7 @@ class StakeholderModel extends FormModel /** * local.php parameter: default region for phone numbers typed without a country prefix. */ - public const PHONE_REGION_PARAMETER = 'program_stakeholder_phone_region'; + public const PHONE_REGION_PARAMETER = 'mt3s_marketing_program_stakeholder_phone_region'; public const DEFAULT_PHONE_REGION = 'FR'; @@ -41,7 +41,7 @@ class StakeholderModel extends FormModel public function getPermissionBase(): string { - return 'program:stakeholders'; + return 'mt3smarketingprogram:stakeholders'; } public function getEntity($id = null): ?Stakeholder diff --git a/Model/TaskModel.php b/Model/TaskModel.php index 3195257..6a1de3f 100644 --- a/Model/TaskModel.php +++ b/Model/TaskModel.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Model; +namespace MauticPlugin\MT3SMarketingProgramBundle\Model; use Mautic\CoreBundle\Model\FormModel; -use MauticPlugin\ProgramBundle\Entity\Initiative; -use MauticPlugin\ProgramBundle\Entity\Task; -use MauticPlugin\ProgramBundle\Entity\TaskRepository; -use MauticPlugin\ProgramBundle\Form\Type\TaskType; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\TaskType; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; /** - * Available as mautic.program.model.task, or getModel('program.task'). + * Available as mt3s.marketing_program.model.task, or getModel('mt3smp.task'). * * @extends FormModel */ @@ -30,7 +30,7 @@ class TaskModel extends FormModel public function getPermissionBase(): string { - return 'program:tasks'; + return 'mt3smarketingprogram:tasks'; } public function getEntity($id = null): ?Task @@ -45,16 +45,16 @@ class TaskModel extends FormModel } /** - * The plan's tasks as rows for the initiative's Tasks tab: the tasks ordered by name, each with its + * The plan's tasks as rows for the program's Tasks tab: the tasks ordered by name, each with its * dependencies and RACI rows loaded. The former parent/child tree is gone; the tab lists the * tasks flat, and the dependencies are shown per task. * * @return array */ - public function getTaskTree(Initiative $initiative): array + public function getTaskTree(Program $program): array { $rows = []; - foreach ($this->getRepository()->findByInitiative($initiative) as $task) { + foreach ($this->getRepository()->findByProgram($program) as $task) { $rows[] = ['task' => $task, 'depth' => 0]; } diff --git a/ProgramBundle.php b/ProgramBundle.php deleted file mode 100644 index 699199d..0000000 --- a/ProgramBundle.php +++ /dev/null @@ -1,11 +0,0 @@ - {{ include('@MauticCore/Helper/page_actions.html.twig', { 'item': item, 'templateButtons': { - 'edit': securityHasEntityAccess(permissions['program:audiences:editown'], permissions['program:audiences:editother'], item.createdBy), - 'delete': securityHasEntityAccess(permissions['program:audiences:deleteown'], permissions['program:audiences:deleteother'], item.createdBy), + 'edit': securityHasEntityAccess(permissions['mt3smarketingprogram:audiences:editown'], permissions['mt3smarketingprogram:audiences:editother'], item.createdBy), + 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:audiences:deleteown'], permissions['mt3smarketingprogram:audiences:deleteother'], item.createdBy), }, - 'actionRoute': 'initiative_audience_action', - 'indexRoute': 'initiative_audience_index', - 'langVar': 'initiative.audience', + 'actionRoute': 'mt3s_marketing_program_audience_action', + 'indexRoute': 'mt3s_marketing_program_audience_index', + 'langVar': 'program.audience', }) }} {% endblock %} @@ -22,103 +22,103 @@ {% block publishStatus %}
- {{ (item.isPublished ? 'mautic.program.audience.active' : 'mautic.program.audience.inactive')|trans }} + {{ (item.isPublished ? 'mt3s.marketing_program.audience.active' : 'mt3s.marketing_program.audience.inactive')|trans }}
{% endblock %} {% block content %}
- +
- + {% if item.segments is not empty %} - + {% endif %} {% if item.tagline %} - - + + {% endif %} {% if item.profileCriteria %} - - + + {% endif %} {% if item.motivations %} - - + + {% endif %} {% if item.barriers %} - - + + {% endif %} {% if item.frustrations %} - - + + {% endif %} {% if item.triggers %} - - + + {% endif %} {% if item.decisionRole %} - - + + {% endif %} {% if item.preferredTones is not empty %} - + {% endif %} {% if item.preferredChannels is not empty %} - + {% endif %} {% if item.stages is not empty %} - + {% endif %} {% if item.estimatedSize %} - + {% endif %} @@ -133,27 +133,27 @@
{{ 'mautic.program.audience.field.type'|trans }}{{ 'mt3s.marketing_program.audience.field.type'|trans }} - + {{ item.audienceType.labelKey|trans }}
{{ 'mautic.program.audience.field.segments'|trans }}{{ 'mt3s.marketing_program.audience.field.segments'|trans }} {% for segment in item.segments %} - {{ segment.name }} ({{ program_audience_segment_count(segment.id) }}){% if not loop.last %} {% endif %} + {{ segment.name }} ({{ mt3s_marketing_program_audience_segment_count(segment.id) }}){% if not loop.last %} {% endif %} {% endfor %}
{{ 'mautic.program.audience.field.tagline'|trans }}{{ item.tagline|program_linkify }}{{ 'mt3s.marketing_program.audience.field.tagline'|trans }}{{ item.tagline|mt3s_marketing_program_linkify }}
{{ 'mautic.program.audience.field.profile_criteria'|trans }}{{ item.profileCriteria|program_linkify }}{{ 'mt3s.marketing_program.audience.field.profile_criteria'|trans }}{{ item.profileCriteria|mt3s_marketing_program_linkify }}
{{ 'mautic.program.audience.field.motivations'|trans }}{{ item.motivations|program_linkify }}{{ 'mt3s.marketing_program.audience.field.motivations'|trans }}{{ item.motivations|mt3s_marketing_program_linkify }}
{{ 'mautic.program.audience.field.barriers'|trans }}{{ item.barriers|program_linkify }}{{ 'mt3s.marketing_program.audience.field.barriers'|trans }}{{ item.barriers|mt3s_marketing_program_linkify }}
{{ 'mautic.program.audience.field.frustrations'|trans }}{{ item.frustrations|program_linkify }}{{ 'mt3s.marketing_program.audience.field.frustrations'|trans }}{{ item.frustrations|mt3s_marketing_program_linkify }}
{{ 'mautic.program.audience.field.triggers'|trans }}{{ item.triggers|program_linkify }}{{ 'mt3s.marketing_program.audience.field.triggers'|trans }}{{ item.triggers|mt3s_marketing_program_linkify }}
{{ 'mautic.program.audience.field.decision_role'|trans }}{{ program_audience_decision_role_label(item.decisionRole) ?? item.decisionRole }}{{ 'mt3s.marketing_program.audience.field.decision_role'|trans }}{{ mt3s_marketing_program_audience_decision_role_label(item.decisionRole) ?? item.decisionRole }}
{{ 'mautic.program.audience.field.preferred_tones'|trans }}{{ 'mt3s.marketing_program.audience.field.preferred_tones'|trans }} {% for tone in item.preferredTones %} - {{ program_audience_tone_label(tone) ?? tone }} + {{ mt3s_marketing_program_audience_tone_label(tone) ?? tone }} {% endfor %}
{{ 'mautic.program.audience.field.preferred_channels'|trans }}{{ 'mt3s.marketing_program.audience.field.preferred_channels'|trans }} {% for channel in item.preferredChannels %} - {{ program_audience_channel_label(channel)|trans }} + {{ mt3s_marketing_program_audience_channel_label(channel)|trans }} {% endfor %}
{{ 'mautic.program.audience.field.stages'|trans }}{{ 'mt3s.marketing_program.audience.field.stages'|trans }} {{ item.stages|map(stage => stage.name)|join(', ') }}
{{ 'mautic.program.audience.field.estimated_size'|trans }}{{ 'mt3s.marketing_program.audience.field.estimated_size'|trans }} {{ item.estimatedSize }}
-

{{ 'mautic.program.audience.field.plans'|trans }}

- {% if item.initiativeLinks is empty %} -

{{ 'mautic.program.audience.no_plans'|trans }}

+

{{ 'mt3s.marketing_program.audience.field.plans'|trans }}

+ {% if item.programLinks is empty %} +

{{ 'mt3s.marketing_program.audience.no_plans'|trans }}

{% else %}
- +
- - - - + + + + - {% for link in item.initiativeLinks %} + {% for link in item.programLinks %} - + - + {% endfor %} diff --git a/Resources/views/Audience/form.html.twig b/Resources/views/Audience/form.html.twig index 028adbf..5c935dd 100644 --- a/Resources/views/Audience/form.html.twig +++ b/Resources/views/Audience/form.html.twig @@ -1,12 +1,12 @@ {% extends '@MauticCore/Default/content.html.twig' %} -{% block mauticContent %}programAudience{% endblock %} +{% block mauticContent %}mt3sMpProgramAudience{% endblock %} {% block headerTitle %} {% if entity.id %} - {{ 'mautic.program.audience.header.edit'|trans({'%name%': entity.name}) }} + {{ 'mt3s.marketing_program.audience.header.edit'|trans({'%name%': entity.name}) }} {% else %} - {{ 'mautic.program.audience.header.new'|trans }} + {{ 'mt3s.marketing_program.audience.header.new'|trans }} {% endif %} {% endblock %} @@ -17,18 +17,18 @@
{{ form_row(form.name) }}
- {# The selected type's pictogram, fixed per type; programAudienceOnLoad updates it + {# The selected type's pictogram, fixed per type; mt3sMpProgramAudienceOnLoad updates it when the dropdown changes. A new form defaults to Persona. #}
- +
{{ form_row(form.audienceType) }} -

{{ 'mautic.program.audience.type.fixed_note'|trans }}

+

{{ 'mt3s.marketing_program.audience.type.fixed_note'|trans }}

{{ form_row(form.segments) }} -

{{ 'mautic.program.audience.segments.note'|trans }}

+

{{ 'mt3s.marketing_program.audience.segments.note'|trans }}

{% if form.tagline is defined %}{{ form_row(form.tagline) }}{% endif %} {% if form.profileCriteria is defined %}{{ form_row(form.profileCriteria) }}{% endif %} {% if form.motivations is defined %}{{ form_row(form.motivations) }}{% endif %} @@ -45,7 +45,7 @@
{{ form_row(form.isPublished) }} -

{{ 'mautic.program.audience.active.help'|trans }}

+

{{ 'mt3s.marketing_program.audience.active.help'|trans }}

diff --git a/Resources/views/Audience/list.html.twig b/Resources/views/Audience/list.html.twig index ea72820..181d262 100644 --- a/Resources/views/Audience/list.html.twig +++ b/Resources/views/Audience/list.html.twig @@ -2,110 +2,110 @@ {% set tmpl = 'list' %} {% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %} -{% block mauticContent %}programAudience{% endblock %} +{% block mauticContent %}mt3sMpProgramAudience{% endblock %} -{% block headerTitle %}{{ 'mautic.program.audience.header.index'|trans }}{% endblock %} +{% block headerTitle %}{{ 'mt3s.marketing_program.audience.header.index'|trans }}{% endblock %} {% block content %} - {% set segmentCounts = program_audience_segment_counts(items) %} + {% set segmentCounts = mt3s_marketing_program_audience_segment_counts(items) %}
{{- include('@MauticCore/Helper/list_toolbar.html.twig', { 'searchValue': searchValue, 'action': currentRoute, 'page_actions': { 'templateButtons': { - 'new': permissions['program:audiences:create'], + 'new': permissions['mt3smarketingprogram:audiences:create'], }, - 'langVar': 'initiative.audience', + 'langVar': 'program.audience', }, 'bulk_actions': { - 'langVar': 'initiative.audience', + 'langVar': 'program.audience', 'templateButtons': { - 'delete': permissions['program:audiences:deleteown'] or permissions['program:audiences:deleteother'], + 'delete': permissions['mt3smarketingprogram:audiences:deleteown'] or permissions['mt3smarketingprogram:audiences:deleteother'], }, }, }) -}}
{% if items is defined and items is not empty %}
-
{{ 'mautic.program.field.name'|trans }}{{ 'mautic.program.audience.field.priority'|trans }}{{ 'mautic.program.audience.field.value_proposition'|trans }}{{ 'mautic.program.field.status'|trans }}{{ 'mt3s.marketing_program.field.name'|trans }}{{ 'mt3s.marketing_program.audience.field.priority'|trans }}{{ 'mt3s.marketing_program.audience.field.value_proposition'|trans }}{{ 'mt3s.marketing_program.field.status'|trans }}
{{ link.initiative.name }}{{ link.program.name }} {{ link.priority.labelKey|trans }} {{ link.valueProposition|default('—') }}{{ link.initiative.status.labelKey|trans }}{{ link.program.status.labelKey|trans }}
+
{{ include('@MauticCore/Helper/tableheader.html.twig', { 'checkall': 'true', - 'target': '#programAudienceTable', + 'target': '#mt3sMpProgramAudienceTable', }) }} {# Columns: ID, Pictogram, Type, Name (+ tagline), Segments (with contact - counts), Estimated size, Active, Assigned initiatives. #} + counts), Estimated size, Active, Assigned programs. #} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', + 'sessionVar': 'program.audience', 'orderBy': 't.id', 'text': 'mautic.core.id', - 'class': 'col-initiative-audience-id', + 'class': 'col-program-audience-id', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', - 'text': 'mautic.program.audience.field.pictogram', - 'class': 'col-initiative-audience-pictogram', + 'sessionVar': 'program.audience', + 'text': 'mt3s.marketing_program.audience.field.pictogram', + 'class': 'col-program-audience-pictogram', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', + 'sessionVar': 'program.audience', 'orderBy': 't.audienceType', - 'text': 'mautic.program.audience.field.type', - 'class': 'col-initiative-audience-type', + 'text': 'mt3s.marketing_program.audience.field.type', + 'class': 'col-program-audience-type', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', + 'sessionVar': 'program.audience', 'orderBy': 't.name', - 'text': 'mautic.program.audience.field.name', - 'class': 'col-initiative-audience-name', + 'text': 'mt3s.marketing_program.audience.field.name', + 'class': 'col-program-audience-name', 'default': true, }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', - 'text': 'mautic.program.audience.field.segments', - 'class': 'visible-md visible-lg col-initiative-audience-segments', + 'sessionVar': 'program.audience', + 'text': 'mt3s.marketing_program.audience.field.segments', + 'class': 'visible-md visible-lg col-program-audience-segments', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', - 'text': 'mautic.program.audience.field.estimated_size', - 'class': 'visible-md visible-lg col-initiative-audience-size', + 'sessionVar': 'program.audience', + 'text': 'mt3s.marketing_program.audience.field.estimated_size', + 'class': 'visible-md visible-lg col-program-audience-size', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', + 'sessionVar': 'program.audience', 'orderBy': 't.isPublished', - 'text': 'mautic.program.audience.field.active', - 'class': 'col-initiative-audience-active', + 'text': 'mt3s.marketing_program.audience.field.active', + 'class': 'col-program-audience-active', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.audience', - 'text': 'mautic.program.audience.field.plans', - 'class': 'visible-md visible-lg col-initiative-audience-initiatives', + 'sessionVar': 'program.audience', + 'text': 'mt3s.marketing_program.audience.field.plans', + 'class': 'visible-md visible-lg col-program-audience-programs', }) }} {% for item in items %} - {% set canEdit = securityHasEntityAccess(permissions['program:audiences:editown'], permissions['program:audiences:editother'], item.createdBy) %} + {% set canEdit = securityHasEntityAccess(permissions['mt3smarketingprogram:audiences:editown'], permissions['mt3smarketingprogram:audiences:editother'], item.createdBy) %} @@ -144,8 +144,8 @@ 'totalItems': totalItems, 'page': page, 'limit': limit, - 'baseUrl': path('initiative_audience_index'), - 'sessionVar': 'initiative.audience', + 'baseUrl': path('mt3s_marketing_program_audience_index'), + 'sessionVar': 'program.audience', }) -}} @@ -154,9 +154,9 @@ {% else %}
{{ include('@MauticCore/Components/content-block.html.twig', { - 'heading': 'mautic.program.audience.onboarding.heading', - 'subheading': 'mautic.program.audience.onboarding.subheading', - 'copy': 'mautic.program.audience.onboarding.copy', + 'heading': 'mt3s.marketing_program.audience.onboarding.heading', + 'subheading': 'mt3s.marketing_program.audience.onboarding.subheading', + 'copy': 'mt3s.marketing_program.audience.onboarding.copy', }) }}
{% endif %} diff --git a/Resources/views/FormTheme/Config/_config_mt3smarketingprogramconfig_widget.html.twig b/Resources/views/FormTheme/Config/_config_mt3smarketingprogramconfig_widget.html.twig new file mode 100644 index 0000000..52f7366 --- /dev/null +++ b/Resources/views/FormTheme/Config/_config_mt3smarketingprogramconfig_widget.html.twig @@ -0,0 +1,24 @@ +{# + # Settings > Configuration > Program Settings: the plugin's general settings only — the currency, + # the stakeholder phone region, and the audience attribute toggles. The item type lists moved to + # their own page under Programs (ItemTypesController, Resources/views/ItemTypes/form.html.twig). + #} + +{% block _config_mt3smarketingprogramconfig_widget %} +
{{ 'mt3s.marketing_program.config.description'|trans }}
+ +

{{ 'mt3s.marketing_program.config.section.general'|trans }}

+
+
{{ form_row(form.children.mt3s_marketing_program_currency) }}
+
{{ form_row(form.children.mt3s_marketing_program_stakeholder_phone_region) }}
+
+

{{ 'mt3s.marketing_program.config.currency.help'|trans }}

+ +

{{ 'mt3s.marketing_program.config.section.audience_attributes'|trans }}

+

{{ 'mt3s.marketing_program.config.section.audience_attributes.help'|trans }}

+
+ {% for attribute in mt3s_marketing_program_audience_attributes() %} + {{ form_row(form.children[mt3s_marketing_program_audience_attribute_toggle(attribute)]) }} + {% endfor %} +
+{% endblock %} diff --git a/Resources/views/FormTheme/Config/_config_programconfig_widget.html.twig b/Resources/views/FormTheme/Config/_config_programconfig_widget.html.twig deleted file mode 100644 index 8cbfc1b..0000000 --- a/Resources/views/FormTheme/Config/_config_programconfig_widget.html.twig +++ /dev/null @@ -1,24 +0,0 @@ -{# - # Settings > Configuration > Program Settings: the plugin's general settings only — the currency, - # the stakeholder phone region, and the audience attribute toggles. The item type lists moved to - # their own page under Programs (ItemTypesController, Resources/views/ItemTypes/form.html.twig). - #} - -{% block _config_programconfig_widget %} -
{{ 'mautic.program.config.description'|trans }}
- -

{{ 'mautic.program.config.section.general'|trans }}

-
-
{{ form_row(form.children.program_currency) }}
-
{{ form_row(form.children.program_stakeholder_phone_region) }}
-
-

{{ 'mautic.program.config.currency.help'|trans }}

- -

{{ 'mautic.program.config.section.audience_attributes'|trans }}

-

{{ 'mautic.program.config.section.audience_attributes.help'|trans }}

-
- {% for attribute in program_audience_attributes() %} - {{ form_row(form.children[program_audience_attribute_toggle(attribute)]) }} - {% endfor %} -
-{% endblock %} diff --git a/Resources/views/Initiative/_tab_table_filter.html.twig b/Resources/views/Initiative/_tab_table_filter.html.twig deleted file mode 100644 index d4d6459..0000000 --- a/Resources/views/Initiative/_tab_table_filter.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{# - # The filter box of an initiative tab table (Description, Objectives, Allocation, Tasks) and the switch that - # shows the "no match" message. Filtering and sorting are handled by Assets/js/program.js - # (Mautic.programInitTabTable), on any table with the data-initiative-tab-table attribute. - #} -
- - -
-

{{ 'mautic.program.filter.no_match'|trans }}

diff --git a/Resources/views/Initiative/_tabs.html.twig b/Resources/views/Initiative/_tabs.html.twig deleted file mode 100644 index 5ae5dbe..0000000 --- a/Resources/views/Initiative/_tabs.html.twig +++ /dev/null @@ -1,32 +0,0 @@ -{# - # Tab bar shared by the initiative form and the initiative detail page. - # - # Parameters: - # initiativeId: the initiative's id (null for a new initiative) - # counts (optional): tab id => number shown next to the tab name - # - # The tab panes use the ids initiative-tab-. Assets/js/program.js reopens the tab last used for this plan - # (so Edit, Save and Cancel keep the same tab), and on the form marks the tabs whose pane contains a - # validation error and opens the first of them. - #} -{% set initiativeTabs = { - 'details': 'mautic.program.tab.details', - 'description': 'mautic.program.tab.description', - 'objectives': 'mautic.program.tab.objectives', - 'allocation': 'mautic.program.tab.allocations', - 'audiences': 'mautic.program.tab.audiences', - 'stakeholders': 'mautic.program.tab.stakeholders', - 'tasks': 'mautic.program.tab.tasks', -} %} - diff --git a/Resources/views/Initiative/_task_table.html.twig b/Resources/views/Initiative/_task_table.html.twig deleted file mode 100644 index 0315389..0000000 --- a/Resources/views/Initiative/_task_table.html.twig +++ /dev/null @@ -1,93 +0,0 @@ -{# - # The initiative's tasks, for the Tasks tab of the initiative detail page and form. Same harmonized columns as the - # other tabs: Pictogram (no label), Type, Name, Description, Start date, End date, Status (last). No ID - # column. Rows are in tree order: each task is followed by its sub-tasks, indented under it. - # - # Parameters: - # initiative: the Initiative - # taskTree: rows from TaskModel::getTaskTree(): {task, depth}, in display order - # readOnly: true on the initiative form: no links, no filter, so that following one can't drop unsaved changes - # taskPermissions: program:tasks:* permissions (create, editown, editother), when not read-only - # - # Links carry returnTo=initiative, so that Save and Cancel on the task form come back to this initiative page - # (see TaskController). Opened from Programs > Tasks, the task form goes back to the task list. - #} -{% set readOnly = readOnly|default(false) %} -{% set taskPermissions = taskPermissions|default({}) %} -{% set canCreate = not readOnly and initiative.id and taskPermissions['program:tasks:create']|default(false) %} - -{% if canCreate %} - -{% endif %} - -{% if not initiative.id %} -

{{ 'mautic.program.task.save_initiative_first'|trans }}

-{% elseif taskTree is empty %} -

{{ 'mautic.program.task.empty'|trans }}

-{% else %} - {% if not readOnly %} - {# Filter + click-to-sort on the detail page (program.js). The form's read-only copy stays plain. #} - {{ include('@Program/Initiative/_tab_table_filter.html.twig') }} - {% endif %} -
-
{{- include('@MauticCore/Helper/list_actions.html.twig', { 'item': item, 'templateButtons': { 'edit': canEdit, - 'delete': securityHasEntityAccess(permissions['program:audiences:deleteown'], permissions['program:audiences:deleteother'], item.createdBy), + 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:audiences:deleteown'], permissions['mt3smarketingprogram:audiences:deleteother'], item.createdBy), }, - 'langVar': 'initiative.audience', + 'langVar': 'program.audience', }) -}} {{ item.id }} - + {{ item.audienceType.labelKey|trans }} {% if canEdit %} - {% if item.tagline %}{{ item.name }} — {{ item.tagline }}{% else %}{{ item.name }}{% endif %} + {% if item.tagline %}{{ item.name }} — {{ item.tagline }}{% else %}{{ item.name }}{% endif %} {% else %} {{ item.name }}{% if item.tagline %} — {{ item.tagline }}{% endif %} {% endif %} @@ -123,16 +123,16 @@ {{ item.estimatedSize }} - {{ (item.isPublished ? 'mautic.program.audience.active' : 'mautic.program.audience.inactive')|trans }} + {{ (item.isPublished ? 'mt3s.marketing_program.audience.active' : 'mt3s.marketing_program.audience.inactive')|trans }} - {# The initiatives this audience is assigned to, through their Audiences tab. #} - {% set links = item.initiativeLinks|default([]) %} + {# The programs this audience is assigned to, through their Audiences tab. #} + {% set links = item.programLinks|default([]) %} {% for link in links %} - {{ link.initiative.name }}{% if link.valueProposition %} ({{ link.valueProposition }}){% endif %}{% if not loop.last %}, {% endif %} + {{ link.program.name }}{% if link.valueProposition %} ({{ link.valueProposition }}){% endif %}{% if not loop.last %}, {% endif %} {% else %} - {{ 'mautic.program.audience.no_plans'|trans }} + {{ 'mt3s.marketing_program.audience.no_plans'|trans }} {% endfor %}
- - - - - - - - - - - - - {% for row in taskTree %} - {% set task = row.task %} - {% set canEdit = not readOnly and securityHasEntityAccess(taskPermissions['program:tasks:editown']|default(false), taskPermissions['program:tasks:editother']|default(false), task.createdBy) %} - - - - - - - - - - {% endfor %} - -
{{ 'mautic.program.task.field.type'|trans }}{{ 'mautic.program.task.field.name'|trans }}{{ 'mautic.program.task.field.description'|trans }}{{ 'mautic.program.task.field.start_date'|trans }}{{ 'mautic.program.task.field.end_date'|trans }}{{ 'mautic.program.task.field.status'|trans }}
- {% set taskTypeIcon = program_item_type_icon('task', task.type) %} - {% if taskTypeIcon %}{% endif %} - - {{ program_item_type_name('task', task.type) ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': task.type}) }} - - {% if canEdit %} - {{ task.name }} - {% else %} - {{ task.name }} - {% endif %} - {% if task.taskKind == constant('MauticPlugin\\ProgramBundle\\Entity\\TaskKind::Milestone') %} - {{ 'mautic.program.task.kind.milestone_short'|trans }} - {% elseif task.taskKind == constant('MauticPlugin\\ProgramBundle\\Entity\\TaskKind::Phase') %} - {{ 'mautic.program.task.kind.phase_short'|trans }} - {% endif %} - - {# Same 10-line clamp and read-more as the Description tab; URLs become links. #} - {{ include('@Program/Initiative/_description_read_more.html.twig', { - 'text': task.description|default('')|striptags, - 'id': 'initiative-task-desc-' ~ task.id, - }) }} - {{ task.startDate ? task.startDate|date('Y-m-d') : '' }}{{ task.endDate ? task.endDate|date('Y-m-d') : '' }} - {# A phase has no status of its own — skip the column value. #} - {% if task.taskKind != constant('MauticPlugin\\ProgramBundle\\Entity\\TaskKind::Phase') %} - {{ task.status.labelKey|trans }} - {% endif %} -
-
-{% endif %} diff --git a/Resources/views/Initiative/details.html.twig b/Resources/views/Initiative/details.html.twig deleted file mode 100644 index 7c04f5a..0000000 --- a/Resources/views/Initiative/details.html.twig +++ /dev/null @@ -1,449 +0,0 @@ -{% extends '@MauticCore/Default/content.html.twig' %} - -{% block mauticContent %}program{% endblock %} - -{# - # No routeBase on the page_actions includes: core would turn it into mautic_program_* route names. - # The buttons use actionRoute (initiative_action) from the controller, and the close button gets its URL here. - #} -{% block preHeader %} - {{- include('@MauticCore/Helper/page_actions.html.twig', { - 'item': item, - 'templateButtons': { - 'close': true, - }, - 'closeUrl': path('initiative_index'), - 'targetLabel': 'mautic.program.header.index'|trans, - }) -}} - {# Core's helper renders an empty pill when there is no category. #} - {% if item.category %} - {{ include('@MauticCore/Modules/category--inline.html.twig', {'category': item.category}) }} - {% endif %} -{% endblock %} - -{% block headerTitle %}{{ item.name }}{% endblock %} - -{# - # Under the title, as on an email's page: the plan status, then the total planned and real costs of the - # allocation items, in the general currency. A real total above the planned total is red, otherwise green. - #} -{% block publishStatus %} - {% set statusColors = { - 'draft': 'warm-gray', 'planned': 'blue', 'active': 'green', - 'paused': 'warning', 'completed': 'teal', 'archived': 'cool-gray', - } %} - {% include '@MauticCore/Helper/_tag.html.twig' with { tags: [{ - color: statusColors[item.status.value]|default('gray'), - label: item.status.labelKey, - icon: 'ri-flag-line', - attributes: {'class': 'initiative-status-tag'}, - }] } %} - - {% set totals = item.allocationTotals %} - {% if totals.planned is not null or totals.real is not null %} -
- {% set totalTags = [] %} - {% if totals.planned is not null %} - {% set totalTags = totalTags|merge([{ - color: 'high-contrast', - icon: 'ri-wallet-3-line', - label: 'mautic.program.header.total_planned'|trans({'%amount%': program_money(totals.planned), '%currency%': program_currency()}), - attributes: {'class': 'initiative-total-planned', 'title': 'mautic.program.header.total_planned.tooltip'|trans, 'data-toggle': 'tooltip'}, - }]) %} - {% endif %} - {% if totals.real is not null %} - {% set overPlan = totals.planned is not null and (totals.real + 0) > (totals.planned + 0) %} - {% set totalTags = totalTags|merge([{ - color: overPlan ? 'red' : 'green', - icon: overPlan ? 'ri-error-warning-line' : 'ri-checkbox-circle-line', - label: 'mautic.program.header.total_real'|trans({'%amount%': program_money(totals.real), '%currency%': program_currency()}), - attributes: {'class': 'initiative-total-real', 'title': (overPlan ? 'mautic.program.header.total_real.over' : 'mautic.program.header.total_real.tooltip')|trans, 'data-toggle': 'tooltip'}, - }]) %} - {% endif %} - {% include '@MauticCore/Helper/_tag.html.twig' with { tags: totalTags } %} - {% endif %} -{% endblock %} - -{% block actions %} - {{- include('@MauticCore/Helper/page_actions.html.twig', { - 'item': item, - 'templateButtons': { - 'edit': securityHasEntityAccess(permissions['program:initiatives:editown'], permissions['program:initiatives:editother'], item.createdBy), - 'delete': securityHasEntityAccess(permissions['program:initiatives:deleteown'], permissions['program:initiatives:deleteother'], item.createdBy), - }, - 'langVar': 'initiative', - }) -}} -{% endblock %} - -{% block content %} - {% set objectives = item.objectives %} - {% set achievedCount = objectives|filter(o => o.achieved)|length %} - {% set descriptionItems = item.descriptionItems %} - {% set allocationItems = item.allocationItems %} - {% set allocationTotals = item.allocationTotals %} - - {{ include('@Program/Initiative/_tabs.html.twig', {'initiativeId': item.id, 'counts': { - 'description': descriptionItems|length, - 'objectives': objectives|length, - 'allocation': allocationItems|length, - 'audiences': item.audiences|length, - 'stakeholders': item.stakeholders|length, - 'tasks': taskTree|length, - }}) }} - -
- {# Details #} -
- - - - - - - {% if item.completedAt %} - - - - - {% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {% if item.dateModified %} - - - - - {% endif %} - - - - - -
{{ 'mautic.program.field.status'|trans }}{{ item.status.labelKey|trans }}
{{ 'mautic.program.field.completed_at'|trans }}{{ dateToFull(item.completedAt) }}
{{ 'mautic.program.field.version'|trans }}{{ item.version }}
{{ 'mautic.program.field.owner'|trans }}{{ item.owner ? item.owner.name : 'mautic.program.owner.none'|trans }}
{{ 'mautic.program.field.start_date'|trans }}{{ item.startDate ? dateToFull(item.startDate) : 'mautic.program.value.none'|trans }}
{{ 'mautic.program.field.end_date'|trans }}{{ item.endDate ? dateToFull(item.endDate) : 'mautic.program.value.none'|trans }}
{{ 'mautic.core.category'|trans }}{{ item.category ? item.category.title : 'mautic.program.value.none'|trans }}
{{ 'mautic.core.form.available'|trans }}{{ (item.isPublished ? 'mautic.core.form.yes' : 'mautic.core.form.no')|trans }}
{{ 'mautic.core.created'|trans }}{{ item.dateAdded ? dateToFull(item.dateAdded) : '' }}{% if item.createdByUser %} ({{ item.createdByUser }}){% endif %}
{{ 'mautic.core.modified'|trans }}{{ dateToFull(item.dateModified) }}{% if item.modifiedByUser %} ({{ item.modifiedByUser }}){% endif %}
{{ 'mautic.core.id'|trans }}{{ item.id }}
-
- - {# Description #} -
- {% if descriptionItems is empty %} -

{{ 'mautic.program.description_item.empty'|trans }}

- {% else %} - {# Harmonized columns: Pictogram (no label), Type, Description. Description items have no - name of their own, so the Name column is left out here. Filter + click-to-sort (program.js). #} - {{ include('@Program/Initiative/_tab_table_filter.html.twig') }} -
- - - - - - - - - - {% for descriptionItem in descriptionItems %} - {% set typeName = program_item_type_name('description', descriptionItem.type) %} - {% set typeDescription = program_item_type_description('description', descriptionItem.type) %} - {% set typeIcon = program_item_type_icon('description', descriptionItem.type) %} - - - - - - {% endfor %} - -
{{ 'mautic.program.description_item.field.type'|trans }}{{ 'mautic.program.description_item.field.description'|trans }}
- {% if typeIcon %}{% endif %} - - {{ typeName ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': descriptionItem.type}) }} - - {{ include('@Program/Initiative/_description_read_more.html.twig', { - 'text': descriptionItem.description, - 'id': 'initiative-desc-item-' ~ descriptionItem.id, - }) }} -
-
- {% endif %} -
- - {# Objectives #} -
- {% if objectives is empty %} -

{{ 'mautic.program.objective.empty'|trans }}

- {% else %} -

- {{ 'mautic.program.objective.progress'|trans({'%achieved%': achievedCount, '%total%': objectives|length}) }} -

- {# Harmonized columns: Pictogram (no label), Type, Name (title), Description, Priority, - Status (achieved). Filter + click-to-sort (program.js). #} - {{ include('@Program/Initiative/_tab_table_filter.html.twig') }} -
- - - - - - - - - - - - - {% for objective in objectives %} - {% set typeName = program_item_type_name('objective', objective.type) %} - {% set typeDescription = program_item_type_description('objective', objective.type) %} - {% set typeIcon = program_item_type_icon('objective', objective.type) %} - - - - - - - - - {% endfor %} - -
{{ 'mautic.program.objective.field.type'|trans }}{{ 'mautic.program.objective.field.name'|trans }}{{ 'mautic.program.objective.field.description'|trans }}{{ 'mautic.program.objective.field.priority'|trans }}{{ 'mautic.program.objective.field.is_achieved'|trans }}
- {% if typeIcon %}{% endif %} - - {{ typeName ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': objective.type}) }} - {{ objective.title }}{{ objective.description|program_linkify }}{{ objective.priority ?? '—' }} - {% if objective.achieved %} - {{ 'mautic.program.objective.achieved'|trans }} - {% else %} - {{ 'mautic.program.objective.not_achieved'|trans }} - {% endif %} -
-
- {% endif %} -
- - {# Allocation: the initiative's budget, then the allocation items (cost lines) with their totals. #} -
- - - - - - - -
{{ 'mautic.program.field.budget_planned'|trans }} - {% if item.budgetPlanned is not null %} - {{ program_money(item.budgetPlanned) }} {{ program_currency() }} - {% else %} - {{ 'mautic.program.value.none'|trans }} - {% endif %} -
- -

{{ 'mautic.program.field.allocation_items'|trans }}

- {% if allocationItems is empty %} -

{{ 'mautic.program.allocation_item.empty'|trans }}

- {% else %} - {# Harmonized columns: Pictogram (no label), Type, Name, Description, then the costs. - Filter + click-to-sort (program.js). #} - {{ include('@Program/Initiative/_tab_table_filter.html.twig') }} -
- - - - - - - - - - - - - {% for allocationItem in allocationItems %} - {% set typeName = program_item_type_name('allocation', allocationItem.type) %} - {% set typeDescription = program_item_type_description('allocation', allocationItem.type) %} - {% set typeIcon = program_item_type_icon('allocation', allocationItem.type) %} - - - - - - - - - {% endfor %} - - - - - - - - -
{{ 'mautic.program.allocation_item.field.type'|trans }}{{ 'mautic.program.allocation_item.field.name'|trans }}{{ 'mautic.program.allocation_item.field.description'|trans }}{{ 'mautic.program.allocation_item.field.planned_cost'|trans }}{{ 'mautic.program.allocation_item.field.real_cost'|trans }}
- {% if typeIcon %}{% endif %} - - {{ typeName ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': allocationItem.type}) }} - {{ allocationItem.name }}{{ allocationItem.description|program_linkify }} - {% if allocationItem.plannedCost is not null %}{{ program_money(allocationItem.plannedCost) }} {{ program_currency() }}{% endif %} - - {% if allocationItem.realCost is not null %}{{ program_money(allocationItem.realCost) }} {{ program_currency() }}{% endif %} -
{{ 'mautic.program.allocation.total'|trans }} - {% if allocationTotals.planned is not null %}{{ program_money(allocationTotals.planned) }} {{ program_currency() }}{% endif %} - - {% if allocationTotals.real is not null %}{{ program_money(allocationTotals.real) }} {{ program_currency() }}{% endif %} -
-
- {% endif %} -
- - {# Stakeholders: the initiative's links to the global directory, harmonized like the other tabs. #} -
- {% set stakeholders = item.stakeholders %} - {% if stakeholders is empty %} -

{{ 'mautic.program.stakeholder.empty'|trans }}

- {% else %} - {# Harmonized columns: Pictogram (no label), Type, Name, then the link's own fields. - Filter + click-to-sort (program.js). #} - {{ include('@Program/Initiative/_tab_table_filter.html.twig') }} -
- - - - - - - - - - - - - - - {% for link in stakeholders %} - {% set stakeholder = link.stakeholder %} - - - - - - - - - - - {% endfor %} - -
{{ 'mautic.program.stakeholder.field.type'|trans }}{{ 'mautic.program.stakeholder.field.name'|trans }}{{ 'mautic.program.stakeholder.field.role_in_initiative'|trans }}{{ 'mautic.program.stakeholder.field.role'|trans }}{{ 'mautic.program.stakeholder.field.phone'|trans }}{{ 'mautic.program.stakeholder.field.active'|trans }}
- {% set typeIcon = program_item_type_icon('stakeholder', stakeholder.type) %} - {% if typeIcon %}{% endif %} - - {{ program_item_type_name('stakeholder', stakeholder.type) ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': stakeholder.type}) }} - - {{ stakeholder.name }} - {{ link.roleInInitiative }}{{ stakeholder.role }} - {% if stakeholder.phone %}{{ stakeholder.phone }}{% endif %} - - - {{ (stakeholder.isPublished ? 'mautic.program.stakeholder.active' : 'mautic.program.stakeholder.inactive')|trans }} - -
-
- {% endif %} -
- - {# Audiences: the initiative's links to the global directory (Programs > Audiences), harmonized like - the other tabs: pictogram, Type, Name (link to the audience's page), priority in this plan, - then the audience's own attributes. Filter + click-to-sort (program.js). #} -
- {% set audiences = item.audiences %} - {% if audiences is empty %} -

{{ 'mautic.program.audience.empty'|trans }}

- {% else %} - {{ include('@Program/Initiative/_tab_table_filter.html.twig') }} -
- - - - - - - - - - - - - - - {% for link in audiences %} - {% set audience = link.audience %} - - - - - - - - - - - {% endfor %} - -
{{ 'mautic.program.audience.field.type'|trans }}{{ 'mautic.program.audience.field.name'|trans }}{{ 'mautic.program.audience.field.priority'|trans }}{{ 'mautic.program.audience.field.stages'|trans }}{{ 'mautic.program.audience.field.estimated_size'|trans }}{{ 'mautic.program.audience.field.value_proposition'|trans }}{{ 'mautic.program.audience.field.preferred_channels'|trans }}
- - {{ audience.audienceType.labelKey|trans }} - {{ audience.name }} - - {{ link.priority.labelKey|trans }} - - {{ audience.stages|map(stage => stage.name)|join(', ') }} - {{ audience.estimatedSize }}{{ link.valueProposition }} - {% for channel in audience.preferredChannels ?? [] %} - {{ program_audience_channel_label(channel)|trans }} - {% endfor %} -
-
- {% endif %} -
- - {# Tasks: same columns as Programs > Tasks, in tree order. #} -
- {{ include('@Program/Initiative/_task_table.html.twig', { - 'initiative': item, - 'taskTree': taskTree, - 'taskPermissions': taskPermissions, - }) }} -
-
-{% endblock %} diff --git a/Resources/views/ItemTypes/form.html.twig b/Resources/views/ItemTypes/form.html.twig index 60d4b0e..7ade449 100644 --- a/Resources/views/ItemTypes/form.html.twig +++ b/Resources/views/ItemTypes/form.html.twig @@ -1,8 +1,8 @@ {% extends '@MauticCore/Default/content.html.twig' %} -{% block mauticContent %}programItemTypes{% endblock %} +{% block mauticContent %}mt3sMpProgramItemTypes{% endblock %} -{% block headerTitle %}{{ 'mautic.program.item_type.header.index'|trans }}{% endblock %} +{% block headerTitle %}{{ 'mt3s.marketing_program.item_type.header.index'|trans }}{% endblock %} {# # The type lists of the plugin's items, formerly the type sections of Settings > Configuration > @@ -10,7 +10,7 @@ # items), allocations, objectives, tasks, stakeholders, then the values offered for an # audience's decision roles and tones. # - # Adding and removing types, and the pictogram preview, are handled by Assets/js/program.js + # Adding and removing types, and the pictogram preview, are handled by Assets/js/mt3s-mp-program.js # (delegated handlers on .program-config-types). #} @@ -23,7 +23,7 @@ {% set icon = type.children.icon.vars.value %}
- +
{{ form_row(type.children.icon) }}
@@ -31,9 +31,9 @@ - - - + + + @@ -57,7 +57,7 @@
{{ 'mautic.program.config.type.language'|trans }}{{ 'mautic.program.config.type.name'|trans }}{{ 'mautic.program.config.type.description'|trans }}{{ 'mt3s.marketing_program.config.type.language'|trans }}{{ 'mt3s.marketing_program.config.type.name'|trans }}{{ 'mt3s.marketing_program.config.type.description'|trans }}
@@ -71,7 +71,7 @@ {{ form_errors(types) }}

- {{ 'mautic.program.config.types.empty'|trans }} + {{ 'mt3s.marketing_program.config.types.empty'|trans }}

{% for type in types %} @@ -79,7 +79,7 @@ {% endfor %}
{% do types.setRendered %} @@ -91,41 +91,41 @@ {{ form_start(form) }} {# The root form's errors: the in-use guard adds its message here. #} {{ form_errors(form) }} -
{{ 'mautic.program.item_type.page.description'|trans }}
+
{{ 'mt3s.marketing_program.item_type.page.description'|trans }}
{% if not isWritable %} -
{{ 'mautic.program.item_type.not_writable'|trans }}
+
{{ 'mt3s.marketing_program.item_type.not_writable'|trans }}
{% endif %} - {{ cfg.type_section(form.children.program_description_item_types, - 'mautic.program.config.section.description_item_types', - 'mautic.program.config.section.description_item_types.help') }} + {{ cfg.type_section(form.children.mt3s_marketing_program_description_item_types, + 'mt3s.marketing_program.config.section.description_item_types', + 'mt3s.marketing_program.config.section.description_item_types.help') }} - {{ cfg.type_section(form.children.program_allocation_item_types, - 'mautic.program.config.section.allocation_item_types', - 'mautic.program.config.section.allocation_item_types.help') }} + {{ cfg.type_section(form.children.mt3s_marketing_program_allocation_item_types, + 'mt3s.marketing_program.config.section.allocation_item_types', + 'mt3s.marketing_program.config.section.allocation_item_types.help') }} - {{ cfg.type_section(form.children.program_objective_types, - 'mautic.program.config.section.objective_types', - 'mautic.program.config.section.objective_types.help') }} + {{ cfg.type_section(form.children.mt3s_marketing_program_objective_types, + 'mt3s.marketing_program.config.section.objective_types', + 'mt3s.marketing_program.config.section.objective_types.help') }} - {{ cfg.type_section(form.children.program_task_types, - 'mautic.program.config.section.task_types', - 'mautic.program.config.section.task_types.help') }} + {{ cfg.type_section(form.children.mt3s_marketing_program_task_types, + 'mt3s.marketing_program.config.section.task_types', + 'mt3s.marketing_program.config.section.task_types.help') }} - {{ cfg.type_section(form.children.program_stakeholder_types, - 'mautic.program.config.section.stakeholder_types', - 'mautic.program.config.section.stakeholder_types.help') }} + {{ cfg.type_section(form.children.mt3s_marketing_program_stakeholder_types, + 'mt3s.marketing_program.config.section.stakeholder_types', + 'mt3s.marketing_program.config.section.stakeholder_types.help') }} -

{{ 'mautic.program.config.section.audience_values'|trans }}

-

{{ 'mautic.program.config.section.audience_values.help'|trans }}

- {{ cfg.type_section(form.children.program_audience_decision_roles, - 'mautic.program.config.section.audience_decision_roles', - 'mautic.program.config.section.audience_decision_roles.help') }} +

{{ 'mt3s.marketing_program.config.section.audience_values'|trans }}

+

{{ 'mt3s.marketing_program.config.section.audience_values.help'|trans }}

+ {{ cfg.type_section(form.children.mt3s_marketing_program_audience_decision_roles, + 'mt3s.marketing_program.config.section.audience_decision_roles', + 'mt3s.marketing_program.config.section.audience_decision_roles.help') }} - {{ cfg.type_section(form.children.program_audience_tones, - 'mautic.program.config.section.audience_tones', - 'mautic.program.config.section.audience_tones.help') }} + {{ cfg.type_section(form.children.mt3s_marketing_program_audience_tones, + 'mt3s.marketing_program.config.section.audience_tones', + 'mt3s.marketing_program.config.section.audience_tones.help') }} {{ form_row(form.children.buttons) }} {# render_rest is false, so the hidden CSRF token must be rendered explicitly. #} diff --git a/Resources/views/Initiative/_description_read_more.html.twig b/Resources/views/Program/_description_read_more.html.twig similarity index 51% rename from Resources/views/Initiative/_description_read_more.html.twig rename to Resources/views/Program/_description_read_more.html.twig index 1970c4b..f74d9da 100644 --- a/Resources/views/Initiative/_description_read_more.html.twig +++ b/Resources/views/Program/_description_read_more.html.twig @@ -4,21 +4,21 @@ # display:-webkit-box); the button only toggles the class, so it also works without JS. # # Parameters: - # text: the text to show (may contain line breaks; URLs in it become links, see program_linkify) + # text: the text to show (may contain line breaks; URLs in it become links, see mt3s_marketing_program_linkify) # id: unique element id for this instance # lines: number of lines to clamp to (default 10) #} {% set lines = lines|default(10) %} {% if text|trim is not empty %} -
-
{{ text|program_linkify }}
-
{% endif %} diff --git a/Resources/views/Program/_tab_table_filter.html.twig b/Resources/views/Program/_tab_table_filter.html.twig new file mode 100644 index 0000000..d98c0d0 --- /dev/null +++ b/Resources/views/Program/_tab_table_filter.html.twig @@ -0,0 +1,11 @@ +{# + # The filter box of an program tab table (Description, Objectives, Allocation, Tasks) and the switch that + # shows the "no match" message. Filtering and sorting are handled by Assets/js/mt3s-mp-program.js + # (Mautic.mt3sMpProgramInitTabTable), on any table with the data-program-tab-table attribute. + #} +
+ + +
+

{{ 'mt3s.marketing_program.filter.no_match'|trans }}

diff --git a/Resources/views/Program/_tabs.html.twig b/Resources/views/Program/_tabs.html.twig new file mode 100644 index 0000000..895590f --- /dev/null +++ b/Resources/views/Program/_tabs.html.twig @@ -0,0 +1,32 @@ +{# + # Tab bar shared by the program form and the program detail page. + # + # Parameters: + # programId: the program's id (null for a new program) + # counts (optional): tab id => number shown next to the tab name + # + # The tab panes use the ids program-tab-. Assets/js/mt3s-mp-program.js reopens the tab last used for this plan + # (so Edit, Save and Cancel keep the same tab), and on the form marks the tabs whose pane contains a + # validation error and opens the first of them. + #} +{% set programTabs = { + 'details': 'mt3s.marketing_program.tab.details', + 'description': 'mt3s.marketing_program.tab.description', + 'objectives': 'mt3s.marketing_program.tab.objectives', + 'allocation': 'mt3s.marketing_program.tab.allocations', + 'audiences': 'mt3s.marketing_program.tab.audiences', + 'stakeholders': 'mt3s.marketing_program.tab.stakeholders', + 'tasks': 'mt3s.marketing_program.tab.tasks', +} %} + diff --git a/Resources/views/Program/_task_table.html.twig b/Resources/views/Program/_task_table.html.twig new file mode 100644 index 0000000..6feafeb --- /dev/null +++ b/Resources/views/Program/_task_table.html.twig @@ -0,0 +1,93 @@ +{# + # The program's tasks, for the Tasks tab of the program detail page and form. Same harmonized columns as the + # other tabs: Pictogram (no label), Type, Name, Description, Start date, End date, Status (last). No ID + # column. Rows are in tree order: each task is followed by its sub-tasks, indented under it. + # + # Parameters: + # program: the Program + # taskTree: rows from TaskModel::getTaskTree(): {task, depth}, in display order + # readOnly: true on the program form: no links, no filter, so that following one can't drop unsaved changes + # taskPermissions: mt3smarketingprogram:tasks:* permissions (create, editown, editother), when not read-only + # + # Links carry returnTo=program, so that Save and Cancel on the task form come back to this program page + # (see TaskController). Opened from Programs > Tasks, the task form goes back to the task list. + #} +{% set readOnly = readOnly|default(false) %} +{% set taskPermissions = taskPermissions|default({}) %} +{% set canCreate = not readOnly and program.id and taskPermissions['mt3smarketingprogram:tasks:create']|default(false) %} + +{% if canCreate %} + +{% endif %} + +{% if not program.id %} +

{{ 'mt3s.marketing_program.task.save_program_first'|trans }}

+{% elseif taskTree is empty %} +

{{ 'mt3s.marketing_program.task.empty'|trans }}

+{% else %} + {% if not readOnly %} + {# Filter + click-to-sort on the detail page (mt3s-mp-program.js). The form's read-only copy stays plain. #} + {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }} + {% endif %} +
+ + + + + + + + + + + + + + {% for row in taskTree %} + {% set task = row.task %} + {% set canEdit = not readOnly and securityHasEntityAccess(taskPermissions['mt3smarketingprogram:tasks:editown']|default(false), taskPermissions['mt3smarketingprogram:tasks:editother']|default(false), task.createdBy) %} + + + + + + + + + + {% endfor %} + +
{{ 'mt3s.marketing_program.task.field.type'|trans }}{{ 'mt3s.marketing_program.task.field.name'|trans }}{{ 'mt3s.marketing_program.task.field.description'|trans }}{{ 'mt3s.marketing_program.task.field.start_date'|trans }}{{ 'mt3s.marketing_program.task.field.end_date'|trans }}{{ 'mt3s.marketing_program.task.field.status'|trans }}
+ {% set taskTypeIcon = mt3s_marketing_program_item_type_icon('task', task.type) %} + {% if taskTypeIcon %}{% endif %} + + {{ mt3s_marketing_program_item_type_name('task', task.type) ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': task.type}) }} + + {% if canEdit %} + {{ task.name }} + {% else %} + {{ task.name }} + {% endif %} + {% if task.taskKind == constant('MauticPlugin\\MT3SMarketingProgramBundle\\Entity\\TaskKind::Milestone') %} + {{ 'mt3s.marketing_program.task.kind.milestone_short'|trans }} + {% elseif task.taskKind == constant('MauticPlugin\\MT3SMarketingProgramBundle\\Entity\\TaskKind::Phase') %} + {{ 'mt3s.marketing_program.task.kind.phase_short'|trans }} + {% endif %} + + {# Same 10-line clamp and read-more as the Description tab; URLs become links. #} + {{ include('@MT3SMarketingProgram/Program/_description_read_more.html.twig', { + 'text': task.description|default('')|striptags, + 'id': 'program-task-desc-' ~ task.id, + }) }} + {{ task.startDate ? task.startDate|date('Y-m-d') : '' }}{{ task.endDate ? task.endDate|date('Y-m-d') : '' }} + {# A phase has no status of its own — skip the column value. #} + {% if task.taskKind != constant('MauticPlugin\\MT3SMarketingProgramBundle\\Entity\\TaskKind::Phase') %} + {{ task.status.labelKey|trans }} + {% endif %} +
+
+{% endif %} diff --git a/Resources/views/Program/details.html.twig b/Resources/views/Program/details.html.twig new file mode 100644 index 0000000..fd7b033 --- /dev/null +++ b/Resources/views/Program/details.html.twig @@ -0,0 +1,449 @@ +{% extends '@MauticCore/Default/content.html.twig' %} + +{% block mauticContent %}program{% endblock %} + +{# + # No routeBase on the page_actions includes: core would turn it into mautic_mt3s_marketing_program_* route names. + # The buttons use actionRoute (mt3s_marketing_program_action) from the controller, and the close button gets its URL here. + #} +{% block preHeader %} + {{- include('@MauticCore/Helper/page_actions.html.twig', { + 'item': item, + 'templateButtons': { + 'close': true, + }, + 'closeUrl': path('mt3s_marketing_program_index'), + 'targetLabel': 'mt3s.marketing_program.header.index'|trans, + }) -}} + {# Core's helper renders an empty pill when there is no category. #} + {% if item.category %} + {{ include('@MauticCore/Modules/category--inline.html.twig', {'category': item.category}) }} + {% endif %} +{% endblock %} + +{% block headerTitle %}{{ item.name }}{% endblock %} + +{# + # Under the title, as on an email's page: the plan status, then the total planned and real costs of the + # allocation items, in the general currency. A real total above the planned total is red, otherwise green. + #} +{% block publishStatus %} + {% set statusColors = { + 'draft': 'warm-gray', 'planned': 'blue', 'active': 'green', + 'paused': 'warning', 'completed': 'teal', 'archived': 'cool-gray', + } %} + {% include '@MauticCore/Helper/_tag.html.twig' with { tags: [{ + color: statusColors[item.status.value]|default('gray'), + label: item.status.labelKey, + icon: 'ri-flag-line', + attributes: {'class': 'program-status-tag'}, + }] } %} + + {% set totals = item.allocationTotals %} + {% if totals.planned is not null or totals.real is not null %} +
+ {% set totalTags = [] %} + {% if totals.planned is not null %} + {% set totalTags = totalTags|merge([{ + color: 'high-contrast', + icon: 'ri-wallet-3-line', + label: 'mt3s.marketing_program.header.total_planned'|trans({'%amount%': mt3s_marketing_program_money(totals.planned), '%currency%': mt3s_marketing_program_currency()}), + attributes: {'class': 'program-total-planned', 'title': 'mt3s.marketing_program.header.total_planned.tooltip'|trans, 'data-toggle': 'tooltip'}, + }]) %} + {% endif %} + {% if totals.real is not null %} + {% set overPlan = totals.planned is not null and (totals.real + 0) > (totals.planned + 0) %} + {% set totalTags = totalTags|merge([{ + color: overPlan ? 'red' : 'green', + icon: overPlan ? 'ri-error-warning-line' : 'ri-checkbox-circle-line', + label: 'mt3s.marketing_program.header.total_real'|trans({'%amount%': mt3s_marketing_program_money(totals.real), '%currency%': mt3s_marketing_program_currency()}), + attributes: {'class': 'program-total-real', 'title': (overPlan ? 'mt3s.marketing_program.header.total_real.over' : 'mt3s.marketing_program.header.total_real.tooltip')|trans, 'data-toggle': 'tooltip'}, + }]) %} + {% endif %} + {% include '@MauticCore/Helper/_tag.html.twig' with { tags: totalTags } %} + {% endif %} +{% endblock %} + +{% block actions %} + {{- include('@MauticCore/Helper/page_actions.html.twig', { + 'item': item, + 'templateButtons': { + 'edit': securityHasEntityAccess(permissions['mt3smarketingprogram:programs:editown'], permissions['mt3smarketingprogram:programs:editother'], item.createdBy), + 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:programs:deleteown'], permissions['mt3smarketingprogram:programs:deleteother'], item.createdBy), + }, + 'langVar': 'program', + }) -}} +{% endblock %} + +{% block content %} + {% set objectives = item.objectives %} + {% set achievedCount = objectives|filter(o => o.achieved)|length %} + {% set descriptionItems = item.descriptionItems %} + {% set allocationItems = item.allocationItems %} + {% set allocationTotals = item.allocationTotals %} + + {{ include('@MT3SMarketingProgram/Program/_tabs.html.twig', {'programId': item.id, 'counts': { + 'description': descriptionItems|length, + 'objectives': objectives|length, + 'allocation': allocationItems|length, + 'audiences': item.audiences|length, + 'stakeholders': item.stakeholders|length, + 'tasks': taskTree|length, + }}) }} + +
+ {# Details #} +
+ + + + + + + {% if item.completedAt %} + + + + + {% endif %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% if item.dateModified %} + + + + + {% endif %} + + + + + +
{{ 'mt3s.marketing_program.field.status'|trans }}{{ item.status.labelKey|trans }}
{{ 'mt3s.marketing_program.field.completed_at'|trans }}{{ dateToFull(item.completedAt) }}
{{ 'mt3s.marketing_program.field.version'|trans }}{{ item.version }}
{{ 'mt3s.marketing_program.field.owner'|trans }}{{ item.owner ? item.owner.name : 'mt3s.marketing_program.owner.none'|trans }}
{{ 'mt3s.marketing_program.field.start_date'|trans }}{{ item.startDate ? dateToFull(item.startDate) : 'mt3s.marketing_program.value.none'|trans }}
{{ 'mt3s.marketing_program.field.end_date'|trans }}{{ item.endDate ? dateToFull(item.endDate) : 'mt3s.marketing_program.value.none'|trans }}
{{ 'mautic.core.category'|trans }}{{ item.category ? item.category.title : 'mt3s.marketing_program.value.none'|trans }}
{{ 'mautic.core.form.available'|trans }}{{ (item.isPublished ? 'mautic.core.form.yes' : 'mautic.core.form.no')|trans }}
{{ 'mautic.core.created'|trans }}{{ item.dateAdded ? dateToFull(item.dateAdded) : '' }}{% if item.createdByUser %} ({{ item.createdByUser }}){% endif %}
{{ 'mautic.core.modified'|trans }}{{ dateToFull(item.dateModified) }}{% if item.modifiedByUser %} ({{ item.modifiedByUser }}){% endif %}
{{ 'mautic.core.id'|trans }}{{ item.id }}
+
+ + {# Description #} +
+ {% if descriptionItems is empty %} +

{{ 'mt3s.marketing_program.description_item.empty'|trans }}

+ {% else %} + {# Harmonized columns: Pictogram (no label), Type, Description. Description items have no + name of their own, so the Name column is left out here. Filter + click-to-sort (mt3s-mp-program.js). #} + {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }} +
+ + + + + + + + + + {% for descriptionItem in descriptionItems %} + {% set typeName = mt3s_marketing_program_item_type_name('description', descriptionItem.type) %} + {% set typeDescription = mt3s_marketing_program_item_type_description('description', descriptionItem.type) %} + {% set typeIcon = mt3s_marketing_program_item_type_icon('description', descriptionItem.type) %} + + + + + + {% endfor %} + +
{{ 'mt3s.marketing_program.description_item.field.type'|trans }}{{ 'mt3s.marketing_program.description_item.field.description'|trans }}
+ {% if typeIcon %}{% endif %} + + {{ typeName ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': descriptionItem.type}) }} + + {{ include('@MT3SMarketingProgram/Program/_description_read_more.html.twig', { + 'text': descriptionItem.description, + 'id': 'program-desc-item-' ~ descriptionItem.id, + }) }} +
+
+ {% endif %} +
+ + {# Objectives #} +
+ {% if objectives is empty %} +

{{ 'mt3s.marketing_program.objective.empty'|trans }}

+ {% else %} +

+ {{ 'mt3s.marketing_program.objective.progress'|trans({'%achieved%': achievedCount, '%total%': objectives|length}) }} +

+ {# Harmonized columns: Pictogram (no label), Type, Name (title), Description, Priority, + Status (achieved). Filter + click-to-sort (mt3s-mp-program.js). #} + {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }} +
+ + + + + + + + + + + + + {% for objective in objectives %} + {% set typeName = mt3s_marketing_program_item_type_name('objective', objective.type) %} + {% set typeDescription = mt3s_marketing_program_item_type_description('objective', objective.type) %} + {% set typeIcon = mt3s_marketing_program_item_type_icon('objective', objective.type) %} + + + + + + + + + {% endfor %} + +
{{ 'mt3s.marketing_program.objective.field.type'|trans }}{{ 'mt3s.marketing_program.objective.field.name'|trans }}{{ 'mt3s.marketing_program.objective.field.description'|trans }}{{ 'mt3s.marketing_program.objective.field.priority'|trans }}{{ 'mt3s.marketing_program.objective.field.is_achieved'|trans }}
+ {% if typeIcon %}{% endif %} + + {{ typeName ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': objective.type}) }} + {{ objective.title }}{{ objective.description|mt3s_marketing_program_linkify }}{{ objective.priority ?? '—' }} + {% if objective.achieved %} + {{ 'mt3s.marketing_program.objective.achieved'|trans }} + {% else %} + {{ 'mt3s.marketing_program.objective.not_achieved'|trans }} + {% endif %} +
+
+ {% endif %} +
+ + {# Allocation: the program's budget, then the allocation items (cost lines) with their totals. #} +
+ + + + + + + +
{{ 'mt3s.marketing_program.field.budget_planned'|trans }} + {% if item.budgetPlanned is not null %} + {{ mt3s_marketing_program_money(item.budgetPlanned) }} {{ mt3s_marketing_program_currency() }} + {% else %} + {{ 'mt3s.marketing_program.value.none'|trans }} + {% endif %} +
+ +

{{ 'mt3s.marketing_program.field.allocation_items'|trans }}

+ {% if allocationItems is empty %} +

{{ 'mt3s.marketing_program.allocation_item.empty'|trans }}

+ {% else %} + {# Harmonized columns: Pictogram (no label), Type, Name, Description, then the costs. + Filter + click-to-sort (mt3s-mp-program.js). #} + {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }} +
+ + + + + + + + + + + + + {% for allocationItem in allocationItems %} + {% set typeName = mt3s_marketing_program_item_type_name('allocation', allocationItem.type) %} + {% set typeDescription = mt3s_marketing_program_item_type_description('allocation', allocationItem.type) %} + {% set typeIcon = mt3s_marketing_program_item_type_icon('allocation', allocationItem.type) %} + + + + + + + + + {% endfor %} + + + + + + + + +
{{ 'mt3s.marketing_program.allocation_item.field.type'|trans }}{{ 'mt3s.marketing_program.allocation_item.field.name'|trans }}{{ 'mt3s.marketing_program.allocation_item.field.description'|trans }}{{ 'mt3s.marketing_program.allocation_item.field.planned_cost'|trans }}{{ 'mt3s.marketing_program.allocation_item.field.real_cost'|trans }}
+ {% if typeIcon %}{% endif %} + + {{ typeName ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': allocationItem.type}) }} + {{ allocationItem.name }}{{ allocationItem.description|mt3s_marketing_program_linkify }} + {% if allocationItem.plannedCost is not null %}{{ mt3s_marketing_program_money(allocationItem.plannedCost) }} {{ mt3s_marketing_program_currency() }}{% endif %} + + {% if allocationItem.realCost is not null %}{{ mt3s_marketing_program_money(allocationItem.realCost) }} {{ mt3s_marketing_program_currency() }}{% endif %} +
{{ 'mt3s.marketing_program.allocation.total'|trans }} + {% if allocationTotals.planned is not null %}{{ mt3s_marketing_program_money(allocationTotals.planned) }} {{ mt3s_marketing_program_currency() }}{% endif %} + + {% if allocationTotals.real is not null %}{{ mt3s_marketing_program_money(allocationTotals.real) }} {{ mt3s_marketing_program_currency() }}{% endif %} +
+
+ {% endif %} +
+ + {# Stakeholders: the program's links to the global directory, harmonized like the other tabs. #} +
+ {% set stakeholders = item.stakeholders %} + {% if stakeholders is empty %} +

{{ 'mt3s.marketing_program.stakeholder.empty'|trans }}

+ {% else %} + {# Harmonized columns: Pictogram (no label), Type, Name, then the link's own fields. + Filter + click-to-sort (mt3s-mp-program.js). #} + {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }} +
+ + + + + + + + + + + + + + + {% for link in stakeholders %} + {% set stakeholder = link.stakeholder %} + + + + + + + + + + + {% endfor %} + +
{{ 'mt3s.marketing_program.stakeholder.field.type'|trans }}{{ 'mt3s.marketing_program.stakeholder.field.name'|trans }}{{ 'mt3s.marketing_program.stakeholder.field.role_in_program'|trans }}{{ 'mt3s.marketing_program.stakeholder.field.role'|trans }}{{ 'mt3s.marketing_program.stakeholder.field.phone'|trans }}{{ 'mt3s.marketing_program.stakeholder.field.active'|trans }}
+ {% set typeIcon = mt3s_marketing_program_item_type_icon('stakeholder', stakeholder.type) %} + {% if typeIcon %}{% endif %} + + {{ mt3s_marketing_program_item_type_name('stakeholder', stakeholder.type) ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': stakeholder.type}) }} + + {{ stakeholder.name }} + {{ link.roleInProgram }}{{ stakeholder.role }} + {% if stakeholder.phone %}{{ stakeholder.phone }}{% endif %} + + + {{ (stakeholder.isPublished ? 'mt3s.marketing_program.stakeholder.active' : 'mt3s.marketing_program.stakeholder.inactive')|trans }} + +
+
+ {% endif %} +
+ + {# Audiences: the program's links to the global directory (Programs > Audiences), harmonized like + the other tabs: pictogram, Type, Name (link to the audience's page), priority in this plan, + then the audience's own attributes. Filter + click-to-sort (mt3s-mp-program.js). #} +
+ {% set audiences = item.audiences %} + {% if audiences is empty %} +

{{ 'mt3s.marketing_program.audience.empty'|trans }}

+ {% else %} + {{ include('@MT3SMarketingProgram/Program/_tab_table_filter.html.twig') }} +
+ + + + + + + + + + + + + + + {% for link in audiences %} + {% set audience = link.audience %} + + + + + + + + + + + {% endfor %} + +
{{ 'mt3s.marketing_program.audience.field.type'|trans }}{{ 'mt3s.marketing_program.audience.field.name'|trans }}{{ 'mt3s.marketing_program.audience.field.priority'|trans }}{{ 'mt3s.marketing_program.audience.field.stages'|trans }}{{ 'mt3s.marketing_program.audience.field.estimated_size'|trans }}{{ 'mt3s.marketing_program.audience.field.value_proposition'|trans }}{{ 'mt3s.marketing_program.audience.field.preferred_channels'|trans }}
+ + {{ audience.audienceType.labelKey|trans }} + {{ audience.name }} + + {{ link.priority.labelKey|trans }} + + {{ audience.stages|map(stage => stage.name)|join(', ') }} + {{ audience.estimatedSize }}{{ link.valueProposition }} + {% for channel in audience.preferredChannels ?? [] %} + {{ mt3s_marketing_program_audience_channel_label(channel)|trans }} + {% endfor %} +
+
+ {% endif %} +
+ + {# Tasks: same columns as Programs > Tasks, in tree order. #} +
+ {{ include('@MT3SMarketingProgram/Program/_task_table.html.twig', { + 'program': item, + 'taskTree': taskTree, + 'taskPermissions': taskPermissions, + }) }} +
+
+{% endblock %} diff --git a/Resources/views/Initiative/form.html.twig b/Resources/views/Program/form.html.twig similarity index 54% rename from Resources/views/Initiative/form.html.twig rename to Resources/views/Program/form.html.twig index 02d3b51..8c7e569 100644 --- a/Resources/views/Initiative/form.html.twig +++ b/Resources/views/Program/form.html.twig @@ -4,22 +4,22 @@ {% block headerTitle %} {% if entity.id %} - {{ 'mautic.program.header.edit'|trans({'%name%': entity.name}) }} + {{ 'mt3s.marketing_program.header.edit'|trans({'%name%': entity.name}) }} {% else %} - {{ 'mautic.program.header.new'|trans }} + {{ 'mt3s.marketing_program.header.new'|trans }} {% endif %} {% endblock %} {# # Editable, sortable rows (objectives, description items). Each macro renders one row, for existing # rows and, through data-prototype, for new ones. Adding, removing and reordering rows is handled by - # Assets/js/program.js, through the initiative-collection-* classes. + # Assets/js/mt3s-mp-program.js, through the program-collection-* classes. #} {% macro row_start(dragLabel) %} -
  • +
  • - +
    @@ -29,7 +29,7 @@ {% macro row_end(removeLabel) %}
    -
    @@ -38,16 +38,16 @@ {% endmacro %} {% macro objective_row(objective) %} - {{ _self.row_start('mautic.program.objective.drag') }} + {{ _self.row_start('mt3s.marketing_program.objective.drag') }}
    - {# The selected type's pictogram; updated by program.js when the type changes. #} + {# The selected type's pictogram; updated by mt3s-mp-program.js when the type changes. #}
    - +
    {{ form_row(objective.type) }} - {# Filled with the selected type's description by program.js. #} -

    {{ program_item_type_description('objective', objective.type.vars.value) }}

    + {# Filled with the selected type's description by mt3s-mp-program.js. #} +

    {{ mt3s_marketing_program_item_type_description('objective', objective.type.vars.value) }}

    {{ form_row(objective.title) }} @@ -57,59 +57,59 @@ {{ form_row(objective.description) }} {{ form_widget(objective.position) }} - {{ _self.row_end('mautic.program.objective.remove') }} + {{ _self.row_end('mt3s.marketing_program.objective.remove') }} {% endmacro %} {% macro description_item_row(item) %} - {{ _self.row_start('mautic.program.description_item.drag') }} + {{ _self.row_start('mt3s.marketing_program.description_item.drag') }}
    - {# The selected type's pictogram; updated by program.js when the type changes. #} + {# The selected type's pictogram; updated by mt3s-mp-program.js when the type changes. #}
    - +
    {{ form_row(item.type) }} - {# Filled with the selected type's description by program.js. #} -

    {{ program_item_type_description('description', item.type.vars.value) }}

    + {# Filled with the selected type's description by mt3s-mp-program.js. #} +

    {{ mt3s_marketing_program_item_type_description('description', item.type.vars.value) }}

    {{ form_row(item.description) }} {{ form_widget(item.position) }} - {{ _self.row_end('mautic.program.description_item.remove') }} + {{ _self.row_end('mt3s.marketing_program.description_item.remove') }} {% endmacro %} {% macro stakeholder_row(link) %} - {{ _self.row_start('mautic.program.stakeholder.drag') }} + {{ _self.row_start('mt3s.marketing_program.stakeholder.drag') }}
    {{ form_row(link.stakeholder) }}
    -
    {{ form_row(link.roleInInitiative) }}
    +
    {{ form_row(link.roleInProgram) }}
    {{ form_widget(link.position) }} - {{ _self.row_end('mautic.program.stakeholder.remove') }} + {{ _self.row_end('mt3s.marketing_program.stakeholder.remove') }} {% endmacro %} {% macro audience_row(audience) %} - {{ _self.row_start('mautic.program.audience.drag') }} + {{ _self.row_start('mt3s.marketing_program.audience.drag') }} {{ form_row(audience.audience) }} {{ form_row(audience.priority) }} {{ form_row(audience.valueProposition) }} {{ form_widget(audience.position) }} - {{ _self.row_end('mautic.program.audience.remove') }} + {{ _self.row_end('mt3s.marketing_program.audience.remove') }} {% endmacro %} {% macro allocation_item_row(item) %} - {{ _self.row_start('mautic.program.allocation_item.drag') }} + {{ _self.row_start('mt3s.marketing_program.allocation_item.drag') }}
    - {# The selected type's pictogram; updated by program.js when the type changes. #} + {# The selected type's pictogram; updated by mt3s-mp-program.js when the type changes. #}
    - +
    {{ form_row(item.type) }} - {# Filled with the selected type's description by program.js. #} -

    {{ program_item_type_description('allocation', item.type.vars.value) }}

    + {# Filled with the selected type's description by mt3s-mp-program.js. #} +

    {{ mt3s_marketing_program_item_type_description('allocation', item.type.vars.value) }}

    {{ form_row(item.name) }}
    @@ -121,7 +121,7 @@
    {{ form_row(item.realCost) }}
    {{ form_widget(item.position) }} - {{ _self.row_end('mautic.program.allocation_item.remove') }} + {{ _self.row_end('mt3s.marketing_program.allocation_item.remove') }} {% endmacro %} {% block content %} @@ -130,11 +130,11 @@ {{ form_row(form.name) }}
    - {{ include('@Program/Initiative/_tabs.html.twig', {'initiativeId': entity.id}) }} + {{ include('@MT3SMarketingProgram/Program/_tabs.html.twig', {'programId': entity.id}) }}
    {# Details #} -
    +
    {{ form_row(form.status) }}
    {{ form_row(form.version) }}
    @@ -142,7 +142,7 @@
    {% if entity.completedAt %}
    - +

    {{ dateToFull(entity.completedAt) }}

    {% endif %} @@ -157,26 +157,26 @@
    {# Description: description items. #} -
    +
    {% set hasTypes = form.descriptionItems.vars.prototype.type.vars.choices is not empty %} -
    {{ form_errors(form.descriptionItems) }} {% if not hasTypes %} -
    {{ 'mautic.program.description_item.no_types'|trans }}
    +
    {{ 'mt3s.marketing_program.description_item.no_types'|trans }}
    {% endif %} -

    - {{ 'mautic.program.description_item.empty'|trans }} +

    + {{ 'mt3s.marketing_program.description_item.empty'|trans }}

    -
      +
        {% for item in form.descriptionItems %} {{ _self.description_item_row(item) }} {% endfor %}
      {% if hasTypes %} - {% endif %}
    @@ -184,58 +184,58 @@
    {# Objectives #} -
    +
    {% set hasObjectiveTypes = form.objectives.vars.prototype.type.vars.choices is not empty %} -
    {{ form_errors(form.objectives) }} {% if not hasObjectiveTypes %} -
    {{ 'mautic.program.objective.no_types'|trans }}
    +
    {{ 'mt3s.marketing_program.objective.no_types'|trans }}
    {% endif %} -

    - {{ 'mautic.program.objective.empty'|trans }} +

    + {{ 'mt3s.marketing_program.objective.empty'|trans }}

    -
      +
        {% for objective in form.objectives %} {{ _self.objective_row(objective) }} {% endfor %}
      {% if hasObjectiveTypes %} - {% endif %}
    {% do form.objectives.setRendered %}
    - {# Allocation: the initiative's budget, then the allocation items (cost lines). #} -
    + {# Allocation: the program's budget, then the allocation items (cost lines). #} +
    {{ form_row(form.budgetPlanned) }}
    {% set hasAllocationTypes = form.allocationItems.vars.prototype.type.vars.choices is not empty %} -
    -

    {{ 'mautic.program.field.allocation_items'|trans }}

    +

    {{ 'mt3s.marketing_program.field.allocation_items'|trans }}

    {{ form_errors(form.allocationItems) }} {% if not hasAllocationTypes %} -
    {{ 'mautic.program.allocation_item.no_types'|trans }}
    +
    {{ 'mt3s.marketing_program.allocation_item.no_types'|trans }}
    {% endif %} -

    - {{ 'mautic.program.allocation_item.empty'|trans }} +

    + {{ 'mt3s.marketing_program.allocation_item.empty'|trans }}

    -
      +
        {% for item in form.allocationItems %} {{ _self.allocation_item_row(item) }} {% endfor %}
      {% if hasAllocationTypes %} - {% endif %}
    @@ -243,55 +243,55 @@
    {# Stakeholders: links to the global directory (Programs > Stakeholders). #} -
    -
    +
    {{ form_errors(form.stakeholders) }} -

    - {{ 'mautic.program.stakeholder.empty'|trans }} +

    + {{ 'mt3s.marketing_program.stakeholder.empty'|trans }}

    -
      +
        {% for link in form.stakeholders %} {{ _self.stakeholder_row(link) }} {% endfor %}
      -
    {% do form.stakeholders.setRendered %}
    - {# Audiences: the initiative's links to the global directory (Programs > Audiences). #} -
    -

    {{ 'mautic.program.audience.link_tab.help'|trans }}

    -
    Audiences). #} +
    +

    {{ 'mt3s.marketing_program.audience.link_tab.help'|trans }}

    +
    {{ form_errors(form.audiences) }} -

    - {{ 'mautic.program.audience.empty'|trans }} +

    + {{ 'mt3s.marketing_program.audience.empty'|trans }}

    -
      +
        {% for audience in form.audiences %} {{ _self.audience_row(audience) }} {% endfor %}
      -
    {% do form.audiences.setRendered %}
    {# Tasks: read-only here, so that following a link doesn't drop unsaved changes to the plan. #} -
    +
    {% if entity.id %} -

    {{ 'mautic.program.task.manage_from_initiative_page'|trans }}

    +

    {{ 'mt3s.marketing_program.task.manage_from_program_page'|trans }}

    {% endif %} - {{ include('@Program/Initiative/_task_table.html.twig', { - 'initiative': entity, + {{ include('@MT3SMarketingProgram/Program/_task_table.html.twig', { + 'program': entity, 'taskTree': taskTree|default([]), 'readOnly': true, }) }} diff --git a/Resources/views/Initiative/list.html.twig b/Resources/views/Program/list.html.twig similarity index 66% rename from Resources/views/Initiative/list.html.twig rename to Resources/views/Program/list.html.twig index 236b6fa..ec411b4 100644 --- a/Resources/views/Initiative/list.html.twig +++ b/Resources/views/Program/list.html.twig @@ -4,7 +4,7 @@ {% block mauticContent %}program{% endblock %} -{% block headerTitle %}{{ 'mautic.program.header.index'|trans }}{% endblock %} +{% block headerTitle %}{{ 'mt3s.marketing_program.header.index'|trans }}{% endblock %} {% block content %}
    @@ -13,95 +13,95 @@ 'action': currentRoute, 'page_actions': { 'templateButtons': { - 'new': permissions['program:initiatives:create'], + 'new': permissions['mt3smarketingprogram:programs:create'], }, - 'routeBase': 'initiative', - 'langVar': 'initiative', + 'routeBase': 'program', + 'langVar': 'program', }, 'bulk_actions': { - 'langVar': 'initiative', - 'routeBase': 'initiative', + 'langVar': 'program', + 'routeBase': 'program', 'templateButtons': { - 'delete': permissions['program:initiatives:deleteown'] or permissions['program:initiatives:deleteother'], + 'delete': permissions['mt3smarketingprogram:programs:deleteown'] or permissions['mt3smarketingprogram:programs:deleteother'], }, }, }) -}}
    {% if items is defined and items is not empty %}
    - +
    {{ include('@MauticCore/Helper/tableheader.html.twig', { 'checkall': 'true', - 'target': '#initiativeTable', + 'target': '#programTable', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative', + 'sessionVar': 'program', 'orderBy': 'p.name', - 'text': 'mautic.program.field.name', - 'class': 'col-initiative-name', + 'text': 'mt3s.marketing_program.field.name', + 'class': 'col-program-name', 'default': true, }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative', + 'sessionVar': 'program', 'orderBy': 'p.status', - 'text': 'mautic.program.field.status', - 'class': 'col-initiative-status', + 'text': 'mt3s.marketing_program.field.status', + 'class': 'col-program-status', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative', - 'text': 'mautic.program.field.owner', - 'class': 'visible-md visible-lg col-initiative-owner', + 'sessionVar': 'program', + 'text': 'mt3s.marketing_program.field.owner', + 'class': 'visible-md visible-lg col-program-owner', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative', + 'sessionVar': 'program', 'orderBy': 'p.startDate', - 'text': 'mautic.program.field.start_date', - 'class': 'visible-md visible-lg col-initiative-start', + 'text': 'mt3s.marketing_program.field.start_date', + 'class': 'visible-md visible-lg col-program-start', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative', + 'sessionVar': 'program', 'orderBy': 'p.endDate', - 'text': 'mautic.program.field.end_date', - 'class': 'visible-md visible-lg col-initiative-end', + 'text': 'mt3s.marketing_program.field.end_date', + 'class': 'visible-md visible-lg col-program-end', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative', + 'sessionVar': 'program', 'orderBy': 'p.budgetPlanned', - 'text': 'mautic.program.field.budget_planned', - 'class': 'visible-md visible-lg col-initiative-budget text-right', + 'text': 'mt3s.marketing_program.field.budget_planned', + 'class': 'visible-md visible-lg col-program-budget text-right', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative', + 'sessionVar': 'program', 'orderBy': 'p.id', 'text': 'mautic.core.id', - 'class': 'visible-md visible-lg col-initiative-id', + 'class': 'visible-md visible-lg col-program-id', }) }} {% for item in items %} - {% set canEdit = securityHasEntityAccess(permissions['program:initiatives:editown'], permissions['program:initiatives:editother'], item.createdBy) %} + {% set canEdit = securityHasEntityAccess(permissions['mt3smarketingprogram:programs:editown'], permissions['mt3smarketingprogram:programs:editother'], item.createdBy) %} @@ -130,8 +130,8 @@ 'totalItems': totalItems, 'page': page, 'limit': limit, - 'baseUrl': path('initiative_index'), - 'sessionVar': 'initiative', + 'baseUrl': path('mt3s_marketing_program_index'), + 'sessionVar': 'program', }) -}} @@ -140,9 +140,9 @@ {% else %}
    {{ include('@MauticCore/Components/content-block.html.twig', { - 'heading': 'mautic.program.onboarding.heading', - 'subheading': 'mautic.program.onboarding.subheading', - 'copy': 'mautic.program.onboarding.copy', + 'heading': 'mt3s.marketing_program.onboarding.heading', + 'subheading': 'mt3s.marketing_program.onboarding.subheading', + 'copy': 'mt3s.marketing_program.onboarding.copy', }) }}
    {% endif %} diff --git a/Resources/views/Stakeholder/details.html.twig b/Resources/views/Stakeholder/details.html.twig index b8f1c2b..14ab14c 100644 --- a/Resources/views/Stakeholder/details.html.twig +++ b/Resources/views/Stakeholder/details.html.twig @@ -1,6 +1,6 @@ {% extends '@MauticCore/Default/content.html.twig' %} -{% block mauticContent %}programStakeholder{% endblock %} +{% block mauticContent %}mt3sMpProgramStakeholder{% endblock %} {% block preHeader %} {{- include('@MauticCore/Helper/page_actions.html.twig', { @@ -8,8 +8,8 @@ 'templateButtons': { 'close': true, }, - 'closeUrl': path('initiative_stakeholder_index'), - 'targetLabel': 'mautic.program.stakeholder.header.index'|trans, + 'closeUrl': path('mt3s_marketing_program_stakeholder_index'), + 'targetLabel': 'mt3s.marketing_program.stakeholder.header.index'|trans, }) -}} {% endblock %} @@ -18,9 +18,9 @@ {% block publishStatus %} {% include '@MauticCore/Helper/_tag.html.twig' with { tags: [{ color: item.isPublished ? 'green' : 'cool-gray', - label: (item.isPublished ? 'mautic.program.stakeholder.active' : 'mautic.program.stakeholder.inactive')|trans, + label: (item.isPublished ? 'mt3s.marketing_program.stakeholder.active' : 'mt3s.marketing_program.stakeholder.inactive')|trans, icon: item.isPublished ? 'ri-checkbox-circle-line' : 'ri-time-line', - attributes: {'class': 'initiative-stakeholder-status-tag'}, + attributes: {'class': 'program-stakeholder-status-tag'}, }] } %} {% endblock %} @@ -28,36 +28,36 @@ {{- include('@MauticCore/Helper/page_actions.html.twig', { 'item': item, 'templateButtons': { - 'edit': securityHasEntityAccess(permissions['program:stakeholders:editown'], permissions['program:stakeholders:editother'], item.createdBy), - 'delete': securityHasEntityAccess(permissions['program:stakeholders:deleteown'], permissions['program:stakeholders:deleteother'], item.createdBy), + 'edit': securityHasEntityAccess(permissions['mt3smarketingprogram:stakeholders:editown'], permissions['mt3smarketingprogram:stakeholders:editother'], item.createdBy), + 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:stakeholders:deleteown'], permissions['mt3smarketingprogram:stakeholders:deleteother'], item.createdBy), }, - 'langVar': 'initiative.stakeholder', + 'langVar': 'program.stakeholder', }) -}} {% endblock %} {% block content %}
    -
    {{- include('@MauticCore/Helper/list_actions.html.twig', { 'item': item, 'templateButtons': { 'edit': canEdit, - 'delete': securityHasEntityAccess(permissions['program:initiatives:deleteown'], permissions['program:initiatives:deleteother'], item.createdBy), + 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:programs:deleteown'], permissions['mt3smarketingprogram:programs:deleteother'], item.createdBy), }, - 'routeBase': 'initiative', - 'langVar': 'initiative', + 'routeBase': 'program', + 'langVar': 'program', }) -}}
    {{- include('@MauticCore/Helper/publishstatus_icon.html.twig', { 'item': item, - 'model': 'initiative', + 'model': 'program', }) -}} - + {{ item.name }} {% if item.category %} @@ -111,13 +111,13 @@
    {{ item.status.labelKey|trans }} - {{ item.owner ? item.owner.name : 'mautic.program.owner.none'|trans }} + {{ item.owner ? item.owner.name : 'mt3s.marketing_program.owner.none'|trans }} {{ item.startDate ? dateToDate(item.startDate) : '' }} {{ item.endDate ? dateToDate(item.endDate) : '' }} {% if item.budgetPlanned is not null %} - {{ program_money(item.budgetPlanned) }} {{ program_currency() }} + {{ mt3s_marketing_program_money(item.budgetPlanned) }} {{ mt3s_marketing_program_currency() }} {% endif %} {{ item.id }}
    +
    - + - - + + - - + + - - + + @@ -70,25 +70,25 @@
    {{ 'mautic.program.stakeholder.field.type'|trans }}{{ 'mt3s.marketing_program.stakeholder.field.type'|trans }} - {% set typeIcon = program_item_type_icon('stakeholder', item.type) %} - {% if typeIcon %} {% endif %} - {{ program_item_type_name('stakeholder', item.type) ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': item.type}) }} + {% set typeIcon = mt3s_marketing_program_item_type_icon('stakeholder', item.type) %} + {% if typeIcon %} {% endif %} + {{ mt3s_marketing_program_item_type_name('stakeholder', item.type) ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': item.type}) }}
    {{ 'mautic.program.stakeholder.field.role'|trans }}{{ item.role|default('mautic.program.value.none'|trans) }}{{ 'mt3s.marketing_program.stakeholder.field.role'|trans }}{{ item.role|default('mt3s.marketing_program.value.none'|trans) }}
    {{ 'mautic.program.stakeholder.field.email'|trans }}{% if item.email %}{{ item.email }}{% else %}{{ 'mautic.program.value.none'|trans }}{% endif %}{{ 'mt3s.marketing_program.stakeholder.field.email'|trans }}{% if item.email %}{{ item.email }}{% else %}{{ 'mt3s.marketing_program.value.none'|trans }}{% endif %}
    {{ 'mautic.program.stakeholder.field.phone'|trans }}{% if item.phone %}{{ item.phone }}{% else %}{{ 'mautic.program.value.none'|trans }}{% endif %}{{ 'mt3s.marketing_program.stakeholder.field.phone'|trans }}{% if item.phone %}{{ item.phone }}{% else %}{{ 'mt3s.marketing_program.value.none'|trans }}{% endif %}
    {{ 'mautic.core.created'|trans }}
    -

    {{ 'mautic.program.stakeholder.field.plans'|trans }}

    - {% if item.initiativeLinks is empty %} -

    {{ 'mautic.program.stakeholder.no_plans'|trans }}

    +

    {{ 'mt3s.marketing_program.stakeholder.field.plans'|trans }}

    + {% if item.programLinks is empty %} +

    {{ 'mt3s.marketing_program.stakeholder.no_plans'|trans }}

    {% else %}
    - +
    - - - + + + - {% for link in item.initiativeLinks %} + {% for link in item.programLinks %} - - - + + + {% endfor %} diff --git a/Resources/views/Stakeholder/form.html.twig b/Resources/views/Stakeholder/form.html.twig index 0aa5211..1285104 100644 --- a/Resources/views/Stakeholder/form.html.twig +++ b/Resources/views/Stakeholder/form.html.twig @@ -1,12 +1,12 @@ {% extends '@MauticCore/Default/content.html.twig' %} -{% block mauticContent %}programStakeholder{% endblock %} +{% block mauticContent %}mt3sMpProgramStakeholder{% endblock %} {% block headerTitle %} {% if entity.id %} - {{ 'mautic.program.stakeholder.header.edit'|trans({'%name%': entity.name}) }} + {{ 'mt3s.marketing_program.stakeholder.header.edit'|trans({'%name%': entity.name}) }} {% else %} - {{ 'mautic.program.stakeholder.header.new'|trans }} + {{ 'mt3s.marketing_program.stakeholder.header.new'|trans }} {% endif %} {% endblock %} @@ -17,14 +17,14 @@
    {{ form_row(form.name) }}
    - {# The selected type's pictogram; updated by program.js when the type changes. #} + {# The selected type's pictogram; updated by mt3s-mp-program.js when the type changes. #}
    - +
    {{ form_row(form.type) }} - {# Filled with the selected type's description by program.js. #} -

    {{ program_item_type_description('stakeholder', form.type.vars.value) }}

    + {# Filled with the selected type's description by mt3s-mp-program.js. #} +

    {{ mt3s_marketing_program_item_type_description('stakeholder', form.type.vars.value) }}

    {{ form_row(form.role) }} @@ -35,7 +35,7 @@ {{ form_row(form.isPublished) }} {{ form_row(form.email) }} {{ form_row(form.phone) }} -

    {{ 'mautic.program.stakeholder.phone.help'|trans }}

    +

    {{ 'mt3s.marketing_program.stakeholder.phone.help'|trans }}

    diff --git a/Resources/views/Stakeholder/list.html.twig b/Resources/views/Stakeholder/list.html.twig index e2bf56a..74142dd 100644 --- a/Resources/views/Stakeholder/list.html.twig +++ b/Resources/views/Stakeholder/list.html.twig @@ -2,9 +2,9 @@ {% set tmpl = 'list' %} {% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %} -{% block mauticContent %}programStakeholder{% endblock %} +{% block mauticContent %}mt3sMpProgramStakeholder{% endblock %} -{% block headerTitle %}{{ 'mautic.program.stakeholder.header.index'|trans }}{% endblock %} +{% block headerTitle %}{{ 'mt3s.marketing_program.stakeholder.header.index'|trans }}{% endblock %} {% block content %}
    @@ -13,107 +13,107 @@ 'action': currentRoute, 'page_actions': { 'templateButtons': { - 'new': permissions['program:stakeholders:create'], + 'new': permissions['mt3smarketingprogram:stakeholders:create'], }, - 'langVar': 'initiative.stakeholder', + 'langVar': 'program.stakeholder', }, 'bulk_actions': { - 'langVar': 'initiative.stakeholder', + 'langVar': 'program.stakeholder', 'templateButtons': { - 'delete': permissions['program:stakeholders:deleteown'] or permissions['program:stakeholders:deleteother'], + 'delete': permissions['mt3smarketingprogram:stakeholders:deleteown'] or permissions['mt3smarketingprogram:stakeholders:deleteother'], }, }, }) -}}
    {% if items is defined and items is not empty %}
    -
    {{ 'mautic.program.field.name'|trans }}{{ 'mautic.program.stakeholder.field.role_in_initiative'|trans }}{{ 'mautic.program.field.status'|trans }}{{ 'mt3s.marketing_program.field.name'|trans }}{{ 'mt3s.marketing_program.stakeholder.field.role_in_program'|trans }}{{ 'mt3s.marketing_program.field.status'|trans }}
    {{ link.initiative.name }}{{ link.roleInInitiative|default('—') }}{{ link.initiative.status.labelKey|trans }}{{ link.program.name }}{{ link.roleInProgram|default('—') }}{{ link.program.status.labelKey|trans }}
    +
    {{ include('@MauticCore/Helper/tableheader.html.twig', { 'checkall': 'true', - 'target': '#programStakeholderTable', + 'target': '#mt3sMpProgramStakeholderTable', }) }} - {# Columns: ID, Pictogram, Type, Name, Role, Email, Phone, Active, Assigned initiatives. #} + {# Columns: ID, Pictogram, Type, Name, Role, Email, Phone, Active, Assigned programs. #} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', + 'sessionVar': 'program.stakeholder', 'orderBy': 's.id', 'text': 'mautic.core.id', - 'class': 'col-initiative-stakeholder-id', + 'class': 'col-program-stakeholder-id', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', - 'text': 'mautic.program.stakeholder.field.pictogram', - 'class': 'col-initiative-stakeholder-pictogram', + 'sessionVar': 'program.stakeholder', + 'text': 'mt3s.marketing_program.stakeholder.field.pictogram', + 'class': 'col-program-stakeholder-pictogram', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', + 'sessionVar': 'program.stakeholder', 'orderBy': 's.type', - 'text': 'mautic.program.stakeholder.field.type', - 'class': 'col-initiative-stakeholder-type', + 'text': 'mt3s.marketing_program.stakeholder.field.type', + 'class': 'col-program-stakeholder-type', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', + 'sessionVar': 'program.stakeholder', 'orderBy': 's.name', - 'text': 'mautic.program.stakeholder.field.name', - 'class': 'col-initiative-stakeholder-name', + 'text': 'mt3s.marketing_program.stakeholder.field.name', + 'class': 'col-program-stakeholder-name', 'default': true, }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', + 'sessionVar': 'program.stakeholder', 'orderBy': 's.role', - 'text': 'mautic.program.stakeholder.field.role', - 'class': 'visible-md visible-lg col-initiative-stakeholder-role', + 'text': 'mt3s.marketing_program.stakeholder.field.role', + 'class': 'visible-md visible-lg col-program-stakeholder-role', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', + 'sessionVar': 'program.stakeholder', 'orderBy': 's.email', - 'text': 'mautic.program.stakeholder.field.email', - 'class': 'col-initiative-stakeholder-email', + 'text': 'mt3s.marketing_program.stakeholder.field.email', + 'class': 'col-program-stakeholder-email', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', - 'text': 'mautic.program.stakeholder.field.phone', - 'class': 'col-initiative-stakeholder-phone', + 'sessionVar': 'program.stakeholder', + 'text': 'mt3s.marketing_program.stakeholder.field.phone', + 'class': 'col-program-stakeholder-phone', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', + 'sessionVar': 'program.stakeholder', 'orderBy': 's.isPublished', - 'text': 'mautic.program.stakeholder.field.active', - 'class': 'col-initiative-stakeholder-active', + 'text': 'mt3s.marketing_program.stakeholder.field.active', + 'class': 'col-program-stakeholder-active', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.stakeholder', - 'text': 'mautic.program.stakeholder.field.plans', - 'class': 'visible-md visible-lg col-initiative-stakeholder-initiatives', + 'sessionVar': 'program.stakeholder', + 'text': 'mt3s.marketing_program.stakeholder.field.plans', + 'class': 'visible-md visible-lg col-program-stakeholder-programs', }) }} {% for item in items %} - {% set canEdit = securityHasEntityAccess(permissions['program:stakeholders:editown'], permissions['program:stakeholders:editother'], item.createdBy) %} + {% set canEdit = securityHasEntityAccess(permissions['mt3smarketingprogram:stakeholders:editown'], permissions['mt3smarketingprogram:stakeholders:editother'], item.createdBy) %} - - {{ program_item_type_name('stakeholder', item.type) ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': item.type}) }} + + {{ mt3s_marketing_program_item_type_name('stakeholder', item.type) ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': item.type}) }} @@ -148,8 +148,8 @@ 'totalItems': totalItems, 'page': page, 'limit': limit, - 'baseUrl': path('initiative_stakeholder_index'), - 'sessionVar': 'initiative.stakeholder', + 'baseUrl': path('mt3s_marketing_program_stakeholder_index'), + 'sessionVar': 'program.stakeholder', }) -}} @@ -158,9 +158,9 @@ {% else %}
    {{ include('@MauticCore/Components/content-block.html.twig', { - 'heading': 'mautic.program.stakeholder.onboarding.heading', - 'subheading': 'mautic.program.stakeholder.onboarding.subheading', - 'copy': 'mautic.program.stakeholder.onboarding.copy', + 'heading': 'mt3s.marketing_program.stakeholder.onboarding.heading', + 'subheading': 'mt3s.marketing_program.stakeholder.onboarding.subheading', + 'copy': 'mt3s.marketing_program.stakeholder.onboarding.copy', }) }}
    {% endif %} diff --git a/Resources/views/Task/form.html.twig b/Resources/views/Task/form.html.twig index 30047e4..8350d18 100644 --- a/Resources/views/Task/form.html.twig +++ b/Resources/views/Task/form.html.twig @@ -1,23 +1,23 @@ {% extends '@MauticCore/Default/content.html.twig' %} -{% block mauticContent %}programTask{% endblock %} +{% block mauticContent %}mt3sMpProgramTask{% endblock %} {% block headerTitle %} {% if entity.id %} - {{ 'mautic.program.task.header.edit'|trans({'%name%': entity.name}) }} + {{ 'mt3s.marketing_program.task.header.edit'|trans({'%name%': entity.name}) }} {% else %} - {{ 'mautic.program.task.header.new'|trans }} + {{ 'mt3s.marketing_program.task.header.new'|trans }} {% endif %} {% endblock %} -{# The dependencies and the RACI rows: the same editable, sortable rows as the initiative form's - collections. Adding, removing and reordering is handled by Assets/js/program.js through the - initiative-collection-* classes. #} +{# The dependencies and the RACI rows: the same editable, sortable rows as the program form's + collections. Adding, removing and reordering is handled by Assets/js/mt3s-mp-program.js through the + program-collection-* classes. #} {% macro dependency_row(dependency) %} -
  • +
  • - +
    @@ -29,7 +29,7 @@ {{ form_widget(dependency.position) }}
    -
    @@ -38,10 +38,10 @@ {% endmacro %} {% macro raci_row(raci) %} -
  • +
  • - +
    @@ -53,7 +53,7 @@ {{ form_widget(raci.position) }}
    -
    @@ -68,14 +68,14 @@
    {{ form_row(form.name) }}
    - {# The selected type's pictogram; updated by program.js when the type changes. #} + {# The selected type's pictogram; updated by mt3s-mp-program.js when the type changes. #}
    - +
    {{ form_row(form.type) }} - {# Filled with the selected type's description by program.js. #} -

    {{ program_item_type_description('task', form.type.vars.value) }}

    + {# Filled with the selected type's description by mt3s-mp-program.js. #} +

    {{ mt3s_marketing_program_item_type_description('task', form.type.vars.value) }}

    {{ form_row(form.description) }} @@ -84,7 +84,7 @@
    - {{ form_row(form.initiative) }} + {{ form_row(form.program) }} {{ form_row(form.taskKind) }} {{ form_row(form.startDate) }} {{ form_row(form.endDate) }} @@ -92,7 +92,7 @@ {{ form_row(form.status) }} {% else %} {# A phase has no status of its own: its state comes from its tasks. #} -

    {{ 'mautic.program.task.kind.phase_status_note'|trans }}

    +

    {{ 'mt3s.marketing_program.task.kind.phase_status_note'|trans }}

    {% endif %} {{ form_row(form.plannedWork) }}
    @@ -100,42 +100,42 @@
    - {# Dependencies: several edges, each another task of the initiative with the relation type. #} -
    -

    {{ 'mautic.program.task.field.dependencies'|trans }}

    +

    {{ 'mt3s.marketing_program.task.field.dependencies'|trans }}

    {{ form_errors(form.dependencies) }} -

    - {{ 'mautic.program.task.dependency.empty'|trans }} +

    + {{ 'mt3s.marketing_program.task.dependency.empty'|trans }}

    -
      +
        {% for dependency in form.dependencies %} {{ _self.dependency_row(dependency) }} {% endfor %}
      -
    {% do form.dependencies.setRendered %} - {# RACI: one row per role, several stakeholders per role, picked from the initiative's. #} -
    -

    {{ 'mautic.program.task.field.raci'|trans }}

    +

    {{ 'mt3s.marketing_program.task.field.raci'|trans }}

    {{ form_errors(form.raci) }} -

    - {{ 'mautic.program.task.raci.empty'|trans }} +

    + {{ 'mt3s.marketing_program.task.raci.empty'|trans }}

    -
      +
        {% for raci in form.raci %} {{ _self.raci_row(raci) }} {% endfor %}
      -
    {% do form.raci.setRendered %} diff --git a/Resources/views/Task/list.html.twig b/Resources/views/Task/list.html.twig index 5be6c06..7e0d767 100644 --- a/Resources/views/Task/list.html.twig +++ b/Resources/views/Task/list.html.twig @@ -2,9 +2,9 @@ {% set tmpl = 'list' %} {% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %} -{% block mauticContent %}programTask{% endblock %} +{% block mauticContent %}mt3sMpProgramTask{% endblock %} -{% block headerTitle %}{{ 'mautic.program.task.header.index'|trans }}{% endblock %} +{% block headerTitle %}{{ 'mt3s.marketing_program.task.header.index'|trans }}{% endblock %} {% block content %}
    @@ -13,118 +13,118 @@ 'action': currentRoute, 'page_actions': { 'templateButtons': { - 'new': permissions['program:tasks:create'], + 'new': permissions['mt3smarketingprogram:tasks:create'], }, - 'langVar': 'initiative.task', + 'langVar': 'program.task', }, 'bulk_actions': { - 'langVar': 'initiative.task', + 'langVar': 'program.task', 'templateButtons': { - 'delete': permissions['program:tasks:deleteown'] or permissions['program:tasks:deleteother'], + 'delete': permissions['mt3smarketingprogram:tasks:deleteown'] or permissions['mt3smarketingprogram:tasks:deleteother'], }, }, }) -}}
    {% if items is defined and items is not empty %}
    -
  • {{- include('@MauticCore/Helper/list_actions.html.twig', { 'item': item, 'templateButtons': { 'edit': canEdit, - 'delete': securityHasEntityAccess(permissions['program:stakeholders:deleteown'], permissions['program:stakeholders:deleteother'], item.createdBy), + 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:stakeholders:deleteown'], permissions['mt3smarketingprogram:stakeholders:deleteother'], item.createdBy), }, - 'langVar': 'initiative.stakeholder', + 'langVar': 'program.stakeholder', }) -}} {{ item.id }} - {% set typeIcon = program_item_type_icon('stakeholder', item.type) %} - {% if typeIcon %}{% endif %} + {% set typeIcon = mt3s_marketing_program_item_type_icon('stakeholder', item.type) %} + {% if typeIcon %}{% endif %} {% if canEdit %} - {{ item.name }} + {{ item.name }} {% else %} {{ item.name }} {% endif %} @@ -127,16 +127,16 @@ - {{ (item.isPublished ? 'mautic.program.stakeholder.active' : 'mautic.program.stakeholder.inactive')|trans }} + {{ (item.isPublished ? 'mt3s.marketing_program.stakeholder.active' : 'mt3s.marketing_program.stakeholder.inactive')|trans }} - {# The initiatives this stakeholder is assigned to, through their Stakeholders tab. #} - {% set initiatives = item.initiativeLinks|default([]) %} - {% for link in initiatives %} - {{ link.initiative.name }}{% if link.roleInInitiative %} ({{ link.roleInInitiative }}){% endif %}{% if not loop.last %}, {% endif %} + {# The programs this stakeholder is assigned to, through their Stakeholders tab. #} + {% set programs = item.programLinks|default([]) %} + {% for link in programs %} + {{ link.program.name }}{% if link.roleInProgram %} ({{ link.roleInProgram }}){% endif %}{% if not loop.last %}, {% endif %} {% else %} - {{ 'mautic.program.stakeholder.no_plans'|trans }} + {{ 'mt3s.marketing_program.stakeholder.no_plans'|trans }} {% endfor %}
    +
    {{ include('@MauticCore/Helper/tableheader.html.twig', { 'checkall': 'true', - 'target': '#programTaskTable', + 'target': '#mt3sMpProgramTaskTable', }) }} {# Columns: ID, Pictogram, Type, Name, Description, Start date, End date, Status. #} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', + 'sessionVar': 'program.task', 'orderBy': 't.id', 'text': 'mautic.core.id', - 'class': 'col-initiative-task-id', + 'class': 'col-program-task-id', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', - 'text': 'mautic.program.task.field.pictogram', - 'class': 'col-initiative-task-pictogram', + 'sessionVar': 'program.task', + 'text': 'mt3s.marketing_program.task.field.pictogram', + 'class': 'col-program-task-pictogram', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', + 'sessionVar': 'program.task', 'orderBy': 't.type', - 'text': 'mautic.program.task.field.type', - 'class': 'col-initiative-task-type', + 'text': 'mt3s.marketing_program.task.field.type', + 'class': 'col-program-task-type', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', + 'sessionVar': 'program.task', 'orderBy': 't.name', - 'text': 'mautic.program.task.field.name', - 'class': 'col-initiative-task-name', + 'text': 'mt3s.marketing_program.task.field.name', + 'class': 'col-program-task-name', 'default': true, }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', - 'text': 'mautic.program.task.field.description', - 'class': 'visible-md visible-lg col-initiative-task-description', + 'sessionVar': 'program.task', + 'text': 'mt3s.marketing_program.task.field.description', + 'class': 'visible-md visible-lg col-program-task-description', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', + 'sessionVar': 'program.task', 'orderBy': 't.startDate', - 'text': 'mautic.program.task.field.start_date', - 'class': 'col-initiative-task-start', + 'text': 'mt3s.marketing_program.task.field.start_date', + 'class': 'col-program-task-start', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', + 'sessionVar': 'program.task', 'orderBy': 't.endDate', - 'text': 'mautic.program.task.field.end_date', - 'class': 'col-initiative-task-end', + 'text': 'mt3s.marketing_program.task.field.end_date', + 'class': 'col-program-task-end', }) }} {{ include('@MauticCore/Helper/tableheader.html.twig', { - 'sessionVar': 'initiative.task', + 'sessionVar': 'program.task', 'orderBy': 't.status', - 'text': 'mautic.program.task.field.status', - 'class': 'col-initiative-task-status', + 'text': 'mt3s.marketing_program.task.field.status', + 'class': 'col-program-task-status', }) }} {% for item in items %} - {% set canEdit = securityHasEntityAccess(permissions['program:tasks:editown'], permissions['program:tasks:editother'], item.createdBy) %} + {% set canEdit = securityHasEntityAccess(permissions['mt3smarketingprogram:tasks:editown'], permissions['mt3smarketingprogram:tasks:editother'], item.createdBy) %} - - {{ program_item_type_name('task', item.type) ?? 'mautic.program.description_item.type.unknown'|trans({'%key%': item.type}) }} + + {{ mt3s_marketing_program_item_type_name('task', item.type) ?? 'mt3s.marketing_program.description_item.type.unknown'|trans({'%key%': item.type}) }} @@ -136,8 +136,8 @@ 'totalItems': totalItems, 'page': page, 'limit': limit, - 'baseUrl': path('initiative_task_index'), - 'sessionVar': 'initiative.task', + 'baseUrl': path('mt3s_marketing_program_task_index'), + 'sessionVar': 'program.task', }) -}} @@ -146,9 +146,9 @@ {% else %}
    {{ include('@MauticCore/Components/content-block.html.twig', { - 'heading': 'mautic.program.task.onboarding.heading', - 'subheading': 'mautic.program.task.onboarding.subheading', - 'copy': 'mautic.program.task.onboarding.copy', + 'heading': 'mt3s.marketing_program.task.onboarding.heading', + 'subheading': 'mt3s.marketing_program.task.onboarding.subheading', + 'copy': 'mt3s.marketing_program.task.onboarding.copy', }) }}
    {% endif %} diff --git a/Resources/views/UtmTaxonomy/list.html.twig b/Resources/views/UtmTaxonomy/list.html.twig index c08934a..4a4c84d 100644 --- a/Resources/views/UtmTaxonomy/list.html.twig +++ b/Resources/views/UtmTaxonomy/list.html.twig @@ -2,17 +2,17 @@ {% set tmpl = 'list' %} {% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %} -{% block mauticContent %}programUtmTaxonomy{% endblock %} +{% block mauticContent %}mt3sMpProgramUtmTaxonomy{% endblock %} -{% block headerTitle %}{{ 'mautic.program.utm_taxonomy.header.index'|trans }}{% endblock %} +{% block headerTitle %}{{ 'mt3s.marketing_program.utm_taxonomy.header.index'|trans }}{% endblock %} {% block content %}
    {{ include('@MauticCore/Components/content-block.html.twig', { - 'heading': 'mautic.program.utm_taxonomy.onboarding.heading', - 'subheading': 'mautic.program.utm_taxonomy.onboarding.subheading', - 'copy': 'mautic.program.utm_taxonomy.onboarding.copy', + 'heading': 'mt3s.marketing_program.utm_taxonomy.onboarding.heading', + 'subheading': 'mt3s.marketing_program.utm_taxonomy.onboarding.subheading', + 'copy': 'mt3s.marketing_program.utm_taxonomy.onboarding.copy', }) }}
    diff --git a/Security/Permissions/MT3SMarketingProgramPermissions.php b/Security/Permissions/MT3SMarketingProgramPermissions.php new file mode 100644 index 0000000..046ab86 --- /dev/null +++ b/Security/Permissions/MT3SMarketingProgramPermissions.php @@ -0,0 +1,53 @@ + Item types), and mt3smarketingprogram:categories:* (managing the + * "program" category type). + * + * Shown under Settings > Roles. Core discovers this class from Security/Permissions/. + */ +class MT3SMarketingProgramPermissions extends AbstractPermissions +{ + /** + * @param mixed[] $params + */ + public function __construct(array $params) + { + parent::__construct($params); + + $this->addStandardPermissions('categories'); + $this->addExtendedPermissions('programs'); + $this->addExtendedPermissions('tasks'); + $this->addExtendedPermissions('stakeholders'); + $this->addExtendedPermissions('audiences'); + $this->addStandardPermissions('itemtypes'); + } + + public function getName(): string + { + return 'mt3smarketingprogram'; + } + + /** + * @param array $options + * @param array $data + */ + public function buildForm(FormBuilderInterface &$builder, array $options, array $data): void + { + $this->addStandardFormFields('mt3smarketingprogram', 'categories', $builder, $data); + $this->addExtendedFormFields('mt3smarketingprogram', 'programs', $builder, $data); + $this->addExtendedFormFields('mt3smarketingprogram', 'tasks', $builder, $data); + $this->addExtendedFormFields('mt3smarketingprogram', 'stakeholders', $builder, $data); + $this->addExtendedFormFields('mt3smarketingprogram', 'audiences', $builder, $data); + $this->addStandardFormFields('mt3smarketingprogram', 'itemtypes', $builder, $data); + } +} diff --git a/Security/Permissions/ProgramPermissions.php b/Security/Permissions/ProgramPermissions.php deleted file mode 100644 index b0220a7..0000000 --- a/Security/Permissions/ProgramPermissions.php +++ /dev/null @@ -1,53 +0,0 @@ - Item types), and program:categories:* (managing the - * "initiative" category type). - * - * Shown under Settings > Roles. Core discovers this class from Security/Permissions/. - */ -class ProgramPermissions extends AbstractPermissions -{ - /** - * @param mixed[] $params - */ - public function __construct(array $params) - { - parent::__construct($params); - - $this->addStandardPermissions('categories'); - $this->addExtendedPermissions('initiatives'); - $this->addExtendedPermissions('tasks'); - $this->addExtendedPermissions('stakeholders'); - $this->addExtendedPermissions('audiences'); - $this->addStandardPermissions('itemtypes'); - } - - public function getName(): string - { - return 'program'; - } - - /** - * @param array $options - * @param array $data - */ - public function buildForm(FormBuilderInterface &$builder, array $options, array $data): void - { - $this->addStandardFormFields('program', 'categories', $builder, $data); - $this->addExtendedFormFields('program', 'initiatives', $builder, $data); - $this->addExtendedFormFields('program', 'tasks', $builder, $data); - $this->addExtendedFormFields('program', 'stakeholders', $builder, $data); - $this->addExtendedFormFields('program', 'audiences', $builder, $data); - $this->addStandardFormFields('program', 'itemtypes', $builder, $data); - } -} diff --git a/Service/AudienceAttributes.php b/Service/AudienceAttributes.php index 1595ff7..063f883 100644 --- a/Service/AudienceAttributes.php +++ b/Service/AudienceAttributes.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Service; +namespace MauticPlugin\MT3SMarketingProgramBundle\Service; use Mautic\CoreBundle\Helper\CoreParametersHelper; @@ -12,17 +12,17 @@ use Mautic\CoreBundle\Helper\CoreParametersHelper; * Which attributes of an audience persona are offered on the forms is chosen there, one toggle per * attribute, so a b2b install and a b2c install define their personas differently. Each toggle is * a local.php parameter (default enabled; an admin turns off what they don't use): - * - program_audience_attribute_tagline (Tagline) - * - program_audience_attribute_profile (Profile criteria) - * - program_audience_attribute_motivations (Motivations) - * - program_audience_attribute_barriers (Barriers) - * - program_audience_attribute_frustrations (Frustrations) - * - program_audience_attribute_triggers (Triggers) - * - program_audience_attribute_decision_role (Decision-making role; values program_audience_decision_roles) - * - program_audience_attribute_tones (Preferred tones; values program_audience_tones) - * - program_audience_attribute_channels (Preferred channels) - * - program_audience_attribute_stages (Stages) - * - program_audience_attribute_size (Estimated size) + * - mt3s_marketing_program_audience_attribute_tagline (Tagline) + * - mt3s_marketing_program_audience_attribute_profile (Profile criteria) + * - mt3s_marketing_program_audience_attribute_motivations (Motivations) + * - mt3s_marketing_program_audience_attribute_barriers (Barriers) + * - mt3s_marketing_program_audience_attribute_frustrations (Frustrations) + * - mt3s_marketing_program_audience_attribute_triggers (Triggers) + * - mt3s_marketing_program_audience_attribute_decision_role (Decision-making role; values mt3s_marketing_program_audience_decision_roles) + * - mt3s_marketing_program_audience_attribute_tones (Preferred tones; values mt3s_marketing_program_audience_tones) + * - mt3s_marketing_program_audience_attribute_channels (Preferred channels) + * - mt3s_marketing_program_audience_attribute_stages (Stages) + * - mt3s_marketing_program_audience_attribute_size (Estimated size) * * The values of the decision roles and the tones are lists edited in the same place, with a name * per language — read through ItemTypeProvider (kinds "audience_decision_role" and "audience_tone"). @@ -102,6 +102,6 @@ class AudienceAttributes */ public static function toggleParameter(string $attribute): string { - return 'program_audience_attribute_'.$attribute; + return 'mt3s_marketing_program_audience_attribute_'.$attribute; } } \ No newline at end of file diff --git a/Service/CurrencyProvider.php b/Service/CurrencyProvider.php index 0ee141e..656af52 100644 --- a/Service/CurrencyProvider.php +++ b/Service/CurrencyProvider.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Service; +namespace MauticPlugin\MT3SMarketingProgramBundle\Service; use Mautic\CoreBundle\Helper\CoreParametersHelper; use Symfony\Component\Intl\Currencies; use Symfony\Contracts\Translation\TranslatorInterface; /** - * The currency of all amounts in the plugin (initiative budgets, allocation costs and totals). + * The currency of all amounts in the plugin (program budgets, allocation costs and totals). * * It is a general setting, chosen by an administrator in Settings > Configuration > Program Settings and - * stored in the local.php parameter program_currency; users don't pick a currency. Amounts aren't converted + * stored in the local.php parameter mt3s_marketing_program_currency; users don't pick a currency. Amounts aren't converted * when it changes: they are simply shown with the new currency. */ class CurrencyProvider { - public const CONFIG_PARAMETER = 'program_currency'; + public const CONFIG_PARAMETER = 'mt3s_marketing_program_currency'; public const DEFAULT_CURRENCY = 'EUR'; diff --git a/Service/ItemTypeInUseGuard.php b/Service/ItemTypeInUseGuard.php index 0d77488..8ea1602 100644 --- a/Service/ItemTypeInUseGuard.php +++ b/Service/ItemTypeInUseGuard.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Service; +namespace MauticPlugin\MT3SMarketingProgramBundle\Service; -use MauticPlugin\ProgramBundle\Entity\InitiativeAllocationItemRepository; -use MauticPlugin\ProgramBundle\Entity\InitiativeDescriptionItemRepository; -use MauticPlugin\ProgramBundle\Entity\InitiativeObjectiveRepository; -use MauticPlugin\ProgramBundle\Entity\StakeholderRepository; -use MauticPlugin\ProgramBundle\Entity\TaskRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramAllocationItemRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramDescriptionItemRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramObjectiveRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\StakeholderRepository; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskRepository; /** * Refuses to remove item types that items or tasks still use: a stored item references its type @@ -18,9 +18,9 @@ use MauticPlugin\ProgramBundle\Entity\TaskRepository; class ItemTypeInUseGuard { public function __construct( - private InitiativeDescriptionItemRepository $descriptionItemRepository, - private InitiativeAllocationItemRepository $allocationItemRepository, - private InitiativeObjectiveRepository $objectiveRepository, + private ProgramDescriptionItemRepository $descriptionItemRepository, + private ProgramAllocationItemRepository $allocationItemRepository, + private ProgramObjectiveRepository $objectiveRepository, private TaskRepository $taskRepository, private StakeholderRepository $stakeholderRepository, private ItemTypeProvider $typeProvider, diff --git a/Service/ItemTypeProvider.php b/Service/ItemTypeProvider.php index 98974b6..04a0ac4 100644 --- a/Service/ItemTypeProvider.php +++ b/Service/ItemTypeProvider.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Service; +namespace MauticPlugin\MT3SMarketingProgramBundle\Service; use Mautic\CoreBundle\Helper\CoreParametersHelper; use Mautic\CoreBundle\Helper\LanguageHelper; @@ -10,21 +10,21 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * Reads the item types set up on the Item types page (Programs > Item types). There is one list of types per kind: - * - KIND_DESCRIPTION: types of description items (the Insights tab), parameter program_description_item_types; - * - KIND_ALLOCATION: types of allocation items (Allocation tab), parameter program_allocation_item_types; - * - KIND_OBJECTIVE: types of objectives (Objectives tab), parameter program_objective_types; - * - KIND_TASK: types of tasks (Programs > Tasks and the initiative's Tasks tab), parameter program_task_types; - * - KIND_STAKEHOLDER: types of stakeholders (Programs > Stakeholders), parameter program_stakeholder_types; + * - KIND_DESCRIPTION: types of description items (the Insights tab), parameter mt3s_marketing_program_description_item_types; + * - KIND_ALLOCATION: types of allocation items (Allocation tab), parameter mt3s_marketing_program_allocation_item_types; + * - KIND_OBJECTIVE: types of objectives (Objectives tab), parameter mt3s_marketing_program_objective_types; + * - KIND_TASK: types of tasks (Programs > Tasks and the program's Tasks tab), parameter mt3s_marketing_program_task_types; + * - KIND_STAKEHOLDER: types of stakeholders (Programs > Stakeholders), parameter mt3s_marketing_program_stakeholder_types; * - KIND_AUDIENCE_DECISION_ROLE: values of an audience's "Decision-making role" attribute, parameter - * program_audience_decision_roles (Item types page); - * - KIND_AUDIENCE_TONE: values of an audience's "Preferred tone" attribute, parameter program_audience_tones. + * mt3s_marketing_program_audience_decision_roles (Item types page); + * - KIND_AUDIENCE_TONE: values of an audience's "Preferred tone" attribute, parameter mt3s_marketing_program_audience_tones. * * Each list is stored in local.php, in display order, and edited on the Item types page * (Programs > Item types; ItemTypesController): * * [ * ['key' => 'type_1a2b3c4d', 'names' => ['en_US' => 'Context', 'fr' => 'Contexte'], - * 'descriptions' => ['en_US' => 'Why this initiative exists', 'fr' => '…'], 'icon' => 'ri-lightbulb-line'], + * 'descriptions' => ['en_US' => 'Why this program exists', 'fr' => '…'], 'icon' => 'ri-lightbulb-line'], * … * ] * @@ -46,13 +46,13 @@ class ItemTypeProvider * Kind => local.php parameter. */ public const PARAMETERS = [ - self::KIND_DESCRIPTION => 'program_description_item_types', - self::KIND_ALLOCATION => 'program_allocation_item_types', - self::KIND_OBJECTIVE => 'program_objective_types', - self::KIND_TASK => 'program_task_types', - self::KIND_STAKEHOLDER => 'program_stakeholder_types', - self::KIND_AUDIENCE_DECISION_ROLE => 'program_audience_decision_roles', - self::KIND_AUDIENCE_TONE => 'program_audience_tones', + self::KIND_DESCRIPTION => 'mt3s_marketing_program_description_item_types', + self::KIND_ALLOCATION => 'mt3s_marketing_program_allocation_item_types', + self::KIND_OBJECTIVE => 'mt3s_marketing_program_objective_types', + self::KIND_TASK => 'mt3s_marketing_program_task_types', + self::KIND_STAKEHOLDER => 'mt3s_marketing_program_stakeholder_types', + self::KIND_AUDIENCE_DECISION_ROLE => 'mt3s_marketing_program_audience_decision_roles', + self::KIND_AUDIENCE_TONE => 'mt3s_marketing_program_audience_tones', ]; public function __construct( diff --git a/Service/Pictograms.php b/Service/Pictograms.php index e127d8f..878560d 100644 --- a/Service/Pictograms.php +++ b/Service/Pictograms.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Service; +namespace MauticPlugin\MT3SMarketingProgramBundle\Service; /** * Pictograms an administrator can give to an item type — description or allocation (Settings > diff --git a/Translations/en_US/flashes.ini b/Translations/en_US/flashes.ini index 6aae30d..a59821d 100644 --- a/Translations/en_US/flashes.ini +++ b/Translations/en_US/flashes.ini @@ -1 +1 @@ -mautic.program.item_type.saved="Item types saved." \ No newline at end of file +mt3s.marketing_program.item_type.saved="Item types saved." \ No newline at end of file diff --git a/Translations/en_US/messages.ini b/Translations/en_US/messages.ini index 7994614..8a84a40 100644 --- a/Translations/en_US/messages.ini +++ b/Translations/en_US/messages.ini @@ -1,339 +1,338 @@ -mautic.plugin.program.name="Program" -mautic.program.menu.root="Programs" -mautic.program.menu.index="Initiatives" -mautic.program.menu.item_types="Item types" +mautic.plugin.mt3smarketingprogram.name="MT3S Marketing Program" +mt3s.marketing_program.menu.root="Marketing Programs" +mt3s.marketing_program.menu.index="Marketing Programs" +mt3s.marketing_program.menu.item_types="Item types" -mautic.program.tab.details="Details" -mautic.program.tab.description="Insights" -mautic.program.tab.objectives="Objectives" -mautic.program.tab.allocations="Allocations" -mautic.program.tab.audiences="Audiences" -mautic.program.tab.stakeholders="Stakeholders" -mautic.program.tab.tasks="Tasks" +mt3s.marketing_program.tab.details="Details" +mt3s.marketing_program.tab.description="Insights" +mt3s.marketing_program.tab.objectives="Objectives" +mt3s.marketing_program.tab.allocations="Allocations" +mt3s.marketing_program.tab.audiences="Audiences" +mt3s.marketing_program.tab.stakeholders="Stakeholders" +mt3s.marketing_program.tab.tasks="Tasks" -mautic.program.value.none="None" -mautic.program.audience.empty="No audiences yet." -mautic.program.task.empty="No tasks yet." +mt3s.marketing_program.value.none="None" +mt3s.marketing_program.audience.empty="No audiences yet." +mt3s.marketing_program.task.empty="No tasks yet." -; Stakeholders (the global directory, Programs > Stakeholders, and the initiative's Stakeholders tab). -mautic.program.field.stakeholders="Stakeholders" -mautic.program.stakeholder.menu.index="Stakeholders" -mautic.program.stakeholder.header.index="Stakeholders" -mautic.program.stakeholder.header.new="New stakeholder" -mautic.program.stakeholder.header.edit="Edit stakeholder - %name%" -mautic.program.stakeholder.error.notfound="No stakeholder with the ID %id% was found." -mautic.program.stakeholder.form.confirmdelete="Delete the stakeholder, %name%? Its links to the initiatives are deleted too." -mautic.program.stakeholder.form.confirmbatchdelete="Delete the selected stakeholders? Their links to the initiatives are deleted too." -mautic.program.stakeholder.onboarding.heading="No stakeholders yet" -mautic.program.stakeholder.onboarding.subheading="Stakeholders are the people, companies and teams involved in your initiatives." -mautic.program.stakeholder.onboarding.copy="Use the New button above to add a stakeholder to the directory. Then assign it to an initiative from the initiative's Stakeholders tab, with its role in that initiative." -mautic.program.stakeholder.field.pictogram="Pictogram" -mautic.program.stakeholder.field.name="Name" -mautic.program.stakeholder.field.email="Email" -mautic.program.stakeholder.field.phone="Phone" -mautic.program.stakeholder.field.role="Role" -mautic.program.stakeholder.field.type="Type" -mautic.program.stakeholder.field.active="Active" -mautic.program.stakeholder.field.role_in_initiative="Role in the initiative" -mautic.program.stakeholder.field.plans="Assigned initiatives" -mautic.program.stakeholder.active="Active" -mautic.program.stakeholder.inactive="Inactive" -mautic.program.stakeholder.no_plans="Not assigned to any initiative" -mautic.program.stakeholder.add="Add stakeholder" -mautic.program.stakeholder.remove="Remove stakeholder" -mautic.program.stakeholder.drag="Drag to reorder" -mautic.program.stakeholder.empty="No stakeholders assigned to this initiative yet." -mautic.program.stakeholder.phone.help="Typed without a country prefix, the number is read with the default region from Settings > Configuration > Program Settings." +; Stakeholders (the global directory, Programs > Stakeholders, and the program's Stakeholders tab). +mt3s.marketing_program.field.stakeholders="Stakeholders" +mt3s.marketing_program.stakeholder.menu.index="Stakeholders" +mt3s.marketing_program.stakeholder.header.index="Stakeholders" +mt3s.marketing_program.stakeholder.header.new="New stakeholder" +mt3s.marketing_program.stakeholder.header.edit="Edit stakeholder - %name%" +mt3s.marketing_program.stakeholder.error.notfound="No stakeholder with the ID %id% was found." +mt3s.marketing_program.stakeholder.form.confirmdelete="Delete the stakeholder, %name%? Its links to the programs are deleted too." +mt3s.marketing_program.stakeholder.form.confirmbatchdelete="Delete the selected stakeholders? Their links to the programs are deleted too." +mt3s.marketing_program.stakeholder.onboarding.heading="No stakeholders yet" +mt3s.marketing_program.stakeholder.onboarding.subheading="Stakeholders are the people, companies and teams involved in your programs." +mt3s.marketing_program.stakeholder.onboarding.copy="Use the New button above to add a stakeholder to the directory. Then assign it to an program from the program's Stakeholders tab, with its role in that program." +mt3s.marketing_program.stakeholder.field.pictogram="Pictogram" +mt3s.marketing_program.stakeholder.field.name="Name" +mt3s.marketing_program.stakeholder.field.email="Email" +mt3s.marketing_program.stakeholder.field.phone="Phone" +mt3s.marketing_program.stakeholder.field.role="Role" +mt3s.marketing_program.stakeholder.field.type="Type" +mt3s.marketing_program.stakeholder.field.active="Active" +mt3s.marketing_program.stakeholder.field.role_in_program="Role in the program" +mt3s.marketing_program.stakeholder.field.plans="Assigned programs" +mt3s.marketing_program.stakeholder.active="Active" +mt3s.marketing_program.stakeholder.inactive="Inactive" +mt3s.marketing_program.stakeholder.no_plans="Not assigned to any program" +mt3s.marketing_program.stakeholder.add="Add stakeholder" +mt3s.marketing_program.stakeholder.remove="Remove stakeholder" +mt3s.marketing_program.stakeholder.drag="Drag to reorder" +mt3s.marketing_program.stakeholder.empty="No stakeholders assigned to this program yet." +mt3s.marketing_program.stakeholder.phone.help="Typed without a country prefix, the number is read with the default region from Settings > Configuration > Program Settings." ; Stakeholder types (Settings > Configuration > Plan Settings). -mautic.program.config.section.stakeholder_types="Stakeholder types" -mautic.program.config.section.stakeholder_types.help="The types offered for the stakeholders of the directory (Programs > Stakeholders), in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." -mautic.program.config.stakeholder_phone_region="Default phone region" -mautic.program.config.stakeholder_phone_region.tooltip="ISO country code (e.g. FR) used to read stakeholder phone numbers typed without a country prefix." +mt3s.marketing_program.config.section.stakeholder_types="Stakeholder types" +mt3s.marketing_program.config.section.stakeholder_types.help="The types offered for the stakeholders of the directory (Programs > Stakeholders), in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." +mt3s.marketing_program.config.stakeholder_phone_region="Default phone region" +mt3s.marketing_program.config.stakeholder_phone_region.tooltip="ISO country code (e.g. FR) used to read stakeholder phone numbers typed without a country prefix." ; Audience attributes and values (Settings > Configuration > Plan Settings). -mautic.program.config.section.audience_values="Audience values" -mautic.program.config.section.audience_values.help="The values offered for an audience's closed attributes (decision roles, tones), in this order. Give each value a name in each language; the default language is required." -mautic.program.config.section.audience_decision_roles="Decision-making roles" -mautic.program.config.section.audience_decision_roles.help="The roles offered for an audience's decision-making role (e.g. User, Influencer, Decision-Maker, Budget Holder), in this order." -mautic.program.config.section.audience_tones="Tones" -mautic.program.config.section.audience_tones.help="The tones offered for an audience's preferred tone (e.g. Formal, Casual, Data-driven, Emotional), in this order." -mautic.program.config.section.audience_attributes="Audience attributes" -mautic.program.config.section.audience_attributes.help="Switch the persona attributes on or off to define how your installs describe their audiences (b2b, b2c). A switched-off attribute disappears from the audience forms; the values entered so far are kept." +mt3s.marketing_program.config.section.audience_values="Audience values" +mt3s.marketing_program.config.section.audience_values.help="The values offered for an audience's closed attributes (decision roles, tones), in this order. Give each value a name in each language; the default language is required." +mt3s.marketing_program.config.section.audience_decision_roles="Decision-making roles" +mt3s.marketing_program.config.section.audience_decision_roles.help="The roles offered for an audience's decision-making role (e.g. User, Influencer, Decision-Maker, Budget Holder), in this order." +mt3s.marketing_program.config.section.audience_tones="Tones" +mt3s.marketing_program.config.section.audience_tones.help="The tones offered for an audience's preferred tone (e.g. Formal, Casual, Data-driven, Emotional), in this order." +mt3s.marketing_program.config.section.audience_attributes="Audience attributes" +mt3s.marketing_program.config.section.audience_attributes.help="Switch the persona attributes on or off to define how your installs describe their audiences (b2b, b2c). A switched-off attribute disappears from the audience forms; the values entered so far are kept." -; Audiences (the global directory, Programs > Audiences, and the initiative's Audiences tab). -mautic.program.field.audiences="Audiences" -mautic.program.audience.menu.index="Audiences" -mautic.program.utm_taxonomy.menu.index="UTM Taxonomies" -mautic.program.utm_taxonomy.header.index="UTM Taxonomies" -mautic.program.utm_taxonomy.onboarding.heading="Coming soon" -mautic.program.utm_taxonomy.onboarding.subheading="UTM Taxonomies will classify the UTM parameters of your programs." -mautic.program.utm_taxonomy.onboarding.copy="This page is a placeholder for now; its content is coming in a later version." -mautic.program.audience.header.index="Audiences" -mautic.program.audience.header.new="New audience" -mautic.program.audience.header.edit="Edit audience - %name%" -mautic.program.audience.error.notfound="No audience with the ID %id% was found." -mautic.program.audience.form.confirmdelete="Delete the audience, %name%? Its column is removed from every initiative that lists it; the initiatives themselves are kept." -mautic.program.audience.form.confirmbatchdelete="Delete the selected audiences? Their columns are removed from every initiative that lists them; the initiatives themselves are kept." -mautic.program.audience.onboarding.heading="No audiences yet" -mautic.program.audience.onboarding.subheading="Audiences are the people your initiatives aim at." -mautic.program.audience.onboarding.copy="Use the New button above. An audience is defined once and reused in as many initiatives as needed: an initiative's Audiences tab lists the directory's audiences with their priority in that initiative, and a message specific to it." -mautic.program.audience.field.pictogram="Pictogram" -mautic.program.audience.field.name="Name" -mautic.program.audience.field.type="Type" -mautic.program.audience.field.tagline="Tagline" -mautic.program.audience.field.priority="Priority" -mautic.program.audience.field.stages="Stages" -mautic.program.audience.field.segments="Segments" -mautic.program.audience.field.estimated_size="Estimated size" -mautic.program.audience.field.profile_criteria="Profile criteria" -mautic.program.audience.field.motivations="Motivations" -mautic.program.audience.field.barriers="Barriers" -mautic.program.audience.field.frustrations="Frustrations" -mautic.program.audience.field.triggers="Triggers" -mautic.program.audience.field.decision_role="Decision-making role" -mautic.program.audience.field.preferred_tones="Preferred tone" -mautic.program.audience.field.value_proposition="Value proposition" -mautic.program.audience.field.preferred_channels="Preferred channels" -mautic.program.audience.field.active="Active" -mautic.program.audience.field.plans="Assigned initiatives" -mautic.program.audience.active="Active" -mautic.program.audience.inactive="Inactive" -mautic.program.audience.active.help="An inactive audience is hidden from the initiative forms, but keeps its history on the initiatives it is already assigned to." -mautic.program.audience.no_plans="Not assigned to any initiative" -mautic.program.audience.add="Add audience" -mautic.program.audience.remove="Remove audience" -mautic.program.audience.drag="Drag to reorder" -mautic.program.audience.empty="No audiences assigned to this initiative yet." -mautic.program.audience.link_tab.help="Pick the initiative's audiences from the directory (Programs > Audiences), with their priority in this initiative and a message specific to it." -mautic.program.audience.type.fixed_note="The type is fixed (not admin-configured); the pictogram follows it." -mautic.program.audience.type.persona="Buyer Persona" -mautic.program.audience.type.icp="Account / ICP" -mautic.program.audience.type.broad_audience="Broad / Ad Audience" -mautic.program.audience.type.lifecycle_cohort="Lifecycle Cohort" -mautic.program.audience.type.partner_influencer="Partner / Influencer" -mautic.program.audience.priority.primary="Primary audience" -mautic.program.audience.priority.secondary="Secondary audience" -mautic.program.audience.priority.exclusion="Exclusion / Anti-Persona" -mautic.program.audience.channel.email="Email" -mautic.program.audience.channel.sms="SMS" -mautic.program.audience.channel.web="Web" -mautic.program.audience.channel.social_organic="Social organic" -mautic.program.audience.channel.paid_social="Paid social" -mautic.program.audience.channel.paid_search="Paid search" -mautic.program.audience.channel.events_webinar="Events / webinar" -mautic.program.audience.channel.outbound_sales="Outbound sales" -mautic.program.audience.channel.partners="Partners" -mautic.program.audience.segments.note="The segments are informational: they hold this audience's contacts in Mautic. Pick none, one or several; the list shows their names and their number of contacts." +; Audiences (the global directory, Programs > Audiences, and the program's Audiences tab). +mt3s.marketing_program.field.audiences="Audiences" +mt3s.marketing_program.audience.menu.index="Audiences" +mt3s.marketing_program.utm_taxonomy.header.index="UTM Taxonomies" +mt3s.marketing_program.utm_taxonomy.onboarding.heading="Coming soon" +mt3s.marketing_program.utm_taxonomy.onboarding.subheading="UTM Taxonomies will classify the UTM parameters of your programs." +mt3s.marketing_program.utm_taxonomy.onboarding.copy="This page is a placeholder for now; its content is coming in a later version." +mt3s.marketing_program.audience.header.index="Audiences" +mt3s.marketing_program.audience.header.new="New audience" +mt3s.marketing_program.audience.header.edit="Edit audience - %name%" +mt3s.marketing_program.audience.error.notfound="No audience with the ID %id% was found." +mt3s.marketing_program.audience.form.confirmdelete="Delete the audience, %name%? Its column is removed from every program that lists it; the programs themselves are kept." +mt3s.marketing_program.audience.form.confirmbatchdelete="Delete the selected audiences? Their columns are removed from every program that lists them; the programs themselves are kept." +mt3s.marketing_program.audience.onboarding.heading="No audiences yet" +mt3s.marketing_program.audience.onboarding.subheading="Audiences are the people your programs aim at." +mt3s.marketing_program.audience.onboarding.copy="Use the New button above. An audience is defined once and reused in as many programs as needed: an program's Audiences tab lists the directory's audiences with their priority in that program, and a message specific to it." +mt3s.marketing_program.audience.field.pictogram="Pictogram" +mt3s.marketing_program.audience.field.name="Name" +mt3s.marketing_program.audience.field.type="Type" +mt3s.marketing_program.audience.field.tagline="Tagline" +mt3s.marketing_program.audience.field.priority="Priority" +mt3s.marketing_program.audience.field.stages="Stages" +mt3s.marketing_program.audience.field.segments="Segments" +mt3s.marketing_program.audience.field.estimated_size="Estimated size" +mt3s.marketing_program.audience.field.profile_criteria="Profile criteria" +mt3s.marketing_program.audience.field.motivations="Motivations" +mt3s.marketing_program.audience.field.barriers="Barriers" +mt3s.marketing_program.audience.field.frustrations="Frustrations" +mt3s.marketing_program.audience.field.triggers="Triggers" +mt3s.marketing_program.audience.field.decision_role="Decision-making role" +mt3s.marketing_program.audience.field.preferred_tones="Preferred tone" +mt3s.marketing_program.audience.field.value_proposition="Value proposition" +mt3s.marketing_program.audience.field.preferred_channels="Preferred channels" +mt3s.marketing_program.audience.field.active="Active" +mt3s.marketing_program.audience.field.plans="Assigned programs" +mt3s.marketing_program.audience.active="Active" +mt3s.marketing_program.audience.inactive="Inactive" +mt3s.marketing_program.audience.active.help="An inactive audience is hidden from the program forms, but keeps its history on the programs it is already assigned to." +mt3s.marketing_program.audience.no_plans="Not assigned to any program" +mt3s.marketing_program.audience.add="Add audience" +mt3s.marketing_program.audience.remove="Remove audience" +mt3s.marketing_program.audience.drag="Drag to reorder" +mt3s.marketing_program.audience.empty="No audiences assigned to this program yet." +mt3s.marketing_program.audience.link_tab.help="Pick the program's audiences from the directory (Programs > Audiences), with their priority in this program and a message specific to it." +mt3s.marketing_program.audience.type.fixed_note="The type is fixed (not admin-configured); the pictogram follows it." +mt3s.marketing_program.audience.type.persona="Buyer Persona" +mt3s.marketing_program.audience.type.icp="Account / ICP" +mt3s.marketing_program.audience.type.broad_audience="Broad / Ad Audience" +mt3s.marketing_program.audience.type.lifecycle_cohort="Lifecycle Cohort" +mt3s.marketing_program.audience.type.partner_influencer="Partner / Influencer" +mt3s.marketing_program.audience.priority.primary="Primary audience" +mt3s.marketing_program.audience.priority.secondary="Secondary audience" +mt3s.marketing_program.audience.priority.exclusion="Exclusion / Anti-Persona" +mt3s.marketing_program.audience.channel.email="Email" +mt3s.marketing_program.audience.channel.sms="SMS" +mt3s.marketing_program.audience.channel.web="Web" +mt3s.marketing_program.audience.channel.social_organic="Social organic" +mt3s.marketing_program.audience.channel.paid_social="Paid social" +mt3s.marketing_program.audience.channel.paid_search="Paid search" +mt3s.marketing_program.audience.channel.events_webinar="Events / webinar" +mt3s.marketing_program.audience.channel.outbound_sales="Outbound sales" +mt3s.marketing_program.audience.channel.partners="Partners" +mt3s.marketing_program.audience.segments.note="The segments are informational: they hold this audience's contacts in Mautic. Pick none, one or several; the list shows their names and their number of contacts." ; Which audience persona attributes are offered (one toggle each), and the values of the closed ones. -mautic.program.audience.attribute.tagline="Tagline" -mautic.program.audience.attribute.profile="Profile criteria" -mautic.program.audience.attribute.motivations="Motivations" -mautic.program.audience.attribute.barriers="Barriers" -mautic.program.audience.attribute.frustrations="Frustrations (replaces Pain points)" -mautic.program.audience.attribute.triggers="Triggers" -mautic.program.audience.attribute.decision_role="Decision-making role" -mautic.program.audience.attribute.tones="Preferred tone" -mautic.program.audience.attribute.channels="Preferred channels" -mautic.program.audience.attribute.stages="Stages" -mautic.program.audience.attribute.size="Estimated size" +mt3s.marketing_program.audience.attribute.tagline="Tagline" +mt3s.marketing_program.audience.attribute.profile="Profile criteria" +mt3s.marketing_program.audience.attribute.motivations="Motivations" +mt3s.marketing_program.audience.attribute.barriers="Barriers" +mt3s.marketing_program.audience.attribute.frustrations="Frustrations (replaces Pain points)" +mt3s.marketing_program.audience.attribute.triggers="Triggers" +mt3s.marketing_program.audience.attribute.decision_role="Decision-making role" +mt3s.marketing_program.audience.attribute.tones="Preferred tone" +mt3s.marketing_program.audience.attribute.channels="Preferred channels" +mt3s.marketing_program.audience.attribute.stages="Stages" +mt3s.marketing_program.audience.attribute.size="Estimated size" ; Plan tab tables (detail page): filter box and click-to-sort headers. -mautic.program.filter.placeholder="Filter…" -mautic.program.filter.no_match="No rows match the filter." -mautic.program.filter.sort_hint="Click to sort" +mt3s.marketing_program.filter.placeholder="Filter…" +mt3s.marketing_program.filter.no_match="No rows match the filter." +mt3s.marketing_program.filter.sort_hint="Click to sort" ; Long description item texts, clamped to 10 lines (Insights tab, detail page). -mautic.program.read_more.more="Read more" -mautic.program.read_more.less="Show less" +mt3s.marketing_program.read_more.more="Read more" +mt3s.marketing_program.read_more.less="Show less" -mautic.program.header.index="Initiatives" -mautic.program.header.new="New initiative" -mautic.program.header.edit="Edit initiative - %name%" +mt3s.marketing_program.header.index="Marketing Programs" +mt3s.marketing_program.header.new="New marketing program" +mt3s.marketing_program.header.edit="Edit marketing program - %name%" -mautic.program.onboarding.heading="No initiatives yet" -mautic.program.onboarding.subheading="Create your first initiative to get started." -mautic.program.onboarding.copy="Use the New button above to create an initiative, then track its status, dates and budget here." +mt3s.marketing_program.onboarding.heading="No programs yet" +mt3s.marketing_program.onboarding.subheading="Create your first program to get started." +mt3s.marketing_program.onboarding.copy="Use the New button above to create an program, then track its status, dates and budget here." -; Used by core's standard CRUD controller and buttons (translation base mautic.program). -mautic.program.error.notfound="No initiative with the ID %id% was found." -mautic.program.form.confirmdelete="Delete the initiative, %name%? Its objectives and tasks are deleted too." -mautic.program.form.confirmbatchdelete="Delete the selected initiatives? Their objectives and tasks are deleted too." +; Used by core's standard CRUD controller and buttons (translation base mt3s.marketing_program). +mt3s.marketing_program.error.notfound="No program with the ID %id% was found." +mt3s.marketing_program.form.confirmdelete="Delete the program, %name%? Its objectives and tasks are deleted too." +mt3s.marketing_program.form.confirmbatchdelete="Delete the selected programs? Their objectives and tasks are deleted too." ; Category type label (Settings > Categories). -mautic.program.category.type="Initiative" +mt3s.marketing_program.category.type="MT3S Marketing Program" ; Settings > Roles. -mautic.program.permissions.header="Program Permissions" -mautic.program.permissions.initiatives="Initiatives - User has access to" -mautic.program.permissions.tasks="Tasks - User has access to" -mautic.program.permissions.stakeholders="Stakeholders - User has access to" -mautic.program.permissions.audiences="Audiences - User has access to" -mautic.program.permissions.itemtypes="Item types - User has access to" +mt3s.marketing_program.permissions.header="Marketing Program Permissions" +mt3s.marketing_program.permissions.programs="Programs - User has access to" +mt3s.marketing_program.permissions.tasks="Tasks - User has access to" +mt3s.marketing_program.permissions.stakeholders="Stakeholders - User has access to" +mt3s.marketing_program.permissions.audiences="Audiences - User has access to" +mt3s.marketing_program.permissions.itemtypes="Item types - User has access to" ; The Item types page (Programs > Item types). -mautic.program.item_type.header.index="Item types" -mautic.program.item_type.page.description="The types of the plugin's items: insights, allocations, objectives, tasks, stakeholders, and the values offered for an audience's decision roles and tones. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." -mautic.program.item_type.not_writable="The configuration file (config/local.php) is not writable: the type lists can be changed, but not saved." +mt3s.marketing_program.item_type.header.index="Item types" +mt3s.marketing_program.item_type.page.description="The types of the plugin's items: insights, allocations, objectives, tasks, stakeholders, and the values offered for an audience's decision roles and tones. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." +mt3s.marketing_program.item_type.not_writable="The configuration file (config/local.php) is not writable: the type lists can be changed, but not saved." -; Tasks (Programs > Tasks). Translation base mautic.program.task. -mautic.program.task.menu.index="Tasks" -mautic.program.task.header.index="Tasks" -mautic.program.task.header.new="New task" -mautic.program.task.header.edit="Edit task - %name%" -mautic.program.task.error.notfound="No task with the ID %id% was found." -mautic.program.task.form.confirmdelete="Delete the task, %name%? Its dependencies on other tasks and its RACI assignments are removed too." -mautic.program.task.form.confirmbatchdelete="Delete the selected tasks? Their dependencies on other tasks and their RACI assignments are removed too." -mautic.program.task.onboarding.heading="No tasks yet" -mautic.program.task.onboarding.subheading="Tasks break an initiative down into work to do." -mautic.program.task.onboarding.copy="Use the New button above, or Add task on an initiative's Tasks tab. A task belongs to one initiative, may depend on other tasks of that initiative (start to start, end to end and so on), and is assigned to the initiative's stakeholders through RACI roles." -mautic.program.task.field.name="Name" -mautic.program.task.field.type="Type" -mautic.program.task.field.pictogram="Pictogram" -mautic.program.task.field.description="Description" -mautic.program.task.field.initiative="Initiative" -mautic.program.task.field.kind="Kind" -mautic.program.task.field.start_date="Start date" -mautic.program.task.field.end_date="End date" -mautic.program.task.field.status="Status" -mautic.program.task.field.definition_of_done="Definition of Done" -mautic.program.task.field.planned_work="Planned work" -mautic.program.task.field.dependencies="Dependencies" -mautic.program.task.field.raci="RACI" -mautic.program.task.status.new="New" -mautic.program.task.status.todo="To do" -mautic.program.task.status.in_progress="In progress" -mautic.program.task.status.done="Done" -mautic.program.task.kind.task="Task" -mautic.program.task.kind.milestone="Milestone" -mautic.program.task.kind.milestone_short="M" -mautic.program.task.kind.phase="Phase" -mautic.program.task.kind.phase_short="P" -mautic.program.task.kind.task_short="T" -mautic.program.task.kind.phase_status_note="A phase has no status of its own: its state comes from its tasks." -mautic.program.task.kind.milestone_end_note="A milestone ends on its start date: the end date is the start date." -mautic.program.task.planned_work_unit="hours" -mautic.program.task.dependency.add="Add dependency" -mautic.program.task.dependency.remove="Remove dependency" -mautic.program.task.dependency.drag="Drag to reorder" -mautic.program.task.dependency.empty="No dependencies yet." -mautic.program.task.dependency.field.depends_on="Depends on" -mautic.program.task.dependency.field.type="Relation" -mautic.program.task.dependency_type.end_to_start="End to Start" -mautic.program.task.dependency_type.end_to_end="End to End" -mautic.program.task.dependency_type.start_to_start="Start to Start" -mautic.program.task.dependency_type.start_to_end="Start to End" -mautic.program.task.raci.add="Add RACI role" -mautic.program.task.raci.remove="Remove" -mautic.program.task.raci.drag="Drag to reorder" -mautic.program.task.raci.empty="No RACI assignments yet." -mautic.program.task.raci.field.role="Role" -mautic.program.task.raci.field.stakeholders="Stakeholders" -mautic.program.task.raci_role.responsible="Responsible" -mautic.program.task.raci_role.accountable="Accountable" -mautic.program.task.raci_role.consulted="Consulted" -mautic.program.task.raci_role.informed="Informed" -mautic.program.task.add="Add task" -mautic.program.task.manage_from_initiative_page="Add and edit tasks from the initiative's page, after saving." +; Tasks (Programs > Tasks). Translation base mt3s.marketing_program.task. +mt3s.marketing_program.task.menu.index="Tasks" +mt3s.marketing_program.task.header.index="Tasks" +mt3s.marketing_program.task.header.new="New task" +mt3s.marketing_program.task.header.edit="Edit task - %name%" +mt3s.marketing_program.task.error.notfound="No task with the ID %id% was found." +mt3s.marketing_program.task.form.confirmdelete="Delete the task, %name%? Its dependencies on other tasks and its RACI assignments are removed too." +mt3s.marketing_program.task.form.confirmbatchdelete="Delete the selected tasks? Their dependencies on other tasks and their RACI assignments are removed too." +mt3s.marketing_program.task.onboarding.heading="No tasks yet" +mt3s.marketing_program.task.onboarding.subheading="Tasks break an program down into work to do." +mt3s.marketing_program.task.onboarding.copy="Use the New button above, or Add task on an program's Tasks tab. A task belongs to one program, may depend on other tasks of that program (start to start, end to end and so on), and is assigned to the program's stakeholders through RACI roles." +mt3s.marketing_program.task.field.name="Name" +mt3s.marketing_program.task.field.type="Type" +mt3s.marketing_program.task.field.pictogram="Pictogram" +mt3s.marketing_program.task.field.description="Description" +mt3s.marketing_program.task.field.program="MT3S Marketing Program" +mt3s.marketing_program.task.field.kind="Kind" +mt3s.marketing_program.task.field.start_date="Start date" +mt3s.marketing_program.task.field.end_date="End date" +mt3s.marketing_program.task.field.status="Status" +mt3s.marketing_program.task.field.definition_of_done="Definition of Done" +mt3s.marketing_program.task.field.planned_work="Planned work" +mt3s.marketing_program.task.field.dependencies="Dependencies" +mt3s.marketing_program.task.field.raci="RACI" +mt3s.marketing_program.task.status.new="New" +mt3s.marketing_program.task.status.todo="To do" +mt3s.marketing_program.task.status.in_progress="In progress" +mt3s.marketing_program.task.status.done="Done" +mt3s.marketing_program.task.kind.task="Task" +mt3s.marketing_program.task.kind.milestone="Milestone" +mt3s.marketing_program.task.kind.milestone_short="M" +mt3s.marketing_program.task.kind.phase="Phase" +mt3s.marketing_program.task.kind.phase_short="P" +mt3s.marketing_program.task.kind.task_short="T" +mt3s.marketing_program.task.kind.phase_status_note="A phase has no status of its own: its state comes from its tasks." +mt3s.marketing_program.task.kind.milestone_end_note="A milestone ends on its start date: the end date is the start date." +mt3s.marketing_program.task.planned_work_unit="hours" +mt3s.marketing_program.task.dependency.add="Add dependency" +mt3s.marketing_program.task.dependency.remove="Remove dependency" +mt3s.marketing_program.task.dependency.drag="Drag to reorder" +mt3s.marketing_program.task.dependency.empty="No dependencies yet." +mt3s.marketing_program.task.dependency.field.depends_on="Depends on" +mt3s.marketing_program.task.dependency.field.type="Relation" +mt3s.marketing_program.task.dependency_type.end_to_start="End to Start" +mt3s.marketing_program.task.dependency_type.end_to_end="End to End" +mt3s.marketing_program.task.dependency_type.start_to_start="Start to Start" +mt3s.marketing_program.task.dependency_type.start_to_end="Start to End" +mt3s.marketing_program.task.raci.add="Add RACI role" +mt3s.marketing_program.task.raci.remove="Remove" +mt3s.marketing_program.task.raci.drag="Drag to reorder" +mt3s.marketing_program.task.raci.empty="No RACI assignments yet." +mt3s.marketing_program.task.raci.field.role="Role" +mt3s.marketing_program.task.raci.field.stakeholders="Stakeholders" +mt3s.marketing_program.task.raci_role.responsible="Responsible" +mt3s.marketing_program.task.raci_role.accountable="Accountable" +mt3s.marketing_program.task.raci_role.consulted="Consulted" +mt3s.marketing_program.task.raci_role.informed="Informed" +mt3s.marketing_program.task.add="Add task" +mt3s.marketing_program.task.manage_from_program_page="Add and edit tasks from the program's page, after saving." -mautic.program.field.name="Name" -mautic.program.field.status="Status" -mautic.program.field.owner="Owner" -mautic.program.field.start_date="Start date" -mautic.program.field.end_date="End date" -mautic.program.field.completed_at="Completed at" -mautic.program.field.budget_planned="Planned budget" -mautic.program.field.version="Version" -mautic.program.field.objectives="Objectives" -mautic.program.field.description_items="Description items" -mautic.program.field.allocation_items="Allocation items" +mt3s.marketing_program.field.name="Name" +mt3s.marketing_program.field.status="Status" +mt3s.marketing_program.field.owner="Owner" +mt3s.marketing_program.field.start_date="Start date" +mt3s.marketing_program.field.end_date="End date" +mt3s.marketing_program.field.completed_at="Completed at" +mt3s.marketing_program.field.budget_planned="Planned budget" +mt3s.marketing_program.field.version="Version" +mt3s.marketing_program.field.objectives="Objectives" +mt3s.marketing_program.field.description_items="Description items" +mt3s.marketing_program.field.allocation_items="Allocation items" -mautic.program.objective.field.title="Title" -mautic.program.objective.field.type="Type" -mautic.program.objective.field.pictogram="Pictogram" -mautic.program.objective.field.name="Name" -mautic.program.objective.field.priority="Priority" -mautic.program.objective.field.description="Description" -mautic.program.objective.field.is_achieved="Achieved" -mautic.program.objective.add="Add objective" -mautic.program.objective.remove="Remove objective" -mautic.program.objective.drag="Drag to reorder" -mautic.program.objective.empty="No objectives yet." -mautic.program.objective.no_types="No objective types are set up yet. They can be added in Programs > Item types." -mautic.program.objective.progress="%achieved% of %total% achieved" -mautic.program.objective.achieved="Achieved" -mautic.program.objective.not_achieved="Not achieved" +mt3s.marketing_program.objective.field.title="Title" +mt3s.marketing_program.objective.field.type="Type" +mt3s.marketing_program.objective.field.pictogram="Pictogram" +mt3s.marketing_program.objective.field.name="Name" +mt3s.marketing_program.objective.field.priority="Priority" +mt3s.marketing_program.objective.field.description="Description" +mt3s.marketing_program.objective.field.is_achieved="Achieved" +mt3s.marketing_program.objective.add="Add objective" +mt3s.marketing_program.objective.remove="Remove objective" +mt3s.marketing_program.objective.drag="Drag to reorder" +mt3s.marketing_program.objective.empty="No objectives yet." +mt3s.marketing_program.objective.no_types="No objective types are set up yet. They can be added in Programs > Item types." +mt3s.marketing_program.objective.progress="%achieved% of %total% achieved" +mt3s.marketing_program.objective.achieved="Achieved" +mt3s.marketing_program.objective.not_achieved="Not achieved" -mautic.program.owner.none="No owner" +mt3s.marketing_program.owner.none="No owner" -mautic.program.status.draft="Draft" -mautic.program.status.planned="Planned" -mautic.program.status.active="Active" -mautic.program.status.paused="Paused" -mautic.program.status.completed="Completed" -mautic.program.status.archived="Archived" +mt3s.marketing_program.status.draft="Draft" +mt3s.marketing_program.status.planned="Planned" +mt3s.marketing_program.status.active="Active" +mt3s.marketing_program.status.paused="Paused" +mt3s.marketing_program.status.completed="Completed" +mt3s.marketing_program.status.archived="Archived" -; Description items (the initiative's Insights tab). -mautic.program.description_item.field.type="Type" -mautic.program.description_item.field.description="Description" -mautic.program.description_item.add="Add description item" -mautic.program.description_item.remove="Remove description item" -mautic.program.description_item.drag="Drag to reorder" -mautic.program.description_item.empty="No description items yet." -mautic.program.description_item.no_types="No insights types are set up yet. They can be added in Programs > Item types." -mautic.program.description_item.type.unknown="Unknown type (%key%)" +; Description items (the program's Insights tab). +mt3s.marketing_program.description_item.field.type="Type" +mt3s.marketing_program.description_item.field.description="Description" +mt3s.marketing_program.description_item.add="Add description item" +mt3s.marketing_program.description_item.remove="Remove description item" +mt3s.marketing_program.description_item.drag="Drag to reorder" +mt3s.marketing_program.description_item.empty="No description items yet." +mt3s.marketing_program.description_item.no_types="No insights types are set up yet. They can be added in Programs > Item types." +mt3s.marketing_program.description_item.type.unknown="Unknown type (%key%)" ; Settings > Configuration > Plan. Core builds the tab title key from the form alias. -mautic.config.tab.programconfig="Program Settings" -mautic.program.config.description="Settings of the Program plugin." -mautic.program.config.section.description_item_types="Insights types" -mautic.program.config.section.description_item_types.help="The types offered for the items of an initiative's Insights tab, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." -mautic.program.config.types.empty="No types yet." -mautic.program.config.type.add="Add type" -mautic.program.config.type.remove="Remove type" -mautic.program.config.type.language="Language" -mautic.program.config.type.name="Name" -mautic.program.config.type.description="Description" +mautic.config.tab.mt3smarketingprogramconfig="Marketing Program Settings" +mt3s.marketing_program.config.description="Settings of the Program plugin." +mt3s.marketing_program.config.section.description_item_types="Insights types" +mt3s.marketing_program.config.section.description_item_types.help="The types offered for the items of an program's Insights tab, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." +mt3s.marketing_program.config.types.empty="No types yet." +mt3s.marketing_program.config.type.add="Add type" +mt3s.marketing_program.config.type.remove="Remove type" +mt3s.marketing_program.config.type.language="Language" +mt3s.marketing_program.config.type.name="Name" +mt3s.marketing_program.config.type.description="Description" -; Allocation items (the initiative's Allocations tab). -mautic.program.allocation_item.field.type="Type" -mautic.program.allocation_item.field.pictogram="Pictogram" -mautic.program.allocation_item.field.name="Name" -mautic.program.allocation_item.field.description="Description" -mautic.program.allocation_item.field.planned_cost="Planned cost" -mautic.program.allocation_item.field.real_cost="Real cost" -mautic.program.allocation_item.add="Add allocation item" -mautic.program.allocation_item.remove="Remove allocation item" -mautic.program.allocation_item.drag="Drag to reorder" -mautic.program.allocation_item.empty="No allocation items yet." -mautic.program.allocation_item.no_types="No allocation item types are set up yet. They can be added in Programs > Item types." -mautic.program.allocation.total="Total" +; Allocation items (the program's Allocations tab). +mt3s.marketing_program.allocation_item.field.type="Type" +mt3s.marketing_program.allocation_item.field.pictogram="Pictogram" +mt3s.marketing_program.allocation_item.field.name="Name" +mt3s.marketing_program.allocation_item.field.description="Description" +mt3s.marketing_program.allocation_item.field.planned_cost="Planned cost" +mt3s.marketing_program.allocation_item.field.real_cost="Real cost" +mt3s.marketing_program.allocation_item.add="Add allocation item" +mt3s.marketing_program.allocation_item.remove="Remove allocation item" +mt3s.marketing_program.allocation_item.drag="Drag to reorder" +mt3s.marketing_program.allocation_item.empty="No allocation items yet." +mt3s.marketing_program.allocation_item.no_types="No allocation item types are set up yet. They can be added in Programs > Item types." +mt3s.marketing_program.allocation.total="Total" ; Plan page header: total costs of the allocation items, in the general currency. -mautic.program.header.total_planned="Planned: %amount% %currency%" -mautic.program.header.total_planned.tooltip="Total planned cost of the allocation items" -mautic.program.header.total_real="Real: %amount% %currency%" -mautic.program.header.total_real.tooltip="Total real cost of the allocation items, within the planned cost" -mautic.program.header.total_real.over="Total real cost of the allocation items, above the planned cost" +mt3s.marketing_program.header.total_planned="Planned: %amount% %currency%" +mt3s.marketing_program.header.total_planned.tooltip="Total planned cost of the allocation items" +mt3s.marketing_program.header.total_real="Real: %amount% %currency%" +mt3s.marketing_program.header.total_real.tooltip="Total real cost of the allocation items, within the planned cost" +mt3s.marketing_program.header.total_real.over="Total real cost of the allocation items, above the planned cost" -mautic.program.task.save_initiative_first="Save the initiative first, then add tasks from its page." +mt3s.marketing_program.task.save_program_first="Save the program first, then add tasks from its page." -mautic.program.config.section.allocation_item_types="Allocation item types" -mautic.program.config.section.allocation_item_types.help="The types offered for the cost lines of an initiative's Allocations tab, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." +mt3s.marketing_program.config.section.allocation_item_types="Allocation item types" +mt3s.marketing_program.config.section.allocation_item_types.help="The types offered for the cost lines of an program's Allocations tab, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." ; Objective types (Settings > Configuration > Plan Settings). -mautic.program.config.section.objective_types="Objective types" -mautic.program.config.section.objective_types.help="The types offered for the objectives of an initiative's Objectives tab, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." +mt3s.marketing_program.config.section.objective_types="Objective types" +mt3s.marketing_program.config.section.objective_types.help="The types offered for the objectives of an program's Objectives tab, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." ; Task types (Settings > Configuration > Plan Settings). -mautic.program.config.section.task_types="Task types" -mautic.program.config.section.task_types.help="The types offered for tasks, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." +mt3s.marketing_program.config.section.task_types="Task types" +mt3s.marketing_program.config.section.task_types.help="The types offered for tasks, in this order. Give each type a name and a description in each language, and a pictogram; the default language is required. Users see their own language, or the default language when it's empty." -mautic.program.description_item.field.pictogram="Pictogram" -mautic.program.config.section.general="General" -mautic.program.config.currency="Currency" -mautic.program.config.currency.tooltip="The currency of every amount in initiatives: budgets, costs and totals." -mautic.program.config.currency.help="Users don't choose a currency: every budget, cost and total is in this currency. Changing it doesn't convert existing amounts." -mautic.program.config.type.icon="Pictogram" -mautic.program.config.type.icon.none="No pictogram" +mt3s.marketing_program.description_item.field.pictogram="Pictogram" +mt3s.marketing_program.config.section.general="General" +mt3s.marketing_program.config.currency="Currency" +mt3s.marketing_program.config.currency.tooltip="The currency of every amount in programs: budgets, costs and totals." +mt3s.marketing_program.config.currency.help="Users don't choose a currency: every budget, cost and total is in this currency. Changing it doesn't convert existing amounts." +mt3s.marketing_program.config.type.icon="Pictogram" +mt3s.marketing_program.config.type.icon.none="No pictogram" diff --git a/Translations/en_US/validators.ini b/Translations/en_US/validators.ini index 8f18731..7142bb4 100644 --- a/Translations/en_US/validators.ini +++ b/Translations/en_US/validators.ini @@ -1,23 +1,23 @@ -mautic.program.owner.required="An owner is required." -mautic.program.end_date.before_start_date="The end date must be on or after the start date." -mautic.program.version.range="The version must be a whole number from 1 to 99." -mautic.program.objective.title.required="An objective needs a title." -mautic.program.objective.type.required="Choose a type." -mautic.program.objective.priority.range="The priority must be a whole number from 1 to 99." -mautic.program.audience.name.required="An audience needs a name." -mautic.program.audience.estimated_size.invalid="The estimated size must be 0 or more." -mautic.program.audience_link.audience.required="Choose an audience." -mautic.program.stakeholder.email.invalid="This email address is not valid." -mautic.program.stakeholder_link.stakeholder.required="Choose a stakeholder." -mautic.program.task.initiative.required="A task must be assigned to an initiative." -mautic.program.task.type.required="Choose a type." -mautic.program.task.planned_work.invalid="The planned work must be a whole number of hours, 0 or more." -mautic.program.task.planned_work.range="The planned work must be a whole number of hours from 0 to %max%." -mautic.program.task.milestone.end_enslaved="A milestone ends on its start date." -mautic.program.task.dependency.self="A task can't depend on itself." -mautic.program.task.dependency.cycle="A task can't depend on a task that (directly or not) depends on it." -mautic.program.task.dependency.other_plan="A task can only depend on tasks of the same initiative." -mautic.program.description_item.type.required="Choose a type." -mautic.program.config.type.name.required="A type needs a name in the default language." -mautic.program.config.type.in_use="These types are in use and can't be removed: %types%. Change the items or tasks that use them to another type first." -mautic.program.allocation_item.type.required="Choose a type." +mt3s.marketing_program.owner.required="An owner is required." +mt3s.marketing_program.end_date.before_start_date="The end date must be on or after the start date." +mt3s.marketing_program.version.range="The version must be a whole number from 1 to 99." +mt3s.marketing_program.objective.title.required="An objective needs a title." +mt3s.marketing_program.objective.type.required="Choose a type." +mt3s.marketing_program.objective.priority.range="The priority must be a whole number from 1 to 99." +mt3s.marketing_program.audience.name.required="An audience needs a name." +mt3s.marketing_program.audience.estimated_size.invalid="The estimated size must be 0 or more." +mt3s.marketing_program.audience_link.audience.required="Choose an audience." +mt3s.marketing_program.stakeholder.email.invalid="This email address is not valid." +mt3s.marketing_program.stakeholder_link.stakeholder.required="Choose a stakeholder." +mt3s.marketing_program.task.program.required="A task must be assigned to an program." +mt3s.marketing_program.task.type.required="Choose a type." +mt3s.marketing_program.task.planned_work.invalid="The planned work must be a whole number of hours, 0 or more." +mt3s.marketing_program.task.planned_work.range="The planned work must be a whole number of hours from 0 to %max%." +mt3s.marketing_program.task.milestone.end_enslaved="A milestone ends on its start date." +mt3s.marketing_program.task.dependency.self="A task can't depend on itself." +mt3s.marketing_program.task.dependency.cycle="A task can't depend on a task that (directly or not) depends on it." +mt3s.marketing_program.task.dependency.other_plan="A task can only depend on tasks of the same program." +mt3s.marketing_program.description_item.type.required="Choose a type." +mt3s.marketing_program.config.type.name.required="A type needs a name in the default language." +mt3s.marketing_program.config.type.in_use="These types are in use and can't be removed: %types%. Change the items or tasks that use them to another type first." +mt3s.marketing_program.allocation_item.type.required="Choose a type." diff --git a/Twig/MT3SMarketingProgramExtension.php b/Twig/MT3SMarketingProgramExtension.php new file mode 100644 index 0000000..6ae9a0e --- /dev/null +++ b/Twig/MT3SMarketingProgramExtension.php @@ -0,0 +1,151 @@ + (segment id => count) + * mt3s_marketing_program_audience_segment_count(segmentId) the contact count of one segment + * + * Filters: + * mt3s_marketing_program_linkify(text) plain text as HTML, with the URLs in it as links opening in a new tab + * mt3s_marketing_program_audience_type_icon(value) the pictogram of an AudienceType case value ('persona'…) + */ +class MT3SMarketingProgramExtension extends AbstractExtension +{ + public function __construct( + private ItemTypeProvider $typeProvider, + private CurrencyProvider $currencyProvider, + private AudienceAttributes $audienceAttributes, + private AudienceRepository $audienceRepository, + ) { + } + + public function getFilters(): array + { + return [ + // The filter escapes everything itself, so its output is safe for templates. + new TwigFilter('mt3s_marketing_program_linkify', fn (?string $text): string => self::linkify($text), ['is_safe' => ['html']]), + new TwigFilter('mt3s_marketing_program_audience_type_icon', fn ($value): string => self::audienceTypeIcon($value)), + ]; + } + + public function getFunctions(): array + { + return [ + new TwigFunction('mt3s_marketing_program_item_type_name', fn (string $kind, ?string $key): ?string => $this->typeProvider->getName($kind, $key)), + new TwigFunction('mt3s_marketing_program_item_type_description', fn (string $kind, ?string $key): ?string => $this->typeProvider->getDescription($kind, $key)), + new TwigFunction('mt3s_marketing_program_item_type_icon', fn (string $kind, ?string $key): ?string => $this->typeProvider->getIcon($kind, $key)), + new TwigFunction('mt3s_marketing_program_currency', fn (): string => $this->currencyProvider->getCurrency()), + new TwigFunction('mt3s_marketing_program_money', fn ($amount): string => number_format((float) $amount, 2)), + new TwigFunction('mt3s_marketing_program_audience_channel_label', fn (string $key): string => Audience::CHANNELS[$key] ?? $key), + new TwigFunction('mt3s_marketing_program_audience_decision_role_label', fn (?string $key): ?string => $this->typeProvider->getName(ItemTypeProvider::KIND_AUDIENCE_DECISION_ROLE, $key)), + new TwigFunction('mt3s_marketing_program_audience_tone_label', fn (?string $key): ?string => $this->typeProvider->getName(ItemTypeProvider::KIND_AUDIENCE_TONE, $key)), + new TwigFunction('mt3s_marketing_program_audience_attributes', fn (): array => array_keys(AudienceAttributes::ATTRIBUTES)), + new TwigFunction('mt3s_marketing_program_audience_attribute_toggle', fn (string $attribute): string => AudienceAttributes::toggleParameter($attribute)), + new TwigFunction('mt3s_marketing_program_audience_segment_counts', fn (iterable $items): array => $this->audienceRepository->getSegmentContactCountsForAudiences( + array_map( + static fn (Audience $audience): int => $audience->getId(), + is_array($items) ? $items : iterator_to_array($items) + ) + )), + new TwigFunction('mt3s_marketing_program_audience_segment_count', fn (int $leadlistId): int => $this->audienceRepository->getSegmentContactCount($leadlistId)), + ]; + } + + /** + * The pictogram of an audience type. Accepts the enum itself (what the form's and entity's value + * holds) or its backing value ('persona'); null defaults to Persona, the form's default. + */ + private static function audienceTypeIcon($value): string + { + if ($value instanceof AudienceType) { + return $value->getIcon(); + } + + try { + return AudienceType::from((string) ($value ?? 'persona'))->getIcon(); + } catch (\ValueError) { + return ''; + } + } + + /** + * Plain text as HTML, with the URLs in it (https://… and www.…) turned into links that open in a + * new tab. For the description fields of plans and tasks, which stay plain text: typing or pasting + * a URL is enough, no editor needed. Everything is escaped here, so no HTML can be injected. + */ + public static function linkify(?string $text): string + { + if (null === $text || '' === $text) { + return ''; + } + + // One capture group: preg_split then alternates plain text (even) and URLs (odd). + $parts = preg_split('~((?:https?://|(?"\']+)~i', $text, -1, PREG_SPLIT_DELIM_CAPTURE); + $html = ''; + + foreach ($parts as $i => $part) { + $html .= $i % 2 ? self::urlAnchor($part) : htmlspecialchars($part, ENT_QUOTES, 'UTF-8'); + } + + return $html; + } + + /** + * One URL as a link. Sentence punctuation that follows the URL (".", ")", "!", …) stays outside + * the link, and a bare "www." address gets the https:// prefix. + */ + private static function urlAnchor(string $url): string + { + $after = ''; + + while ('' !== $url && str_contains('.,;:!?', substr($url, -1))) { + $after = substr($url, -1).$after; + $url = substr($url, 0, -1); + } + + // An unbalanced closing parenthesis belongs to the sentence, not the URL. + if (str_ends_with($url, ')') && !str_contains($url, '(')) { + $after = ')'.$after; + $url = substr($url, 0, -1); + } + + // Only a prefix is left ("www.", "https://"): not a link after all. + if ('' === $url || 'www.' === $url || 'http://' === $url || 'https://' === $url) { + return htmlspecialchars($url.$after, ENT_QUOTES, 'UTF-8'); + } + + $href = preg_match('~^https?://~i', $url) ? $url : 'https://'.$url; + + return sprintf( + '%s%s', + htmlspecialchars($href, ENT_QUOTES, 'UTF-8'), + htmlspecialchars($url, ENT_QUOTES, 'UTF-8'), + htmlspecialchars($after, ENT_QUOTES, 'UTF-8') + ); + } +} diff --git a/Twig/ProgramExtension.php b/Twig/ProgramExtension.php deleted file mode 100644 index 04fd815..0000000 --- a/Twig/ProgramExtension.php +++ /dev/null @@ -1,151 +0,0 @@ - (segment id => count) - * program_audience_segment_count(segmentId) the contact count of one segment - * - * Filters: - * program_linkify(text) plain text as HTML, with the URLs in it as links opening in a new tab - * program_audience_type_icon(value) the pictogram of an AudienceType case value ('persona'…) - */ -class ProgramExtension extends AbstractExtension -{ - public function __construct( - private ItemTypeProvider $typeProvider, - private CurrencyProvider $currencyProvider, - private AudienceAttributes $audienceAttributes, - private AudienceRepository $audienceRepository, - ) { - } - - public function getFilters(): array - { - return [ - // The filter escapes everything itself, so its output is safe for templates. - new TwigFilter('program_linkify', fn (?string $text): string => self::linkify($text), ['is_safe' => ['html']]), - new TwigFilter('program_audience_type_icon', fn ($value): string => self::audienceTypeIcon($value)), - ]; - } - - public function getFunctions(): array - { - return [ - new TwigFunction('program_item_type_name', fn (string $kind, ?string $key): ?string => $this->typeProvider->getName($kind, $key)), - new TwigFunction('program_item_type_description', fn (string $kind, ?string $key): ?string => $this->typeProvider->getDescription($kind, $key)), - new TwigFunction('program_item_type_icon', fn (string $kind, ?string $key): ?string => $this->typeProvider->getIcon($kind, $key)), - new TwigFunction('program_currency', fn (): string => $this->currencyProvider->getCurrency()), - new TwigFunction('program_money', fn ($amount): string => number_format((float) $amount, 2)), - new TwigFunction('program_audience_channel_label', fn (string $key): string => Audience::CHANNELS[$key] ?? $key), - new TwigFunction('program_audience_decision_role_label', fn (?string $key): ?string => $this->typeProvider->getName(ItemTypeProvider::KIND_AUDIENCE_DECISION_ROLE, $key)), - new TwigFunction('program_audience_tone_label', fn (?string $key): ?string => $this->typeProvider->getName(ItemTypeProvider::KIND_AUDIENCE_TONE, $key)), - new TwigFunction('program_audience_attributes', fn (): array => array_keys(AudienceAttributes::ATTRIBUTES)), - new TwigFunction('program_audience_attribute_toggle', fn (string $attribute): string => AudienceAttributes::toggleParameter($attribute)), - new TwigFunction('program_audience_segment_counts', fn (iterable $items): array => $this->audienceRepository->getSegmentContactCountsForAudiences( - array_map( - static fn (Audience $audience): int => $audience->getId(), - is_array($items) ? $items : iterator_to_array($items) - ) - )), - new TwigFunction('program_audience_segment_count', fn (int $leadlistId): int => $this->audienceRepository->getSegmentContactCount($leadlistId)), - ]; - } - - /** - * The pictogram of an audience type. Accepts the enum itself (what the form's and entity's value - * holds) or its backing value ('persona'); null defaults to Persona, the form's default. - */ - private static function audienceTypeIcon($value): string - { - if ($value instanceof AudienceType) { - return $value->getIcon(); - } - - try { - return AudienceType::from((string) ($value ?? 'persona'))->getIcon(); - } catch (\ValueError) { - return ''; - } - } - - /** - * Plain text as HTML, with the URLs in it (https://… and www.…) turned into links that open in a - * new tab. For the description fields of plans and tasks, which stay plain text: typing or pasting - * a URL is enough, no editor needed. Everything is escaped here, so no HTML can be injected. - */ - public static function linkify(?string $text): string - { - if (null === $text || '' === $text) { - return ''; - } - - // One capture group: preg_split then alternates plain text (even) and URLs (odd). - $parts = preg_split('~((?:https?://|(?"\']+)~i', $text, -1, PREG_SPLIT_DELIM_CAPTURE); - $html = ''; - - foreach ($parts as $i => $part) { - $html .= $i % 2 ? self::urlAnchor($part) : htmlspecialchars($part, ENT_QUOTES, 'UTF-8'); - } - - return $html; - } - - /** - * One URL as a link. Sentence punctuation that follows the URL (".", ")", "!", …) stays outside - * the link, and a bare "www." address gets the https:// prefix. - */ - private static function urlAnchor(string $url): string - { - $after = ''; - - while ('' !== $url && str_contains('.,;:!?', substr($url, -1))) { - $after = substr($url, -1).$after; - $url = substr($url, 0, -1); - } - - // An unbalanced closing parenthesis belongs to the sentence, not the URL. - if (str_ends_with($url, ')') && !str_contains($url, '(')) { - $after = ')'.$after; - $url = substr($url, 0, -1); - } - - // Only a prefix is left ("www.", "https://"): not a link after all. - if ('' === $url || 'www.' === $url || 'http://' === $url || 'https://' === $url) { - return htmlspecialchars($url.$after, ENT_QUOTES, 'UTF-8'); - } - - $href = preg_match('~^https?://~i', $url) ? $url : 'https://'.$url; - - return sprintf( - '%s%s', - htmlspecialchars($href, ENT_QUOTES, 'UTF-8'), - htmlspecialchars($url, ENT_QUOTES, 'UTF-8'), - htmlspecialchars($after, ENT_QUOTES, 'UTF-8') - ); - } -} diff --git a/Validator/Constraints/EndDateAfterStartDate.php b/Validator/Constraints/EndDateAfterStartDate.php index 7322165..d6f6b7f 100644 --- a/Validator/Constraints/EndDateAfterStartDate.php +++ b/Validator/Constraints/EndDateAfterStartDate.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Validator\Constraints; +namespace MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints; use Symfony\Component\Validator\Constraint; @@ -12,7 +12,7 @@ use Symfony\Component\Validator\Constraint; */ class EndDateAfterStartDate extends Constraint { - public string $message = 'mautic.program.end_date.before_start_date'; + public string $message = 'mt3s.marketing_program.end_date.before_start_date'; public function getTargets(): string { diff --git a/Validator/Constraints/EndDateAfterStartDateValidator.php b/Validator/Constraints/EndDateAfterStartDateValidator.php index 913402f..74d7615 100644 --- a/Validator/Constraints/EndDateAfterStartDateValidator.php +++ b/Validator/Constraints/EndDateAfterStartDateValidator.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Validator\Constraints; +namespace MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints; -use MauticPlugin\ProgramBundle\Entity\DateRangeInterface; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\DateRangeInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; diff --git a/Validator/Constraints/TaskDates.php b/Validator/Constraints/TaskDates.php index 7b87371..0401cbb 100644 --- a/Validator/Constraints/TaskDates.php +++ b/Validator/Constraints/TaskDates.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Validator\Constraints; +namespace MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints; use Symfony\Component\Validator\Constraint; @@ -16,7 +16,7 @@ use Symfony\Component\Validator\Constraint; #[\Symfony\Component\Validator\Attribute\HasNamedArguments] class TaskDates extends Constraint { - public const MILESTONE_END_ENSLAVED = 'mautic.program.task.milestone.end_enslaved'; + public const MILESTONE_END_ENSLAVED = 'mt3s.marketing_program.task.milestone.end_enslaved'; public function getTargets(): string|array { diff --git a/Validator/Constraints/TaskDatesValidator.php b/Validator/Constraints/TaskDatesValidator.php index 660fc36..ed87830 100644 --- a/Validator/Constraints/TaskDatesValidator.php +++ b/Validator/Constraints/TaskDatesValidator.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Validator\Constraints; +namespace MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints; -use MauticPlugin\ProgramBundle\Entity\Task; -use MauticPlugin\ProgramBundle\Entity\TaskKind; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskKind; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; diff --git a/Validator/Constraints/ValidTaskDependency.php b/Validator/Constraints/ValidTaskDependency.php index e994699..434648f 100644 --- a/Validator/Constraints/ValidTaskDependency.php +++ b/Validator/Constraints/ValidTaskDependency.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Validator\Constraints; +namespace MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints; use Symfony\Component\Validator\Constraint; @@ -11,9 +11,9 @@ use Symfony\Component\Validator\Constraint; */ class ValidTaskDependency extends Constraint { - public const SELF_REFERENCE = 'mautic.program.task.dependency.self'; - public const CYCLE = 'mautic.program.task.dependency.cycle'; - public const OTHER_PLAN = 'mautic.program.task.dependency.other_plan'; + public const SELF_REFERENCE = 'mt3s.marketing_program.task.dependency.self'; + public const CYCLE = 'mt3s.marketing_program.task.dependency.cycle'; + public const OTHER_PLAN = 'mt3s.marketing_program.task.dependency.other_plan'; public function getTargets(): string|array { diff --git a/Validator/Constraints/ValidTaskDependencyValidator.php b/Validator/Constraints/ValidTaskDependencyValidator.php index 87389fc..42d1f63 100644 --- a/Validator/Constraints/ValidTaskDependencyValidator.php +++ b/Validator/Constraints/ValidTaskDependencyValidator.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace MauticPlugin\ProgramBundle\Validator\Constraints; +namespace MauticPlugin\MT3SMarketingProgramBundle\Validator\Constraints; use Doctrine\ORM\EntityManagerInterface; -use MauticPlugin\ProgramBundle\Entity\Task; -use MauticPlugin\ProgramBundle\Entity\TaskDependency; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task; +use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskDependency; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -50,7 +50,7 @@ class ValidTaskDependencyValidator extends ConstraintValidator return; } - if (null !== $task->getInitiative() && null !== $dependsOn->getInitiative() && $task->getInitiative()->getId() !== $dependsOn->getInitiative()->getId()) { + if (null !== $task->getProgram() && null !== $dependsOn->getProgram() && $task->getProgram()->getId() !== $dependsOn->getProgram()->getId()) { $this->context->buildViolation($constraint::OTHER_PLAN)->atPath('dependencies')->addViolation(); return; diff --git a/composer.json b/composer.json index 4176075..6fba2bd 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,12 @@ { - "name": "experiential/mautic-program-bundle", - "description": "Program plugin for Mautic", + "name": "mt3s/mautic-marketing-program-bundle", + "description": "Marketing Program for Mautic", "type": "mautic-plugin", "license": "GPL-3.0-or-later", "keywords": [ "mautic", "plugin", - "program" + "marketing-program" ], "require": { "php": ">=8.2", @@ -14,10 +14,10 @@ }, "autoload": { "psr-4": { - "MauticPlugin\\ProgramBundle\\": "" + "MauticPlugin\\MT3SMarketingProgramBundle\\": "" } }, "extra": { - "install-directory-name": "ProgramBundle" + "install-directory-name": "MT3SMarketingProgramBundle" } } diff --git a/readme.md b/readme.md index f34f7cf..09fa9ab 100644 --- a/readme.md +++ b/readme.md @@ -1,12 +1,12 @@ -# Mautic Program plugin +# Mautic Marketing Program plugin -A custom Mautic 7 plugin (`ProgramBundle`) for managing programs: a name, status, owner, dates, budget and category, with their initiatives. +A custom Mautic 7 plugin (`MT3SMarketingProgramBundle`) for managing marketing programs: a name, status, owner, dates, budget and category, with their mt3s_mp_programs. -This repository holds only the plugin source. The bundle files are at the repository root, and Mautic loads them from `docroot/plugins/ProgramBundle`. The plugin was called `PlanBundle` (and plans `Plan`) before 0.16.0: see *Rename history* below. +This repository holds only the plugin source. The bundle files are at the repository root, and Mautic loads them from `docroot/plugins/MT3SMarketingProgramBundle`. The plugin was called `PlanBundle` before 0.16.0 and `ProgramBundle` (with programs) before 0.17.0: see *Rename history* below. ## Installation -1. Copy or clone this repository into your Mautic installation as `docroot/plugins/ProgramBundle`. The folder name must be `ProgramBundle`. +1. Copy or clone this repository into your Mautic installation as `docroot/plugins/MT3SMarketingProgramBundle`. The folder name must be `MT3SMarketingProgramBundle`. 2. Clear the cache and register the plugin: ```bash @@ -14,11 +14,11 @@ This repository holds only the plugin source. The bundle files are at the reposi php bin/console mautic:plugins:reload ``` -3. In Mautic, go to **Settings > Plugins**, open **Program** and publish it. +3. In Mautic, go to **Settings > Plugins**, open **MT3S Marketing Program** and publish it. -Initiatives are listed under **Programs > Initiatives** in the main menu (URL `/s/programs`), tasks under **Programs > Tasks** (URL `/s/program-tasks`), the stakeholder directory under **Programs > Stakeholders** (URL `/s/program-stakeholders`), and the audience directory under **Programs > Audiences** (URL `/s/program-audiences`). The item type lists are edited under **Programs > Item types** (URL `/s/program-item-types`), below **UTM Taxonomies** (URL `/s/program-utm-taxonomies`, a placeholder for a coming feature). Users who aren't administrators need a role with the **Program Permissions** set in **Settings > Roles**. +Programs are listed under **Marketing Programs** in the main menu (URL `/s/marketing-programs`), tasks under **Marketing Programs > Tasks** (URL `/s/marketing-program-tasks`), the stakeholder directory under **Marketing Programs > Stakeholders** (URL `/s/marketing-program-stakeholders`), and the audience directory under **Marketing Programs > Audiences** (URL `/s/marketing-program-audiences`). The item type lists are edited under **Marketing Programs > Item types** (URL `/s/marketing-program-item-types`). The UTM Taxonomies page (URL `/s/marketing-program-utm-taxonomies`) is a placeholder for a coming feature and is kept out of the menu. Users who aren't administrators need a role with the **Marketing Program Permissions** set in **Settings > Roles**. -Before using the items of an initiative's **Insights**, **Objectives**, **Allocations** and **Tasks** tabs, set up their types under **Programs > Item types** (`program:itemtypes:view` to see the page, `program:itemtypes:edit` to save it). +Before using the items of a program's **Insights**, **Objectives**, **Allocations** and **Tasks** tabs, set up their types under **Marketing Programs > Item types** (`mt3smarketingprogram:itemtypes:view` to see the page, `mt3smarketingprogram:itemtypes:edit` to save it). ## Development @@ -35,7 +35,7 @@ In the dev environment's `.env`, point it at this plugin: PLUGIN_PLAN_PATH=../mautic-plugin-plan ``` -The dev environment mounts it as `docroot/plugins/ProgramBundle`. +The dev environment mounts it as `docroot/plugins/MT3SMarketingProgramBundle`. Run all commands from the `mautic-dev-env` folder: @@ -52,175 +52,178 @@ For the complete list of commands, see the dev environment's README. The plugin uses the IntegrationsBundle conventions: -- `ProgramBundle.php`: the bundle class +- `MT3SMarketingProgramBundle.php`: the bundle class - `Config/config.php`: metadata, routes, menu and integration service tags - `Config/services.php`: autowires and autoconfigures every class in the bundle -- `DependencyInjection/ProgramExtension.php`: loads `Config/services.php` -- `Integration/ProgramIntegration.php`: the integration that is listed on the Plugins page -- `Integration/Support/ProgramConfigSupport.php`: the configuration form for the integration +- `DependencyInjection/MT3SMarketingProgramExtension.php`: loads `Config/services.php` +- `Event/MT3SMarketingProgramEvents.php` and `Event/ProgramEvent.php`: the plugin's `mt3s.marketing_program.*` event names and their payload, dispatched by `Model/ProgramModel.php` on save and delete +- `Command/RefreshStatsCommand.php`: `mt3s:marketing-program:refresh-stats`, recomputes and prints the per-program statistics +- `Integration/MT3SMarketingProgramIntegration.php`: the integration that is listed on the Plugins page +- `Integration/Support/MT3SMarketingProgramConfigSupport.php`: the configuration form for the integration - `Translations/en_US/messages.ini` and `validators.ini`: UI strings and validation messages ### Pages and permissions -- `Controller/InitiativeController.php`: list, detail page, create, edit and delete (single and batch), built on core's `AbstractStandardFormController` -- `Resources/views/Initiative/list.html.twig`: the list. An initiative's name opens its detail page. -- `Resources/views/Initiative/form.html.twig` and `details.html.twig`: the create/edit form and the detail page. Both have the same seven tabs, from `_tabs.html.twig`: **Details**, **Insights** (description items), **Objectives**, **Allocations** (planned budget, currency and allocation items), **Audiences**, **Stakeholders** and **Tasks**. -- `Resources/views/Initiative/_task_table.html.twig`: the initiative's tasks in the Tasks tab. It has the harmonized tab columns (pictogram, Type, Name with kind badge for milestones and phases, Description, Start date, End date, Status — no ID), one row per task, no tree: a phase's or milestone's badge marks it in the name column. On the detail page it has an **Add task** button, links to each task and the filter/sort of the other tabs. On the initiative form it is read-only (no links, no filter), so that following a link doesn't drop unsaved changes. -- `Controller/TaskController.php` and `Resources/views/Task/`: the task list, and the create/edit form (**Programs > Tasks**). `new?initiative=ID` preselects the initiative. After Save or Cancel, the user goes back to where the form was opened from. Opened from **Programs > Tasks**, that's the task list. Opened from an initiative's Tasks tab, whose links carry `returnTo=initiative`, that's the initiative (its new initiative, if the task was moved). The origin is stored in the session when the form is opened, because the form posts without the query string. -- `Controller/UtmTaxonomyController.php` and `Resources/views/UtmTaxonomy/`: the placeholder page for the coming UTM Taxonomies feature. -- `Controller/ItemTypesController.php` and `Resources/views/ItemTypes/form.html.twig`: the Item types page (**Programs > Item types**), below UTM Taxonomies in the menu. The type lists that used to be sections of **Settings > Configuration > Program Settings** (insights, allocation, objective, task, stakeholder types and the audience decision roles and tones) are edited here. `Form/Type/ItemTypesType.php` builds the lists, `Service/ItemTypeInUseGuard.php` refuses to remove a type that items still use, and the page saves through core's `Configurator` exactly like the Settings pages do: merge into `config/local.php`, write, refresh the config cache. **Settings > Configuration > Program Settings** keeps only the plugin's general settings: the currency, the stakeholder phone region and the audience attribute toggles. -- `Assets/js/program.js`: on the form, the objectives editor (add, remove, drag-and-drop ordering), and after a failed save, marking the tabs that contain errors with an icon and opening the first one. Started by `Mautic.programOnLoad()`. +- `Controller/ProgramController.php`: list, detail page, create, edit and delete (single and batch), built on core's `AbstractStandardFormController` +- `Resources/views/Program/list.html.twig`: the list. A program's name opens its detail page. +- `Resources/views/Program/form.html.twig` and `details.html.twig`: the create/edit form and the detail page. Both have the same seven tabs, from `_tabs.html.twig`: **Details**, **Insights** (description items), **Objectives**, **Allocations** (planned budget, currency and allocation items), **Audiences**, **Stakeholders** and **Tasks**. +- `Resources/views/Program/_task_table.html.twig`: the program's tasks in the Tasks tab. It has the harmonized tab columns (pictogram, Type, Name with kind badge for milestones and phases, Description, Start date, End date, Status — no ID), one row per task, no tree: a phase's or milestone's badge marks it in the name column. On the detail page it has an **Add task** button, links to each task and the filter/sort of the other tabs. On the program form it is read-only (no links, no filter), so that following a link doesn't drop unsaved changes. +- `Controller/TaskController.php` and `Resources/views/Task/`: the task list, and the create/edit form (**Marketing Programs > Tasks**). `new?program=ID` preselects the program. After Save or Cancel, the user goes back to where the form was opened from. Opened from **Marketing Programs > Tasks**, that's the task list. Opened from a program's Tasks tab, whose links carry `returnTo=program`, that's the program (its new program, if the task was moved). The origin is stored in the session when the form is opened, because the form posts without the query string. +- `Controller/UtmTaxonomyController.php` and `Resources/views/UtmTaxonomy/`: the placeholder page for the coming UTM Taxonomies feature, kept out of the menu (reachable at `/s/marketing-program-utm-taxonomies`). +- `Controller/ItemTypesController.php` and `Resources/views/ItemTypes/form.html.twig`: the Item types page (**Marketing Programs > Item types**). The type lists that used to be sections of **Settings > Configuration > Marketing Program Settings** (insights, allocation, objective, task, stakeholder types and the audience decision roles and tones) are edited here. `Form/Type/ItemTypesType.php` builds the lists, `Service/ItemTypeInUseGuard.php` refuses to remove a type that items still use, and the page saves through core's `Configurator` exactly like the Settings pages do: merge into `config/local.php`, write, refresh the config cache. **Settings > Configuration > Marketing Program Settings** keeps only the plugin's general settings: the currency, the stakeholder phone region and the audience attribute toggles. +- `Assets/js/mt3s-mp-program.js`: on the form, the objectives editor (add, remove, drag-and-drop ordering), and after a failed save, marking the tabs that contain errors with an icon and opening the first one. Started by `Mautic.mt3sMpProgramOnLoad()`. -The initiative's tab panes deliberately have no Bootstrap `fade` class. Core reopens the last tab used on a page (`12.tabs.js`), and the plugin opens the tab with an error after a failed save. With `fade`, those two `tab('show')` calls overlapped within the 150 ms transition and left two panes visible at once, so the Tasks tab also showed the objectives. +The program's tab panes deliberately have no Bootstrap `fade` class. Core reopens the last tab used on a page (`12.tabs.js`), and the plugin opens the tab with an error after a failed save. With `fade`, those two `tab('show')` calls overlapped within the 150 ms transition and left two panes visible at once, so the Tasks tab also showed the objectives. -Which tab opens on an initiative's detail page and form (`Mautic.programInitTabs`): +Which tab opens on a program's detail page and form (`Mautic.mt3sMpProgramInitTabs`): -- The tab last used for an initiative is remembered for the browser session (`sessionStorage`, key `mautic.program.tab.`). The detail page and the form both reopen it, so Edit and Save keep the current tab. Cancel goes to the initiatives list, as in core. +- The tab last used for a program is remembered for the browser session (`sessionStorage`, key `mt3s.marketing_program.tab.`). The detail page and the form both reopen it, so Edit and Save keep the current tab. Cancel goes to the mt3s_mp_programs list, as in core. - After a failed save, the first tab with an error opens instead, and every tab with an error gets a warning icon. -- Core reopens its own remembered tab on page load and after every Ajax request (`Mautic.rememberActiveTabs`), in an order that varies. `program.js` wraps that function, so the initiative's choice is applied right after core's restore, and only during the page load. +- Core reopens its own remembered tab on page load and after every Ajax request (`Mautic.rememberActiveTabs`), in an order that varies. `mt3s-mp-program.js` wraps that function, so the program's choice is applied right after core's restore, and only during the page load. - A tab counts as having an error only if it shows an error message (`.help-block .alert-danger`), not just because an element has the `has-error` class. Mautic's own `checkbox_row` theme adds `has-error` to every checkbox: it tests `errors|length is not empty`, and `0` isn't "empty" in Twig. Every objective's "Achieved" checkbox would otherwise put a warning icon on the Objectives tab, and opening that tab on load looked like a jump to Objectives. -- `Security/Permissions/ProgramPermissions.php`: the permissions shown in **Settings > Roles** +- `Security/Permissions/MT3SMarketingProgramPermissions.php`: the permissions shown in **Settings > Roles** -The main menu has a top-level **Programs** entry, with **Initiatives**, **Tasks**, **Stakeholders**, **Audiences** and **UTM Taxonomies** as its items. Add future pages as more children of `mautic.program.menu.root` in `Config/config.php`. +The main menu has a top-level **Programs** entry, with **Programs**, **Tasks**, **Stakeholders**, **Audiences** and **Item types** as its items. Add future pages as more children of `mt3s.marketing_program.menu.root` in `Config/config.php`. -The **Audiences** tab lists the initiative's audiences, harmonized like the other tabs: pictogram (fixed per audience type), Type, Name (a link to the audience's page in the directory), Priority in this initiative, Stages, Estimated size, Value proposition, Preferred channels. +The **Audiences** tab lists the program's audiences, harmonized like the other tabs: pictogram (fixed per audience type), Type, Name (a link to the audience's page in the directory), Priority in this program, Stages, Estimated size, Value proposition, Preferred channels. | Route | URL | Purpose | | --- | --- | --- | -| `initiative_index` | `/s/programs/{page}` | Initiative list, with search on name | -| `initiative_action` | `/s/programs/{objectAction}/{objectId}` | `view`, `new`, `edit`, `delete`, `batchDelete` | -| `initiative_task_index` | `/s/program-tasks/{page}` | Task list, with search on name and description | -| `initiative_task_action` | `/s/program-tasks/{objectAction}/{objectId}` | `new` (optional `?initiative=ID`), `edit`, `delete`, `batchDelete` | -| `initiative_stakeholder_index` | `/s/program-stakeholders/{page}` | Stakeholder directory, with search on name, email, role and type | -| `initiative_stakeholder_action` | `/s/program-stakeholders/{objectAction}/{objectId}` | `new`, `edit`, `delete`, `batchDelete` | -| `initiative_audience_index` | `/s/program-audiences/{page}` | Audience directory, with search on name | -| `initiative_audience_action` | `/s/program-audiences/{objectAction}/{objectId}` | `new`, `edit`, `view`, `delete`, `batchDelete` | -| `program_utm_taxonomy_index` | `/s/program-utm-taxonomies/{page}` | UTM Taxonomies (placeholder) | +| `mt3s_marketing_program_index` | `/s/marketing-programs/{page}` | Program list, with search on name | +| `mt3s_marketing_program_action` | `/s/marketing-programs/{objectAction}/{objectId}` | `view`, `new`, `edit`, `delete`, `batchDelete` | +| `mt3s_marketing_program_task_index` | `/s/marketing-program-tasks/{page}` | Task list, with search on name and description | +| `mt3s_marketing_program_task_action` | `/s/marketing-program-tasks/{objectAction}/{objectId}` | `new` (optional `?program=ID`), `edit`, `delete`, `batchDelete` | +| `mt3s_marketing_program_stakeholder_index` | `/s/marketing-program-stakeholders/{page}` | Stakeholder directory, with search on name, email, role and type | +| `mt3s_marketing_program_stakeholder_action` | `/s/marketing-program-stakeholders/{objectAction}/{objectId}` | `new`, `edit`, `delete`, `batchDelete` | +| `mt3s_marketing_program_audience_index` | `/s/marketing-program-audiences/{page}` | Audience directory, with search on name | +| `mt3s_marketing_program_audience_action` | `/s/marketing-program-audiences/{objectAction}/{objectId}` | `new`, `edit`, `view`, `delete`, `batchDelete` | +| `mt3s_marketing_program_utm_taxonomy_index` | `/s/marketing-program-utm-taxonomies/{page}` | UTM Taxonomies (placeholder, off-menu) | -The initiative templates don't pass `routeBase` to core's button helpers (`page_actions`, `list_actions`) when a "close" button is involved: from `routeBase`, core builds `mautic__*` route names, which don't exist in this plugin. The other buttons use the `actionRoute` (`initiative_action`) that the controller passes to the template. +The program templates don't pass `routeBase` to core's button helpers (`page_actions`, `list_actions`) when a "close" button is involved: from `routeBase`, core builds `mautic__*` route names, which don't exist in this plugin. The other buttons use the `actionRoute` (`mt3s_marketing_program_action`) that the controller passes to the template. Permission keys: -- `program:initiatives:*`, `program:tasks:*`, `program:stakeholders:*` and `program:audiences:*`: `viewown`, `viewother`, `editown`, `editother`, `create`, `deleteown`, `deleteother`, `publishown`, `publishother`, `full`. "Own" means items the user created (`createdBy`), as in core objects. -- `program:categories:*`: managing the `program` category type. +- `mt3smarketingprogram:programs:*`, `mt3smarketingprogram:tasks:*`, `mt3smarketingprogram:stakeholders:*` and `mt3smarketingprogram:audiences:*`: `viewown`, `viewother`, `editown`, `editother`, `create`, `deleteown`, `deleteother`, `publishown`, `publishother`, `full`. "Own" means items the user created (`createdBy`), as in core objects. +- `mt3smarketingprogram:categories:*`: managing the `program` category type. -### The Initiative object +### The Program object -- `Entity/Initiative.php`: the entity (table `initiatives`), with its Doctrine mapping and validation rules -- `Entity/InitiativeStatus.php`: the status enum (`draft`, `planned`, `active`, `paused`, `completed`, `archived`) -- `Entity/InitiativeRepository.php`: the repository -- `Entity/InitiativeObjective.php` and `InitiativeObjectiveRepository.php`: an initiative's objectives (table `initiative_objectives`): type (with its pictogram), title, description, position and an "achieved" flag -- `Entity/Audience.php`, `AudienceType.php`, `AudiencePriority.php` and `AudienceRepository.php`: the audiences of the global directory (table `initiative_audiences`, `plan_targets` before 0.15.0): name, a fixed type (persona, ICP, broad audience, lifecycle cohort, partner/influencer — each with its own pictogram), a tagline, the Mautic segments that hold this audience's contacts (see below), and the persona attributes the admin switched on (**Settings > Configuration > Program Settings**, one toggle per attribute, so a b2b install and a b2c install define their personas differently): profile criteria, motivations, barriers, frustrations (formerly pain points), triggers, a decision-making role (a value of the admin-edited list `program_audience_decision_roles`), a preferred tone (checkboxes of the admin-edited list `program_audience_tones`), preferred channels (checkboxes: email, SMS, web, social organic, paid social, paid search, events/webinar, outbound sales, partners), any number of Mautic stages (join table `initiative_audiences_stages`) and an estimated size. `Service/AudienceAttributes.php` reads the toggles. -- **Segments**: each audience can have any number of Mautic segments (LeadBundle lists), purely informational — nothing requires one, and nothing in the initiative depends on them. They are stored in the join table `initiative_audiences_segments` (audience_id, leadlist_id), picked in the audience form (published segments only), shown in the directory's Segments column (each with its count of contacts, from `lead_lists_leads` where `manually_removed = 0`) and on the detail page. `AudienceRepository::getSegmentContactCountsForAudiences()` computes the counts for the whole page in one query. -- `Entity/InitiativeAudience.php`: the link between an initiative and an audience (table `initiative_audiences_initiative`), with the audience's priority in that initiative (primary, secondary, exclusion), an initiative-specific value proposition and a position. Deleting the initiative or the audience deletes the link (ON DELETE CASCADE both sides). -- `Model/AudienceModel.php`: the model, available as `mautic.program.model.audience` or with `getModel('program.audience')`. -- `Controller/AudienceController.php` and `Resources/views/Audience/`: the directory (**Programs > Audiences**), with the columns ID, Pictogram, Type, Name (with its tagline), Segments (each with its contact count), Estimated size, Active, and **Assigned initiatives** — the initiatives the audience is linked to, each with its priority in that initiative. The detail page lists the segments, the persona attributes that are filled in, and those initiatives. -- `Model/InitiativeModel.php`: the model, available as `mautic.program.model.initiative` or with `getModel('program.initiative')`. A new initiative from `getEntity()` has the current user as owner. -- `Entity/InitiativeDescriptionItem.php` and `InitiativeDescriptionItemRepository.php`: an initiative's description items (table `initiative_description_items`): type, description and position. They make up the **Insights** tab and replace the former `description` field. -- `Form/Type/InitiativeType.php`, `InitiativeObjectiveType.php` and `InitiativeDescriptionItemType.php`: the create and edit form, with the objectives and the description items as collections -- `Validator/Constraints/EndDateAfterStartDate.php`: the end date must be on or after the start date, when both are set. Used by initiatives and tasks, through `Entity/DateRangeInterface.php`. +- `Entity/Program.php`: the entity (table `mt3s_mp_programs`), with its Doctrine mapping and validation rules +- `Entity/ProgramStatus.php`: the status enum (`draft`, `planned`, `active`, `paused`, `completed`, `archived`) +- `Entity/ProgramRepository.php`: the repository +- `Entity/ProgramObjective.php` and `ProgramObjectiveRepository.php`: a program's objectives (table `mt3s_mp_program_objectives`): type (with its pictogram), title, description, position and an "achieved" flag +- `Entity/Audience.php`, `AudienceType.php`, `AudiencePriority.php` and `AudienceRepository.php`: the audiences of the global directory (table `mt3s_mp_program_audiences`, `plan_targets` before 0.15.0): name, a fixed type (persona, ICP, broad audience, lifecycle cohort, partner/influencer — each with its own pictogram), a tagline, the Mautic segments that hold this audience's contacts (see below), and the persona attributes the admin switched on (**Settings > Configuration > Marketing Program Settings**, one toggle per attribute, so a b2b install and a b2c install define their personas differently): profile criteria, motivations, barriers, frustrations (formerly pain points), triggers, a decision-making role (a value of the admin-edited list `mt3s_marketing_program_audience_decision_roles`), a preferred tone (checkboxes of the admin-edited list `mt3s_marketing_program_audience_tones`), preferred channels (checkboxes: email, SMS, web, social organic, paid social, paid search, events/webinar, outbound sales, partners), any number of Mautic stages (join table `mt3s_mp_program_audiences_stages`) and an estimated size. `Service/AudienceAttributes.php` reads the toggles. +- **Segments**: each audience can have any number of Mautic segments (LeadBundle lists), purely informational — nothing requires one, and nothing in the program depends on them. They are stored in the join table `mt3s_mp_program_audiences_segments` (audience_id, leadlist_id), picked in the audience form (published segments only), shown in the directory's Segments column (each with its count of contacts, from `lead_lists_leads` where `manually_removed = 0`) and on the detail page. `AudienceRepository::getSegmentContactCountsForAudiences()` computes the counts for the whole page in one query. +- `Entity/ProgramAudience.php`: the link between a program and an audience (table `mt3s_mp_program_audiences_program`), with the audience's priority in that program (primary, secondary, exclusion), a program-specific value proposition and a position. Deleting the program or the audience deletes the link (ON DELETE CASCADE both sides). +- `Model/AudienceModel.php`: the model, available as `mt3s.marketing_program.model.audience` or with `getModel('mt3smp.audience')`. +- `Controller/AudienceController.php` and `Resources/views/Audience/`: the directory (**Marketing Programs > Audiences**), with the columns ID, Pictogram, Type, Name (with its tagline), Segments (each with its contact count), Estimated size, Active, and **Assigned mt3s_mp_programs** — the mt3s_mp_programs the audience is linked to, each with its priority in that program. The detail page lists the segments, the persona attributes that are filled in, and those mt3s_mp_programs. +- `Model/ProgramModel.php`: the model, available as `mt3s.marketing_program.model.program` or with `getModel('mt3smp.program')`. A new program from `getEntity()` has the current user as owner. +- `Entity/ProgramDescriptionItem.php` and `ProgramDescriptionItemRepository.php`: a program's description items (table `mt3s_mp_program_description_items`): type, description and position. They make up the **Insights** tab and replace the former `description` field. +- `Form/Type/ProgramType.php`, `ProgramObjectiveType.php` and `ProgramDescriptionItemType.php`: the create and edit form, with the objectives and the description items as collections +- `Validator/Constraints/EndDateAfterStartDate.php`: the end date must be on or after the start date, when both are set. Used by mt3s_mp_programs and tasks, through `Entity/DateRangeInterface.php`. Behaviour to know about: -- Setting the status to `completed` from another status sets `completedAt` to the current time. Moving a completed initiative to any other status clears `completedAt`. -- `owner` is required by validation, but the column is nullable: if the user is deleted, the owner becomes `NULL` (`ON DELETE SET NULL`), and the initiative must be given a new owner before it can be saved again. -- Categories use the core CategoryBundle with the `program` type (**Settings > Categories**), shown as "Initiative". -- There is one currency for every amount: initiative budgets, allocation costs and totals. It's a general setting, the **Currency** dropdown in **Settings > Configuration > Program Settings** (parameter `program_currency`, `EUR` by default), offering 40 main world currencies (`Service/CurrencyProvider.php`). Users never choose a currency, and amount fields show it next to the input. Changing it doesn't convert existing amounts: they're simply shown with the new currency. -- `version` is a whole number from 1 to 99, and new initiatives start at 1. It is edited by hand and isn't related to Doctrine's optimistic locking. -- Objectives belong to their initiative: they are saved with it, deleted with it (`ON DELETE CASCADE` in the database too), and an objective removed from the form is deleted (`orphanRemoval`). They are always loaded ordered by `position`. On save, the model renumbers positions to 0, 1, 2… in their current order. Description items follow the same rules. +- Setting the status to `completed` from another status sets `completedAt` to the current time. Moving a completed program to any other status clears `completedAt`. +- `owner` is required by validation, but the column is nullable: if the user is deleted, the owner becomes `NULL` (`ON DELETE SET NULL`), and the program must be given a new owner before it can be saved again. +- Categories use the core CategoryBundle with the `program` type (**Settings > Categories**), shown as "MT3S Marketing Program" (label `mt3s.marketing_program.category.type`). +- There is one currency for every amount: program budgets, allocation costs and totals. It's a general setting, the **Currency** dropdown in **Settings > Configuration > Marketing Program Settings** (parameter `mt3s_marketing_program_currency`, `EUR` by default), offering 40 main world currencies (`Service/CurrencyProvider.php`). Users never choose a currency, and amount fields show it next to the input. Changing it doesn't convert existing amounts: they're simply shown with the new currency. +- `version` is a whole number from 1 to 99, and new mt3s_mp_programs start at 1. It is edited by hand and isn't related to Doctrine's optimistic locking. +- Objectives belong to their program: they are saved with it, deleted with it (`ON DELETE CASCADE` in the database too), and an objective removed from the form is deleted (`orphanRemoval`). They are always loaded ordered by `position`. On save, the model renumbers positions to 0, 1, 2… in their current order. Description items follow the same rules. - `getObjectives()` and `getDescriptionItems()` return the rows sorted by position, as a new collection. The mapping's `orderBy` isn't enough: after a reorder, the page shown right after saving uses the collection already loaded, in its old order. -- Text typed in the initiative form, including in objectives and description items, is kept as typed: line breaks, `&` and quotes are preserved, and HTML tags are removed. This depends on `InitiativeType` passing a mask array to `CleanFormSubscriber`. Without one, core HTML-encodes every value, again on each save. +- Text typed in the program form, including in objectives and description items, is kept as typed: line breaks, `&` and quotes are preserved, and HTML tags are removed. This depends on `ProgramType` passing a mask array to `CleanFormSubscriber`. Without one, core HTML-encodes every value, again on each save. ### Typed items: description items, allocation items and tasks -- A **description item** (Insights tab, `Entity/InitiativeDescriptionItem.php`) has a type and a description. More fields are planned. -- An **allocation item** (Allocations tab, `Entity/InitiativeAllocationItem.php`, table `initiative_allocation_items`) is a cost line: type (with its pictogram), name (optional), description, planned cost and real cost. Costs are `DECIMAL(12,2)`, in the general currency. -- An **objective** (`Entity/InitiativeObjective.php`) has a type too (with its pictogram), a title, a priority (a whole number from 1, the most important, to 99), a description and the achieved flag. The initiative's Objectives tab lists them by priority; ties keep the manual order. The priority is required. +- A **description item** (Insights tab, `Entity/ProgramDescriptionItem.php`) has a type and a description. More fields are planned. +- An **allocation item** (Allocations tab, `Entity/ProgramAllocationItem.php`, table `mt3s_mp_program_allocation_items`) is a cost line: type (with its pictogram), name (optional), description, planned cost and real cost. Costs are `DECIMAL(12,2)`, in the general currency. +- An **objective** (`Entity/ProgramObjective.php`) has a type too (with its pictogram), a title, a priority (a whole number from 1, the most important, to 99), a description and the achieved flag. The program's Objectives tab lists them by priority; ties keep the manual order. The priority is required. - A **task** (`Entity/Task.php`) has a type too (with its pictogram): see *The Task object* below. -- Description items, allocation items and objectives are edited inside the initiative form, like objectives: add, remove, drag to reorder. They're saved and deleted with the initiative. Tasks are edited on their own form, where the type's pictogram and description appear around the type dropdown. -- Each kind's types are set up on the **Item types** page (**Programs > Item types**), in several sections. Each type has a name and a description for each language installed in Mautic, and the default language (the `locale` parameter) requires a name. Each type also has a pictogram (none for the audience decision roles and tones). Users see their own language, or the default language when theirs is empty. The order of the types is the order of the dropdown. -- The types are stored in `config/local.php`, in the `program_description_item_types`, `program_allocation_item_types`, `program_objective_types`, `program_task_types` and `program_stakeholder_types` parameters. Read them with `Service/ItemTypeProvider.php`, passing the kind (`description`, `allocation`, `objective`, `task` or `stakeholder`). In templates, use the Twig functions `program_item_type_name(kind, key)`, `program_item_type_description(kind, key)` and `program_item_type_icon(kind, key)`, plus `program_currency()` and `program_money(amount)` (`Twig/ProgramExtension.php`). -- **Every item type has a pictogram**, chosen by the administrator from a list of Remix Icons that Mautic ships (`Service/Pictograms.php`, each checked against Mautic 7's icon stylesheet), with a live preview. It's stored as `icon` in the type. On the initiative form and the task form it appears next to the type dropdown when a type is chosen. -- **The four item tabs of an initiative's detail page are harmonized** (`Resources/views/Initiative/details.html.twig`, `_task_table.html.twig`, `_tab_table_filter.html.twig`): every column starts with the pictogram (its header stays empty — no "Pictogram" label), then Type, Name, Description, and the kind's other fields; objectives show their Priority after Description, and tasks end with Status. The initiative's Tasks tab doesn't show task IDs (`data-task-id` still carries them). Each tab has one filter box that matches every column, and every column header sorts the rows asc/desc on click (`Mautic.programInitTabTable` in `Assets/js/program.js`, client-side). The objective's achieved flag is the Status column of its table. -- A description item's long description is **clamped to 10 lines** in the Insights tab, with a *Read more* / *Show less* toggle (`_description_read_more.html.twig`, `Mautic.programInitReadMore`). The toggle appears only when the text really overflows: the pane is hidden on page load, so the measurement waits for the tab to be shown. +- Description items, allocation items and objectives are edited inside the program form, like objectives: add, remove, drag to reorder. They're saved and deleted with the program. Tasks are edited on their own form, where the type's pictogram and description appear around the type dropdown. +- Each kind's types are set up on the **Item types** page (**Marketing Programs > Item types**), in several sections. Each type has a name and a description for each language installed in Mautic, and the default language (the `locale` parameter) requires a name. Each type also has a pictogram (none for the audience decision roles and tones). Users see their own language, or the default language when theirs is empty. The order of the types is the order of the dropdown. +- The types are stored in `config/local.php`, in the `mt3s_marketing_program_description_item_types`, `mt3s_marketing_program_allocation_item_types`, `mt3s_marketing_program_objective_types`, `mt3s_marketing_program_task_types` and `mt3s_marketing_program_stakeholder_types` parameters. Read them with `Service/ItemTypeProvider.php`, passing the kind (`description`, `allocation`, `objective`, `task` or `stakeholder`). In templates, use the Twig functions `mt3s_marketing_program_item_type_name(kind, key)`, `mt3s_marketing_program_item_type_description(kind, key)` and `mt3s_marketing_program_item_type_icon(kind, key)`, plus `mt3s_marketing_program_currency()` and `mt3s_marketing_program_money(amount)` (`Twig/MT3SMarketingProgramExtension.php`). +- **Every item type has a pictogram**, chosen by the administrator from a list of Remix Icons that Mautic ships (`Service/Pictograms.php`, each checked against Mautic 7's icon stylesheet), with a live preview. It's stored as `icon` in the type. On the program form and the task form it appears next to the type dropdown when a type is chosen. +- **The four item tabs of a program's detail page are harmonized** (`Resources/views/Program/details.html.twig`, `_task_table.html.twig`, `_tab_table_filter.html.twig`): every column starts with the pictogram (its header stays empty — no "Pictogram" label), then Type, Name, Description, and the kind's other fields; objectives show their Priority after Description, and tasks end with Status. The program's Tasks tab doesn't show task IDs (`data-task-id` still carries them). Each tab has one filter box that matches every column, and every column header sorts the rows asc/desc on click (`Mautic.mt3sMpProgramInitTabTable` in `Assets/js/mt3s-mp-program.js`, client-side). The objective's achieved flag is the Status column of its table. +- A description item's long description is **clamped to 10 lines** in the Insights tab, with a *Read more* / *Show less* toggle (`_description_read_more.html.twig`, `Mautic.mt3sMpProgramInitReadMore`). The toggle appears only when the text really overflows: the pane is hidden on page load, so the measurement waits for the tab to be shown. - Each type has a hidden key, generated when it's created and never changed. Items store that key, so renaming a type renames it everywhere. - A type that items use can't be removed: the lists aren't saved, and the error lists the types and how many items use them (`Service/ItemTypeInUseGuard.php`, called by `ItemTypesController` before saving the page). -- On the initiative form, the selected type's description is shown under the type dropdown. When no types are set up, the tab says where to set them up. -- Files: `Form/Type/ItemTypesType.php`, `ItemTypeConfigType.php`, `InitiativeDescriptionItemType.php`, `InitiativeAllocationItemType.php`, `Controller/ItemTypesController.php` and `Resources/views/ItemTypes/form.html.twig` (the page), and `Form/Type/ConfigType.php` with `Resources/views/FormTheme/Config/_config_programconfig_widget.html.twig` (the general settings that stayed in **Settings > Configuration**). Adding and removing types is handled in `Assets/js/program.js`. +- On the program form, the selected type's description is shown under the type dropdown. When no types are set up, the tab says where to set them up. +- Files: `Form/Type/ItemTypesType.php`, `ItemTypeConfigType.php`, `ProgramDescriptionItemType.php`, `ProgramAllocationItemType.php`, `Controller/ItemTypesController.php` and `Resources/views/ItemTypes/form.html.twig` (the page), and `Form/Type/ConfigType.php` with `Resources/views/FormTheme/Config/_config_mt3smarketingprogramconfig_widget.html.twig` (the general settings that stayed in **Settings > Configuration**). Adding and removing types is handled in `Assets/js/mt3s-mp-program.js`. ### Cost totals -- `Initiative::getAllocationTotals()` adds up the allocation items' planned and real costs, in the general currency. The sums are done in cents, as integers. -- The initiative detail page shows them under the title, after the initiative status, as on an email's page (`publishStatus` block): a "Planned" tag and a "Real" tag. A real total above the planned total is red, otherwise green. +- `Program::getAllocationTotals()` adds up the allocation items' planned and real costs, in the general currency. The sums are done in cents, as integers. +- The program detail page shows them under the title, after the program status, as on an email's page (`publishStatus` block): a "Planned" tag and a "Real" tag. A real total above the planned total is red, otherwise green. - The Allocations tab of the detail page lists the cost lines, followed by a total row. - `isAchieved` is toggled by hand on the form for now. ### The Stakeholder object -- `Entity/Stakeholder.php` and `StakeholderRepository.php`: a stakeholder (table `initiative_stakeholders`), the global directory of the people, companies and teams involved in the initiatives: name, email (validated, indexed for duplicate detection), phone, role, type and the active flag (`isPublished`). Independent of initiatives. -- `Entity/InitiativeStakeholder.php`: the link between an initiative and a stakeholder (table `initiative_stakeholders_initiative`), with the stakeholder's role in that initiative (free text, column `role_in_initiative`) and a position. Deleting the initiative or the stakeholder deletes the link (ON DELETE CASCADE both sides). -- `Model/StakeholderModel.php`: the model, available as `mautic.program.model.stakeholder` or with `getModel('program.stakeholder')`. On save, the phone number is normalized to E.164 using the default region from **Settings > Configuration > Program Settings** (parameter `program_stakeholder_phone_region`, `FR` by default); a number that doesn't parse is kept exactly as typed, and the save is never blocked. -- `Controller/StakeholderController.php` and `Resources/views/Stakeholder/`: the directory (**Programs > Stakeholders**), with the columns ID, Pictogram, Type, Name, Role, Email (mailto link), Phone (tel link), Active, and **Assigned initiatives** — the initiatives the stakeholder is linked to, each with its role in that initiative. The detail page lists those initiatives too. -- The stakeholder's type is the key of a stakeholder type set up in **Settings > Configuration > Program Settings** (parameter `program_stakeholder_types`), same pattern as the other item types, pictogram included. -- An initiative's **Stakeholders tab** links the directory to the initiative: each row picks an active stakeholder and gives its role in the initiative. The tab shows the harmonized table (pictogram, Type, Name, Role in the initiative, Role, Email, Phone, Active). Unpublished stakeholders are not offered in the picker, but keep their links. +- `Entity/Stakeholder.php` and `StakeholderRepository.php`: a stakeholder (table `mt3s_mp_program_stakeholders`), the global directory of the people, companies and teams involved in the mt3s_mp_programs: name, email (validated, indexed for duplicate detection), phone, role, type and the active flag (`isPublished`). Independent of mt3s_mp_programs. +- `Entity/ProgramStakeholder.php`: the link between a program and a stakeholder (table `mt3s_mp_program_stakeholders_program`), with the stakeholder's role in that program (free text, column `role_in_program`) and a position. Deleting the program or the stakeholder deletes the link (ON DELETE CASCADE both sides). +- `Model/StakeholderModel.php`: the model, available as `mt3s.marketing_program.model.stakeholder` or with `getModel('mt3smp.stakeholder')`. On save, the phone number is normalized to E.164 using the default region from **Settings > Configuration > Marketing Program Settings** (parameter `mt3s_marketing_program_stakeholder_phone_region`, `FR` by default); a number that doesn't parse is kept exactly as typed, and the save is never blocked. +- `Controller/StakeholderController.php` and `Resources/views/Stakeholder/`: the directory (**Marketing Programs > Stakeholders**), with the columns ID, Pictogram, Type, Name, Role, Email (mailto link), Phone (tel link), Active, and **Assigned mt3s_mp_programs** — the mt3s_mp_programs the stakeholder is linked to, each with its role in that program. The detail page lists those mt3s_mp_programs too. +- The stakeholder's type is the key of a stakeholder type set up in **Settings > Configuration > Marketing Program Settings** (parameter `mt3s_marketing_program_stakeholder_types`), same pattern as the other item types, pictogram included. +- A program's **Stakeholders tab** links the directory to the program: each row picks an active stakeholder and gives its role in the program. The tab shows the harmonized table (pictogram, Type, Name, Role in the program, Role, Email, Phone, Active). Unpublished stakeholders are not offered in the picker, but keep their links. ### The Task object -- `Entity/Task.php` and `TaskRepository.php`: a task (table `initiative_tasks`): type (with its pictogram), name, description, initiative, kind (task, milestone or phase), optional start and end dates (plain dates, no time), definition of done, planned work in whole hours, status (not for phases), dependencies (table `initiative_task_dependencies`) and RACI assignments (table `initiative_task_raci` with its `initiative_task_raci_stakeholders` join table) +- `Entity/Task.php` and `TaskRepository.php`: a task (table `mt3s_mp_program_tasks`): type (with its pictogram), name, description, program, kind (task, milestone or phase), optional start and end dates (plain dates, no time), definition of done, planned work in whole hours, status (not for phases), dependencies (table `mt3s_mp_program_task_dependencies`) and RACI assignments (table `mt3s_mp_program_task_raci` with its `mt3s_mp_program_task_raci_stakeholders` join table) - `Entity/TaskStatus.php`: the status enum. The order of its cases is the order of the dropdown: `new` (New, the default), `todo` (To do), `in_progress` (In progress), `done` (Done). Stored as `VARCHAR(20)`, indexed. -- `Model/TaskModel.php`: the model, available as `mautic.program.model.task` or with `getModel('program.task')`. `getTaskTree($initiative)` returns an initiative's tasks as flat rows for the Tasks tab, ordered by name, with their dependencies and RACI rows fully loaded. +- `Model/TaskModel.php`: the model, available as `mt3s.marketing_program.model.task` or with `getModel('mt3smp.task')`. `getTaskTree($program)` returns a program's tasks as flat rows for the Tasks tab, ordered by name, with their dependencies and RACI rows fully loaded. - `Form/Type/TaskType.php`: the create and edit form -- `Validator/Constraints/ValidTaskDependency.php`: a dependency must point at another task of the same initiative, and the dependency graph must not form a cycle (followed through the database, so a cycle crossing other tasks is caught too) +- `Validator/Constraints/ValidTaskDependency.php`: a dependency must point at another task of the same program, and the dependency graph must not form a cycle (followed through the database, so a cycle crossing other tasks is caught too) Behaviour to know about: -- A task must belong to an initiative. An initiative can have any number of tasks, including none. +- A task must belong to a program. A program can have any number of tasks, including none. - A task's end date must be on or after its start date, when both are set. -- The task list (**Programs > Tasks**) shows these columns, in this order: ID, Pictogram, Type, Name, Description (first 120 characters), Start date, End date, Status. Every column except Pictogram and Description can be sorted. -- A task's type is required. It's the key of a task type set up in **Settings > Configuration > Program Settings** (parameter `program_task_types`); on the task form the type's pictogram appears next to the dropdown and its description under it. The initiative's Tasks tab shows the same Pictogram and Type columns as the task list, without the ID column. -- Deleting an initiative deletes its tasks (`initiative_id` `ON DELETE CASCADE`). +- The task list (**Marketing Programs > Tasks**) shows these columns, in this order: ID, Pictogram, Type, Name, Description (first 120 characters), Start date, End date, Status. Every column except Pictogram and Description can be sorted. +- A task's type is required. It's the key of a task type set up in **Settings > Configuration > Marketing Program Settings** (parameter `mt3s_marketing_program_task_types`); on the task form the type's pictogram appears next to the dropdown and its description under it. The program's Tasks tab shows the same Pictogram and Type columns as the task list, without the ID column. +- Deleting a program deletes its tasks (`program_id` `ON DELETE CASCADE`). - Deleting a task removes its dependency edges and RACI rows too (`ON DELETE CASCADE`). -- Tasks are edited on their own pages, not inside the initiative form: a task can only be picked as a dependency once it exists. +- Tasks are edited on their own pages, not inside the program form: a task can only be picked as a dependency once it exists. - Kinds: a **milestone**'s end date is enslaved to its start date (same day — the entity's `setTaskKind` copies it, the `TaskDates` validator keeps it in step, the form shows it disabled); a **phase** has no status of its own, it comes from its tasks (the form shows no status field). -- RACI: one row per role (Responsible, Accountable, Consulted, Informed), each with several stakeholders picked from the initiative's stakeholders. +- RACI: one row per role (Responsible, Accountable, Consulted, Informed), each with several stakeholders picked from the program's stakeholders. -After you change `Assets/js/program.js`, run `php bin/console mautic:assets:generate` (in the dev environment, `./dev.sh console mautic:assets:generate`), because production mode bundles plugin scripts into `app.js`. +After you change `Assets/js/mt3s-mp-program.js`, run `php bin/console mautic:assets:generate` (in the dev environment, `./dev.sh console mautic:assets:generate`), because production mode bundles plugin scripts into `app.js`. ### Database schema -Mautic creates the `initiatives` table from the entity mapping when it installs the plugin. However, the installer drops foreign keys that point to core tables (`users`, `categories`). `Migrations/Version_0_2_0.php` adds them and only runs when they are missing. Core runs plugin migrations when the plugin version changes, and `EventListener/PluginInstallSubscriber.php` also runs them right after a fresh install. +Mautic creates the `mt3s_mp_programs` table from the entity mapping when it installs the plugin. However, the installer drops foreign keys that point to core tables (`users`, `categories`). `Migrations/Version_0_2_0.php` adds them and only runs when they are missing. Core runs plugin migrations when the plugin version changes, and `EventListener/PluginInstallSubscriber.php` also runs them right after a fresh install. -`Migrations/Version_0_16_0.php` renames every table and column of the Plan era to the Program one: `plans` → `initiatives`, `plan_tasks` → `initiative_tasks`, `plan_stakeholders` → `initiative_stakeholders`, `plan_audiences` → `initiative_audiences`, `plan_stakeholders_plan` → `initiative_stakeholders_initiative`, `plan_audiences_plan` → `initiative_audiences_initiative`, `plan_audiences_segments` → `initiative_audiences_segments`, `plan_audiences_stages` → `initiative_audiences_stages`, `plan_objectives` → `initiative_objectives`, `plan_description_items` → `initiative_description_items`, `plan_allocation_items` → `initiative_allocation_items`, `plan_task_dependencies` → `initiative_task_dependencies`, `plan_task_raci` → `initiative_task_raci`, `plan_task_raci_stakeholders` → `initiative_task_raci_stakeholders`, and the `plan_id` foreign key columns become `initiative_id`; `role_in_plan` becomes `role_in_initiative`. The earlier migrations (`Version_0_2_0.php` … `Version_0_14_0.php`) keep their historical table names in their bodies but are disabled (`isApplicable()` returns `false`), since their changes are history now kept by the renames in 0.16.0. +`Migrations/Version_0_16_0.php` renames every table and column of the Plan era to the Program one: `plans` → `mt3s_mp_programs`, `plan_tasks` → `mt3s_mp_program_tasks`, `plan_stakeholders` → `mt3s_mp_program_stakeholders`, `plan_audiences` → `mt3s_mp_program_audiences`, `plan_stakeholders_plan` → `mt3s_mp_program_stakeholders_program`, `plan_audiences_plan` → `mt3s_mp_program_audiences_program`, `plan_audiences_segments` → `mt3s_mp_program_audiences_segments`, `plan_audiences_stages` → `mt3s_mp_program_audiences_stages`, `plan_objectives` → `mt3s_mp_program_objectives`, `plan_description_items` → `mt3s_mp_program_description_items`, `plan_allocation_items` → `mt3s_mp_program_allocation_items`, `plan_task_dependencies` → `mt3s_mp_program_task_dependencies`, `plan_task_raci` → `mt3s_mp_program_task_raci`, `plan_task_raci_stakeholders` → `mt3s_mp_program_task_raci_stakeholders`, and the `plan_id` foreign key columns become `program_id`; `role_in_plan` becomes `role_in_program`. The earlier migrations (`Version_0_2_0.php` … `Version_0_14_0.php`) keep their historical table names in their bodies but are disabled (`isApplicable()` returns `false`), since their changes are history now kept by the renames in 0.16.0. When you change the schema, add a migration in `Migrations/` and increase `version` in `Config/config.php`, then run `./dev.sh reload`. The migration engine executes the `addSql()` statements after `up()` returns; a rename migration must instead run its statements immediately through `$connection->executeStatement()`, re-reading the schema between steps. ## Naming conventions -To avoid collisions with other plugins, such as UTM Manager, every identifier in this bundle is prefixed with `program`: +To avoid collisions with other plugins, such as UTM Manager, every identifier in this bundle is prefixed with the bundle's name (the `MT3S` in `MT3SMarketingProgramBundle`): -- Service IDs: `mautic.program.*` (and the models resolve from `getModel('program.initiative')` etc.) -- Form block prefixes: `program_*` (`program_task`, `program_audience`, …) -- Route names: `initiative_*` (the initiative pages), with `program_utm_taxonomy_index` for the placeholder -- Translation keys: `mautic.program.*`, plus `mautic.plugin.program.name` -- Permission keys: `program:*` -- Config parameters: `program_*` (`program_currency`, `program_*_types`, …) -- Menu keys: `mautic.program.menu.*` -- URL paths: `/s/programs`, `/s/program-tasks`, `/s/program-stakeholders`, `/s/program-audiences`, `/s/program-utm-taxonomies` +- Service IDs: `mt3s.marketing_program.*` (and the models resolve from `getModel('mt3smp.program')` etc.) +- Form block prefixes: `mt3s_marketing_program_*` (`mt3s_marketing_program_task`, `mt3s_marketing_program_audience`, …) +- Route names: `mt3s_marketing_program_*` (e.g. `mt3s_marketing_program_index`, `mt3s_marketing_program_task_action`, with `mt3s_marketing_program_utm_taxonomy_index` for the placeholder) +- Translation keys: `mt3s.marketing_program.*`, plus `mautic.plugin.mt3smarketingprogram.name` +- Permission keys: `mt3smarketingprogram:*` (from the bundle name, lowercased) +- Config parameters: `mt3s_marketing_program_*` (`mt3s_marketing_program_currency`, `mt3s_marketing_program_*_types`, …) +- Menu keys: `mt3s.marketing_program.menu.*` +- URL paths: `/s/marketing-programs`, `/s/marketing-program-tasks`, `/s/marketing-program-stakeholders`, `/s/marketing-program-audiences`, `/s/marketing-program-utm-taxonomies` -The bundle class is `ProgramBundle`, the integration name is `Program`, the entity classes are `Initiative`, `Task`, `Stakeholder` and `Audience`, and their tables are `initiatives`, `initiative_tasks`, `initiative_stakeholders` and `initiative_audiences`. The DB index names follow: `program_status` on `initiatives`, `program_task_status` on `initiative_tasks`, `program_stakeholder_email` on `initiative_stakeholders`. +The bundle class is `MT3SMarketingProgramBundle`, the integration name is `MT3SMarketingProgram`, the entity classes are `Program`, `Task`, `Stakeholder` and `Audience`, and their tables are `mt3s_mp_programs`, `mt3s_mp_program_tasks`, `mt3s_mp_program_stakeholders` and `mt3s_mp_program_audiences`. The DB index names are kept from before 0.17.0: `program_status` on `mt3s_mp_programs`, `program_task_status` on `mt3s_mp_program_tasks`, `program_stakeholder_email` on `mt3s_mp_program_stakeholders`. The plugin also dispatches `mt3s.marketing_program.*` events (`Event/MT3SMarketingProgramEvents.php`, payload `Event/ProgramEvent.php`) and ships `Command/RefreshStatsCommand.php` (`php bin/console mt3s:marketing-program:refresh-stats`). ## Rename history The plugin was born as `PlanBundle` with a `Plan` entity (table `plans`) and menu root **Planning** > **Plans**: - Before 0.15.0: "targets" were renamed to "audiences" (entity `Audience`, table `plan_targets` → `plan_audiences`), with Mautic segments attached to each audience. -- 0.16.0: the full rename to `ProgramBundle` / `Initiative`. The bundle namespace, class names, the `plugins` DB row (`ProgramBundle`), all tables (`plan_*` → `initiative_*`), all columns (`plan_id` → `initiative_id`, `role_in_plan` → `role_in_initiative`), all permission keys (`plan:*` → `program:*`), the config parameters and the menu (root **Programs**, entry **Initiatives**, plus the placeholder **UTM Taxonomies**) took the new names. The data was kept: the migration renames the tables, it doesn't rebuild them. -- The old URLs (`/s/plans`, `/s/plan-tasks`, …) are gone: the routes were renamed and the old names return 404. +- 0.16.0: the full rename to `ProgramBundle` / `Program` (and a "plan" became an "initiative"). The bundle namespace, class names, the `plugins` DB row (`ProgramBundle`), all tables (`plan_*` → `initiative_*`), all columns (`plan_id` → `initiative_id`, `role_in_plan` → `role_in_initiative`), all permission keys (`plan:*` → `program:*`), the config parameters and the menu (root **Programs**, entry **Initiatives**, plus the placeholder **UTM Taxonomies**) took the new names. The data was kept: the migration renames the tables, it doesn't rebuild them. +- 0.17.0: the rename to `MT3SMarketingProgramBundle` / "MT3S Marketing Program", and an initiative became a marketing program. The bundle namespace, class names, the `plugins` DB row (`MT3SMarketingProgramBundle`, name "MT3S Marketing Program"), all tables (`initiative_*` → `mt3s_mp_program_*`), all columns (`initiative_id` → `program_id`, `role_in_initiative` → `role_in_program`), all permission keys (`program:*` → `mt3smarketingprogram:*`), the routes, the service IDs, the config parameters, the URLs (`/s/marketing-programs`, …) and the menu (root **Marketing Programs**, entry **Marketing Programs**) took the new names, and the plugin's events (`mt3s.marketing_program.*`) and the `mt3s:marketing-program:refresh-stats` command were added. The data was kept again: `Version_0_17_0.php` renames the tables and carries over the rows the rename orphans — the plugins row, the roles' permission rows (which the 0.16.0 rename had missed), the categories (`plan`- and `initiative`-era rows) and the audit log. +- The old URLs (`/s/plans`, `/s/plan-tasks`, `/s/programs`, `/s/program-tasks`, …) are gone: the routes were renamed and the old names return 404. A rename like this needs care: - The historical migrations must stay literal (they describe the old schema) or be neutralized; after the entity renames, their Doctrine mappings no longer match and they can only run with literal SQL. - The `plugins` DB row must be updated to the new bundle name (and its version kept), or Mautic's installer treats the plugin as new and its `SchemaTool` pass creates empty tables from the current mappings. If that happens, drop the empty tables and turn the install into an update before reloading. -- The permission keys of each role are stored in the `permissions` table per (bundle, name); a role that had `plan:plans:*` grants doesn't automatically get `program:initiatives:*`, and cached permission sets in the sessions need a re-login. -- `getModel()` resolves `program.initiative` to the service `mautic.program.model.initiative`, unlike core bundles' `mautic..model.`: only the service IDs decide. -- The `config/local.php` parameter keys are not renamed by the migration either (they are not in the database): `plan_currency` → `program_currency`, the `plan_*_types` lists → `program_*_types`, and the pre-0.15 audience keys `plan_target_attribute_*`, `plan_target_decision_roles` and `plan_target_tones` → `program_audience_attribute_*`, `program_audience_decision_roles` and `program_audience_tones`. Rename them by hand after upgrading, or the type lists on the settings page and every type dropdown read empty (the stored items keep their type keys, they only show "Unknown type"). \ No newline at end of file +- The permission keys of each role are stored in the `permissions` table per (bundle, name); a role that had `plan:plans:*` grants doesn't automatically get `mt3smarketingprogram:programs:*`, and cached permission sets in the sessions need a re-login. +- `getModel()` resolves `mt3smp.program` to the service `mt3s.marketing_program.model.program`, unlike core bundles' `mautic..model.`: only the service IDs decide. +- The `config/local.php` parameter keys are not renamed by the migration either (they are not in the database): `plan_currency` → `mt3s_marketing_program_currency`, the `plan_*_types` lists → `mt3s_marketing_program_*_types`, and the pre-0.15 audience keys `plan_target_attribute_*`, `plan_target_decision_roles` and `plan_target_tones` → `mt3s_marketing_program_audience_attribute_*`, `mt3s_marketing_program_audience_decision_roles` and `mt3s_marketing_program_audience_tones`. Rename them by hand after upgrading, or the type lists on the settings page and every type dropdown read empty (the stored items keep their type keys, they only show "Unknown type"). \ No newline at end of file
    {{- include('@MauticCore/Helper/list_actions.html.twig', { 'item': item, 'templateButtons': { 'edit': canEdit, - 'delete': securityHasEntityAccess(permissions['program:tasks:deleteown'], permissions['program:tasks:deleteother'], item.createdBy), + 'delete': securityHasEntityAccess(permissions['mt3smarketingprogram:tasks:deleteown'], permissions['mt3smarketingprogram:tasks:deleteother'], item.createdBy), }, - 'langVar': 'initiative.task', + 'langVar': 'program.task', }) -}} {{ item.id }} - {% set typeIcon = program_item_type_icon('task', item.type) %} - {% if typeIcon %}{% endif %} + {% set typeIcon = mt3s_marketing_program_item_type_icon('task', item.type) %} + {% if typeIcon %}{% endif %} {% if canEdit %} - {{ item.name }} + {{ item.name }} {% else %} {{ item.name }} {% endif %} {% set description = item.description|default('')|striptags|trim %} - {{ (description|length > 120 ? description|slice(0, 120) ~ '…' : description)|program_linkify }} + {{ (description|length > 120 ? description|slice(0, 120) ~ '…' : description)|mt3s_marketing_program_linkify }} {{ item.startDate ? item.startDate|date('Y-m-d') : '' }} {{ item.endDate ? item.endDate|date('Y-m-d') : '' }} {# A phase has no status of its own: its state comes from its tasks. #} - {% if item.taskKind != constant('MauticPlugin\\ProgramBundle\\Entity\\TaskKind::Phase') %} + {% if item.taskKind != constant('MauticPlugin\\MT3SMarketingProgramBundle\\Entity\\TaskKind::Phase') %} {{ item.status.labelKey|trans }} {% else %} - {{ 'mautic.program.task.kind.phase_short'|trans }} + {{ 'mt3s.marketing_program.task.kind.phase_short'|trans }} {% endif %}