ContentManagerProductContentsController

Extends \AdminHttpViewController

Class ContentManagerProductContentsController

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 file product contents and returns the array for new file post data.

_checkProductContentFileUploads() : 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

_getCkEditorData

_getCkEditorData() 

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".

_getEditData

_getEditData() 

Returns the type of a file by its file extension.

_getFileType( $file) : string

Arguments

$file

Response

string

Return the data for the products content overview.

_getOverviewData() : array

Response

array

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

_getProductContentCustomerGroups

_getProductContentCustomerGroups() 

_getProductContentEditData

_getProductContentEditData() 

_getProductContentProducts

_getProductContentProducts() 

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.

_insertIntoProductContentDescriptionsAndResources

_insertIntoProductContentDescriptionsAndResources(array $productContentDescriptionData, array $productContentResourceData,  $type) 

Arguments

$productContentDescriptionData

array

$productContentResourceData

array

$type

_insertIntoProductContentProducts

_insertIntoProductContentProducts( $productContentId,  $type) 

Arguments

$productContentId

$type

_insertIntoProductContentsAndReturnInsertId

_insertIntoProductContentsAndReturnInsertId( $type) 

Arguments

$type

_insertProductContentPostData

_insertProductContentPostData( $type) 

Arguments

$type

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

_prepareProductContentDescriptionData

_prepareProductContentDescriptionData( $productContentId,  $type) 

Arguments

$productContentId

$type

_prepareProductContentResourceData

_prepareProductContentResourceData( $type) 

Arguments

$type

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.

_updateIntoProductContentDescriptionsAndResources

_updateIntoProductContentDescriptionsAndResources(array $productContentDescriptionData, array $productContentResourceData) 

Arguments

$productContentDescriptionData

array

$productContentResourceData

array

_updateIntoProductContentProducts

_updateIntoProductContentProducts( $productContentId,  $type) 

Arguments

$productContentId

$type

_updateIntoProductContentsAndReturnInsertId

_updateIntoProductContentsAndReturnInsertId( $type) 

Arguments

$type

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.

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

actionEdit

actionEdit() 

Returns the form to edit the product file content

actionEditFile() : \AdminLayoutHttpControllerResponse|boolean

Return the form for creating a new product content.

actionNew() : \AdminLayoutHttpControllerResponse|boolean

Saves product content file data.

actionSaveFile() : \RedirectHttpControllerResponse

Saves product content text data.

actionSaveText() : \RedirectHttpControllerResponse

actionUpdate

actionUpdate() 

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 \HttpResponseProcessorInterface::proceed \HttpContextReaderInterface::getActionName
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

languageProvider

languageProvider : \LanguageProvider
var

Type(s)

\LanguageProvider

queryBuilder

queryBuilder : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

title

title : \NonEmptyStringType
var

Type(s)

\NonEmptyStringType

descriptionFields

descriptionFields : array
var

Type(s)

array

resourceFields

resourceFields : 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