コード例 #1
0
ファイル: Familybook.php プロジェクト: sadr110/webtrees
 public function __construct()
 {
     parent::__construct();
     $PEDIGREE_FULL_DETAILS = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_FULL_DETAILS');
     $MAX_DESCENDANCY_GENERATIONS = get_gedcom_setting(WT_GED_ID, 'MAX_DESCENDANCY_GENERATIONS');
     // Extract the request parameters
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->show_spouse = WT_Filter::getInteger('show_spouse', 0, 1);
     $this->descent = WT_Filter::getInteger('descent', 0, 9, 5);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 2);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     // Box sizes are set globally in the theme.  Modify them here.
     global $bwidth, $bheight, $cbwidth, $cbheight, $Dbwidth, $bhalfheight, $Dbheight;
     $Dbwidth = $this->box_width * $bwidth / 100;
     //$Dbheight=$this->box_width * $bheight / 100;
     $bwidth = $Dbwidth;
     $bheight = $Dbheight;
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $this->box_width * $cbwidth / 100;
         $bheight = $cbheight;
     }
     $bhalfheight = $bheight / 2;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Family book of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Family book'));
     }
     //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;
     }
 }
コード例 #2
0
ファイル: Compact.php プロジェクト: brambravo/webtrees
 public function __construct()
 {
     parent::__construct();
     // Extract the request parameters
     $this->show_thumbs = WT_Filter::getBool('show_thumbs');
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Compact tree of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Compact tree'));
     }
     $this->treeid = ancestry_array($this->rootid, 5);
 }
コード例 #3
0
ファイル: Fanchart.php プロジェクト: jacoline/webtrees
 public function __construct()
 {
     parent::__construct();
     $default_generations = get_gedcom_setting(WT_GED_ID, 'DEFAULT_PEDIGREE_GENERATIONS');
     // Extract the request parameters
     $this->fan_style = WT_Filter::getInteger('fan_style', 2, 4, 3);
     $this->fan_width = WT_Filter::getInteger('fan_width', 50, 300, 100);
     $this->generations = WT_Filter::getInteger('generations', 2, 9, $default_generations);
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Fan chart of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Fan chart'));
     }
 }
コード例 #4
0
ファイル: Hourglass.php プロジェクト: jacoline/webtrees
 function __construct($rootid = '', $show_full = 1)
 {
     global $bheight, $bwidth, $cbwidth, $cbheight, $bhalfheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS;
     global $TEXT_DIRECTION, $show_full;
     parent::__construct();
     // Extract parameters from from
     $this->pid = WT_Filter::get('rootid', WT_REGEX_XREF);
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->show_spouse = WT_Filter::getInteger('show_spouse', 0, 1, 0);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 3);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     // This is passed as a global.  A parameter would be better...
     $show_full = $this->show_full;
     if (!empty($rootid)) {
         $this->pid = $rootid;
     }
     //-- flip the arrows for RTL languages
     if ($TEXT_DIRECTION == 'ltr') {
         $this->left_arrow = 'icon-larrow';
         $this->right_arrow = 'icon-rarrow';
     } else {
         $this->left_arrow = 'icon-larrow';
         $this->right_arrow = 'icon-larrow';
     }
     // -- size of the detailed boxes based upon optional width parameter
     $Dbwidth = $this->box_width * $bwidth / 100;
     $Dbheight = $this->box_width * $bheight / 100;
     $bwidth = $Dbwidth;
     $bheight = $Dbheight;
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $this->box_width * $cbwidth / 100;
         $bheight = $cbheight;
     }
     $bhalfheight = (int) ($bheight / 2);
     // Validate parameters
     $this->hourPerson = WT_Individual::getInstance($this->pid);
     if (!$this->hourPerson) {
         $this->hourPerson = $this->getSignificantIndividual();
         $this->pid = $this->hourPerson->getXref();
     }
     $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;
     }
     $this->setPageTitle(WT_I18N::translate('Hourglass chart of %s', $this->name));
 }
コード例 #5
0
ファイル: Descendancy.php プロジェクト: brambravo/webtrees
 function __construct()
 {
     global $bwidth, $bheight, $cbwidth, $cbheight, $pbwidth, $pbheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full;
     parent::__construct();
     // Extract parameters from form
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3, 0);
     $this->generations = WT_Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     // This is passed as a global.  A parameter would be better...
     $show_full = $this->show_full;
     if (!isset($this->personcount)) {
         $this->personcount = 1;
     }
     // -- size of the detailed boxes based upon optional width parameter
     $Dbwidth = $this->box_width * $bwidth / 100;
     $Dbheight = $this->box_width * $bheight / 100;
     $bwidth = $Dbwidth;
     $bheight = $Dbheight;
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $cbwidth;
         $bheight = $cbheight;
     }
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     // Validate form variables
     if (strlen($this->name) < 30) {
         $this->cellwidth = 420;
     } else {
         $this->cellwidth = strlen($this->name) * 14;
     }
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Descendants of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Descendants'));
     }
 }
コード例 #6
0
ファイル: Ancestry.php プロジェクト: brambravo/webtrees
 function __construct()
 {
     global $bwidth, $bheight, $cbwidth, $cbheight, $pbwidth, $pbheight, $PEDIGREE_FULL_DETAILS;
     global $DEFAULT_PEDIGREE_GENERATIONS, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $OLD_PGENS, $box_width, $Dbwidth, $Dbheight;
     global $show_full;
     parent::__construct();
     // Extract form parameters
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->show_cousins = WT_Filter::getInteger('show_cousins', 0, 1);
     $this->chart_style = WT_Filter::getInteger('chart_style', 0, 3);
     $box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     $PEDIGREE_GENERATIONS = WT_Filter::getInteger('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;
     // -- size of the detailed boxes based upon optional width parameter
     $Dbwidth = $box_width * $bwidth / 100;
     $Dbheight = $box_width * $bheight / 100;
     $bwidth = $Dbwidth;
     $bheight = $Dbheight;
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $cbwidth;
         $bheight = $cbheight;
     }
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Ancestors of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Ancestors'));
     }
     if (strlen($this->name) < 30) {
         $this->cellwidth = "420";
     } else {
         $this->cellwidth = strlen($this->name) * 14;
     }
 }
