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_*
96 lines
2.7 KiB
PHP
96 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\MT3SMarketingProgramBundle\Controller;
|
|
|
|
use Mautic\CoreBundle\Controller\AbstractStandardFormController;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
/**
|
|
* List, create, edit and delete audiences (Programs > Audiences), the global directory of who the
|
|
* 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 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 = 'mt3s_marketing_program_audience_index';
|
|
public const ROUTE_ACTION = 'mt3s_marketing_program_audience_action';
|
|
|
|
protected function getModelName(): string
|
|
{
|
|
return 'mt3smp.audience';
|
|
}
|
|
|
|
protected function getTemplateBase(): string
|
|
{
|
|
return '@MT3SMarketingProgram/Audience';
|
|
}
|
|
|
|
protected function getIndexRoute(): string
|
|
{
|
|
return self::ROUTE_INDEX;
|
|
}
|
|
|
|
protected function getActionRoute(): string
|
|
{
|
|
return self::ROUTE_ACTION;
|
|
}
|
|
|
|
protected function getJsLoadMethodPrefix(): string
|
|
{
|
|
return 'mt3sMpProgramAudience';
|
|
}
|
|
|
|
/**
|
|
* @param int $page
|
|
*/
|
|
public function indexAction(Request $request, $page = 1): Response
|
|
{
|
|
return $this->indexStandard($request, $page);
|
|
}
|
|
|
|
public function newAction(Request $request): Response
|
|
{
|
|
return $this->newStandard($request);
|
|
}
|
|
|
|
/**
|
|
* The audience's detail page (the directory entry, its persona attributes, its segments and
|
|
* 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', 'program');
|
|
}
|
|
|
|
/**
|
|
* @param int $objectId
|
|
* @param bool $ignorePost
|
|
*/
|
|
public function editAction(Request $request, $objectId, $ignorePost = false): Response
|
|
{
|
|
return $this->editStandard($request, $objectId, $ignorePost);
|
|
}
|
|
|
|
/**
|
|
* @param int $objectId
|
|
*/
|
|
public function deleteAction(Request $request, $objectId): Response
|
|
{
|
|
return $this->deleteStandard($request, $objectId);
|
|
}
|
|
|
|
public function batchDeleteAction(Request $request): Response
|
|
{
|
|
return $this->batchDeleteStandard($request);
|
|
}
|
|
} |