Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
ContainerType Class Reference
Inheritance diagram for ContainerType:
AccordionContainer ListContainer TabsContainer

Public Member Functions

 initialPayload ()
 
 addBlock ($block)
 
 validatePayload ($payload)
 
 __construct (\Courseware\Container $container)
 
 getPayload ()
 
 setPayload ($payload)
 
 copyPayload (array $block_map=[])
 
 getContainerWidth ()
 
 getPdfHtmlTemplate ()
 

Static Public Member Functions

static getJsonSchema ()
 
static getType ()
 
static getTitle ()
 
static getDescription ()
 
static getContainerTypes ()
 
static isContainerType (string $containerType)
 
static findContainerType (string $containerType)
 
static factory (\Courseware\Container $container)
 

Protected Member Functions

 decodePayloadString (string $payload)
 

Protected Attributes

 $container
 

Detailed Description

This class represents the content of a Courseware container stored in payload.

Author
Marcus Eibrink-Lunzenauer lunze.nosp@m.naue.nosp@m.r@ela.nosp@m.n-ev.nosp@m..de
Ron Lucke lucke.nosp@m.@ela.nosp@m.n-ev..nosp@m.de GPL2 or any later version
Since
Stud.IP 5.0

Constructor & Destructor Documentation

__construct ( \Courseware\Container  $container)
Parameters
\Courseware\Container$containerthe container associated to this type

Member Function Documentation

addBlock (   $block)
abstract

Adds a block id to payload of the container

Parameters
/Courseware/Block$block - block to be added to the container
copyPayload ( array  $block_map = [])
decodePayloadString ( string  $payload)
protected

Decode a given payload.

Parameters
string$payloadthe payload to be decoded
Returns
mixed the decoded payload
static factory ( \Courseware\Container  $container)
static

Creates an instance of ContainerType for a given container.

Parameters
\Courseware\Container$containerthe container whose ContainerType is returned
Returns
ContainerType the ContainerType associated with the given container
static findContainerType ( string  $containerType)
static

Returns the classname of a container type whose type equals the given one.

Parameters
string$containerTypea short string describing a type of container; see getType
Returns
?string either the classname if the given type was valid; null otherwise
static getContainerTypes ( )
static

Returns all known types of containers: core types and plugin types as well.

Returns
array<string> a list of all known types of containers; each one a fully qualified class name
getContainerWidth ( )

Returns a containers width as a description.

Returns
string the description
static getDescription ( )
staticabstract

Returns the description of this type of containers suitable to display it to the user.

Returns
string the description of this type of containers
static getJsonSchema ( )
staticabstract

Returns the JSON schema which is used to validate the payload of instances of this type of container.

Returns
Schema the JSON schema to be used
getPayload ( )

Returns the decoded payload of the block associated with this instance.

Returns
mixed the decoded payload
getPdfHtmlTemplate ( )

Gets the related container's html template if exists otherwise a default one, to be exported as pdf if exists.

It turns the classname into snakecase in order to find the template file in templates/courseware/container_types.

Returns
mixed the instance if exists, otherwise null.
static getTitle ( )
staticabstract

Returns the title of this type of containers suitable to display it to the user.

Returns
string the title of this type of containers
static getType ( )
staticabstract

Returns a short string describing this type of container.

Returns
string the short string describing this type
initialPayload ( )
abstract

Returns the initial payload of every instance of this type of container.

Returns
array<mixed> the initial payload of an instance of this type of container
static isContainerType ( string  $containerType)
static
Parameters
string$containerTypea short string describing a type of container; see getType
Returns
bool true, if the given type of container is valid; false otherwise
setPayload (   $payload)

Encodes the payload and sets it in the associated block.

Parameters
mixed$payloadthe payload to be encoded
validatePayload (   $payload)

Validates a given payload according to the JSON schema of this type of container.

Parameters
mixed$payloadthe payload to be validated
Returns
bool true, if the given payload is valid; false otherwise

Field Documentation

$container
protected

The documentation for this class was generated from the following file: