Rename the Plan bundle to Program across config, routes, menus, and controllers (Plan -> Initiative), bump version to 0.16.0, and introduce new audience and UTM taxonomy routes and permissions to support the expanded Programs feature set.
96 lines
2.6 KiB
PHP
96 lines
2.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\ProgramBundle\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
|
|
* 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).
|
|
*
|
|
* Model program.audience (mautic.program.model.audience), permission base program:audiences, translation
|
|
* base mautic.program.audience.
|
|
*/
|
|
class AudienceController extends AbstractStandardFormController
|
|
{
|
|
public const ROUTE_INDEX = 'initiative_audience_index';
|
|
public const ROUTE_ACTION = 'initiative_audience_action';
|
|
|
|
protected function getModelName(): string
|
|
{
|
|
return 'program.audience';
|
|
}
|
|
|
|
protected function getTemplateBase(): string
|
|
{
|
|
return '@Program/Audience';
|
|
}
|
|
|
|
protected function getIndexRoute(): string
|
|
{
|
|
return self::ROUTE_INDEX;
|
|
}
|
|
|
|
protected function getActionRoute(): string
|
|
{
|
|
return self::ROUTE_ACTION;
|
|
}
|
|
|
|
protected function getJsLoadMethodPrefix(): string
|
|
{
|
|
return 'programAudience';
|
|
}
|
|
|
|
/**
|
|
* @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 initiatives 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');
|
|
}
|
|
|
|
/**
|
|
* @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);
|
|
}
|
|
} |