コード例 #7
0
ファイル: Pedigree.php プロジェクト: jacoline/webtrees
 public function __construct()
 {
     global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT, $MAX_PEDIGREE_GENERATIONS;
     global $DEFAULT_PEDIGREE_GENERATIONS;
     global $bwidth, $bheight, $cbwidth, $cbheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing;
     global $linewidth, $shadowcolor, $shadowblur, $shadowoffsetX, $shadowoffsetY;
     global $show_full, $talloffset;
     parent::__construct();
     $this->linewidth = $linewidth;
     $this->shadowcolor = $shadowcolor;
     $this->shadowblur = $shadowblur;
     $this->shadowoffsetX = $shadowoffsetX;
     $this->shadowoffsetY = $shadowoffsetY;
     $this->show_full = WT_Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS);
     $this->talloffset = WT_Filter::getInteger('talloffset', 0, 3, $PEDIGREE_LAYOUT);
     $this->box_width = WT_Filter::getInteger('box_width', 50, 300, 100);
     $this->PEDIGREE_GENERATIONS = WT_Filter::getInteger('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;
     } elseif ($this->talloffset < 0) {
         $this->talloffset = 0;
     }
     $show_full = $this->show_full;
     $talloffset = $this->talloffset;
     if ($this->root && $this->root->canShowName()) {
         $this->setPageTitle(WT_I18N::translate('Pedigree tree of %s', $this->root->getFullName()));
     } else {
         $this->setPageTitle(WT_I18N::translate('Pedigree'));
     }
     // -- adjust size of the compact box
     if (!$this->show_full) {
         $bwidth = $cbwidth;
         $bheight = $cbheight;
     }
     //-- adjustments for portrait mode
     if ($this->talloffset == 0) {
         $bxspacing += 12;
         $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;
         } elseif ($this->talloffset == 1) {
             $baseyoffset = 180 + $bheight * 2;
         } elseif ($this->talloffset > 1) {
             if ($this->PEDIGREE_GENERATIONS == 3) {
                 $baseyoffset = 30;
             } else {
                 $baseyoffset = -85;
             }
         }
     } else {
         if ($this->talloffset == 0) {
             $baseyoffset = 100 + $bheight / 2;
         } elseif ($this->talloffset == 1) {
             $baseyoffset = 160 + $bheight / 2;
         } elseif ($this->talloffset > 1) {
             if ($this->PEDIGREE_GENERATIONS == 3) {
                 $baseyoffset = 30;
             } else {
                 $baseyoffset = -85;
             }
         }
     }
     // -- 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 IDs 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 < (int) ($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 = (int) (($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 = (int) (($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 = 22 + $basexoffset + ($this->PEDIGREE_GENERATIONS - $this->curgen) * ($this->pbwidth + $bxspacing);
                 if ($this->curgen == $this->PEDIGREE_GENERATIONS) {
                     $this->xoffset;
                 }
                 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;
                     }
                 } 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->curgen == 1 && $this->talloffset == 1) {
             $this->xoffset += 10;
         }
         $this->offsetarray[$i]["x"] = $this->xoffset;
         $this->offsetarray[$i]["y"] = $this->yoffset;
     }
     //-- calculate the smallest yoffset and adjust the tree to that offset
     $minyoffset = 0;
     for ($i = 0; $i < count($this->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);
 }
コード例 #8
0
ファイル: module.php プロジェクト: jacoline/webtrees
    public function modAction($mod_action)
    {
        require_once WT_MODULES_DIR . $this->getName() . '/class_treeview.php';
        switch ($mod_action) {
            case 'treeview':
                global $controller;
                $controller = new WT_Controller_Chart();
                $tv = new TreeView('tv');
                ob_start();
                $person = $controller->getSignificantIndividual();
                list($html, $js) = $tv->drawViewport($person, 4);
                $controller->setPageTitle(WT_I18N::translate('Interactive tree of %s', $person->getFullName()))->pageHeader()->addExternalJavascript($this->js())->addInlineJavascript($js)->addInlineJavascript('
					if (document.createStyleSheet) {
						document.createStyleSheet("' . $this->css() . '"); // For Internet Explorer
					} else {
						jQuery("head").append(\'<link rel="stylesheet" type="text/css" href="' . $this->css() . '">\');
					}
				');
                echo $html;
                break;
            case 'getDetails':
                //$controller = new WT_Controller_Ajax();
                //$controller->pageHeader();
                Zend_Session::writeClose();
                header('Content-Type: text/html; charset=UTF-8');
                $pid = WT_Filter::get('pid', WT_REGEX_XREF);
                $i = WT_Filter::get('instance');
                $tv = new TreeView($i);
                $individual = WT_Individual::getInstance($pid);
                if ($individual) {
                    echo $tv->getDetails($individual);
                }
                break;
            case 'getPersons':
                //$controller = new WT_Controller_Ajax();
                //$controller->pageHeader();
                Zend_Session::writeClose();
                header('Content-Type: text/html; charset=UTF-8');
                $q = WT_Filter::get('q');
                $i = WT_Filter::get('instance');
                $tv = new TreeView($i);
                echo $tv->getPersons($q);
                break;
            default:
                header('HTTP/1.0 404 Not Found');
                break;
        }
    }