- Correct getChoices() docblock to reflect translated label => enum backing value order instead of value => label - Re-indent Smart Links menu config to match actual array nesting - Align assignment operators in RefreshStatsCommand - Add missing newline at end of RefreshStatsCommand.php
97 lines
2.7 KiB
PHP
97 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 mt3smarketingprogram.audience (mautic.mt3smarketingprogram.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 'mt3smarketingprogram.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);
|
|
}
|
|
}
|