BaseLesson
extends Basic
in package
Uses
Images
Define system lesson object
Tags
Table of Contents
- $ : bool|null
- $ignore_hash_fields : array<string|int, mixed>
- $_next : BaseLesson|null
- $_next_extra : array<string|int, mixed>|null
- __construct() : mixed
- The lesson constructor.
- AssignImage() : Result
- Assign an image from instance
- Author() : User|null
- Get the original author of the task
- CreateExtra() : Result
- Create a new extra
- DeleteExtra() : Result
- Delete the extra
- FetchExtras() : Result
- Fetch extra list
- GetExtra() : Result
- Fetch single extra
- GetPrimaryPicture() : Asset|null
- Get the primary picture
- Hash() : string
- Generate hash of current contents
- HasSubscription() : Result
- Check if user has subscription for this entry
- Images() : array<string|int, mixed>|array<string|int, Asset>
- List images
- MainImage() : Asset|null
- Get main image
- Name() : mixed|null
- Get the lesson name
- Next() : BaseLesson|null
- Get the next lesson in the row
- NextExtra() : array<string|int, mixed>|null
- Method to get the configuration of "next" relation
- Save() : Result|null
- SearchFields() : array<string|int, mixed>
- UpdateExtra() : Result
- Update the extra
- extrasPath() : string
- Helper to get the extras path
- writeExtra() : Result
- Store extras
Properties
$
public
bool|null
$
is_timed
$ignore_hash_fields
protected
array<string|int, mixed>
$ignore_hash_fields
= ['last_changed_by', 'last_changed_at']
$_next
private
BaseLesson|null
$_next
= null
$_next_extra
private
array<string|int, mixed>|null
$_next_extra
= null
Methods
__construct()
The lesson constructor.
public
__construct([null|int $id = null ][, null|string $language = null ][, null|string $type = 'baselesson' ]) : mixed
Parameters
- $id : null|int = null
-
The lesson id
- $language : null|string = null
-
The local language or null
- $type : null|string = 'baselesson'
-
The sub type
Return values
mixed —AssignImage()
Assign an image from instance
public
AssignImage(Asset $asset) : Result
Parameters
- $asset : Asset
-
An asset instance
Return values
Result —The result object
Author()
Get the original author of the task
public
Author() : User|null
Return values
User|null —CreateExtra()
Create a new extra
public
CreateExtra(string $type, array<string|int, mixed> $data[, bool $individual = true ]) : Result
Parameters
- $type : string
- $data : array<string|int, mixed>
- $individual : bool = true
Return values
Result —DeleteExtra()
Delete the extra
public
DeleteExtra(string $type[, string|null $id = null ][, bool $individual = true ]) : Result
Parameters
- $type : string
-
The extras type
- $id : string|null = null
-
The id or null to drop all of certain kind
- $individual : bool = true
-
Is individual file or, in all full list?
Return values
Result —FetchExtras()
Fetch extra list
public
FetchExtras(string $type[, bool $individual = true ]) : Result
Parameters
- $type : string
- $individual : bool = true
Return values
Result —GetExtra()
Fetch single extra
public
GetExtra(string $type, string $id) : Result
Parameters
- $type : string
- $id : string
Return values
Result —GetPrimaryPicture()
Get the primary picture
public
GetPrimaryPicture() : Asset|null
Return values
Asset|null —Hash()
Generate hash of current contents
public
Hash() : string
Return values
string —HasSubscription()
Check if user has subscription for this entry
public
HasSubscription(User|null $user) : Result
Parameters
- $user : User|null
-
User
Return values
Result —A system result object
Images()
List images
public
Images([bool $resolved = false ]) : array<string|int, mixed>|array<string|int, Asset>
Get the content of the images attribute relation Will generate and return an empty array hen attribute is not filled
Parameters
- $resolved : bool = false
Return values
array<string|int, mixed>|array<string|int, Asset> —MainImage()
Get main image
public
MainImage() : Asset|null
Return values
Asset|null —Name()
Get the lesson name
public
Name(string $language) : mixed|null
Parameters
- $language : string
Return values
mixed|null —Next()
Get the next lesson in the row
public
Next() : BaseLesson|null
This method is cached
Return values
BaseLesson|null —NextExtra()
Method to get the configuration of "next" relation
public
NextExtra([string $key = 'delta' ]) : array<string|int, mixed>|null
Parameters
- $key : string = 'delta'
-
The key to fetch
Return values
array<string|int, mixed>|null —The specific setup or, null
Save()
public
Save([false $force_new_id = false ]) : Result|null
Parameters
- $force_new_id : false = false
Return values
Result|null —SearchFields()
public
SearchFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —UpdateExtra()
Update the extra
public
UpdateExtra(string $type, string $id, array<string|int, mixed> $data[, bool $individual = true ]) : Result
Parameters
- $type : string
-
The extras type
- $id : string
-
The item primary key
- $data : array<string|int, mixed>
-
The new data
- $individual : bool = true
-
Is individual file or in all full list?
Return values
Result —extrasPath()
Helper to get the extras path
private
extrasPath(string $type) : string
Parameters
- $type : string
Return values
string —writeExtra()
Store extras
private
writeExtra(string $file, array<string|int, mixed> $data[, bool $individual = true ]) : Result
Parameters
- $file : string
-
The target file
- $data : array<string|int, mixed>
-
The new row
- $individual : bool = true
-
Save in individual file?