ContentManagerElementsController

Extends \AdminHttpViewController

Class ContentManagerPagesController

This class contains some helper methods for handling view requests. Be careful always when outputting raw user data to HTML or when handling POST requests because insufficient protection will lead to XSS and CSRF vulnerabilities.

category

System

package

AdminHttpViewControllers

Methods

__construct

__construct(\HttpContextReaderInterface $httpContextReader, \HttpResponseProcessorInterface $httpResponseProcessor, \ContentViewInterface $defaultContentView) 
inherited

Arguments

$httpContextReader

\HttpContextReaderInterface

$httpResponseProcessor

\HttpResponseProcessorInterface

$defaultContentView

\ContentViewInterface

Invokes an action method by the given action name.

_callActionMethod(string $actionName) : \HttpControllerResponseInterface
inherited
Throws
\LogicException

If no action method of the given name exists.

Arguments

$actionName

string

Name of action method to call, without 'action'-Suffix.

Response

\HttpControllerResponseInterface

Response message.

Detects file uploads for scriptpages and returns the array for new content_file post data.

_checkScriptpageFileUploads() : array

Response

array

Creates the content navigation object for the content manager templates.

_createContentNavigation(\LanguageTextManager $languageTextManager, string|null $current = null) : \ContentNavigationCollection
inherited

Arguments

$languageTextManager

\LanguageTextManager

Text manager instance to fetch texts.

$current

string|null

(Optional) Whether "pages", "elements" or "productContents" to set nav item active.

Response

\ContentNavigationCollection

Creates a new content group id.

_createNewContentGroupId(\CI_DB_query_builder $queryBuilder) : integer
inherited

Arguments

$queryBuilder

\CI_DB_query_builder

Query builder instance to access the database.

Response

integer

New content manager group id.

Returns the assets for the content manager editing and creation pages.

_getAssets() : \AssetCollection
inherited

Response

\AssetCollection

Fetches and returns the content data for the content manager elements.

_getContentData() : array

Response

array

Returns the content type of the given query result.

_getContentType(array $queryResult) : string
inherited

Arguments

$queryResult

array

Data sets of query for content_manager table.

Response

string

Whether "content", "file" or "link".

Creates the template data for creation pages.

_getCreationData(string $action) : array|boolean|\KeyValueCollection

The action determines the target location after clicking the submit button.

Arguments

$action

string

Should be whether "home", "header", "footer" or "boxes".

Response

array|boolean|\KeyValueCollection

Prepares and returns the content manager data to be edited.

_getEditData() : \KeyValueCollection

Returns the expected $_POST value by the given key name.

_getPostData(string $keyName) : string|null
inherited

This method is the object oriented layer for $_POST[$keyName].

Arguments

$keyName

string

Expected key of post parameter.

Response

string|null

Either the expected value or null, of not found.

Creates and returns a key value collection which represent the global $_POST array.

_getPostDataCollection() : \KeyValueCollection
inherited

Returns an array with allowed script files for content data.

_getProductsContentFiles() : array
inherited

Response

array

List with allowed script files.

Returns the expected $_GET value by the given key name.

_getQueryParameter(string $keyName) : mixed|null
inherited

This method is the object oriented layer for $_GET[$keyName].

Arguments

$keyName

string

Expected key of query parameter.

Response

mixed|null

Either the expected value or null, of not found.

Creates and returns a key value collection which represent the global $_GET array.

_getQueryParametersCollection() : \KeyValueCollection
inherited

Returns an array with allowed script files for content data.

_getScriptPageFiles() : array
inherited

Response

array

List with allowed script files.

Returns the expected $_SERVER value by the given key name.

_getServerData(string $keyName) : string|null
inherited

This method is the object oriented layer for $_SERVER[$keyName].

Arguments

$keyName

string

Expected key of server parameter.

Response

string|null

Either the expected value or null, of not found.

Returns an existing file object with the path to a content manager template file.

_getTemplate(string $type, string $name) : \ExistingFile
inherited

Take a look on the template files which are located in html/content/content_manager/$type directory to know possible values for the $name argument.

Arguments

$type

string

Content manager type, whether "pages", "elements" or "product_contents".

$name

string

Name of template file.

Response

\ExistingFile

Whether redirects to the last overview or update pages.

_getUpdateResponse(string $contentManagerType, integer $contentGroupId,  $editMethod = 'edit') : \RedirectHttpControllerResponse
inherited

Arguments

$contentManagerType

string

Name of content manager controller class.

$contentGroupId

integer

Content id of last edited content.

$editMethod

Response

\RedirectHttpControllerResponse

Inserts the given content data in the database.

_insertContentData(\CI_DB_query_builder $queryBuilder, array $contentData) : $this|\ContentManagerPagesController
inherited

Arguments

$queryBuilder

\CI_DB_query_builder

Query builder instance to access the database.

$contentData

array

Content data array.

Response

$this|\ContentManagerPagesController

Same instance for chained method calls.

Returns true if the "Responsive File Manager" is installed an false otherwise.

_isFilemanagerAvailable() : boolean
inherited

Response

boolean

Prepares $_POST data for the content_manager's 'group_ids' column.

_prepareContentManagerGroupCheckData() : string
inherited

Response

string

Prepares the content manager elements post data.

_preparePostData(string $type) : array

Arguments

$type

string

Content manager type, whether "home", "header", "footer" or "boxes".

Response

array

Prepared data array for inserting or updating in database.

Renders and returns a template file.

