Child::toJson - jcobban/Genealogy GitHub Wiki
$child->toJson($print, $options)
Up: class Child
This method creates a JavaScript Object Notation) document. This document contains a row for each field in the associated database record whose key is the name of the field, and whose value is the textual value of the field. This is used by many PHP scripts, in particular those that permit Javascript to use AJAX to retrieve the contents of a database record for dynamic display to the user. The function returns the generated JSON document as a string.
parameter | description |
---|---|
If this is omitted or is boolean true the XML document is also sent to standard output. This can also be specified as an array of settings: 'print' may be set to boolean false . |
|
$options | This contains a bit mask which is present to match the signature of Record::toJson . |
This method is customized to interpret the following fields:
fieldname | display as |
---|---|
cpdadprivate |
a flag field interpreted as a letter 'Y' or 'N' or as null. |
cpmomprivate |
a flag field interpreted as a letter 'Y' or 'N' or as null. |
prefchild |
a flag field interpreted as a letter 'Y' or 'N' or as null. |
parseald |
moved to Event |
parsealsd |
moved to Event |
ldsp |
moved to Event |
templetag |
moved to Event |
parsealnote |
moved to Event |
This returns the document as a string. If there is an LDS Sealed to Parents event for this child then it is displayed by calling Event::toJson
.
For example:
{
"idcr": "1",
"idmr": "1",
"family": "James Collins and Sarah Richardson on 30 Jun 1886",
"idir": "51745",
"child": "Lilly Collins (about 1888\u2014)",
"order": "0",
"prefchild": "Y",
"idcs": "1",
"idcpdad": "1",
"idcpmom": "1",
"cpdadprivate": "N",
"cpmomprivate": "N"
}
Next: class Citation