Stud.IP  5.4
 All Data Structures Namespaces Files Functions Variables Groups
BlockType Class Reference
Inheritance diagram for BlockType:
Audio BeforeAfter BiographyAchievements BiographyCareer BiographyGoals BiographyPersonalInformation Canvas Chart Code Confirm Date DialogCards Document Download Embed Error Folder Gallery Headline IFrame ImageMap KeyPoint Link TableOfContents Text Timeline Typewriter Video

Public Member Functions

 initialPayload ()
 
 validatePayload ($payload)
 
 __construct (\Courseware\Block $block)
 
 getPayload ()
 
 setPayload ($payload)
 
 copyPayload (string $rangeId= '')
 
 getFiles ()
 
 getFeedback ()
 
 getPdfHtmlTemplate ()
 

Static Public Member Functions

static getType ()
 
static getTitle ()
 
static getDescription ()
 
static getJsonSchema ()
 
static getCategories ()
 
static getContentTypes ()
 
static getFileTypes ()
 
static getBlockTypes ()
 
static isBlockType (string $blockType)
 
static findBlockType (string $blockType)
 
static factory (\Courseware\Block $block)
 

Protected Member Functions

 decodePayloadString (string $payload)
 
 getFileById (string $fileId)
 
 getFileRefById (string $fileId)
 
 copyFileById (string $fileId, string $rangeId)
 
 copyFolderById (string $folderId, string $rangeId)
 

Protected Attributes

 $block
 

Detailed Description

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

Author
Marcus Eibrink-Lunzenauer lunze.nosp@m.naue.nosp@m.r@ela.nosp@m.n-ev.nosp@m..de
Till Glöggler gloeg.nosp@m.gler.nosp@m.@elan.nosp@m.-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

(PHPMD.CouplingBetweenObjects)

Constructor & Destructor Documentation

__construct ( \Courseware\Block  $block)
Parameters
\Courseware\Block$blockthe block associated to this type

Member Function Documentation

copyFileById ( string  $fileId,
string  $rangeId 
)
protected

Copies a file to a specified range.

Parameters
string$fileIdthe ID of the file
string$rangeIdthe ID of the range
Returns
string the ID of the copy
copyFolderById ( string  $folderId,
string  $rangeId 
)
protected

Copies a folder to a specified range.

Parameters
string$fileIdthe ID of the folder
string$rangeIdthe ID of the range
Returns
string the ID of the copy
copyPayload ( string  $rangeId = '')
decodePayloadString ( string  $payload)
protected

Decode a given payload.

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

Creates an instance of BlockType for a given block.

Parameters
\Courseware\Block$blockthe block whose BlockType is returned
Returns
BlockType the BlockType associated with the given block
static findBlockType ( string  $blockType)
static

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

Parameters
string$blockTypea short string describing a type of block; see getType
Returns
mixed either the classname if the given type was valid; null otherwise
static getBlockTypes ( )
static

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

Returns
array<string> a list of all known types of blocks; each one a fully qualified class name
static getCategories ( )
staticabstract

Returns a list of categories to which this type of block is associated.

Returns
array the list of categories
static getContentTypes ( )
staticabstract

Returns a list of content types to which this type of block is associated.

Returns
array the list of content types
static getDescription ( )
staticabstract

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

Returns
string the description of this type of blocks
getFeedback ( )

Returns all feedback of the block.

Returns
array<array> a list of feedback objects
getFileById ( string  $fileId)
protected

Casts a of a given ID to an array and returns that.

Parameters
string$fileIdthe ID of the
Returns
array either an empty array if there is no such or that cast to an array
getFileRefById ( string  $fileId)
protected
getFiles ( )

Returns a list of files associated to the block.

Returns
array the list of files
static getFileTypes ( )
staticabstract

Returns a list of file types to which this type of block is associated.

Returns
array the list of file types
static getJsonSchema ( )
staticabstract

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

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 block'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/block_types.

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

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

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

Returns a short string describing this type of blocks.

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

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

Returns
array<mixed> the initial payload of an instance of this type of block
static isBlockType ( string  $blockType)
static
Parameters
string$blockTypea short string describing a type of block; see getType
Returns
bool true, if the given type of block 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 block.

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

Field Documentation

$block
protected

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