LEAP_MasterContent
LEAP™ uses a generic Master_Content table that can be addresses either through direct SQL inlines or through the LEAP_MasterContent data type.
Accessors
The LEAP_MasterContent data type contains two main public methods: load() and save(). Save will handle new record creation as it inherently is a versioned system. That means only the most recent entry is picked up by load(). Future enhancements will allow viewing and reversion to previous states via additional methods.
LEAP_MasterContent as an object
The data type contains the following public data members:
id::integer
The primary key, unique to the row.
Readable but writable only via assignment (the value is not written back to the source row).
updateDate::date
The last updated date of the object.
Readable. Any value change effected programatically will not be saved.
ContentID::integer
The ID of the content instance. This is not the same as .id, which is in effect a content version.
Readable and writable, however be wary of altering it's value as it will have significant consequences such as loss of or misplacement of data.
PageID::integer
The ID of the container page (or page group, etc). This is relative to the Scope of the container Space.
Readable but not writable.
ClassID::integer
A CSS class integer id, as relating to the Master CSS table.
Readable and writable
ClassName::string
The name of the CSS class as referenced by .ClassID
Readable, not writable. Any value change effected programatically will not be saved.
HtmlID::integer
The CSS "html" id, as an integer reference to the Master CSS table.
Readable and writable.
HtmlName::string
The name of the CSS id element as referenced by .HtmlID
Readable, not writable. Any value change effected programatically will not be saved.
HTMLType::string
A string element that denotes p, h1, h2, etc.
Readable and writable.
CustomCSS::string
The contents of this element would be used for storing custom style data for the display of the object.
Readable and writable.
status::string
Used for storing a text-based status. For example "html" or "unformatted" could be valid data.
Readable and writable.
html::string
This element is intended for storage of html formatted text.
Readable and writable.
Text::string
This element is intended for storage of unformatted or raw text. This can be used in conjunction with or instead of the .html element.
Usage
Creating a new text plugin instance on insertion of new content.
This example demonstrates priming of default content on inserting a new instance of the plugin:
local(this = LEAP_MasterContent)
if(...) => {
// ...
else(var('actionis') == 'create' && $gv_admin == true)
if($ContentID > 0) => {
#this->status = 'html'
#this->ContentID = $ContentID
#this->html = 'Insert content here'
#this->save('create','Create Text Module')
$gv_admin = true
}
}
Updating an instance of a plugin, demonstrates pushing only the relevant data, leaving the remainder the same.
local(this = LEAP_MasterContent)
if(var('actionis') == 'save') => {
if($ContentID > 0) => {
#this->load
#this->status = 'html'
#this->html = string(client_param('data'))
#this->save
$gv_admin = false
}
}