_render(string $templateFile, array $contentArray) : string
inherited

Arguments

$templateFile

string

Template file to render.

$contentArray

array

Content array which represent the variables of the template.

Response

string

Rendered template.

Sets the expert mode, if the query parameter has been passed.

_setExpertMode() 
inherited

Updates the given content data in the database.

_updateContentData(\CI_DB_query_builder $queryBuilder, array $contentData, integer $contentGroupId) : $this|\ContentManagerPagesController
inherited

Arguments

$queryBuilder

\CI_DB_query_builder

Query builder instance to access the database.

$contentData

array

Content data array.

$contentGroupId

integer

Content group id.

Response

$this|\ContentManagerPagesController

Same instance for chained method calls.

Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.

_validatePageToken(string $customExceptionMessage = null) 
inherited

Example: public function proceed(HttpContextInterface $httpContext) { parent::proceed($httpContext); // proceed http context from parent class if($_SERVER['REQUEST_METHOD'] === 'POST') { $this->_validatePageToken(); // CSRF Protection } }

Throws
\Exception

If the validation fails.

Arguments

$customExceptionMessage

string

(optional) You can specify a custom exception message.

Renders the creation form for content manager boxes element pages.

actionCreateBoxes() : \AdminLayoutHttpControllerResponse

Renders the creation form for content manager footer element pages.

actionCreateFooter() : \AdminLayoutHttpControllerResponse

Renders the creation form for content manager header element pages.

actionCreateHeader() : \AdminLayoutHttpControllerResponse

Renders the creation form for content manager home element pages.

actionCreateHome() : \AdminLayoutHttpControllerResponse

Renders the creation form for content manager others element pages.

actionCreateOthers() : \AdminLayoutHttpControllerResponse

Renders the creation form for content manager withdrawal element pages.

actionCreateWithdrawal() : \AdminLayoutHttpControllerResponse

Default action method.

actionDefault() : \HttpControllerResponseInterface
inherited

Every controller child class requires at least the default action method, which is invoked when the ::_getQueryParameterData('do') value is not separated by a trailing slash.

Every action method have to return an instance which implements the http controller response interface.

Response

\HttpControllerResponseInterface

Renders the edit form for content manager home element pages.

actionEdit() : \AdminLayoutHttpControllerResponse

Stores content manager boxes element data in the database and redirects to the overview.

actionSaveBoxes() : \RedirectHttpControllerResponse

Stores content manager footer element data in the database and redirects to the overview.

actionSaveFooter() : \RedirectHttpControllerResponse

Stores content manager header element data in the database and redirects to the overview.

actionSaveHeader() : \RedirectHttpControllerResponse

Stores content manager home element data in the database and redirects to the overview.

actionSaveHome() : \RedirectHttpControllerResponse

Stores content manager others element data in the database and redirects to the overview.

actionSaveOthers() : \RedirectHttpControllerResponse

Stores content manager withdrawal element data in the database and redirects to the overview.

actionSaveWithdrawal() : \RedirectHttpControllerResponse

Updates content manager elements data in the database and redirects to the overview.

actionUpdate() : \RedirectHttpControllerResponse

Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.

getTemplateFile(string $templateFile) : \ExistingFile
inherited
Throws
\Exception

if the path or file is not found

Arguments

$templateFile

string

The relative path and filename to search for

Response

\ExistingFile

containing absolute file path to the given template file

Initialize Controller

init() 

Processes a http response object which is get by invoking an action method.

proceed(\HttpContextInterface $httpContext) 
inherited

The action method is determined by the http context reader instance and the current request context. Re-implement this method in child classes to enable XSS and CSRF protection on demand.

see \HttpContextReaderInterface::getActionName \HttpResponseProcessorInterface::proceed
Throws
\LogicException

When no action method is found by the http context reader.

Arguments

$httpContext

\HttpContextInterface

Http context object which hold the request variables.

Makes sure that the admin status is currently given in session

validateCurrentAdminStatus() 
inherited
Throws
\LogicException

Properties

userConfigurationService

userConfigurationService : \UserConfigurationService

languageTextManager

languageTextManager : \LanguageTextManager
var

Type(s)

\LanguageTextManager

queryBuilder

queryBuilder : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

languageProvider

languageProvider : \LanguageProvider
var

Type(s)

\LanguageProvider

title

title : \NonEmptyStringType
var

Type(s)

\NonEmptyStringType

fieldMap

fieldMap : array
var

Type(s)

array

switcherFields

switcherFields : array
var

Type(s)

array

typeMap

typeMap : array
var

Type(s)

array

contentTypeFileFlagMap

contentTypeFileFlagMap : array
inherited
var

Type(s)

array

fileTypMap

fileTypMap : array
inherited
var

Type(s)

array

isExpertMode

isExpertMode : boolean
inherited
var

Type(s)

boolean

httpContextReader

httpContextReader : \HttpContextReaderInterface
inherited

httpResponseProcessor

httpResponseProcessor : \HttpResponseProcessorInterface
inherited

contentView

contentView : \ContentViewInterface
inherited
var

Type(s)

\ContentViewInterface

queryParametersArray

queryParametersArray : array
inherited
var

Type(s)

array

postDataArray

postDataArray : array
inherited
var

Type(s)

array

Contain the assets needed to be included in the view HTML.

assets : \AssetCollectionInterface
inherited
var

Contain the assets needed to be included in the view HTML.

Type(s)

\AssetCollectionInterface

Server data.

serverDataArray : array
inherited
var

Server data.

Type(s)

array