Stud.IP  6.0
ContainerType Class Reference
Inheritance diagram for ContainerType:
AccordionContainer ListContainer TabsContainer

Public Member Functions

 initialPayload ()
 
 addBlock ($block, $sectionIndex)
 
 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()

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

Member Function Documentation

◆ addBlock()

addBlock (   $block,
  $sectionIndex 
)
abstract

Adds a block id to payload of the container

Parameters
/Courseware/Block$block - block to be added to the container

◆ copyPayload()

copyPayload ( array  $block_map = [])

◆ decodePayloadString()

decodePayloadString ( string  $payload)
protected

Decode a given payload.

Parameters
string$payloadthe payload to be decoded
Returns
mixed the decoded payload

◆ factory()

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

◆ findContainerType()

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

◆ getContainerTypes()

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

getContainerWidth ( )

Returns a containers width as a description.

Returns
string the description

◆ getDescription()

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

◆ getJsonSchema()

static getJsonSchema ( )
staticabstract

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

Returns
string the JSON schema to be used

◆ getPayload()

getPayload ( )

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

Returns
mixed the decoded payload

◆ getPdfHtmlTemplate()

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
|null the instance if exists, otherwise null.

◆ getTitle()

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

◆ getType()

static getType ( )
staticabstract

Returns a short string describing this type of container.

Returns
string the short string describing this type

◆ initialPayload()

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

◆ isContainerType()

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

setPayload (   $payload)

Encodes the payload and sets it in the associated block.

Parameters
mixed$payloadthe payload to be encoded

◆ validatePayload()

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

$container
protected

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