summaryrefslogtreecommitdiff
path: root/app/Report/ReportBase.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Report/ReportBase.php')
-rw-r--r--app/Report/ReportBase.php188
1 files changed, 0 insertions, 188 deletions
diff --git a/app/Report/ReportBase.php b/app/Report/ReportBase.php
index 4f4c146621..1bdef4ddfc 100644
--- a/app/Report/ReportBase.php
+++ b/app/Report/ReportBase.php
@@ -16,8 +16,6 @@ namespace Fisharebest\Webtrees\Report;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Individual;
-use Fisharebest\Webtrees\Note;
/**
* Class ReportBase
@@ -475,189 +473,3 @@ class ReportBase {
return $this->Styles[$s];
}
}
-
-/**
- * get gedcom tag value
- *
- * @param string $tag The tag to find, use : to delineate subtags
- * @param int $level The gedcom line level of the first tag to find, setting level to 0 will cause it to use 1+ the level of the incoming record
- * @param string $gedrec The gedcom record to get the value from
- *
- * @return string the value of a gedcom tag from the given gedcom record
- */
-function get_gedcom_value($tag, $level, $gedrec) {
- global $WT_TREE;
-
- if (empty($gedrec)) {
- return '';
- }
- $tags = explode(':', $tag);
- $origlevel = $level;
- if ($level == 0) {
- $level = $gedrec{0} + 1;
- }
-
- $subrec = $gedrec;
- foreach ($tags as $t) {
- $lastsubrec = $subrec;
- $subrec = get_sub_record($level, "$level $t", $subrec);
- if (empty($subrec) && $origlevel == 0) {
- $level--;
- $subrec = get_sub_record($level, "$level $t", $lastsubrec);
- }
- if (empty($subrec)) {
- if ($t == "TITL") {
- $subrec = get_sub_record($level, "$level ABBR", $lastsubrec);
- if (!empty($subrec)) {
- $t = "ABBR";
- }
- }
- if (empty($subrec)) {
- if ($level > 0) {
- $level--;
- }
- $subrec = get_sub_record($level, "@ $t", $gedrec);
- if (empty($subrec)) {
- return '';
- }
- }
- }
- $level++;
- }
- $level--;
- $ct = preg_match("/$level $t(.*)/", $subrec, $match);
- if ($ct == 0) {
- $ct = preg_match("/$level @.+@ (.+)/", $subrec, $match);
- }
- if ($ct == 0) {
- $ct = preg_match("/@ $t (.+)/", $subrec, $match);
- }
- if ($ct > 0) {
- $value = trim($match[1]);
- if ($t == 'NOTE' && preg_match('/^@(.+)@$/', $value, $match)) {
- $note = Note::getInstance($match[1], $WT_TREE);
- if ($note) {
- $value = $note->getNote();
- } else {
- //-- set the value to the id without the @
- $value = $match[1];
- }
- }
- if ($level != 0 || $t != "NOTE") {
- $value .= get_cont($level + 1, $subrec);
- }
-
- return $value;
- }
-
- return "";
-}
-
-/**
- * @param string[] $list
- * @param string $pid
- * @param bool $children
- * @param int $generations
- */
-function add_ancestors(&$list, $pid, $children = false, $generations = -1) {
- global $WT_TREE;
-
- $genlist = array($pid);
- $list[$pid]->generation = 1;
- while (count($genlist) > 0) {
- $id = array_shift($genlist);
- if (strpos($id, 'empty') === 0) {
- continue; // id can be something like “empty7”
- }
- $person = Individual::getInstance($id, $WT_TREE);
- foreach ($person->getChildFamilies() as $family) {
- $husband = $family->getHusband();
- $wife = $family->getWife();
- if ($husband) {
- $list[$husband->getXref()] = $husband;
- $list[$husband->getXref()]->generation = $list[$id]->generation + 1;
- }
- if ($wife) {
- $list[$wife->getXref()] = $wife;
- $list[$wife->getXref()]->generation = $list[$id]->generation + 1;
- }
- if ($generations == -1 || $list[$id]->generation + 1 < $generations) {
- if ($husband) {
- array_push($genlist, $husband->getXref());
- }
- if ($wife) {
- array_push($genlist, $wife->getXref());
- }
- }
- if ($children) {
- foreach ($family->getChildren() as $child) {
- $list[$child->getXref()] = $child;
- if (isset($list[$id]->generation)) {
- $list[$child->getXref()]->generation = $list[$id]->generation;
- } else {
- $list[$child->getXref()]->generation = 1;
- }
- }
- }
- }
- }
-}
-
-/**
- * @param string[] $list
- * @param string $pid
- * @param bool $parents
- * @param int $generations
- */
-function add_descendancy(&$list, $pid, $parents = false, $generations = -1) {
- global $WT_TREE;
-
- $person = Individual::getInstance($pid, $WT_TREE);
- if ($person === null) {
- return;
- }
- if (!isset($list[$pid])) {
- $list[$pid] = $person;
- }
- if (!isset($list[$pid]->generation)) {
- $list[$pid]->generation = 0;
- }
- foreach ($person->getSpouseFamilies() as $family) {
- if ($parents) {
- $husband = $family->getHusband();
- $wife = $family->getWife();
- if ($husband) {
- $list[$husband->getXref()] = $husband;
- if (isset($list[$pid]->generation)) {
- $list[$husband->getXref()]->generation = $list[$pid]->generation - 1;
- } else {
- $list[$husband->getXref()]->generation = 1;
- }
- }
- if ($wife) {
- $list[$wife->getXref()] = $wife;
- if (isset($list[$pid]->generation)) {
- $list[$wife->getXref()]->generation = $list[$pid]->generation - 1;
- } else {
- $list[$wife->getXref()]->generation = 1;
- }
- }
- }
- $children = $family->getChildren();
- foreach ($children as $child) {
- if ($child) {
- $list[$child->getXref()] = $child;
- if (isset($list[$pid]->generation)) {
- $list[$child->getXref()]->generation = $list[$pid]->generation + 1;
- } else {
- $list[$child->getXref()]->generation = 2;
- }
- }
- }
- if ($generations == -1 || $list[$pid]->generation + 1 < $generations) {
- foreach ($children as $child) {
- add_descendancy($list, $child->getXref(), $parents, $generations); // recurse on the childs family
- }
- }
- }
-}