include/DashletContainer/DCMetaDataParser.php
\DCMetaDataParser
DCMetaDataParser handles both the loading and saving of meta-data for Dashlet Containers.
It also provides the API for adding and removing Dashlets from a layout. Since all Dashlet Containers use the same Meta-Data it is in the interest of uniformity to keep this class separate. Think of this meta-data as the master list. This meta-data DOES NOT handle specifics on layout positioning of Dashlets. It just handles which Dashlets should be rendered. Layout Positioning is handled by each Dashlet Container Layout on an individual basis and is not common between Dashlet Container Layouts.
- Api
- Author
- mitani
Properties
string
$filePath= 'null'
file path to the original meta-data loaded
null
Details- Type
- string
Methods
__construct(
string $filePath
)
:
void
Constructor takes in a file path and loads the appropriate meta-data
Name | Type | Description |
---|---|---|
$filePath | string |
Exception | Description |
---|---|
\FileNotFound | and InvalidMetaData errors |
addDashlet(
\$dashletID $dashletID, \$group $group, \$position $position
)
:
bool
This function will add a dashlet to the provided files meta-data based given a dashlet id specifiying the dashlet to add, the group id specifying the group to add it to, and the position within the group to place it in.
This function will be called in conjunction with addDashlet in the Dashlet Container Layout (DCL) with the DCL handling layout specific positioning of a dashlet.
Name | Type | Description |
---|---|---|
$dashletID | \$dashletID |
|
$group | \$group |
|
$position | \$position |
|
Type | Description |
---|---|
bool | - success or failure of add |
getDashlets(
)
:
\unknown_type
Returns the metadata of the dashlets defined
Type | Description |
---|---|
\unknown_type |
load(
\$filePath $filePath
)
:
bool
This function will load the meta-data based on a given file path
Dashlet Meta Data Loading Process 1. Check if a user customized version exists in user preferences (convert the file path to a guid) and load that one if availble 2. Check if a system customized version exists in custom/$dashletMetaDataFile and load that one 3. Otherwise load the provided file path
If the file path is not found or if the meta-data is invalid it will throw an error and return false
Name | Type | Description |
---|---|---|
$filePath | \$filePath |
|
Type | Description |
---|---|
bool | - success or failure of load |
Exception | Description |
---|---|
\FileNotFound | and InvalidMetaData errors |
moveDashlet(
\$id $id, \$group $group, \$position $position
)
:
bool
Allows for moving a dashlet to either a new position in the same group or a new group entirely
Name | Type | Description |
---|---|---|
$id | \$id |
|
$group | \$group |
|
$position | \$position |
|
Type | Description |
---|---|
bool | - success or failure |
removeDashlet(
\$id $id
)
:
bool
Handles the removing of a dashlet from the meta-data based on an instance id of a dashlet
Name | Type | Description |
---|---|---|
$id | \$id |
|
Type | Description |
---|---|
bool | - success or failure of remove |
save(
string $type
=
'SYSTEM'
)
:
bool
Handles the saving of a Dashlet Containers Meta Data. This is useful when either an administrator or end user changes a given layout.Depending on the type it will save the meta-data accordingly.
if $type == 'SYSTEM' it will save to the custom directory if $type == 'USER' it will save to the user preferences of the current user
Name | Type | Description |
---|---|---|
$type | string |
Type | Description |
---|---|
bool | - on success or failure of save |