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. | |
Protected Attributes | |
| $listSections | |
| Stores all the sections in a big array or arrays. | |
| $XmlName | |
| The name of this XML type. | |
Private Member Functions | |
| addCategory ($attributes, $parent) | |
| Adds a section with the mapping 'category'. | |
| addItem ($attributes, $parent) | |
| Adds a section with the mapping 'item'. | |
| addToParent ($array, $parentIds) | |
| a helper function that adds a given section array to a given parent. | |
| generateCategory ($sectionItem, $top) | |
| the helper function to generate categories (currently doesn't do anything) | |
| generateItem ($sectionItem, $top) | |
| the helper function to generate items | |
| generateSection ($sectionItem) | |
| a helper function that generates a single section. Also recursively generates XML for child sections. Uses a switch on mapping and a set of child functions to generate XML. | |
| prepareParent ($array, $parentIds=array(), $parentArray=array()) | |
| a helper function that recursively searches listSections for the given parent and adds the given section array. | |
| sortSectionHelper ($recursive=false, $parentIds=array(), $parentArray=array()) | |
| A manager function for sorting. Hands the firs sections to sortSubSections (below), and handles some of the irregularities at the end. | |
| sortSubSections ($subSections=array(), $recursive=false) | |
| sorts the children of a certain section. | |
Allows users to add sections into the XML of their choice (XMLAlbum, XMLList, or XMLResource) The important functions are the constructor, addSection(), and generateXML().
Definition at line 12 of file CM3.php5.
| CM3::__construct | ( | $ | XmlType | ) |
| CM3::addCategory | ( | $ | attributes, | |
| $ | parent | |||
| ) | [private] |
Adds a section with the mapping 'category'.
For internal use only.
| $attributes | [Array]: an array of attributes and values. | |
| $parent | [Array]: the parent Id (an array of indeces). |
Definition at line 56 of file CM3.php5.
References addToParent().
Referenced by addSection().
| CM3::addItem | ( | $ | attributes, | |
| $ | parent | |||
| ) | [private] |
Adds a section with the mapping 'item'.
For internal use only.
| $attributes | [Array]: an array of attributes and values. | |
| $parent | [Array]: the parent Id (an array of indeces). |
Definition at line 69 of file CM3.php5.
References addToParent().
Referenced by addSection().
| 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). |
Definition at line 36 of file CM3.php5.
References addCategory(), and addItem().
| CM3::addToParent | ( | $ | array, | |
| $ | parentIds | |||
| ) | [private] |
a helper function that adds a given section array to a given parent.
For internal use only.
| $array | [Array]: the section (represented by an array) generated by the appropriate section generator function. | |
| $parentIds | [Array]: The parent Id (an array of indeces). |
Definition at line 83 of file CM3.php5.
References prepareParent().
Referenced by addCategory(), and addItem().
| CM3::generateCategory | ( | $ | sectionItem, | |
| $ | top | |||
| ) | [private] |
the helper function to generate categories (currently doesn't do anything)
For internal use only.
| $sectionItem | [Array]: the array for the current section (generated by the appropriate section generator). | |
| $top | [boolean]: whether this is above or below the child sections. |
Definition at line 285 of file CM3.php5.
Referenced by generateSection().
| CM3::generateItem | ( | $ | sectionItem, | |
| $ | top | |||
| ) | [private] |
the helper function to generate items
For internal use only.
| $sectionItem | [Array]: the array for the current section (generated by the appropriate section generator). | |
| $top | [boolean]: whether this is above or below the child sections. |
Definition at line 292 of file CM3.php5.
Referenced by generateSection().
| CM3::generateSection | ( | $ | sectionItem | ) | [private] |
a helper function that generates a single section. Also recursively generates XML for child sections. Uses a switch on mapping and a set of child functions to generate XML.
For internal use only.
| $sectionItem | [Array]: the array for the current section (generated by the appropriate section generator). |
Definition at line 241 of file CM3.php5.
References generateCategory(), and generateItem().
Referenced by generateXML().
| CM3::generateXML | ( | ) |
generate the XML for this set of sections
Definition at line 217 of file CM3.php5.
References generateSection().
| CM3::prepareParent | ( | $ | array, | |
| $ | parentIds = array(), |
|||
| $ | parentArray = array() | |||
| ) | [private] |
a helper function that recursively searches listSections for the given parent and adds the given section array.
For internal use only.
| $array | [Array]: the section (represented by an array) generated by the appropriate section generator function. | |
| $parentIds | [Array]: The parent Id (an array of indeces). Only the indeces still left (if this is not the first call). | |
| $parentArray | [Array]: The current array (eventually the actual parent array wanted). |
Definition at line 99 of file CM3.php5.
Referenced by addToParent().
| CM3::sortSectionHelper | ( | $ | recursive = false, |
|
| $ | parentIds = array(), |
|||
| $ | parentArray = array() | |||
| ) | [private] |
A manager function for sorting. Hands the firs sections to sortSubSections (below), and handles some of the irregularities at the end.
For internal use only.
| $recursive | [boolean]: whether or not to sort recursively (defaults to false) | |
| $parentIds | [Array]: the id of the parent folder (if recursive is false only this folder's immediate children will be sorted) | |
| $parentArray | [Array]: an alternative array to start with (defaults to the entire array being managed). If an alternative array is given the id will start at the highest level of that array. |
Definition at line 146 of file CM3.php5.
Referenced by sortSections().
| 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. |
Definition at line 130 of file CM3.php5.
References sortSectionHelper().
| CM3::sortSubSections | ( | $ | subSections = array(), |
|
| $ | recursive = false | |||
| ) | [private] |
sorts the children of a certain section.
For internal use only.
| $subSections | [Array]: the list of children to be sorted (theoretically they do not have to be children of the same section, but the parents will not be preserved) | |
| $recursive | [boolean]: if true will recursively sort all the children of the given sections. Defaults to false. |
CM3::$listSections [protected] |
CM3::$XmlName [protected] |
1.5.6