Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
portfolio_format_leap2a_entry Class Reference
Inheritance diagram for portfolio_format_leap2a_entry:
portfolio_format_leap2a_file

Public Member Functions

 __construct ($id, $title, $type, $content=null)
 Constructor. More...
 
 __set ($field, $value)
 Override __set to do proper dispatching for different things. More...
 
 add_category ($term, $scheme=null, $label=null)
 Add a category to this entry http://wiki.cetis.ac.uk/2009-03/LEAP2A_categories "tags" should just pass a term here and no scheme or label. More...
 
 add_link ($otherentry, $reltype, $displayorder=null)
 Add a link from this entry to another one. More...
 
 to_dom (DomDocument $dom, $feedauthor)
 Create an entry element and append all the children And return it rather than adding it to the dom. More...
 
 validate ()
 Validate this entry. More...
 

Public Attributes

array $attachments = array()
 attachments to this entry
 
string $author
 optional author (only if different to feed author)
 
mixed $content
 main content of the entry. More...
 
string $id
 entry id - something like forumpost6, must be unique to the feed
 
array $links = array()
 links from this entry to other entries
 
int $published
 published date (ctime) - unix timestamp
 
string $summary
 summary - for split long content
 
string $title
 title of the entry
 
string $type
 leap2a entry type
 
int $updated
 updated date - unix timestamp
 

Protected Member Functions

 add_extra_links ($dom, $entry)
 Hook function for subclasses to add extra links (like for files) More...
 

Constructor & Destructor Documentation

◆ __construct()

portfolio_format_leap2a_entry::__construct (   $id,
  $title,
  $type,
  $content = null 
)

Constructor.

All arguments are required (and will be validated) http://wiki.cetis.ac.uk/2009-03/LEAP2A_types

Parameters
string$idunique id of this entry. could be something like forumpost6 for example. This must be unique to the entire feed.
string$titletitle of the entry. This is pure atom.
string$typethe leap type of this entry.
mixed$contentthe content of the entry. string (xhtml/html/text)

Member Function Documentation

◆ __set()

portfolio_format_leap2a_entry::__set (   $field,
  $value 
)

Override __set to do proper dispatching for different things.

Only allows the optional and required leap2a entry fields to be set

Parameters
string$fieldproperty's name
mixed$valueproperty's value
Return values
mixed

◆ add_category()

portfolio_format_leap2a_entry::add_category (   $term,
  $scheme = null,
  $label = null 
)

Add a category to this entry http://wiki.cetis.ac.uk/2009-03/LEAP2A_categories "tags" should just pass a term here and no scheme or label.

They will be automatically normalised if they have spaces.

Parameters
string$termeg 'Offline'
string$scheme(optional) eg resource_type
string$label(optional) eg File

◆ add_extra_links()

portfolio_format_leap2a_entry::add_extra_links (   $dom,
  $entry 
)
protected

Hook function for subclasses to add extra links (like for files)

Parameters
DomDocument$domfeed object
DomDocument$entryfeed added link

Reimplemented in portfolio_format_leap2a_file.

◆ add_link()

portfolio_format_leap2a_entry::add_link (   $otherentry,
  $reltype,
  $displayorder = null 
)

Add a link from this entry to another one.

These will be collated at the end of the export (during to_xml) and validated at that point. This function does no validation http://wiki.cetis.ac.uk/2009-03/LEAP2A_relationships

Parameters
portfolio_format_leap2a_entry | string$otherentryportfolio_format_leap2a_entry or its id
string$reltype(no leap2: ns required)
string$displayorder(optional)
Return values
portfolio_format_leap2a_entrythe current entry object. This is so that these calls can be chained eg $entry->add_link('something6', 'has_part')->add_link('something7', 'has_part');

◆ to_dom()

portfolio_format_leap2a_entry::to_dom ( DomDocument  $dom,
  $feedauthor 
)

Create an entry element and append all the children And return it rather than adding it to the dom.

This is handled by the main writer object.

Parameters
DomDocument$domuse this to create elements
stdClass$feedauthorobject of author(user) info
Return values
DOMDocument

◆ validate()

portfolio_format_leap2a_entry::validate ( )

Validate this entry.

At the moment this just makes sure required fields exist but it could also check things against a list, for example

Todo:
MDL-31303 - add category with a scheme 'selection_type'

Member Data Documentation

◆ $content

mixed portfolio_format_leap2a_entry::$content

main content of the entry.

can be html,text,or xhtml. for a stored_file, use portfolio_format_leap2a_file


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