/** * initialize the controller */ function init() { global $pgv_lang, $CONTACT_EMAIL, $GEDCOM, $pgv_changes; $this->nid = safe_GET_xref('nid'); $noterec = find_other_record($this->nid); if (isset($pgv_changes[$this->nid . "_" . $GEDCOM])) { $noterec = "0 @" . $this->nid . "@ NOTE\n"; } else { if (!$noterec) { return false; } } $this->note = new Note($noterec); $this->note->ged_id = PGV_GED_ID; // This record is from a file if (!$this->note->canDisplayDetails()) { print_header($pgv_lang["private"] . " " . $pgv_lang["shared_note_info"]); print_privacy_error($CONTACT_EMAIL); print_footer(); exit; } $this->uname = PGV_USER_NAME; //-- perform the desired action switch ($this->action) { case "addfav": $this->addFavorite(); break; case "accept": $this->acceptChanges(); break; case "undo": $this->note->undoChange(); break; } //-- check for the user //-- if the user can edit and there are changes then get the new changes if ($this->show_changes && PGV_USER_CAN_EDIT && isset($pgv_changes[$this->nid . "_" . $GEDCOM])) { $newrec = find_updated_record($this->nid); $this->diffnote = new Note($newrec); $this->diffnote->setChanged(true); $noterec = $newrec; } if ($this->note->canDisplayDetails()) { $this->canedit = PGV_USER_CAN_EDIT; } if ($this->show_changes && $this->canedit) { $this->note->diffMerge($this->diffnote); } }
$image_data = serialize($image_data); unset($_SESSION['image_data']); $_SESSION['image_data'] = $image_data; // step 2. call imageflush.php to read this session variable and display image // note: arg "image_name=" is to avoid image miscaching $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";
/** * 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 $USE_RIN, $MAX_ALIVE_AGE, $GEDCOM, $GEDCOM_DEFAULT_TAB, $pgv_changes, $pgv_lang, $CHARACTER_SET; global $USE_QUICK_UPDATE, $pid; global $Fam_Navigator, $gBitUser, $gGedcom; $this->sexarray["M"] = $pgv_lang["male"]; $this->sexarray["F"] = $pgv_lang["female"]; $this->sexarray["U"] = $pgv_lang["unknown"]; $this->pid = safe_GET_xref('pid'); $show_famlink = $this->view != 'preview'; $pid = $this->pid; $this->default_tab = $GEDCOM_DEFAULT_TAB; $indirec = find_person_record($this->pid); if ($USE_RIN && $indirec == false) { $this->pid = find_rin_id($this->pid); $indirec = find_person_record($this->pid); } if (empty($indirec)) { $ct = preg_match("/(\\w+):(.+)/", $this->pid, $match); if ($ct > 0) { $servid = trim($match[1]); $remoteid = trim($match[2]); include_once 'includes/classes/class_serviceclient.php'; $service = ServiceClient::getInstance($servid); if ($service != null) { $newrec = $service->mergeGedcomRecord($remoteid, "0 @" . $this->pid . "@ INDI\n1 RFN " . $this->pid, false); $indirec = $newrec; } } else { if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) { $indirec = "0 @" . $this->pid . "@ INDI\n"; } else { return false; } } } //-- check for the user if ($gBitUser->isRegistered()) { $this->default_tab = get_user_setting($gBitUser->mUserId, 'defaulttab'); } //-- check for a cookie telling what the last tab was when they were last //-- visiting this individual if ($this->default_tab == -2) { if (isset($_COOKIE['lasttabs'])) { $ct = preg_match("/" . $this->pid . "=(\\d+)/", $_COOKIE['lasttabs'], $match); if ($ct > 0) { $this->default_tab = $match[1] - 1; } } } //-- if the action is a research assistant action then default to the RA tab if (strstr($this->action, 'ra_') !== false) { $this->default_tab = 6; } //-- set the default tab from a request parameter if (isset($_REQUEST['tab'])) { $this->default_tab = $_REQUEST['tab']; } if ($this->default_tab < -2 || $this->default_tab > 9) { $this->default_tab = 0; } $this->indi = new Person($indirec, false); $this->indi->ged_id = $gGedcom->mGEDCOMId; // This record is from a file //-- 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->indi->undoChange(); break; } //-- if the user can edit and there are changes then get the new changes if ($this->show_changes && $gGedcom->isEditable()) { if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) { //-- get the changed record from the file $newrec = find_updated_record($this->pid); //print("jkdsakjhdkjsadkjsakjdhsakd".$newrec); $remoterfn = get_gedcom_value("RFN", 1, $newrec); } else { $remoterfn = get_gedcom_value("RFN", 1, $indirec); } // print "remoterfn=".$remoterfn; //-- get an updated record from the web service if (!empty($remoterfn)) { $parts = explode(':', $remoterfn); if (count($parts) == 2) { $servid = $parts[0]; $aliaid = $parts[1]; if (!empty($servid) && !empty($aliaid)) { require_once "includes/classes/class_serviceclient.php"; $serviceClient = ServiceClient::getInstance($servid); if (!is_null($serviceClient)) { if (!empty($newrec)) { $mergerec = $serviceClient->mergeGedcomRecord($aliaid, $newrec, true); } else { $mergerec = $serviceClient->mergeGedcomRecord($aliaid, $indirec, true); } if ($serviceClient->type == "remote") { $newrec = $mergerec; } else { $indirec = $mergerec; } } } } } if (!empty($newrec)) { $this->diffindi = new Person($newrec, false); $this->diffindi->setChanged(true); $indirec = $newrec; } } if ($this->show_changes) { $this->indi->diffMerge($this->diffindi); } //-- only allow editors or users who are editing their own individual or their immediate relatives if ($this->indi->canDisplayDetails()) { $this->canedit = $gGedcom->isEditable(); /* Disable self-editing completely until we have a GEDCOM config option to control this if (!$this->canedit && $USE_QUICK_UPDATE) { $my_id=PGV_USER_GEDCOM_ID; if ($my_id) { if ($this->pid==$my_id) $this->canedit=true; else { $famids = array_merge(find_sfamily_ids($my_id), find_family_ids($my_id)); foreach($famids as $indexval => $famid) { if (!isset($pgv_changes[$famid."_".$GEDCOM])) $famrec = find_family_record($famid); else $famrec = find_updated_record($famid); if (preg_match("/1 (HUSB|WIFE|CHIL) @$this->pid@/", $famrec)>0) $this->canedit=true; } } } } */ } //-- handle ajax calls if ($this->action == "ajax") { $tab = 0; if (isset($_REQUEST['tab'])) { $tab = $_REQUEST['tab'] - 1; } header("Content-Type: text/html; charset={$CHARACTER_SET}"); //AJAX calls do not have the meta tag headers and need this set $this->getTab($tab); //-- only get the requested tab and then exit /* TODO if (PGV_DEBUG_SQL) { echo ADOdb::getQueryLog(); } */ exit; } }
/** * 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; }
function init() { global $Dbwidth, $bwidth, $pbwidth, $pbheight, $bheight, $GEDCOM, $pgv_lang, $CONTACT_EMAIL, $show_famlink, $pgv_changes; $bwidth = $Dbwidth; $pbwidth = $bwidth + 12; $pbheight = $bheight + 14; $show_famlink = $this->view != 'preview'; $this->famid = safe_GET_xref('famid'); $this->family = Family::getInstance($this->famid); if (empty($this->famrec)) { $ct = preg_match("/(\\w+):(.+)/", $this->famid, $match); if ($ct > 0) { $servid = trim($match[1]); $remoteid = trim($match[2]); include_once 'includes/classes/class_serviceclient.php'; $service = ServiceClient::getInstance($servid); if (!is_null($service)) { $newrec = $service->mergeGedcomRecord($remoteid, "0 @" . $this->famid . "@ FAM\n1 RFN " . $this->famid, false); $this->famrec = $newrec; } } //-- if no record was found create a default empty one if (isset($pgv_changes[$this->famid . "_" . $GEDCOM])) { $this->famrec = "0 @" . $this->famid . "@ FAM\n"; $this->family = new Family($this->famrec); } else { if (empty($this->family)) { return false; } } } $this->famrec = $this->family->getGedcomRecord(); $this->display = displayDetailsById($this->famid, 'FAM'); //-- if the user can edit and there are changes then get the new changes if ($this->show_changes && PGV_USER_CAN_EDIT && isset($pgv_changes[$this->famid . "_" . $GEDCOM])) { $newrec = find_updated_record($this->famid); if (empty($newrec)) { $newrec = find_family_record($this->famid); } $this->difffam = new Family($newrec); $this->difffam->setChanged(true); $this->family->diffMerge($this->difffam); //$this->famrec = $newrec; //$this->family = new Family($this->famrec); } $this->parents = array('HUSB' => $this->family->getHusbId(), 'WIFE' => $this->family->getWifeId()); //-- check if we can display both parents if ($this->display == false) { $this->showLivingHusb = showLivingNameById($this->parents['HUSB']); $this->showLivingWife = showLivingNameById($this->parents['WIFE']); } //-- add favorites action if ($this->action == 'addfav' && !empty($_REQUEST['gid']) && PGV_USER_NAME) { $_REQUEST['gid'] = strtoupper($_REQUEST['gid']); $indirec = find_family_record($_REQUEST['gid']); if ($indirec) { $favorite = array('username' => PGV_USER_NAME, 'gid' => $_REQUEST['gid'], 'type' => 'FAM', 'file' => $GEDCOM, 'url' => '', 'note' => '', 'title' => ''); addFavorite($favorite); } } if (PGV_USER_CAN_ACCEPT) { if ($this->action == 'accept') { if (accept_changes($_REQUEST['famid'] . '_' . $GEDCOM)) { $this->show_changes = false; $this->accept_success = true; //-- check if we just deleted the record and redirect to index $famrec = find_family_record($_REQUEST['famid']); if (empty($famrec)) { header("Location: index.php?ctype=gedcom"); exit; } $this->family = new Family($famrec); $this->parents = find_parents($_REQUEST['famid']); } } if ($this->action == 'undo') { $this->family->undoChange(); $this->parents = find_parents($_REQUEST['famid']); } } //-- make sure we have the true id from the record $ct = preg_match("/0 @(.*)@/", $this->famrec, $match); if ($ct > 0) { $this->famid = trim($match[1]); } if ($this->showLivingHusb == false && $this->showLivingWife == false) { print_header($pgv_lang['private'] . " " . $pgv_lang['family_info']); print_privacy_error($CONTACT_EMAIL); print_footer(); exit; } $this->title = $this->family->getFullName(); if (empty($this->parents['HUSB']) || empty($this->parents['WIFE'])) { $this->link_relation = 0; } else { $this->link_relation = 1; } }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @package PhpGedView * @subpackage Charts * @version $Id: familybook.php 6879 2010-01-30 11:35:46Z fisharebest $ */ define('PGV_SCRIPT_NAME', 'familybook.php'); require './config.php'; require_once PGV_ROOT . 'includes/functions/functions_charts.php'; // Extract form variables $pid = safe_GET_xref('pid'); $show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS); $show_spouse = safe_GET('show_spouse', '1', '0'); $descent = safe_GET_integer('descent', 0, 9, 5); $generations = safe_GET_integer('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 2); $box_width = safe_GET_integer('box_width', 50, 300, 100); // -- size of the boxes if (!$show_full) { $bwidth = $bwidth / 1.5; } $bwidth = (int) ($bwidth * $box_width / 100); if ($show_full == false) { $bheight = (int) ($bheight / 2.5); } $bhalfheight = (int) ($bheight / 2); // -- root id
/** * 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)); } }
/** * 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"); } } }
/** * 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; } }
function init() { global $MEDIA_DIRECTORY, $USE_MEDIA_FIREWALL, $GEDCOM, $pgv_changes; $filename = decrypt(safe_GET('filename')); $this->mid = safe_GET_xref('mid'); if ($USE_MEDIA_FIREWALL && empty($filename) && empty($this->mid)) { // this section used by mediafirewall.php to determine what media file was requested if (isset($_SERVER['REQUEST_URI'])) { // NOTE: format of this server variable: // Apache: /phpGedView/media/a.jpg // IIS: /phpGedView/mediafirewall.php?404;http://server/phpGedView/media/a.jpg $requestedfile = $_SERVER['REQUEST_URI']; // urldecode the request $requestedfile = rawurldecode($requestedfile); // make sure the requested file is in the media directory if (strpos($requestedfile, $MEDIA_DIRECTORY) !== false) { // strip off the pgv directory and media directory from the requested url so just the image information is left $filename = substr($requestedfile, strpos($requestedfile, $MEDIA_DIRECTORY) + strlen($MEDIA_DIRECTORY) - 1); // if user requested a thumbnail, lookup permissions based on the original image $filename = str_replace('/thumbs', '', $filename); } } } //Checks to see if the File Name ($filename) exists if (!empty($filename)) { //If the File Name ($filename) is set, then it will call the method to get the Media ID ($this->mid) from the File Name ($filename) $this->mid = get_media_id_from_file($filename); if (!$this->mid) { //This will set the Media ID to be false if the File given doesn't match to anything in the database $this->mid = false; // create a very basic gedcom record for this file so that the functions of the media object will work // this is used by the media firewall when requesting an object that exists in the media firewall directory but not in the gedcom $this->mediaobject = new Media("0 @" . "0" . "@ OBJE\n1 FILE " . $filename); } } //checks to see if the Media ID ($this->mid) is set. If the Media ID isn't set then there isn't any information avaliable for that picture the picture doesn't exist. if ($this->mid) { //This creates a Media Object from the getInstance method of the Media Class. It takes the Media ID ($this->mid) and creates the object. $this->mediaobject = Media::getInstance($this->mid); //This sets the controller ID to be the Media ID $this->pid = $this->mid; } if (is_null($this->mediaobject)) { return false; } $this->mediaobject->ged_id = PGV_GED_ID; // This record is from a file //-- perform the desired action switch ($this->action) { case "addfav": $this->addFavorite(); break; case "accept": $this->acceptChanges(); break; case "undo": $this->mediaobject->undoChange(); break; } if ($this->mediaobject->canDisplayDetails()) { $this->canedit = PGV_USER_CAN_EDIT; } }
/** * 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; } }