Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Public Member Functions | |
__construct ($name, $type=null, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $default=null, $previous=null) | |
Creates one new xmldb_field. | |
arr2xmldb_field ($xmlarr) | |
Load data from XML to the table. | |
calculateHash ($recursive=false) | |
This function calculate and set the hash of one xmldb_field. | |
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. | |
getDecimals () | |
Get the decimals. | |
getDefault () | |
Get the default. | |
getError () | |
This function will return the error detected in the object. | |
getHash () | |
This function returns the hash of one xmldb_object. | |
getLength () | |
Get the length. | |
getName () | |
This function will return the name of the xmldb_object. | |
getNext () | |
This function will return the name of the next xmldb_object. | |
getNotNull () | |
Get the notnull. | |
getPHP ($includeprevious=true) | |
Returns the PHP code needed to define one xmldb_field. | |
getPrevious () | |
This function will return the name of the previous xmldb_object. | |
getSequence () | |
Get the sequence. | |
getType () | |
Get the type. | |
getUnsigned () | |
Get the unsigned. | |
getXMLDBFieldType ($type) | |
This function returns the correct XMLDB_TYPE_XXX value for the string passed as argument. | |
getXMLDBTypeName ($type) | |
This function returns the correct name value for the XMLDB_TYPE_XXX 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, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $default=null, $previous=null) | |
Set all the attributes of one xmldb_field. | |
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. | |
setDecimals ($decimals) | |
Set the field decimals. | |
setDefault ($default) | |
Set the field default. | |
setFromADOField ($adofield) | |
This function will set all the attributes of the xmldb_field object based on information passed in one ADOField. | |
setHash ($hash) | |
This function will set the hash of the xmldb_object. | |
setLength ($length) | |
Set the field length. | |
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. | |
setNotNull ($notnull=true) | |
Set the field notnull. | |
setPrevious ($previous) | |
This function will set the previous of the xmldb_object. | |
setSequence ($sequence=true) | |
Set the field sequence. | |
setType ($type) | |
Set the field type. | |
setUnsigned ($unsigned=true) | |
Set the field unsigned. | |
validateDefinition (xmldb_table $xmldb_table=null) | |
Validates the field restrictions. | |
xmlOutput () | |
This function will output the XML text for one field. | |
Public Attributes | |
maximum const | CHAR_MAX_LENGTH = 1333 |
Note: | |
max const | FLOAT_MAX_LENGTH = 20 |
length of floats | |
maximum const | INTEGER_MAX_LENGTH = 20 |
number of digits of integers | |
int const | NAME_MAX_LENGTH = 63 |
Note: | |
max const | NUMBER_MAX_LENGTH = 38 |
length (precision, the total number of digits) of decimals | |
xmldb_field::__construct | ( | $name, | |
$type = null, | |||
$precision = null, | |||
$unsigned = null, | |||
$notnull = null, | |||
$sequence = null, | |||
$default = null, | |||
$previous = null ) |
Creates one new xmldb_field.
string | $name | of field |
int | $type | XMLDB_TYPE_INTEGER, XMLDB_TYPE_NUMBER, XMLDB_TYPE_CHAR, XMLDB_TYPE_TEXT, XMLDB_TYPE_BINARY |
string | $precision | length for integers and chars, two-comma separated numbers for numbers |
bool | $unsigned | XMLDB_UNSIGNED or null (or false) |
bool | $notnull | XMLDB_NOTNULL or null (or false) |
bool | $sequence | XMLDB_SEQUENCE or null (or false) |
mixed | $default | meaningful default o null (or false) |
string | $previous |
xmldb_field::arr2xmldb_field | ( | $xmlarr | ) |
Load data from XML to the table.
array | $xmlarr |
mixed |
xmldb_field::calculateHash | ( | $recursive = false | ) |
This function calculate and set the hash of one xmldb_field.
bool | $recursive |
void,modifies\$this-,>hash |
|
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 |
xmldb_field::getDecimals | ( | ) |
Get the decimals.
string |
xmldb_field::getDefault | ( | ) |
Get the default.
mixed |
|
inherited |
This function will return the error detected in the object.
string |
|
inherited |
This function returns the hash of one xmldb_object.
string |
xmldb_field::getLength | ( | ) |
Get the length.
int |
|
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_field::getNotNull | ( | ) |
Get the notnull.
bool |
xmldb_field::getPHP | ( | $includeprevious = true | ) |
Returns the PHP code needed to define one xmldb_field.
bool | $includeprevious |
string |
|
inherited |
This function will return the name of the previous xmldb_object.
string |
xmldb_field::getSequence | ( | ) |
Get the sequence.
bool |
xmldb_field::getType | ( | ) |
Get the type.
int |
xmldb_field::getUnsigned | ( | ) |
xmldb_field::getXMLDBFieldType | ( | $type | ) |
This function returns the correct XMLDB_TYPE_XXX value for the string passed as argument.
string | $type |
int |
xmldb_field::getXMLDBTypeName | ( | $type | ) |
This function returns the correct name value for the XMLDB_TYPE_XXX passed as argument.
int | $type |
string |
|
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_field::readableInfo | ( | ) |
xmldb_field::set_attributes | ( | $type, | |
$precision = null, | |||
$unsigned = null, | |||
$notnull = null, | |||
$sequence = null, | |||
$default = null, | |||
$previous = null ) |
Set all the attributes of one xmldb_field.
int | $type | XMLDB_TYPE_INTEGER, XMLDB_TYPE_NUMBER, XMLDB_TYPE_CHAR, XMLDB_TYPE_TEXT, XMLDB_TYPE_BINARY |
string | $precision | length for integers and chars, two-comma separated numbers for numbers |
bool | $unsigned | XMLDB_UNSIGNED or null (or false) |
bool | $notnull | XMLDB_NOTNULL or null (or false) |
bool | $sequence | XMLDB_SEQUENCE or null (or false) |
mixed | $default | meaningful default o null (or false) |
string | $previous |
|
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_field::setDecimals | ( | $decimals | ) |
Set the field decimals.
string |
xmldb_field::setDefault | ( | $default | ) |
Set the field default.
mixed | $default |
xmldb_field::setFromADOField | ( | $adofield | ) |
This function will set all the attributes of the xmldb_field object based on information passed in one ADOField.
database_column_info | $adofield |
void,sets\$this-,>type |
|
inherited |
This function will set the hash of the xmldb_object.
string | $hash |
xmldb_field::setLength | ( | $length | ) |
Set the field length.
int | $length |
|
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 |
xmldb_field::setNotNull | ( | $notnull = true | ) |
Set the field notnull.
bool | $notnull |
|
inherited |
This function will set the previous of the xmldb_object.
string | $previous |
xmldb_field::setSequence | ( | $sequence = true | ) |
Set the field sequence.
bool | $sequence |
xmldb_field::setType | ( | $type | ) |
Set the field type.
int | $type |
xmldb_field::setUnsigned | ( | $unsigned = true | ) |
xmldb_field::validateDefinition | ( | xmldb_table | $xmldb_table = null | ) |
Validates the field restrictions.
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 from xmldb_object.
xmldb_field::xmlOutput | ( | ) |
This function will output the XML text for one field.
string |
maximum const xmldb_field::CHAR_MAX_LENGTH = 1333 |
Note:
length of text field
int const xmldb_field::NAME_MAX_LENGTH = 63 |
Note:
max length of field names.