$image_name = "V" . time(); unset($_SESSION[$image_name]); // statisticsplot.php uses this to hold a file name to send to browser $image_title = preg_replace("~<.*>~", "", $name) . " " . $pgv_lang["fan_chart"]; echo "<p align=\"center\" >"; echo "<img src=\"imageflush.php?image_type=png&image_name={$image_name}&height={$fanh}&width={$fanw}\" width=\"{$fanw}\" height=\"{$fanh}\" border=\"0\" alt=\"{$image_title}\" title=\"{$image_title}\" usemap=\"#fanmap\" />"; echo "</p>"; ImageDestroy($image); } // Extract form parameters $rootid = safe_GET_xref('rootid'); $fan_style = safe_GET_integer('fan_style', 2, 4, 3); $fan_width = safe_GET_integer('fan_width', 50, 300, 100); $PEDIGREE_GENERATIONS = safe_GET_integer('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); // Validate form parameters $rootid = check_rootid($rootid); $person = Person::getInstance($rootid); $name = $person->getFullName(); $addname = $person->getAddName(); // -- print html header information print_header(PrintReady($name) . " " . $pgv_lang["fan_chart"]); if ($ENABLE_AUTOCOMPLETE) { require './js/autocomplete.js.htm'; } if (strlen($name) < 30) { $cellwidth = "420"; } else { $cellwidth = strlen($name) * 14; } print "<table class=\"list_table {$TEXT_DIRECTION}\"><tr><td width=\"" . $cellwidth . "px\" valign=\"top\">"; if ($view == "preview") {
/** * Initialization function */ function init() { global $GEDCOM_ID_PREFIX; $this->baseyear = date("Y"); //-- new pid $newpid = safe_GET_xref('newpid'); if ($newpid) { $indirec = find_person_record($newpid); if (empty($indirec) && $GEDCOM_ID_PREFIX) { if (stristr($newpid, $GEDCOM_ID_PREFIX) === false) { $newpid = $GEDCOM_ID_PREFIX . $newpid; } } } if (safe_GET('clear', '1') == '1') { unset($_SESSION['timeline_pids']); } else { if (isset($_SESSION['timeline_pids'])) { $this->pids = $_SESSION['timeline_pids']; } //-- pids array $this->pids = safe_GET_xref('pids'); } if (!is_array($this->pids)) { $this->pids = array(); } else { //-- make sure that arrays are indexed by numbers $this->pids = array_values($this->pids); } if (!empty($newpid) && !in_array($newpid, $this->pids)) { $this->pids[] = $newpid; } if (count($this->pids) == 0) { $this->pids[] = check_rootid(""); } $remove = safe_GET_xref('remove'); //-- cleanup user input $newpids = array(); foreach ($this->pids as $key => $value) { if ($value != $remove) { $newpids[] = $value; $person = Person::getInstance($value); if (!is_null($person)) { $this->people[] = $person; } } } $this->pids = $newpids; $this->pidlinks = ""; /* @var $indi Person */ foreach ($this->people as $p => $indi) { if (!is_null($indi) && $indi->canDisplayDetails()) { //-- setup string of valid pids for links $this->pidlinks .= "pids[]=" . $indi->getXref() . "&"; $bdate = $indi->getBirthDate(); if ($bdate->isOK()) { $date = $bdate->MinDate(); $date = $date->convert_to_cal('gregorian'); if ($date->y) { $this->birthyears[$indi->getXref()] = $date->y; $this->birthmonths[$indi->getXref()] = max(1, $date->m); $this->birthdays[$indi->getXref()] = max(1, $date->d); } } // find all the fact information $indi->add_family_facts(false); foreach ($indi->getIndiFacts() as $event) { //-- get the fact type $fact = $event->getTag(); if (!in_array($fact, $this->nonfacts)) { //-- check for a date $date = $event->getDate(); $date = $date->MinDate(); $date = $date->convert_to_cal('gregorian'); if ($date->y) { $this->baseyear = min($this->baseyear, $date->y); $this->topyear = max($this->topyear, $date->y); if (!$indi->isDead()) { $this->topyear = max($this->topyear, date('Y')); } $event->temp = $p; //-- do not add the same fact twice (prevents marriages from being added multiple times) if (!in_array($event, $this->indifacts, true)) { $this->indifacts[] = $event; } } } } } } $_SESSION['timeline_pids'] = $this->pids; $scale = safe_GET_integer('scale', 0, 200, 0); if ($scale == 0) { $this->scale = round(($this->topyear - $this->baseyear) / 20 * count($this->indifacts) / 4); if ($this->scale < 6) { $this->scale = 6; } } else { $this->scale = $scale; } if ($this->scale < 2) { $this->scale = 2; } $this->baseyear -= 5; $this->topyear += 5; }
/** * Initialization function */ function init($rootid = '', $show_full = 1, $generations = 3) { global $USE_RIN, $MAX_ALIVE_AGE, $GEDCOM, $bheight, $bwidth, $bhalfheight, $GEDCOM_DEFAULT_TAB, $pgv_lang, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS; global $PGV_IMAGES, $PGV_IMAGE_DIR, $TEXT_DIRECTION, $show_full; // Extract parameters from from $this->pid = safe_GET_xref('pid'); $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS); $this->show_spouse = safe_GET('show_spouse', array('0', '1'), '0'); $this->generations = safe_GET_integer('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 3); $this->box_width = safe_GET_integer('box_width', 50, 300, 100); // This is passed as a global. A parameter would be better... $show_full = $this->show_full; if (!empty($_REQUEST["action"])) { $this->action = $_REQUEST["action"]; } if (!empty($rootid)) { $this->pid = $rootid; } //-- flip the arrows for RTL languages if ($TEXT_DIRECTION == "rtl") { $temp = $PGV_IMAGES['larrow']['other']; $PGV_IMAGES['larrow']['other'] = $PGV_IMAGES['rarrow']['other']; $PGV_IMAGES['rarrow']['other'] = $temp; } //-- get the width and height of the arrow images for adjusting spacing if (file_exists($PGV_IMAGE_DIR . "/" . $PGV_IMAGES['larrow']['other'])) { $temp = getimagesize($PGV_IMAGE_DIR . "/" . $PGV_IMAGES['larrow']['other']); $this->arrwidth = $temp[0]; $this->arrheight = $temp[1]; } // -- Sets the sizes of the boxes if (!$this->show_full) { $bwidth *= $this->box_width / 150; } else { $bwidth *= $this->box_width / 100; } if (!$this->show_full) { $bheight = (int) ($bheight / 2); } $bhalfheight = (int) ($bheight / 2); // Validate parameters $this->pid = check_rootid($this->pid); $this->hourPerson = Person::getInstance($this->pid); $this->name = $this->hourPerson->getFullName(); //Checks how many generations of descendency is for the person for formatting purposes $this->dgenerations = $this->max_descendency_generations($this->pid, 0); if ($this->dgenerations < 1) { $this->dgenerations = 1; } if (!$this->isPrintPreview()) { $this->visibility = "hidden"; $this->position = "absolute"; $this->display = "none"; } //-- perform the desired action switch ($this->action) { /* case "addfav": $this->addFavorite(); break; */ case "accept": $this->acceptChanges(); break; case "undo": $this->hourPerson->undoChange(); break; } }
/** * Initialization function */ function init() { global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT, $MAX_PEDIGREE_GENERATIONS; global $DEFAULT_PEDIGREE_GENERATIONS, $SHOW_EMPTY_BOXES; global $bwidth, $bheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing; global $TEXT_DIRECTION, $BROWSER_TYPE, $show_full, $talloffset; $this->log2 = log(2); if ($this->isPrintPreview()) { $this->show_famlink = false; } $this->rootid = safe_GET_xref('rootid'); $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS); $this->talloffset = safe_GET('talloffset', array('0', '1', '2', '3'), $PEDIGREE_LAYOUT); $this->PEDIGREE_GENERATIONS = safe_GET_integer('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); if ($this->talloffset == 1) { $this->talloffset = 1; } // Make SURE this is an integer if ($this->talloffset > 1 && $this->PEDIGREE_GENERATIONS > 8) { $this->PEDIGREE_GENERATIONS = 8; } // TODO: some library functions expect this as a global. // Passing a function parameter would be much better. global $PEDIGREE_GENERATIONS; $PEDIGREE_GENERATIONS = $this->PEDIGREE_GENERATIONS; // This is passed as a global. A parameter would be better... $this->show_full = $this->show_full ? 1 : 0; // Make SURE this is an integer if ($this->talloffset > 3) { $this->talloffset = 3; } else { if ($this->talloffset < 0) { $this->talloffset = 0; } } $show_full = $this->show_full; $talloffset = $this->talloffset; // Validate parameters $this->rootid = check_rootid($this->rootid); $this->rootPerson = Person::getInstance($this->rootid); if (is_null($this->rootPerson)) { $this->rootPerson = new Person(''); } $this->name = $this->rootPerson->getFullName(); $this->addname = $this->rootPerson->getAddName(); //-- adjustments for hide details if ($this->show_full == false) { $bheight = 30; if ($this->talloffset < 2) { $bwidth -= 30; } else { $bwidth -= 50; } } //-- adjustments for portrait mode if ($this->talloffset == 0) { $bxspacing += 12; $bwidth += 20; $baseyoffset -= 20 * ($this->PEDIGREE_GENERATIONS - 1); } $this->pbwidth = $bwidth + 6; $this->pbheight = $bheight + 5; $this->treeid = ancestry_array($this->rootid); $this->treesize = pow(2, (int) $this->PEDIGREE_GENERATIONS) - 1; //-- ancestry_array puts everyone at $i+1 for ($i = 0; $i < $this->treesize; $i++) { $this->treeid[$i] = $this->treeid[$i + 1]; } if (!$this->show_full) { if ($this->talloffset == 0) { $baseyoffset = 160 + $bheight * 2; } else { if ($this->talloffset == 1) { $baseyoffset = 180 + $bheight * 2; } else { if ($this->talloffset > 1) { if ($this->PEDIGREE_GENERATIONS == 3) { $baseyoffset = 30; } else { $baseyoffset = -85; } } } } } else { if ($this->talloffset == 0) { $baseyoffset = 100 + $bheight / 2; } else { if ($this->talloffset == 1) { $baseyoffset = 160 + $bheight / 2; } else { if ($this->talloffset > 1) { if ($this->PEDIGREE_GENERATIONS == 3) { $baseyoffset = 30; } else { $baseyoffset = -85; } } } } } //-- adjustments for preview if ($this->isPrintPreview() && $this->talloffset < 2) { $baseyoffset -= 230; } // -- this next section will create and position the DIV layers for the pedigree tree $this->curgen = 1; // -- variable to track which generation the algorithm is currently working on $this->yoffset = 0; // -- used to offset the position of each box as it is generated $this->xoffset = 0; $this->prevyoffset = 0; // -- used to track the y position of the previous box $this->offsetarray = array(); $this->minyoffset = 0; if ($this->treesize < 3) { $this->treesize = 3; } // -- loop through all of id's in the array starting at the last and working to the first //-- calculation the box positions for ($i = $this->treesize - 1; $i >= 0; $i--) { // -- check to see if we have moved to the next generation if ($i < floor($this->treesize / pow(2, $this->curgen))) { $this->curgen++; } //-- box position in current generation $boxpos = $i - pow(2, $this->PEDIGREE_GENERATIONS - $this->curgen); //-- offset multiple for current generation if ($this->talloffset < 2) { $genoffset = pow(2, $this->curgen - $this->talloffset); $boxspacing = $this->pbheight + $byspacing; } else { $genoffset = pow(2, $this->curgen - 1); $boxspacing = $this->pbwidth + $byspacing; } // -- calculate the yoffset Position in the generation Spacing between boxes put child between parents $this->yoffset = $baseyoffset + $boxpos * ($boxspacing * $genoffset) + $boxspacing / 2 * $genoffset + $boxspacing * $genoffset; // -- calculate the xoffset if ($this->talloffset == 0) { if ($this->PEDIGREE_GENERATIONS < 6) { $addxoffset = $basexoffset + (10 + 60 * (5 - $this->PEDIGREE_GENERATIONS)); $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset; } else { $addxoffset = $basexoffset + 10; $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset; } //-- compact the tree if ($this->curgen < $this->PEDIGREE_GENERATIONS) { $parent = floor(($i - 1) / 2); if ($i % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * ($this->curgen - 1); } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * ($this->curgen - 1); } $pgen = $this->curgen; while ($parent > 0) { if ($parent % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * $pgen; } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * $pgen; } $pgen++; if ($pgen > 3) { $temp = 0; for ($j = 1; $j < $pgen - 2; $j++) { $temp += pow(2, $j) - 1; } if ($parent % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp; } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp; } } $parent = floor(($parent - 1) / 2); } if ($this->curgen > 3) { $temp = 0; for ($j = 1; $j < $this->curgen - 2; $j++) { $temp += pow(2, $j) - 1; } if ($i % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp; } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp; } } } $this->yoffset -= $boxspacing / 2 * pow(2, $this->PEDIGREE_GENERATIONS - 2) - $boxspacing / 2; } else { if ($this->talloffset == 1) { $this->xoffset = 10 + $basexoffset + ($this->PEDIGREE_GENERATIONS - $this->curgen) * ($this->pbwidth + $bxspacing); if ($this->curgen == $this->PEDIGREE_GENERATIONS) { $this->xoffset += 10; } if ($this->PEDIGREE_GENERATIONS < 4) { $this->xoffset += 60; } } else { if ($this->talloffset == 2) { if ($this->show_full) { $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 2) + $this->curgen * 10 + 136.5; } else { $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 4) + $this->curgen * 10 + 215.75; } if ($this->isPrintPreview()) { $this->xoffset -= 260; } } else { if ($this->show_full) { $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + 260; } else { $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 4) + 270; } if ($this->isPrintPreview()) { $this->xoffset -= 260; } } } } if ($this->curgen == 1 && $this->talloffset == 1) { $this->xoffset += 10; } $this->offsetarray[$i]["x"] = $this->xoffset; $this->offsetarray[$i]["y"] = $this->yoffset; } //-- collapse the tree if boxes are missing if (!$SHOW_EMPTY_BOXES) { if ($this->PEDIGREE_GENERATIONS > 1) { $this->collapse_tree(0, 1, 0); } } //-- calculate the smallest yoffset and adjust the tree to that offset $minyoffset = 0; for ($i = 0; $i < count($this->treeid); $i++) { if ($SHOW_EMPTY_BOXES || !empty($treeid[$i])) { if (!empty($offsetarray[$i])) { if ($minyoffset == 0 || $minyoffset > $this->offsetarray[$i]["y"]) { $minyoffset = $this->offsetarray[$i]["y"]; } } } } $ydiff = $baseyoffset + 35 - $minyoffset; $this->adjust_subtree(0, $ydiff); //-- if no father keep the tree off of the pedigree form if ($this->isPrintPreview() && $this->offsetarray[0]["y"] + $baseyoffset < 300) { $this->adjust_subtree(0, 300 - ($this->offsetarray[0]["y"] + $baseyoffset)); } }
function print_family_book($pid, $descent) { global $generations, $dgenerations, $pgv_lang, $firstrun; if ($descent == 0) { return; } $famids = find_sfamily_ids($pid); if (count($famids) > 0 || empty($firstrun)) { $firstrun = true; $pid = check_rootid($pid); $person = Person::getInstance($pid); $name = $person->getFullName(); print "\n\t<h2 style=\"text-align: center\">" . $pgv_lang["family_of"] . PrintReady($name) . "</h2>"; print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n"; //-- descendancy print "<td valign=\"middle\">\n"; $dgenerations = $generations; // $dgenerations = max_descendency_generations($pid, 0); print_descendency($pid, 1); print "</td>\n"; //-- pedigree print "<td valign=\"middle\">\n"; print_person_pedigree($pid, 1); print "</td>\n"; print "</tr></table>\n"; print "<br /><br />\n"; print "<hr style=\"page-break-after:always;\"/>\n"; print "<br /><br />\n"; foreach ($famids as $indexval => $famid) { $famrec = find_family_record($famid, PGV_GED_ID); $ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER); for ($i = 0; $i < $ct; $i++) { $chil = trim($match[$i][1]); if (showLivingNameById($chil) || displayDetailsById($chil)) { print_family_book($chil, $descent - 1); } } } } }
/** * Initialization function */ function init() { global $GEDCOM_ID_PREFIX; $this->colorindex = 0; $this->Fcolorindex = 0; $this->Mcolorindex = 0; $this->zoomfactor = 10; $this->color = "#0000FF"; $this->currentYear = date("Y"); $this->deathMod = 0; $this->endDate = $this->currentYear; //--new pid $newpid = safe_GET_xref('newpid'); if ($newpid) { $person = Person::getInstance($newpid); if (is_null($person) && $GEDCOM_ID_PREFIX) { //-- allow the user to enter the id without the "I" prefix $newpid = $GEDCOM_ID_PREFIX . $newpid; $person = Person::getInstance($newpid); } else { $newpid = $person->getXref(); } } if (safe_GET('clear', '1') == '1') { unset($_SESSION['timeline_pids']); } else { if (isset($_SESSION['timeline_pids'])) { $this->pids = $_SESSION['timeline_pids']; } if (!empty($newpid)) { $this->pids[] = $newpid; } //-- pids array $pids = safe_GET_xref('pids'); if ($pids) { $this->pids = $pids; if (!empty($newpid)) { $this->pids[] = $newpid; } } //-- gets the immediate family for the individual being added if the include immediate family checkbox is checked. if (safe_GET('addFamily', 'yes') == 'yes') { if (isset($newpid)) { $this->addFamily($newpid); } } $remove = safe_GET_xref('remove'); //-- always start with someone on the chart if (count($this->pids) == 0) { $this->pids[] = $this->addFamily(check_rootid("")); } //-- limit to a certain place $searchplace = safe_GET('place'); if (!empty($searchplace)) { $place_pids = get_place_positions($searchplace); if (count($place_pids) > 0) { $this->pids = $place_pids; } } //-- store the people in the session $_SESSION['timeline_pids'] = $this->pids; $beginYear = safe_GET_integer('beginYear', 0, date('Y') + 100, 0); $endYear = safe_GET_integer('endYear', 0, date('Y') + 100, 0); if ($beginYear == 0 || $endYear == 0) { //-- cleanup user input $this->pids = array_unique($this->pids); //removes duplicates foreach ($this->pids as $key => $value) { if ($value != $remove) { $this->pids[$key] = $value; $person = Person::getInstance($value); if ($person) { $bdate = $person->getEstimatedBirthDate(); $ddate = $person->getEstimatedDeathDate(); //--Checks to see if the details of that person can be viewed if ($bdate->isOK() && $person->canDisplayDetails()) { $this->people[] = $person; } } } } } else { //-- reset the people array when doing a year range search $this->people = array(); //Takes the begining year and end year passed by the postback and modifies them and uses them to populate //the time line //Variables to restrict the person boxes to the year searched. //--Searches for individuals who had an even between the year begin and end years $indis = search_indis_year_range($beginYear, $endYear); //--Populates an array of people that had an event within those years foreach ($indis as $pid) { if (empty($searchplace) || in_array($pid, $this->pids)) { $person = Person::getInstance($pid); if ($person) { $bdate = $person->getEstimatedBirthDate(); $ddate = $person->getEstimatedDeathDate(); //--Checks to see if the details of that person can be viewed if ($bdate->isOK() && $person->canDisplayDetails()) { $this->people[] = $person; } } } } unset($_SESSION['timeline_pids']); } //--Sort the arrar in order of being year uasort($this->people, "compare_people"); //If there is people in the array posted back this if occurs if (isset($this->people[0])) { //Find the maximum Death year and mimimum Birth year for each individual returned in the array. $bdate = $this->people[0]->getEstimatedBirthDate(); $ddate = $this->people[0]->getEstimatedDeathDate(); $this->timelineMinYear = $bdate->gregorianYear(); $this->timelineMaxYear = $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y'); foreach ($this->people as $key => $value) { $bdate = $value->getEstimatedBirthDate(); $ddate = $value->getEstimatedDeathDate(); $this->timelineMinYear = min($this->timelineMinYear, $bdate->gregorianYear()); $this->timelineMaxYear = max($this->timelineMaxYear, $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y')); } if ($this->timelineMaxYear > $this->currentYear) { $this->timelineMaxYear = $this->currentYear; } } else { // Sets the default timeline length $this->timelineMinYear = date("Y") - 101; $this->timelineMaxYear = date("Y"); } } }
} } xml_parser_free($xml_parser); foreach ($report_array["inputs"] as $indexval => $input) { if (!isset($input["type"])) { $report_array["inputs"][$indexval]["type"] = "text"; } if ($input["type"] == "select") { $report_array["inputs"][$indexval]['select'] = preg_split("/[, ]+/", $input["options"]); } if (isset($input["lookup"])) { if ($input["lookup"] == "INDI") { if (isset($_REQUEST['pid'])) { $report_array["inputs"][$indexval]["default"] = clean_input($_REQUEST['pid']); } else { $report_array["inputs"][$indexval]["default"] = check_rootid($input["default"]); } } if ($input["lookup"] == "FAM") { if (isset($_REQUEST['famid'])) { $report_array["inputs"][$indexval]["default"] = clean_input($_REQUEST['famid']); } } if ($input["lookup"] == "SOUR") { if (isset($_REQUEST['sid'])) { $report_array["inputs"][$indexval]["default"] = clean_input($_REQUEST['sid']); } } if ($input["lookup"] == "DATE") { $report_array["calendar"] = true; if (!isset($input["default"]) || $input["default"] == "") {
/** * Initialization function */ function init() { global $USE_RIN, $MAX_ALIVE_AGE, $GEDCOM, $bwidth, $bheight, $pbwidth, $pbheight, $GEDCOM_DEFAULT_TAB, $pgv_lang, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS; global $DEFAULT_PEDIGREE_GENERATIONS, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $OLD_PGENS, $box_width, $Dbwidth, $Dbheight; global $show_full; // Extract form parameters $this->rootid = safe_GET_xref('rootid'); $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS); $this->show_cousins = safe_GET('show_cousins', array('0', '1'), '0'); $this->chart_style = safe_GET_integer('chart_style', 0, 3, 0); $box_width = safe_GET_integer('box_width', 50, 300, 100); $PEDIGREE_GENERATIONS = safe_GET_integer('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); // This is passed as a global. A parameter would be better... $show_full = $this->show_full; $OLD_PGENS = $PEDIGREE_GENERATIONS; // Validate form parameters $this->rootid = check_rootid($this->rootid); // -- size of the boxes $Dbwidth *= $box_width / 100; $bwidth = $Dbwidth; if (!$this->show_full) { $bwidth = $bwidth / 1.5; } $bheight = $Dbheight; if (!$this->show_full) { $bheight = $bheight / 1.5; } $pbwidth = $bwidth + 12; $pbheight = $bheight + 14; $this->ancestry = Person::getInstance($this->rootid); $this->name = $this->ancestry->getFullName(); $this->addname = $this->ancestry->getAddName(); if (strlen($this->name) < 30) { $this->cellwidth = "420"; } else { $this->cellwidth = strlen($this->name) * 14; } if (!$this->isPrintPreview()) { $this->visibility = "hidden"; $this->position = "absolute"; $this->display = "none"; } //-- perform the desired action switch ($this->action) { case "addfav": $this->addFavorite(); break; case "accept": $this->acceptChanges(); break; case "undo": $this->hour->undoChange(); break; } }
/** * Initialization function */ function init() { global $USE_RIN, $MAX_ALIVE_AGE, $bwidth, $bheight, $pbwidth, $pbheight, $GEDCOM, $GEDCOM_DEFAULT_TAB, $pgv_lang, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full; $this->sexarray["M"] = $pgv_lang["male"]; $this->sexarray["F"] = $pgv_lang["female"]; $this->sexarray["U"] = $pgv_lang["unknown"]; // Extract parameters from form $this->pid = safe_GET_xref('pid'); $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS); $this->chart_style = safe_GET_integer('chart_style', 0, 3, 0); $this->generations = safe_GET_integer('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); $this->box_width = safe_GET_integer('box_width', 50, 300, 100); // This is passed as a global. A parameter would be better... $show_full = $this->show_full; if (!isset($this->view)) { $this->view = ""; } if (!isset($this->personcount)) { $this->personcount = 1; } $this->Dbwidth *= $this->box_width / 100; if (!$this->show_full) { $bwidth *= $this->box_width / 150; } else { $bwidth *= $this->box_width / 100; } if (!$this->show_full) { $bheight = $bheight / 1.5; } $pbwidth = $bwidth + 12; $pbheight = $bheight + 14; $this->show_changes = safe_GET('show_changes'); $this->action = safe_GET('action'); // Validate form variables $this->pid = check_rootid($this->pid); if (strlen($this->name) < 30) { $this->cellwidth = "420"; } else { $this->cellwidth = strlen($this->name) * 14; } $this->descPerson = Person::getInstance($this->pid); $this->name = $this->descPerson->getFullName(); //-- if the person is from another gedcom then forward to the correct site /* if ($this->indi->isRemote()) { header('Location: '.encode_url(decode_url($this->indi->getLinkUrl(), false))); exit; } */ if (!$this->isPrintPreview()) { $this->visibility = "hidden"; $this->position = "absolute"; $this->display = "none"; } //-- perform the desired action switch ($this->action) { case "addfav": $this->addFavorite(); break; case "accept": $this->acceptChanges(); break; case "undo": $this->desc->undoChange(); break; } }
/** * Tree Navigator Constructor * @param string $rootid the rootid of the person * @param int $zoom The starting zoom level */ function TreeNav($rootid = '', $name = 'nav', $zoom = 0) { global $SHOW_PRIVATE_RELATIONSHIPS; $SHOW_PRIVATE_RELATIONSHIPS = true; // Interactive Tree doesn't work if this is "false" if ($rootid != 'none') { $rootid = check_rootid($rootid); $this->zoomLevel = $zoom; $this->rootPerson = Person::getInstance($rootid); if (is_null($this->rootPerson)) { $this->rootPerson = new Person(''); } } $this->name = $name; //-- handle AJAX requests if (!empty($_REQUEST['navAjax'])) { //-- embedded tree for mashups if ($_REQUEST['navAjax'] == 'embed') { global $SERVER_URL; global $stylesheet; ?> document.writeln('<link rel="stylesheet" href="<?php print $SERVER_URL . $stylesheet; ?> " type="text/css" media="all" />'); document.writeln('<script type="text/javascript" src="<?php print $SERVER_URL; ?> /js/phpgedview.js"></script>'); <?php ob_start(); $w = safe_GET('width', PGV_REGEX_INTEGER, ''); $h = safe_GET('height', PGV_REGEX_INTEGER, ''); if (!empty($w)) { $w .= "px"; } if (!empty($h)) { $h .= "px"; } $this->drawViewport($rootid, $w, $h); $output = ob_get_clean(); $lines = preg_split("/\r?\n/", $output); foreach ($lines as $line) { print "document.writeln('" . preg_replace("/'/", "\\'", $line) . "');\n"; } exit; } if (isset($_REQUEST['allSpouses'])) { if ($_REQUEST['allSpouses'] == 'false' || $_REQUEST['allSpouses'] == false) { $this->allSpouses = false; } else { $this->allSpouses = true; } } if (!empty($_REQUEST['details'])) { $this->getDetails($this->rootPerson); } else { if (!empty($_REQUEST['newroot'])) { if (!empty($_REQUEST['drawport'])) { $this->drawViewport('', "", "150px"); } else { $fam = null; if ($this->allSpouses) { $this->drawPersonAllSpouses($this->rootPerson, 4, 0); } else { $this->drawPerson($this->rootPerson, 4, 0, $fam); } } } else { if (!empty($_REQUEST['parent'])) { $person = $this->rootPerson; if ($_REQUEST['parent'] == 'f') { $cfamily = $person->getPrimaryChildFamily(); if (!empty($cfamily)) { $father = $cfamily->getHusband(); if (!empty($father)) { $fam = null; $this->drawPerson($father, 2, 1, $fam); } else { print "<br />\n"; } } else { print "<br />\n"; } } else { $spouse = $person->getCurrentSpouse(); if (!empty($spouse)) { $cfamily = $spouse->getPrimaryChildFamily(); if (!empty($cfamily)) { $mother = $cfamily->getHusband(); if (!empty($mother)) { $fam = null; $this->drawPerson($mother, 2, 1, $fam); } else { print "<br />\n"; } } else { print "<br />\n"; } } else { print "<br />\n"; } } } else { $fams = $this->rootPerson->getSpouseFamilies(); $family = end($fams); if (!$this->allSpouses) { $this->drawChildren($family, 2); } else { $this->drawAllChildren($this->rootPerson, 2); } } } } exit; } }