Public Member Functions | |
__construct ($XmlType) | |
intializes the necessary variables | |
addSection ($mapping, $attributes=array(), $parent=array()) | |
Add a section Currently uses a switch statment and a set of child functions to add sections. | |
generateXML () | |
generate the XML for this set of sections | |
sortSections ($recursive=false, $parent=array()) | |
Alphabetically sort the sections. NOTE: this destroys all the ids, so you will have to guess what the ids are after running this function. I _very_ strongly suggest this be the LAST function run on a section before translating into XML. |
Allows users to add sections into the XML of their choice (XMLAlbum, XMLList, or XMLResource) The important functions are the constructor, addSection(), and generateXML().
CM3::__construct | ( | $ | XmlType | ) |
intializes the necessary variables
$XmlType | [string]: The type of Xml being inputted (Album, List, or Resource). |
CM3::addSection | ( | $ | mapping, | |
$ | attributes = array() , |
|||
$ | parent = array() | |||
) |
Add a section Currently uses a switch statment and a set of child functions to add sections.
$mapping | [string]: the mapping for this section (category or item) | |
$attributes | [Array]: (optional) an array of attributes ('attribute'=>'value') | |
$parent | [Array]: (optional) an array of ids (array indeces) for the parent sections. Capture the return value from the addSection function for the parent section and then just plug it in here (makes it far easier than guessing what the indeces will be). |
CM3::generateXML | ( | ) |
generate the XML for this set of sections
CM3::sortSections | ( | $ | recursive = false , |
|
$ | parent = array() | |||
) |
Alphabetically sort the sections. NOTE: this destroys all the ids, so you will have to guess what the ids are after running this function. I _very_ strongly suggest this be the LAST function run on a section before translating into XML.
$recursive | [boolean]: Tells the program to organize all the subsections as well. Defaults to false. | |
$parent | [Array]: standard ID array. |