示例#1
0
 /**
  * Startup activity
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     $this->setPageTitle(I18N::translate('Timeline'));
     $this->baseyear = (int) date('Y');
     $pids = Filter::getArray('pids', WT_REGEX_XREF);
     $remove = Filter::get('remove', WT_REGEX_XREF);
     foreach (array_unique($pids) as $pid) {
         if ($pid !== $remove) {
             $person = Individual::getInstance($pid, $WT_TREE);
             if ($person && $person->canShow()) {
                 $this->people[] = $person;
             }
         }
     }
     $this->pidlinks = '';
     foreach ($this->people as $indi) {
         // setup string of valid pids for links
         $this->pidlinks .= 'pids%5B%5D=' . $indi->getXref() . '&';
         $bdate = $indi->getBirthDate();
         if ($bdate->isOK()) {
             $date = new GregorianDate($bdate->minimumJulianDay());
             $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
         $facts = $indi->getFacts();
         foreach ($indi->getSpouseFamilies() as $family) {
             foreach ($family->getFacts() as $fact) {
                 $facts[] = $fact;
             }
         }
         foreach ($facts as $event) {
             // get the fact type
             $fact = $event->getTag();
             if (!in_array($fact, $this->nonfacts)) {
                 // check for a date
                 $date = $event->getDate();
                 if ($date->isOK()) {
                     $date = new GregorianDate($date->minimumJulianDay());
                     $this->baseyear = min($this->baseyear, $date->y);
                     $this->topyear = max($this->topyear, $date->y);
                     if (!$indi->isDead()) {
                         $this->topyear = max($this->topyear, (int) date('Y'));
                     }
                     // do not add the same fact twice (prevents marriages from being added multiple times)
                     if (!in_array($event, $this->indifacts, true)) {
                         $this->indifacts[] = $event;
                     }
                 }
             }
         }
     }
     $scale = Filter::getInteger('scale', 0, 200);
     if ($scale === 0) {
         $this->scale = (int) (($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;
 }
示例#2
0
         $xtitle = $xtitle . I18N::translate(' per time period');
     }
     //-- reset the data array
     for ($i = 0; $i < $zmax; $i++) {
         for ($j = 0; $j < $xmax; $j++) {
             $ydata[$i][$j] = 0;
         }
     }
     $total = age_at_first_marriage($z_axis, $z_boundaries, $stats);
     $hstr = $title . '|' . I18N::translate('Counts ') . ' ' . I18N::number($total) . ' ' . I18N::translate('of') . ' ' . $stats->totalIndividuals();
     my_plot($hstr, $xdata, $xtitle, $ydata, $ytitle, $legend);
     break;
 case '21':
     $monthdata = array();
     for ($i = 0; $i < 12; ++$i) {
         $monthdata[$i] = GregorianDate::monthNameNominativeCase($i + 1, false);
     }
     $xgiven = false;
     $zgiven = false;
     $title = I18N::translate('Number of children');
     $xtitle = I18N::translate('children');
     $ytitle = I18N::translate('numbers');
     $boundaries_x_axis = Filter::get('x-axis-boundaries-numbers');
     $boundaries_z_axis = Filter::get('z-axis-boundaries-periods', null, '0');
     calculate_axis($boundaries_x_axis);
     if ($z_axis !== 300 && $z_axis !== 301) {
         calculate_legend($boundaries_z_axis);
     }
     $percentage = false;
     if ($y_axis === 201) {
         $percentage = false;