Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Public Member Functions | |
__construct ($name, $type=null, $fields=array(), $reftable=null, $reffields=null) | |
Creates one new xmldb_key. | |
arr2xmldb_key ($xmlarr) | |
Load data from XML to the key. | |
calculateHash ($recursive=false) | |
This function calculate and set the hash of one xmldb_key. | |
checkName () | |
This function will check if one key name is ok or no (true/false) only lowercase a-z, 0-9 and _ are allowed. | |
checkNameValues ($arr) | |
This function will check that all the elements in one array have a correct name [a-z0-9_]. | |
comma2array ($string) | |
Returns one array of elements from one comma separated string, supporting quoted strings containing commas and concat function calls. | |
debug ($message) | |
This function will perform the central debug of all the XMLDB classes being called automatically every time one error is found. | |
findObjectInArray ($objectname, $arr) | |
Returns the position of one object in the array. | |
fixPrevNext (&$arr) | |
Reconstruct previous/next attributes. | |
getComment () | |
This function returns the comment of one xmldb_object. | |
getError () | |
This function will return the error detected in the object. | |
getFields () | |
Get the key fields. | |
getHash () | |
This function returns the hash of one xmldb_object. | |
getName () | |
This function will return the name of the xmldb_object. | |
getNext () | |
This function will return the name of the next xmldb_object. | |
getPHP () | |
Returns the PHP code needed to define one xmldb_key. | |
getPrevious () | |
This function will return the name of the previous xmldb_object. | |
getRefFields () | |
Get the key reffields. | |
getRefTable () | |
Get the key reftable. | |
getType () | |
Get the key type. | |
getXMLDBKeyName ($type) | |
This function returns the correct name value for the XMLDB_KEY_XXX passed as argument. | |
getXMLDBKeyType ($type) | |
This function returns the correct XMLDB_KEY_XXX value for the string passed as argument. | |
hasChanged () | |
This function returns true/false, if the xmldb_object has changed. | |
isLoaded () | |
This function returns true/false, if the xmldb_object has been loaded. | |
orderElements ($arr) | |
This function will order all the elements in one array, following the previous/next rules. | |
readableInfo () | |
Shows info in a readable format. | |
set_attributes ($type, $fields, $reftable=null, $reffields=null) | |
Set all the attributes of one xmldb_key. | |
setChanged ($changed=true) | |
This function will set the changed field of the xmldb_object. | |
setComment ($comment) | |
This function will set the comment of the xmldb_object. | |
setFields ($fields) | |
Set the key fields. | |
setFromADOKey ($adokey) | |
This function will set all the attributes of the xmldb_key object based on information passed in one ADOkey @oaram array $adokey. | |
setHash ($hash) | |
This function will set the hash of the xmldb_object. | |
setLoaded ($loaded=true) | |
This function will set the loaded field of the xmldb_object. | |
setName ($name) | |
This function will set the name field of the xmldb_object. | |
setNext ($next) | |
This function will set the next of the xmldb_object. | |
setPrevious ($previous) | |
This function will set the previous of the xmldb_object. | |
setRefFields ($reffields) | |
Set the key reffields. | |
setRefTable ($reftable) | |
Set the key reftable. | |
setType ($type) | |
Set the key type. | |
validateDefinition (xmldb_table $xmldb_table=null) | |
Validates the definition of objects and returns error message. | |
xmlOutput () | |
This function will output the XML text for one key. | |
xmldb_key::__construct | ( | $name, | |
$type = null, | |||
$fields = array(), | |||
$reftable = null, | |||
$reffields = null ) |
Creates one new xmldb_key.
string | $name | |
string | $type | XMLDB_KEY_[PRIMARY|UNIQUE|FOREIGN|FOREIGN_UNIQUE] |
array | $fields | an array of fieldnames to build the key over |
string | $reftable | name of the table the FK points to or null |
array | $reffields | an array of fieldnames in the FK table or null |
xmldb_key::arr2xmldb_key | ( | $xmlarr | ) |
Load data from XML to the key.
array | $xmlarr |
bool | success |
xmldb_key::calculateHash | ( | $recursive = false | ) |
This function calculate and set the hash of one xmldb_key.
bool | $recursive |
|
inherited |
This function will check if one key name is ok or no (true/false) only lowercase a-z, 0-9 and _ are allowed.
bool |
|
inherited |
This function will check that all the elements in one array have a correct name [a-z0-9_].
array | $arr |
bool |
|
inherited |
Returns one array of elements from one comma separated string, supporting quoted strings containing commas and concat function calls.
string | $string |
array |
|
inherited |
This function will perform the central debug of all the XMLDB classes being called automatically every time one error is found.
Apart from the main actions performed in it (XMLDB agnostic) it looks for one function called xmldb_debug() and invokes it, passing both the message code and the whole object. So, to perform custom debugging just add such function to your libs.
Call to the external hook function can be disabled by request by defining XMLDB_SKIP_DEBUG_HOOK
string | $message |
|
inherited |
Returns the position of one object in the array.
string | $objectname | |
array | $arr |
mixed |
|
inherited |
Reconstruct previous/next attributes.
array | $arr |
bool | true if $arr modified |
|
inherited |
This function returns the comment of one xmldb_object.
string |
|
inherited |
This function will return the error detected in the object.
string |
xmldb_key::getFields | ( | ) |
Get the key fields.
array |
|
inherited |
This function returns the hash of one xmldb_object.
string |
|
inherited |
This function will return the name of the xmldb_object.
string |
|
inherited |
This function will return the name of the next xmldb_object.
string |
xmldb_key::getPHP | ( | ) |
Returns the PHP code needed to define one xmldb_key.
string |
|
inherited |
This function will return the name of the previous xmldb_object.
string |
xmldb_key::getRefFields | ( | ) |
Get the key reffields.
array | reference to ref fields |
xmldb_key::getRefTable | ( | ) |
Get the key reftable.
string |
xmldb_key::getType | ( | ) |
Get the key type.
int |
xmldb_key::getXMLDBKeyName | ( | $type | ) |
This function returns the correct name value for the XMLDB_KEY_XXX passed as argument.
int | $type |
string |
xmldb_key::getXMLDBKeyType | ( | $type | ) |
This function returns the correct XMLDB_KEY_XXX value for the string passed as argument.
string | $type |
int |
|
inherited |
This function returns true/false, if the xmldb_object has changed.
bool |
|
inherited |
This function returns true/false, if the xmldb_object has been loaded.
bool |
|
inherited |
This function will order all the elements in one array, following the previous/next rules.
array | $arr |
array|bool |
xmldb_key::readableInfo | ( | ) |
xmldb_key::set_attributes | ( | $type, | |
$fields, | |||
$reftable = null, | |||
$reffields = null ) |
Set all the attributes of one xmldb_key.
string | $type | XMLDB_KEY_[PRIMARY|UNIQUE|FOREIGN|FOREIGN_UNIQUE] |
array | $fields | an array of fieldnames to build the key over |
string | $reftable | name of the table the FK points to or null |
array | $reffields | an array of fieldnames in the FK table or null |
|
inherited |
This function will set the changed field of the xmldb_object.
bool | $changed |
|
inherited |
This function will set the comment of the xmldb_object.
string | $comment |
xmldb_key::setFields | ( | $fields | ) |
Set the key fields.
array | $fields |
|
inherited |
This function will set the hash of the xmldb_object.
string | $hash |
|
inherited |
This function will set the loaded field of the xmldb_object.
bool | $loaded |
|
inherited |
This function will set the name field of the xmldb_object.
string | $name |
|
inherited |
This function will set the next of the xmldb_object.
string | $next |
|
inherited |
This function will set the previous of the xmldb_object.
string | $previous |
xmldb_key::setRefFields | ( | $reffields | ) |
Set the key reffields.
array | $reffields |
xmldb_key::setRefTable | ( | $reftable | ) |
Set the key reftable.
string | $reftable |
xmldb_key::setType | ( | $type | ) |
Set the key type.
int | $type |
|
inherited |
Validates the definition of objects and returns error message.
The error message should not be localised because it is intended for developers, end users and admins should never see these problems!
xmldb_table | $xmldb_table | optional when object is table |
string | null if ok, error message if problem found |
Reimplemented in xmldb_field, xmldb_index, and xmldb_table.
xmldb_key::xmlOutput | ( | ) |
This function will output the XML text for one key.
string |