This function loads the configuration parameters from the constants defined before.
Model
__construct
([Bool $debug = false])
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function inserts a child in structure tree.
Only with this function all structure can be managed. (Use names without internal root).
Bool
addChild
(String $nombreNodo, String $tipo, String $nombrePadre, String $nombreHermano, [Bool $debug = false])
-
String
$nombreNodo: (Relative name, without path)
-
String
$tipo: (a valid node type)
-
String
$nombrePadre: ("" to a new root).
-
String
$nombreHermano: ("" to most left child).
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function creates a relation between two elements
Integer
createRelation
(String $name, [Bool $debug = false])
-
String
$name: String with the relation name (TYPE-ID/TYPE2-ID)
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
This function deletes all data from tables, not drop tables.
void
deleteAllDB
([Bool $debug = false])
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function deletes an element and all its data.
Bool
deleteElement
(String $name, String $type, [Bool $debug = false])
-
String
$name: contains the name of the element to delete.
-
String
$type: contains the type of the element to delete.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function deletes the subtree in structure with root node specified by $name
Boolean
deleteElementStruct
(String $name)
-
String
$name: with the name of the node to delete.
This function deletes a relation between two elements
Bool
deleteRelation
(String $name, [Bool $debug = false])
-
String
$name: with the relation name.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function drop the three tables from the database.
Bool
deleteTables
([Bool $print = false], [ $debug = false])
-
Bool
$print: if true all querys will be printed using echo
-
$debug
This function deletes a value of an attribute.
If the attribute doesn't exist returns false.
Bool
deleteValue
(String $path, [Bool $debug = false])
-
String
$path: contains the path to the attribute.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function checks if an element exists. It works with type-id.
(to search an element with name, use getId($name,$type)!=-1)
Bool
existsElement
( $elementName, String $name)
-
String
$name: element like TYPE-ID
-
$elementName
This function checks if a relation exists.
Bool
existsRelation
(String $name)
-
String
$name: String with the name of the relation.
This function returns all the nodes below from a given node.
Array
getAllNodes
(String $nodeRoot, Bool $completePath)
-
String
$nodeRoot: Name of the root node.
-
Bool
$completePath: If true, the complete path is returned. Otherwise it returns only the last part of the path.
This auxiliar functions returns an array with all allowed node types.
Array
getAllowedTypes
()
This function transforms an array with ids into an array with the names of the ids.
Array
getElementNameFromIds
(Array $arrayIDS)
-
Array
$arrayIDS: of Integer $arrayIDS Array with the ids of the elements to transform.
This function returns an array containing all the elements of a given type.
Array
getElementsByType
(String $nombretipo, [Bool $debug = false])
-
String
$nombretipo: name of the type.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
This function returns the ID of an element specified by $name.
Integer
getId
(String $name, String $type, [Bool $debug = false])
-
String
$name: contains the name of the element.
-
String
$type: contains the type of the element.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function is used to find elements that have common properties.
Array
getIdsByProperty
(Array $array, [Bool $debug = false])
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
-
Array
$array: of queryHandler $array
This function returns the structure ID of a node specified by $path
Integer
getIdStruct
(String $path)
Function that returns the inmediates children of a node in an array.
Array
getInmChildren
(String $root, [Bool $completePath = false])
-
String
$root
-
Bool
$completePath: if true names will be like /PATH_TO_ROOT/CHILDREN_PATH. if false names will be like /CHILDREN_PATH (without root's path).
This function return the name of an element with a given id.
String
getNameElementId
(Integer $elementid)
This function return the name of an node of structure with a given id.
String
getNameStructId
(Integer $structid)
This function returns the array "params" that contains all the characters used.
Array
getParams
()
This function returns relations between elements (fixed or not).
Array
getRelation
(String $name, [Bool $debug = false])
-
String
$name: relation to get.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
Returns the type of a node with name $name in structure.
Mixed
getTypeStruct
(String $name)
This function return a value of an attribute especified in $path If the attribute doesn't exist returns NULL.
String
getValue
(String $path, [Bool $debug = false])
-
String
$path: contains the path to the attribute.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function returns all different values from a given path.
Array
getValuesFromPath
(String $path, Bool $debug)
-
String
$path: String with the path of the data to retrieve.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
This function builds the three tables with the parameters in $tablesParameters.
Bool
initializateDB
(
TablesParameters $tablesParameters, [
Bool $print =
false], [
$debug =
false])
-
TablesParameters
$tablesParameters
-
Bool
$print: if true all querys will be printed using echo
-
$debug
This function initializes an empty structure.
This function must be called after construct the tables. The model doesn't work with empty structure table, it need the internal root node.
Bool
initializeStruct
([Bool $debug = false])
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function inserts a new element.
Bool
insertElement
(String $type, String $name, [Bool $debug = false])
-
String
$type: contains an element type.
-
String
$name: contains the name of the element to insert.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function creates tables in data base with default values
Bool
install
()
This function will load the data from the XML into the database.
void
loadData
([Bool $debug = false])
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
This function will load the elements from the XML into the database
void
loadElements
([Bool $debug = false])
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
This function will load the structure from the XML into the database
void
loadStructure
([Bool $debug = false])
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This function will load the XML structure and generate all the nodes contained in itself.
void
loadXML
(String $fileName)
-
String
$fileName: String with the path to the filename.
This function will print all the nodes from the struct, not from the database but from the
internal structure of the XML
void
printArraysXML
()
This function prints a node list. Its used in schemeHandler.php.
void
printList
(String $elemento, Bool $showtype, Bool $showid, Bool $removeSlash, Bool $showbuttons, Bool $activarResaltado)
-
String
$elemento: root's name of the subtree to print.
-
Bool
$showtype: if true it prints the node type.
-
Bool
$showid: if true it prints the node id.
-
Bool
$removeSlash: if true it prints the relatives nodes names.
-
Bool
$showbuttons: if true it prints control buttons.
-
Bool
$activarResaltado: if true it prints names in differents colors.
This function prints the structure tree
void
printStructure
()
This auxiliar function removes the internal root name from a path passed by $string
String
removeFirstRoot
(String $string)
This auxiliar function removes the first character of a String.
It's used to remove the first slash in some paths.
String
removeFirstSlash
(String $string)
This function renames an element.
It checks if the new name is correct and doesn't exists another element with same type and same name.
Bool
renameElement
( $elementId, $newName, [Bool $debug = false], Integer $elementId:, String $newName:)
-
Integer
$elementId:: Id of the element to be renamed.
-
String
$newName:: new name.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE.
-
$elementId
-
$newName
This function sets the value of an attribute.
If the attribute doesn't exist returns false.
Bool
setValue
(String $path, String $value, [Bool $debug = false])
-
String
$path: contains the path to the attribute.
-
String
$value: contains the value to set.
-
Bool
$debug: if true function will throw debug messages as USER_NOTICE
This auxiliar function checks if $name is a valid node name.
Boolean
validateStructName
(String $name)