public function pageBody() { $tmp_dir = WT_DATA_DIR . 'ftv_pdf_tmp/'; define('_JPGRAPH_PATH', $tmp_dir); define('_MPDF_TEMP_PATH', $tmp_dir); define('_MPDF_TTFONTDATAPATH', $tmp_dir); require_once WT_MODULES_DIR . $this->getName() . '/mpdf/mpdf.php'; $stylesheet = file_get_contents($this->directory . '/css/style.css'); $stylesheet_rtl = file_get_contents($this->directory . '/css/style-rtl.css'); $html = Filter::post('pdfContent'); $header = '<header>=== ' . $this->tree()->getTitleHtml() . ' ===</header>'; $footer = '<footer>' . '<table><tr>' . '<td class="left">' . WT_BASE_URL . '</td>' . '<td class="center">{DATE d-m-Y}</td>' . '<td class="right">{PAGENO}</td>' . '</tr></table>' . '</footer>'; $mpdf = new mPDF(); $mpdf->simpleTables = true; $mpdf->shrink_tables_to_fit = 1; $mpdf->autoScriptToLang = true; $mpdf->baseScript = 1; $mpdf->autoVietnamese = true; $mpdf->autoArabic = true; $mpdf->autoLangToFont = true; if (I18N::direction() === 'rtl') { $mpdf->SetDirectionality('rtl'); $mpdf->WriteHTML($stylesheet_rtl, 1); } else { $mpdf->WriteHTML($stylesheet, 1); } $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->autoMarginPadding = 5; $admin = User::find($this->tree()->getPreference('WEBMASTER_USER_ID'))->getRealName(); $mpdf->setCreator($this->getTitle() . ' - a webtrees module by justcarmen.nl'); $mpdf->SetTitle(Filter::get('title')); $mpdf->setAuthor($admin); $mpdf->SetHTMLHeader($header); $mpdf->setHTMLFooter($footer); $html_chunks = explode("\n", $html); $chunks = count($html_chunks); $i = 1; foreach ($html_chunks as $html_chunk) { // write html body parts only (option 2); if ($i === 1) { // first chunk (initialize all buffers - init=true) $mpdf->WriteHTML($html_chunk, 2, true, false); } elseif ($i === $chunks) { // last chunck (close all buffers - close=true) $mpdf->WriteHTML($html_chunk, 2, false, true); } else { // all other parts (keep the buffer open) $mpdf->WriteHTML($html_chunk, 2, false, false); } $i++; } $index = ' <pagebreak type="next-odd" /> <h2>' . I18N::translate('Index') . '</h2> <columns column-count="2" column-gap="5" /> <indexinsert usedivletters="on" links="on" collation="' . WT_LOCALE . '.utf8" collationgroup="' . I18N::collation() . '" />'; $mpdf->writeHTML($index); $mpdf->Output($tmp_dir . Filter::get('title') . '.pdf', 'F'); }
public function pageBody() { $cache_dir = WT_DATA_DIR . 'ftv_cache/'; define("_JPGRAPH_PATH", $cache_dir); define("_MPDF_TEMP_PATH", $cache_dir); define('_MPDF_TTFONTDATAPATH', $cache_dir); require_once WT_MODULES_DIR . $this->getName() . '/packages/mpdf60/mpdf.php'; $tmpfile = $cache_dir . 'fancy-treeview-tmp.txt'; if (file_exists($cache_dir) && is_readable($tmpfile)) { $stylesheet = file_get_contents($this->directory . '/css/pdf/style.css'); $stylesheet_rtl = file_get_contents($this->directory . '/css/pdf/style-rtl.css'); $html = file_get_contents($tmpfile); $header = '<header>=== ' . $this->tree->getTitleHtml() . ' ===</header>'; $footer = '<footer>' . '<table><tr>' . '<td class="left">' . WT_BASE_URL . '</td>' . '<td class="center">{DATE d-m-Y}</td>' . '<td class="right">{PAGENO}</td>' . '</tr></table>' . '</footer>'; $mpdf = new mPDF(); $mpdf->simpleTables = true; $mpdf->shrink_tables_to_fit = 1; $mpdf->autoScriptToLang = true; if (I18N::direction() === 'rtl') { $mpdf->SetDirectionality('rtl'); } if (I18N::direction() === 'rtl') { $mpdf->WriteHTML($stylesheet_rtl, 1); } else { $mpdf->WriteHTML($stylesheet, 1); } $mpdf->setAutoTopMargin = 'stretch'; $mpdf->setAutoBottomMargin = 'stretch'; $mpdf->autoMarginPadding = 5; $admin = User::find($this->tree->getPreference('WEBMASTER_USER_ID'))->getRealName(); $mpdf->setCreator($this->getTitle() . ' - a webtrees module by justcarmen.nl'); $mpdf->SetTitle(Filter::get('title')); $mpdf->setAuthor($admin); $mpdf->SetHTMLHeader($header); $mpdf->setHTMLFooter($footer); $html_chunks = explode("\n", $html); $chunks = count($html_chunks); $i = 1; foreach ($html_chunks as $html_chunk) { if ($i === 1) { $mpdf->WriteHTML($html_chunk, 2, true, false); } elseif ($i === $chunks) { $mpdf->WriteHTML($html_chunk, 2, false, false); } else { $mpdf->WriteHTML($html_chunk, 2, false, true); } $i++; } $index = ' <pagebreak type="next-odd" /> <h2>' . I18N::translate('Index') . '</h2> <columns column-count="2" column-gap="5" /> <indexinsert usedivletters="on" links="on" collation="' . WT_LOCALE . '.utf8" collationgroup="' . I18N::collation() . '" />'; $mpdf->writeHTML($index); $mpdf->Output(Filter::get('title') . '.pdf', 'D'); } else { echo $this->addMessage('alert', 'danger', false, I18N::translate('Error: the pdf file could not be generated.')); } }
/** * Print the page header, using the theme * * @param bool $popup Is this a popup window * * @return $this */ public function pageHeader($popup = false) { global $WT_TREE; $this->popup = $popup; // Give Javascript access to some PHP constants $this->addInlineJavascript(' var WT_STATIC_URL = "' . Filter::escapeJs(WT_STATIC_URL) . '"; var WT_MODULES_DIR = "' . Filter::escapeJs(WT_MODULES_DIR) . '"; var WT_GEDCOM = "' . Filter::escapeJs($WT_TREE ? $WT_TREE->getName() : '') . '"; var textDirection = "' . Filter::escapeJs(I18N::direction()) . '"; var WT_SCRIPT_NAME = "' . Filter::escapeJs(WT_SCRIPT_NAME) . '"; var WT_LOCALE = "' . Filter::escapeJs(WT_LOCALE) . '"; var WT_CSRF_TOKEN = "' . Filter::escapeJs(Filter::getCsrfToken()) . '"; ', self::JS_PRIORITY_HIGH); Theme::theme()->sendHeaders(); echo Theme::theme()->doctype(); echo Theme::theme()->html(); echo Theme::theme()->head($this); if ($this->popup) { echo Theme::theme()->bodyHeaderPopupWindow(); // We've displayed the header - display the footer automatically register_shutdown_function(array($this, 'pageFooterPopupWindow'), $this->popup); } else { echo Theme::theme()->bodyHeader(); // We've displayed the header - display the footer automatically register_shutdown_function(array($this, 'pageFooter'), $this->popup); } return $this; }
/** * Prints descendency of passed in person * * @param Individual $person person to print descendency for * @param int $count count of generations to print * @param bool $showNav * * @return int */ public function printDescendency($person, $count, $showNav = true) { global $lastGenSecondFam; if ($count > $this->dgenerations) { return 0; } $pid = $person->getXref(); $tablealign = 'right'; $otablealign = 'left'; if (I18N::direction() === 'rtl') { $tablealign = 'left'; $otablealign = 'right'; } //-- put a space between families on the last generation if ($count == $this->dgenerations - 1) { if (isset($lastGenSecondFam)) { echo '<br>'; } $lastGenSecondFam = true; } echo "<table id='table_{$pid}' class='hourglassChart' style='float:{$tablealign}'>"; echo '<tr>'; echo "<td style='text-align:{$tablealign}'>"; $numkids = 0; $families = $person->getSpouseFamilies(); $famNum = 0; $children = array(); if ($count < $this->dgenerations) { // Put all of the children in a common array foreach ($families as $family) { $famNum++; foreach ($family->getChildren() as $child) { $children[] = $child; } } $ct = count($children); if ($ct > 0) { echo "<table style='position: relative; top: auto; float: {$tablealign};'>"; for ($i = 0; $i < $ct; $i++) { $person2 = $children[$i]; $chil = $person2->getXref(); echo '<tr>'; echo '<td id="td_', $chil, '" class="', I18N::direction(), '" style="text-align:', $otablealign, '">'; $kids = $this->printDescendency($person2, $count + 1); $numkids += $kids; echo '</td>'; // Print the lines if ($ct > 1) { if ($i == 0) { // First child echo "<td style='vertical-align:bottom'><img alt='' class='line1 tvertline' id='vline_{$chil}' src='" . Theme::theme()->parameter('image-vline') . "' width='3'></td>"; } elseif ($i == $ct - 1) { // Last child echo "<td style='vertical-align:top'><img alt='' class='bvertline' id='vline_{$chil}' src='" . Theme::theme()->parameter('image-vline') . "' width='3'></td>"; } else { // Middle child echo '<td style="background: url(\'' . Theme::theme()->parameter('image-vline') . '\');"><img src=\'' . Theme::theme()->parameter('image-spacer') . '\' width="3" alt=""></td>'; } } echo '</tr>'; } echo '</table>'; } echo '</td>'; echo '<td width="', $this->getBoxDimensions()->width, '">'; } // Print the descendency expansion arrow if ($count == $this->dgenerations) { $numkids = 1; $tbwidth = $this->getBoxDimensions()->width + 16; for ($j = $count; $j < $this->dgenerations; $j++) { echo "<div style='width: ", $tbwidth, "px;'><br></div></td><td style='width:", $this->getBoxDimensions()->width, "px'>"; } $kcount = 0; foreach ($families as $family) { $kcount += $family->getNumberOfChildren(); } if ($kcount == 0) { echo "</td><td style='width:", $this->getBoxDimensions()->width, "px'>"; } else { printf(self::LINK, $this->left_arrow, $pid, 'desc', $this->showFull(), $this->show_spouse); //-- move the arrow up to line up with the correct box if ($this->show_spouse) { echo str_repeat('<br><br><br>', count($families)); } echo "</td><td style='width:", $this->getBoxDimensions()->width, "px'>"; } } echo '<table id="table2_' . $pid . '"><tr><td>'; FunctionsPrint::printPedigreePerson($person, $this->showFull()); echo '</td><td><img class="line2" src="' . Theme::theme()->parameter('image-hline') . '" width="7" height="3">'; //----- Print the spouse if ($this->show_spouse) { foreach ($families as $family) { echo "</td></tr><tr><td style='text-align:{$otablealign}'>"; //-- shrink the box for the spouses $tempw = $this->getBoxDimensions()->width; $temph = $this->getBoxDimensions()->height; $this->getBoxDimensions()->width -= 10; $this->getBoxDimensions()->height -= 10; FunctionsPrint::printPedigreePerson($family->getSpouse($person), $this->showFull()); $this->getBoxDimensions()->width = $tempw; $this->getBoxDimensions()->height = $temph; $numkids += 0.95; echo "</td><td></td>"; } //-- add offset divs to make things line up better if ($count == $this->dgenerations) { echo "<tr><td colspan '2'><div style='height:", $this->bhalfheight / 2, "px; width:", $this->getBoxDimensions()->width, "px;'><br></div>"; } } echo "</td></tr></table>"; // For the root person, print a down arrow that allows changing the root of tree if ($showNav && $count == 1) { // NOTE: If statement OK if ($person->canShowName()) { // -- print left arrow for decendants so that we can move down the tree $famids = $person->getSpouseFamilies(); //-- make sure there is more than 1 child in the family with parents $cfamids = $person->getChildFamilies(); $num = 0; foreach ($cfamids as $family) { $num += $family->getNumberOfChildren(); } if ($num > 0) { echo '<div class="center" id="childarrow" style="position:absolute; width:', $this->getBoxDimensions()->width, 'px;">'; echo '<a href="#" class="icon-darrow"></a>'; echo '<div id="childbox">'; echo '<table class="person_box"><tr><td>'; foreach ($famids as $family) { echo "<span class='name1'>" . I18N::translate('Family') . "</span>"; $spouse = $family->getSpouse($person); if ($spouse) { printf(self::SWITCH_LINK, $spouse->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $spouse->getFullName()); } foreach ($family->getChildren() as $child) { printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $child->getFullName()); } } //-- print the siblings foreach ($cfamids as $family) { if ($family->getHusband() || $family->getWife()) { echo "<span class='name1'>" . I18N::translate('Parents') . "</span>"; $husb = $family->getHusband(); if ($husb) { printf(self::SWITCH_LINK, $husb->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $husb->getFullName()); } $wife = $family->getWife(); if ($wife) { printf(self::SWITCH_LINK, $wife->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $wife->getFullName()); } } // filter out root person from children array so only siblings remain $siblings = array_filter($family->getChildren(), function (Individual $item) use($pid) { return $item->getXref() != $pid; }); $num = count($siblings); if ($num) { echo "<span class='name1'>"; echo $num > 1 ? I18N::translate('Siblings') : I18N::translate('Sibling'); echo "</span>"; foreach ($siblings as $child) { printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $child->getFullName()); } } } echo '</td></tr></table>'; echo '</div>'; echo '</div>'; } } } echo '</td></tr></table>'; return $numkids; }
/** {@inheritdoc} */ public function formatSecondaryMenu() { if (I18N::direction() === 'rtl') { $class = 'navbar-left'; } else { $class = 'navbar-right'; } return '<div class="' . $class . '">' . $this->secondaryMenuContainer($this->secondaryMenu()) . $this->menuLogin() . '</div>'; }
/** * Render this menu using javascript popups.. * * @return string */ public function getMenu() { $menu_id = 'menu-' . Uuid::uuid4(); $sub_menu_id = 'sub-' . $menu_id; $html = '<a href="' . $this->link . '"'; foreach ($this->attrs as $key => $value) { $html .= ' ' . $key . '="' . Filter::escapeHtml($value) . '"'; } if (!empty($this->submenus)) { $html .= ' onmouseover="show_submenu(\'' . $sub_menu_id . '\', \'' . $menu_id . '\');"'; $html .= ' onmouseout="timeout_submenu(\'' . $sub_menu_id . '\');"'; } $html .= '>' . $this->label . '</a>'; if (!empty($this->submenus)) { $html .= '<div id="' . $sub_menu_id . '" class="' . $this->submenuclass . '"'; $html .= ' style="position: absolute; visibility: hidden; z-index: 100; text-align: ' . (I18N::direction() === 'ltr' ? 'left' : 'right') . '"'; $html .= ' onmouseover="show_submenu(\'' . $this->parentmenu . '\'); show_submenu(\'' . $sub_menu_id . '\');"'; $html .= ' onmouseout="timeout_submenu(\'' . $sub_menu_id . '\');">'; foreach ($this->submenus as $submenu) { $submenu->parentmenu = $sub_menu_id; $html .= $submenu->getMenu(); } $html .= '</div>'; } return '<div id="' . $menu_id . '" class="' . $this->menuclass . '">' . $html . '</div>'; }
/** * Print a fact for an individual. * * @param Fact $event */ public function printTimeFact(Fact $event) { global $basexoffset, $baseyoffset, $factcount, $placements; $desc = $event->getValue(); // check if this is a family fact $gdate = $event->getDate(); $date = $gdate->minimumDate(); $date = $date->convertToCalendar('gregorian'); $year = $date->y; $month = max(1, $date->m); $day = max(1, $date->d); $xoffset = $basexoffset + 22; $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale; $yoffset = $yoffset + $month / 12 * $this->scale; $yoffset = $yoffset + $day / 30 * ($this->scale / 12); $yoffset = (int) $yoffset; $place = (int) ($yoffset / $this->bheight); $i = 1; $j = 0; $tyoffset = 0; while (isset($placements[$place])) { if ($i === $j) { $tyoffset = $this->bheight * $i; $i++; } else { $tyoffset = -1 * $this->bheight * $j; $j++; } $place = (int) (($yoffset + $tyoffset) / $this->bheight); } $yoffset += $tyoffset; $xoffset += abs($tyoffset); $placements[$place] = $yoffset; echo "<div id=\"fact{$factcount}\" style=\"position:absolute; " . (I18N::direction() === 'ltr' ? 'left: ' . $xoffset : 'right: ' . $xoffset) . 'px; top:' . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">"; echo '<table cellspacing="0" cellpadding="0" border="0" style="cursor: hand;"><tr><td>'; echo '<img src="' . Theme::theme()->parameter('image-hline') . '" name="boxline' . $factcount . '" id="boxline' . $factcount . '" height="3" width="10" style="padding-'; if (I18N::direction() === 'ltr') { echo 'left: 3px;">'; } else { echo 'right: 3px;">'; } $col = array_search($event->getParent(), $this->people); if ($col === false) { // Marriage event - use the color of the husband $col = array_search($event->getParent()->getHusband(), $this->people); } if ($col === false) { // Marriage event - use the color of the wife $col = array_search($event->getParent()->getWife(), $this->people); } $col = $col % 6; echo '</td><td class="person' . $col . '">'; if (count($this->people) > 6) { // We only have six colours, so show naes if more than this number echo $event->getParent()->getFullName() . ' — '; } $record = $event->getParent(); echo $event->getLabel(); echo ' — '; if ($record instanceof Individual) { echo FunctionsPrint::formatFactDate($event, $record, false, false); } elseif ($record instanceof Family) { echo $gdate->display(); if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) { $ageh = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getHusband()->getBirthDate(), $gdate)); } else { $ageh = null; } if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) { $agew = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getWife()->getBirthDate(), $gdate)); } else { $agew = null; } if ($ageh && $agew) { echo '<span class="age"> ', I18N::translate('Husband’s age'), ' ', $ageh, ' ', I18N::translate('Wife’s age'), ' ', $agew, '</span>'; } elseif ($ageh) { echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>'; } elseif ($agew) { echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>'; } } echo ' ' . Filter::escapeHtml($desc); if (!$event->getPlace()->isEmpty()) { echo ' — ' . $event->getPlace()->getShortName(); } // Print spouses names for family events if ($event->getParent() instanceof Family) { echo ' — <a href="', $event->getParent()->getHtmlUrl(), '">', $event->getParent()->getFullName(), '</a>'; } echo '</td></tr></table>'; echo '</div>'; if (I18N::direction() === 'ltr') { $img = 'image-dline2'; $ypos = '0%'; } else { $img = 'image-dline'; $ypos = '100%'; } $dyoffset = $yoffset - $tyoffset + $this->bheight / 3; if ($tyoffset < 0) { $dyoffset = $yoffset + $this->bheight / 3; if (I18N::direction() === 'ltr') { $img = 'image-dline'; $ypos = '100%'; } else { $img = 'image-dline2'; $ypos = '0%'; } } // Print the diagonal line echo '<div id="dbox' . $factcount . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left: ' . ($basexoffset + 25) : 'right: ' . ($basexoffset + 25)) . 'px; top:' . $dyoffset . 'px; font-size: 8pt; height: ' . abs($tyoffset) . 'px; width: ' . abs($tyoffset) . 'px;'; echo ' background-image: url(\'' . Theme::theme()->parameter($img) . '\');'; echo ' background-position: 0% ' . $ypos . ';">'; echo '</div>'; }
/** * Finish current span * * @param string $result * @param bool $theEnd */ public static function finishCurrentSpan(&$result, $theEnd = false) { $textSpan = substr($result, self::$posSpanStart); $result = substr($result, 0, self::$posSpanStart); // Get rid of empty spans, so that our check for presence of RTL will work $result = str_replace(array(self::$startLTR . self::$endLTR, self::$startRTL . self::$endRTL), '', $result); // Look for numeric strings that are times (hh:mm:ss). These have to be separated from surrounding numbers. $tempResult = ''; while ($textSpan != '') { $posColon = strpos($textSpan, ':'); if ($posColon === false) { break; } // No more possible time strings $posLRE = strpos($textSpan, WT_UTF8_LRE); if ($posLRE === false) { break; } // No more numeric strings $posPDF = strpos($textSpan, WT_UTF8_PDF, $posLRE); if ($posPDF === false) { break; } // No more numeric strings $tempResult .= substr($textSpan, 0, $posLRE + 3); // Copy everything preceding the numeric string $numericString = substr($textSpan, $posLRE + 3, $posPDF - $posLRE); // Separate the entire numeric string $textSpan = substr($textSpan, $posPDF + 3); $posColon = strpos($numericString, ':'); if ($posColon === false) { // Nothing that looks like a time here $tempResult .= $numericString; continue; } $posBlank = strpos($numericString . ' ', ' '); $posNbsp = strpos($numericString . ' ', ' '); if ($posBlank < $posNbsp) { $posSeparator = $posBlank; $lengthSeparator = 1; } else { $posSeparator = $posNbsp; $lengthSeparator = 6; } if ($posColon > $posSeparator) { // We have a time string preceded by a blank: Exclude that blank from the numeric string $tempResult .= substr($numericString, 0, $posSeparator); $tempResult .= WT_UTF8_PDF; $tempResult .= substr($numericString, $posSeparator, $lengthSeparator); $tempResult .= WT_UTF8_LRE; $numericString = substr($numericString, $posSeparator + $lengthSeparator); } $posBlank = strpos($numericString, ' '); $posNbsp = strpos($numericString, ' '); if ($posBlank === false && $posNbsp === false) { // The time string isn't followed by a blank $textSpan = $numericString . $textSpan; continue; } // We have a time string followed by a blank: Exclude that blank from the numeric string if ($posBlank === false) { $posSeparator = $posNbsp; $lengthSeparator = 6; } elseif ($posNbsp === false) { $posSeparator = $posBlank; $lengthSeparator = 1; } elseif ($posBlank < $posNbsp) { $posSeparator = $posBlank; $lengthSeparator = 1; } else { $posSeparator = $posNbsp; $lengthSeparator = 6; } $tempResult .= substr($numericString, 0, $posSeparator); $tempResult .= WT_UTF8_PDF; $tempResult .= substr($numericString, $posSeparator, $lengthSeparator); $posSeparator += $lengthSeparator; $numericString = substr($numericString, $posSeparator); $textSpan = WT_UTF8_LRE . $numericString . $textSpan; } $textSpan = $tempResult . $textSpan; $trailingBlanks = ''; $trailingBreaks = ''; /* ****************************** LTR text handling ******************************** */ if (self::$currentState === 'LTR') { // Move trailing numeric strings to the following RTL text. Include any blanks preceding or following the numeric text too. if (I18N::direction() === 'rtl' && self::$previousState === 'RTL' && !$theEnd) { $trailingString = ''; $savedSpan = $textSpan; while ($textSpan !== '') { // Look for trailing spaces and tentatively move them if (substr($textSpan, -1) === ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -6) === ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -3) !== WT_UTF8_PDF) { // There is no trailing numeric string $textSpan = $savedSpan; break; } // We have a numeric string $posStartNumber = strrpos($textSpan, WT_UTF8_LRE); if ($posStartNumber === false) { $posStartNumber = 0; } $trailingString = substr($textSpan, $posStartNumber, strlen($textSpan) - $posStartNumber) . $trailingString; $textSpan = substr($textSpan, 0, $posStartNumber); // Look for more spaces and move them too while ($textSpan != '') { if (substr($textSpan, -1) == ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -6) == ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } break; } self::$waitingText = $trailingString . self::$waitingText; break; } } $savedSpan = $textSpan; // Move any trailing <br>, optionally preceded or followed by blanks, outside this LTR span while ($textSpan != '') { if (substr($textSpan, -1) == ' ') { $trailingBlanks = ' ' . $trailingBlanks; $textSpan = substr($textSpan, 0, -1); continue; } if (substr('......' . $textSpan, -6) == ' ') { $trailingBlanks = ' ' . $trailingBlanks; $textSpan = substr($textSpan, 0, -6); continue; } break; } while (substr($textSpan, -9) == '<LTRbr>') { $trailingBreaks = '<br>' . $trailingBreaks; // Plain <br> because it’s outside a span $textSpan = substr($textSpan, 0, -9); } if ($trailingBreaks != '') { while ($textSpan != '') { if (substr($textSpan, -1) == ' ') { $trailingBreaks = ' ' . $trailingBreaks; $textSpan = substr($textSpan, 0, -1); continue; } if (substr('......' . $textSpan, -6) == ' ') { $trailingBreaks = ' ' . $trailingBreaks; $textSpan = substr($textSpan, 0, -6); continue; } break; } self::$waitingText = $trailingBlanks . self::$waitingText; // Put those trailing blanks inside the following span } else { $textSpan = $savedSpan; } $trailingBlanks = ''; $trailingPunctuation = ''; $trailingID = ''; $trailingSeparator = ''; $leadingSeparator = ''; while (I18N::direction() === 'rtl') { if (strpos($result, self::$startRTL) !== false) { // Remove trailing blanks for inclusion in a separate LTR span while ($textSpan != '') { if (substr($textSpan, -1) === ' ') { $trailingBlanks = ' ' . $trailingBlanks; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -6) === ' ') { $trailingBlanks = ' ' . $trailingBlanks; $textSpan = substr($textSpan, 0, -1); continue; } break; } // Remove trailing punctuation for inclusion in a separate LTR span if ($textSpan == '') { $trailingChar = "\n"; } else { $trailingChar = substr($textSpan, -1); } if (strpos(self::PUNCTUATION, $trailingChar) !== false) { $trailingPunctuation = $trailingChar; $textSpan = substr($textSpan, 0, -1); } } // Remove trailing ID numbers that look like "(xnnn)" for inclusion in a separate LTR span while (true) { if (substr($textSpan, -1) != ')') { break; } // There is no trailing ')' $posLeftParen = strrpos($textSpan, '('); if ($posLeftParen === false) { break; } // There is no leading '(' $temp = self::stripLrmRlm(substr($textSpan, $posLeftParen)); // Get rid of UTF8 control codes // If the parenthesized text doesn't look like an ID number, // we don't want to touch it. // This check won’t work if somebody uses ID numbers with an unusual format. $offset = 1; $charArray = self::getchar($temp, $offset); // Get 1st character of parenthesized text if (strpos(self::NUMBERS, $charArray['letter']) !== false) { break; } $offset += $charArray['length']; // Point at 2nd character of parenthesized text if (strpos(self::NUMBERS, substr($temp, $offset, 1)) === false) { break; } // 1st character of parenthesized text is alpha, 2nd character is a digit; last has to be a digit too if (strpos(self::NUMBERS, substr($temp, -2, 1)) === false) { break; } $trailingID = substr($textSpan, $posLeftParen); $textSpan = substr($textSpan, 0, $posLeftParen); break; } // Look for " - " or blank preceding the ID number and remove it for inclusion in a separate LTR span if ($trailingID != '') { while ($textSpan != '') { if (substr($textSpan, -1) == ' ') { $trailingSeparator = ' ' . $trailingSeparator; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -6) == ' ') { $trailingSeparator = ' ' . $trailingSeparator; $textSpan = substr($textSpan, 0, -6); continue; } if (substr($textSpan, -1) == '-') { $trailingSeparator = '-' . $trailingSeparator; $textSpan = substr($textSpan, 0, -1); continue; } break; } } // Look for " - " preceding the text and remove it for inclusion in a separate LTR span $foundSeparator = false; $savedSpan = $textSpan; while ($textSpan != '') { if (substr($textSpan, 0, 1) == ' ') { $leadingSeparator = ' ' . $leadingSeparator; $textSpan = substr($textSpan, 1); continue; } if (substr($textSpan, 0, 6) == ' ') { $leadingSeparator = ' ' . $leadingSeparator; $textSpan = substr($textSpan, 6); continue; } if (substr($textSpan, 0, 1) == '-') { $leadingSeparator = '-' . $leadingSeparator; $textSpan = substr($textSpan, 1); $foundSeparator = true; continue; } break; } if (!$foundSeparator) { $textSpan = $savedSpan; $leadingSeparator = ''; } break; } // We're done: finish the span $textSpan = self::starredName($textSpan, 'LTR'); // Wrap starred name in <u> and </u> tags while (true) { // Remove blanks that precede <LTRbr> if (strpos($textSpan, ' <LTRbr>') !== false) { $textSpan = str_replace(' <LTRbr>', '<LTRbr>', $textSpan); continue; } if (strpos($textSpan, ' <LTRbr>') !== false) { $textSpan = str_replace(' <LTRbr>', '<LTRbr>', $textSpan); continue; } break; } if ($leadingSeparator != '') { $result = $result . self::$startLTR . $leadingSeparator . self::$endLTR; } $result = $result . $textSpan . self::$endLTR; if ($trailingSeparator != '') { $result = $result . self::$startLTR . $trailingSeparator . self::$endLTR; } if ($trailingID != '') { $result = $result . self::$startLTR . $trailingID . self::$endLTR; } if ($trailingPunctuation != '') { $result = $result . self::$startLTR . $trailingPunctuation . self::$endLTR; } if ($trailingBlanks != '') { $result = $result . self::$startLTR . $trailingBlanks . self::$endLTR; } } /* ****************************** RTL text handling ******************************** */ if (self::$currentState == 'RTL') { $savedSpan = $textSpan; // Move any trailing <br>, optionally followed by blanks, outside this RTL span while ($textSpan != '') { if (substr($textSpan, -1) == ' ') { $trailingBlanks = ' ' . $trailingBlanks; $textSpan = substr($textSpan, 0, -1); continue; } if (substr('......' . $textSpan, -6) == ' ') { $trailingBlanks = ' ' . $trailingBlanks; $textSpan = substr($textSpan, 0, -6); continue; } break; } while (substr($textSpan, -9) == '<RTLbr>') { $trailingBreaks = '<br>' . $trailingBreaks; // Plain <br> because it’s outside a span $textSpan = substr($textSpan, 0, -9); } if ($trailingBreaks != '') { self::$waitingText = $trailingBlanks . self::$waitingText; // Put those trailing blanks inside the following span } else { $textSpan = $savedSpan; } // Move trailing numeric strings to the following LTR text. Include any blanks preceding or following the numeric text too. if (!$theEnd && I18N::direction() !== 'rtl') { $trailingString = ''; $savedSpan = $textSpan; while ($textSpan != '') { // Look for trailing spaces and tentatively move them if (substr($textSpan, -1) === ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -6) === ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -3) !== WT_UTF8_PDF) { // There is no trailing numeric string $textSpan = $savedSpan; break; } // We have a numeric string $posStartNumber = strrpos($textSpan, WT_UTF8_LRE); if ($posStartNumber === false) { $posStartNumber = 0; } $trailingString = substr($textSpan, $posStartNumber, strlen($textSpan) - $posStartNumber) . $trailingString; $textSpan = substr($textSpan, 0, $posStartNumber); // Look for more spaces and move them too while ($textSpan != '') { if (substr($textSpan, -1) == ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -6) == ' ') { $trailingString = ' ' . $trailingString; $textSpan = substr($textSpan, 0, -1); continue; } break; } self::$waitingText = $trailingString . self::$waitingText; break; } } // Trailing " - " needs to be prefixed to the following span if (!$theEnd && substr('...' . $textSpan, -3) == ' - ') { $textSpan = substr($textSpan, 0, -3); self::$waitingText = ' - ' . self::$waitingText; } while (I18N::direction() === 'rtl') { // Look for " - " preceding <RTLbr> and relocate it to the front of the string $posDashString = strpos($textSpan, ' - <RTLbr>'); if ($posDashString === false) { break; } $posStringStart = strrpos(substr($textSpan, 0, $posDashString), '<RTLbr>'); if ($posStringStart === false) { $posStringStart = 0; } else { $posStringStart += 9; } // Point to the first char following the last <RTLbr> $textSpan = substr($textSpan, 0, $posStringStart) . ' - ' . substr($textSpan, $posStringStart, $posDashString - $posStringStart) . substr($textSpan, $posDashString + 3); } // Strip leading spaces from the RTL text $countLeadingSpaces = 0; while ($textSpan != '') { if (substr($textSpan, 0, 1) == ' ') { $countLeadingSpaces++; $textSpan = substr($textSpan, 1); continue; } if (substr($textSpan, 0, 6) == ' ') { $countLeadingSpaces++; $textSpan = substr($textSpan, 6); continue; } break; } // Strip trailing spaces from the RTL text $countTrailingSpaces = 0; while ($textSpan != '') { if (substr($textSpan, -1) == ' ') { $countTrailingSpaces++; $textSpan = substr($textSpan, 0, -1); continue; } if (substr($textSpan, -6) == ' ') { $countTrailingSpaces++; $textSpan = substr($textSpan, 0, -6); continue; } break; } // Look for trailing " -", reverse it, and relocate it to the front of the string if (substr($textSpan, -2) === ' -') { $posDashString = strlen($textSpan) - 2; $posStringStart = strrpos(substr($textSpan, 0, $posDashString), '<RTLbr>'); if ($posStringStart === false) { $posStringStart = 0; } else { $posStringStart += 9; } // Point to the first char following the last <RTLbr> $textSpan = substr($textSpan, 0, $posStringStart) . '- ' . substr($textSpan, $posStringStart, $posDashString - $posStringStart) . substr($textSpan, $posDashString + 2); } if ($countLeadingSpaces != 0) { $newLength = strlen($textSpan) + $countLeadingSpaces; $textSpan = str_pad($textSpan, $newLength, ' ', I18N::direction() === 'rtl' ? STR_PAD_LEFT : STR_PAD_RIGHT); } if ($countTrailingSpaces != 0) { if (I18N::direction() === 'ltr') { if ($trailingBreaks === '') { // Move trailing RTL spaces to front of following LTR span $newLength = strlen(self::$waitingText) + $countTrailingSpaces; self::$waitingText = str_pad(self::$waitingText, $newLength, ' ', STR_PAD_LEFT); } } else { $newLength = strlen($textSpan) + $countTrailingSpaces; $textSpan = str_pad($textSpan, $newLength, ' ', STR_PAD_RIGHT); } } // We're done: finish the span $textSpan = self::starredName($textSpan, 'RTL'); // Wrap starred name in <u> and </u> tags $result = $result . $textSpan . self::$endRTL; } if (self::$currentState != 'LTR' && self::$currentState != 'RTL') { $result = $result . $textSpan; } $result .= $trailingBreaks; // Get rid of any waiting <br> return; }
/** * Convert a date to the preferred format and calendar(s) display. * * @param bool|null $url Wrap the date in a link to calendar.php * @param string|null $date_format Override the default date format * @param bool|null $convert_calendars Convert the date into other calendars * * @return string */ public function display($url = false, $date_format = null, $convert_calendars = true) { global $WT_TREE; $CALENDAR_FORMAT = $WT_TREE->getPreference('CALENDAR_FORMAT'); if ($date_format === null) { $date_format = I18N::dateFormat(); } if ($convert_calendars) { $calendar_format = explode('_and_', $CALENDAR_FORMAT); } else { $calendar_format = array(); } // Two dates with text before, between and after $q1 = $this->qual1; $d1 = $this->date1->format($date_format, $this->qual1); $q2 = $this->qual2; if (is_null($this->date2)) { $d2 = ''; } else { $d2 = $this->date2->format($date_format, $this->qual2); } // Con vert to other calendars, if requested $conv1 = ''; $conv2 = ''; foreach ($calendar_format as $cal_fmt) { if ($cal_fmt != 'none') { $d1conv = $this->date1->convertToCalendar($cal_fmt); if ($d1conv->inValidRange()) { $d1tmp = $d1conv->format($date_format, $this->qual1); } else { $d1tmp = ''; } if (is_null($this->date2)) { $d2conv = null; $d2tmp = ''; } else { $d2conv = $this->date2->convertToCalendar($cal_fmt); if ($d2conv->inValidRange()) { $d2tmp = $d2conv->format($date_format, $this->qual2); } else { $d2tmp = ''; } } // If the date is different from the unconverted date, add it to the date string. if ($d1 != $d1tmp && $d1tmp !== '') { if ($url) { if ($CALENDAR_FORMAT !== 'none') { $conv1 .= ' <span dir="' . I18N::direction() . '">(<a href="' . $d1conv->calendarUrl($date_format) . '" rel="nofollow">' . $d1tmp . '</a>)</span>'; } else { $conv1 .= ' <span dir="' . I18N::direction() . '"><br><a href="' . $d1conv->calendarUrl($date_format) . '" rel="nofollow">' . $d1tmp . '</a></span>'; } } else { $conv1 .= ' <span dir="' . I18N::direction() . '">(' . $d1tmp . ')</span>'; } } if (!is_null($this->date2) && $d2 != $d2tmp && $d1tmp != '') { if ($url) { $conv2 .= ' <span dir="' . I18N::direction() . '">(<a href="' . $d2conv->calendarUrl($date_format) . '" rel="nofollow">' . $d2tmp . '</a>)</span>'; } else { $conv2 .= ' <span dir="' . I18N::direction() . '">(' . $d2tmp . ')</span>'; } } } } // Add URLs, if requested if ($url) { $d1 = '<a href="' . $this->date1->calendarUrl($date_format) . '" rel="nofollow">' . $d1 . '</a>'; if (!is_null($this->date2)) { $d2 = '<a href="' . $this->date2->calendarUrl($date_format) . '" rel="nofollow">' . $d2 . '</a>'; } } // Localise the date switch ($q1 . $q2) { case '': $tmp = $d1 . $conv1; break; case 'ABT': $tmp = I18N::translate('about %s', $d1 . $conv1); break; case 'CAL': $tmp = I18N::translate('calculated %s', $d1 . $conv1); break; case 'EST': $tmp = I18N::translate('estimated %s', $d1 . $conv1); break; case 'INT': $tmp = I18N::translate('interpreted %s (%s)', $d1 . $conv1, $this->text); break; case 'BEF': $tmp = I18N::translate('before %s', $d1 . $conv1); break; case 'AFT': $tmp = I18N::translate('after %s', $d1 . $conv1); break; case 'FROM': $tmp = I18N::translate('from %s', $d1 . $conv1); break; case 'TO': $tmp = I18N::translate('to %s', $d1 . $conv1); break; case 'BETAND': $tmp = I18N::translate('between %s and %s', $d1 . $conv1, $d2 . $conv2); break; case 'FROMTO': $tmp = I18N::translate('from %s to %s', $d1 . $conv1, $d2 . $conv2); break; default: $tmp = I18N::translate('Invalid date'); break; // e.g. BET without AND } if ($this->text && !$q1) { $tmp = I18N::translate('%1$s (%2$s)', $tmp, $this->text); } if (strip_tags($tmp) === '') { return ''; } else { return '<span class="date">' . $tmp . '</span>'; } }
/** * Create a pedigree controller */ public function __construct() { global $WT_TREE; parent::__construct(); $this->orientation = Filter::getInteger('orientation', 0, 3, $WT_TREE->getPreference('PEDIGREE_LAYOUT')); $this->generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); $bxspacing = Theme::theme()->parameter('chart-spacing-x'); $byspacing = Theme::theme()->parameter('chart-spacing-y'); $curgen = 1; // -- track which generation the algorithm is currently working on $addoffset = array(); // With more than 8 generations, we run out of pixels on the <canvas> if ($this->generations > 8) { $this->generations = 8; } if ($this->root && $this->root->canShowName()) { $this->setPageTitle(I18N::translate('Pedigree tree of %s', $this->root->getFullName())); } else { $this->setPageTitle(I18N::translate('Pedigree')); } $this->treesize = pow(2, $this->generations) - 1; // sosaAncestors() starts array at index 1 we need to start at 0 $this->nodes = array_map(function ($item) { return array('indi' => $item, 'x' => 0, 'y' => 0); }, array_values($this->sosaAncestors($this->generations))); //check earliest generation for any ancestors for ($i = (int) ceil($this->treesize / 2); $i < $this->treesize; $i++) { $this->chartHasAncestors = $this->chartHasAncestors || $this->nodes[$i]['indi'] && $this->nodes[$i]['indi']->getChildFamilies(); } $this->arrows = new \stdClass(); switch ($this->orientation) { case self::PORTRAIT: //drop through //drop through case self::LANDSCAPE: $this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow'; $this->arrows->menu = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow'; $addoffset['x'] = $this->chartHasAncestors ? self::ARROW_SIZE : 0; $addoffset['y'] = 0; break; case self::OLDEST_AT_TOP: $this->arrows->prevGen = 'icon-uarrow'; $this->arrows->menu = 'icon-darrow'; $addoffset['x'] = 0; $addoffset['y'] = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0; break; case self::OLDEST_AT_BOTTOM: $this->arrows->prevGen = 'icon-darrow'; $this->arrows->menu = 'icon-uarrow'; $addoffset['x'] = 0; $addoffset['y'] = $this->chartHasAncestors ? self::ARROW_SIZE : 0; break; } // -- this next section will create and position the DIV layers for the pedigree tree // -- loop through all of IDs in the array from last to first // -- calculating 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, $curgen))) { $curgen++; } // -- box position in current generation $boxpos = $i - pow(2, $this->generations - $curgen); // -- offset multiple for current generation if ($this->orientation < self::OLDEST_AT_TOP) { $genoffset = pow(2, $curgen - $this->orientation); $boxspacing = $this->getBoxDimensions()->height + $byspacing; } else { $genoffset = pow(2, $curgen - 1); $boxspacing = $this->getBoxDimensions()->width + $byspacing; } // -- calculate the yoffset position in the generation put child between parents $yoffset = $boxpos * ($boxspacing * $genoffset) + $boxspacing / 2 * $genoffset + $boxspacing * $genoffset; // -- calculate the xoffset switch ($this->orientation) { case self::PORTRAIT: $xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8); if (!$i && $this->root->getSpouseFamilies()) { $xoffset -= self::ARROW_SIZE; } // -- compact the tree if ($curgen < $this->generations) { if ($i % 2 == 0) { $yoffset = $yoffset - $boxspacing / 2 * ($curgen - 1); } else { $yoffset = $yoffset + $boxspacing / 2 * ($curgen - 1); } $parent = (int) (($i - 1) / 2); $pgen = $curgen; while ($parent > 0) { if ($parent % 2 == 0) { $yoffset = $yoffset - $boxspacing / 2 * $pgen; } else { $yoffset = $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) { $yoffset = $yoffset - $boxspacing / 2 * $temp; } else { $yoffset = $yoffset + $boxspacing / 2 * $temp; } } $parent = (int) (($parent - 1) / 2); } if ($curgen > 3) { $temp = 0; for ($j = 1; $j < $curgen - 2; $j++) { $temp += pow(2, $j) - 1; } if ($i % 2 == 0) { $yoffset = $yoffset - $boxspacing / 2 * $temp; } else { $yoffset = $yoffset + $boxspacing / 2 * $temp; } } } $yoffset -= $boxspacing / 2 * pow(2, $this->generations - 2) - $boxspacing / 2; break; case self::LANDSCAPE: $xoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->width + $bxspacing); if ($curgen == 1) { $xoffset += 10; } break; case self::OLDEST_AT_TOP: //swap x & y offsets as chart is rotated $xoffset = $yoffset; $yoffset = $curgen * ($this->getBoxDimensions()->height + $byspacing * 4); break; case self::OLDEST_AT_BOTTOM: //swap x & y offsets as chart is rotated $xoffset = $yoffset; $yoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->height + $byspacing * 2); if ($i && $this->root->getSpouseFamilies()) { $yoffset += self::ARROW_SIZE; } break; } $this->nodes[$i]["x"] = (int) $xoffset; $this->nodes[$i]["y"] = (int) $yoffset; } // find the minimum x & y offsets and deduct that number from // each value in the array so that offsets start from zero $min_xoffset = min(array_map(function ($item) { return $item['x']; }, $this->nodes)); $min_yoffset = min(array_map(function ($item) { return $item['y']; }, $this->nodes)); array_walk($this->nodes, function (&$item) use($min_xoffset, $min_yoffset) { $item['x'] -= $min_xoffset; $item['y'] -= $min_yoffset; }); // calculate chart & canvas dimensions $max_xoffset = max(array_map(function ($item) { return $item['x']; }, $this->nodes)); $max_yoffset = max(array_map(function ($item) { return $item['y']; }, $this->nodes)); $this->chartsize['x'] = $max_xoffset + $bxspacing + $this->getBoxDimensions()->width + $addoffset['x']; $this->chartsize['y'] = $max_yoffset + $byspacing + $this->getBoxDimensions()->height + $addoffset['y']; }
$factcount = 0; foreach ($controller->indifacts as $fact) { $controller->printTimeFact($fact); $factcount++; } // print the age boxes foreach ($controller->people as $p => $indi) { $pid = $indi->getXref(); $ageyoffset = $baseyoffset + $controller->bheight * $p; $col = $p % 6; ?> <div id="agebox<?php echo $p; ?> " style="cursor:move; position:absolute; <?php echo I18N::direction() === 'ltr' ? 'left: ' . ($basexoffset + 20) : 'right: ' . ($basexoffset + 20); ?> px; top:<?php echo $ageyoffset; ?> px; height:<?php echo $controller->bheight; ?> px; display:none;" onmousedown="ageCursorMouseDown(this, <?php echo $p; ?> );"> <table cellspacing="0" cellpadding="0"> <tr> <td> <img src="<?php
/** * Initial Setup - ReportBase * * Setting up document wide defaults that will be inherited of the report modules * As DEFAULT A4 and Portrait will be used if not set */ public function setup() { // Set RTL direction if (I18N::direction() === 'rtl') { $this->rtl = true; } // Set the Keywords $this->rkeywords = ''; // Generated By...text // I18N: This is a report footer. %s is the name of the application. $this->generatedby = I18N::translate('Generated by %s', WT_WEBTREES . ' ' . WT_VERSION); // For known size pages if ($this->pagew == 0 && $this->pageh == 0) { /** * The current ISO 216 standard was introduced in 1975 and is a direct follow up to the german DIN 476 standard from 1922. ISO 216 is also called EN 20216 in Europe. * The ISO paper sizes are based on the metric system so everything else is aproxiamte * * The Series A is used for Standard Printing and Stationary. * The Series B is used for Posters, Wall-Charts etc. * The C series is used for folders, post cards and envelopes. C series envelope is suitable to insert A series sizes. * ISO also define format series RA and SRA for untrimmed raw paper, where SRA stands for 'supplementary raw format A'. * Japan has adopted the ISO series A sizes, but its series B sizes are slightly different. These sizes are sometimes called JIS B or JB sizes. * sun was a unit of length used in Japan and is equal to about 3.03 cm or 1.193 inches * The United States, Canada, and in part Mexico, are today the only industrialized nations in which the ISO standard paper sizes are not yet widely used. * * A0 & A1 Technical drawings, posters * A1 & A2 Flip charts * A2 & A3 Drawings, diagrams, large tables * A4 Letters, magazines, forms, catalogs, laser printer and copying machine output * A5 Note pads * A6 Postcards * B5, A5, B6 A6 Books * C4, C5, C6 Envelopes for A4 letters: unfolded (C4), folded once (C5), folded twice (C6) * B4 & A3 Newspapers, supported by most copying machines in addition to A4 * B8 & A8 Playing cards * * 1 inch = 72 points * 1 mm = 2.8346457 points * 1 inch = 25.4 mm * 1 point = 0,35278 mm */ switch ($this->pageFormat) { // ISO A series case '4A0': // ISO 216, 1682 mm x 2378 mm $sizes = array(4767.86, 6740.79); break; case '2A0': // ISO 216, 1189 mm x 1682 mm $sizes = array(3370.39, 4767.86); break; case 'A0': // ISO 216, 841 mm x 1189mm $sizes = array(2383.94, 3370.39); break; case 'A1': // ISO 216, 594 mm x 841 mm $sizes = array(1683.78, 2383.94); break; case 'A2': // ISO 216, 420 mm x 594 mm $sizes = array(1190.55, 1683.78); break; case 'A3': // ISO 216, 297 mm x 420 mm $sizes = array(841.89, 1190.55); break; case 'A4': // ISO 216, 210 mm 297 mm $sizes = array(595.28, 841.89); break; case 'A5': // ISO 216, 148 mm x 210 mm $sizes = array(419.53, 595.28); break; case 'A6': // ISO 216, 105 mm x 148 mm $sizes = array(297.64, 419.53); break; case 'A7': // ISO 216, 74 mm x 105 mm $sizes = array(209.76, 297.64); break; case 'A8': // ISO 216, 52 mm x 74 mm $sizes = array(147.4, 209.76); break; case 'A9': // ISO 216, 37 mm x 52 mm $sizes = array(104.88, 147.4); break; case 'A10': // ISO 216, 26 mm x 37 mm $sizes = array(73.7, 104.88); break; // ISO B series // ISO B series case 'B0': // ISO 216, 1000 mm x 1414 mm $sizes = array(2834.65, 4008.19); break; case 'B1': // ISO 216, 707 mm x 1000 mm $sizes = array(2004.09, 2834.65); break; case 'B2': // ISO 216, 500 mm x 707 mm $sizes = array(1417.32, 2004.09); break; case 'B3': // ISO 216, 353 mm x 500 mm $sizes = array(1000.63, 1417.32); break; case 'B4': // ISO 216, 250 mm x 353 mm $sizes = array(708.66, 1000.63); break; case 'B5': // ISO 216, 176 mm x 250 mm $sizes = array(498.9, 708.66); break; case 'B6': // ISO 216, 125 mm x 176 mm $sizes = array(354.33, 498.9); break; case 'B7': // ISO 216, 88 mm x 125 mm $sizes = array(249.45, 354.33); break; case 'B8': // ISO 216, 62 mm x 88 mm $sizes = array(175.75, 249.45); break; case 'B9': // ISO 216, 44 mm x 62 mm $sizes = array(124.72, 175.75); break; case 'B10': // ISO 216, 31 mm x 44 mm $sizes = array(87.87, 124.72); break; // ISO C series, Envelope // ISO C series, Envelope case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet $sizes = array(2599.37, 3676.54); break; case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet $sizes = array(1836.85, 2599.37); break; case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half $sizes = array(1298.27, 1836.85); break; case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half $sizes = array(918.4299999999999, 1298.27); break; case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half $sizes = array(649.13, 918.4299999999999); break; case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half $sizes = array(459.21, 649.13); break; case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope $sizes = array(323.15, 649.13); break; case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half $sizes = array(323.15, 459.21); break; case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds $sizes = array(229.61, 459.21); break; case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters $sizes = array(229.61, 323.15); break; case 'C8': // ISO 269, 57 mm x 81 mm $sizes = array(161.57, 229.61); break; case 'C9': // ISO 269, 40 mm x 57 mm $sizes = array(113.39, 161.57); break; case 'C10': // ISO 269, 28 mm x 40 mm $sizes = array(79.37, 113.39); break; case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half $sizes = array(311.81, 623.62); break; // Untrimmed stock sizes for the ISO-A Series - ISO primary range // Untrimmed stock sizes for the ISO-A Series - ISO primary range case 'RA0': // ISO 478, 860 mm x 1220 mm $sizes = array(2437.8, 3458.27); break; case 'RA1': // ISO 478, 610 mm x 860 mm $sizes = array(1729.13, 2437.8); break; case 'RA2': // ISO 478, 430 mm x 610 mm $sizes = array(1218.9, 1729.13); break; case 'RA3': // ISO 478, 305 mm x 430 mm $sizes = array(864.5700000000001, 1218.9); break; case 'RA4': // ISO 478, 215 mm x 305 mm $sizes = array(609.45, 864.5700000000001); break; // Untrimmed stock sizes for the ISO-A Series - ISO supplementary range // Untrimmed stock sizes for the ISO-A Series - ISO supplementary range case 'SRA0': // ISO 593, 900 mm x 1280 mm $sizes = array(2551.18, 3628.35); break; case 'SRA1': // ISO 593, 640 mm x 900 mm $sizes = array(1814.17, 2551.18); break; case 'SRA2': // ISO 593, 450 mm x 640 mm $sizes = array(1275.59, 1814.17); break; case 'SRA3': // ISO 593, 320 mm x 450 mm $sizes = array(907.09, 1275.59); break; case 'SRA4': // ISO 593, 225 mm x 320 mm $sizes = array(637.8, 907.09); break; // ISO size variations // ISO size variations case 'A2EXTRA': // ISO 216, 445 mm x 619 mm $sizes = array(1261.42, 1754.65); break; case 'A2SUPER': // ISO 216, 305 mm x 508 mm $sizes = array(864.5700000000001, 1440.0); break; case 'A3EXTRA': // ISO 216, 322 mm x 445 mm $sizes = array(912.76, 1261.42); break; case 'SUPERA3': // ISO 216, 305 mm x 487 mm $sizes = array(864.5700000000001, 1380.47); break; case 'A4EXTRA': // ISO 216, 235 mm x 322 mm $sizes = array(666.14, 912.76); break; case 'A4LONG': // ISO 216, 210 mm x 348 mm $sizes = array(595.28, 986.46); break; case 'A4SUPER': // ISO 216, 229 mm x 322 mm $sizes = array(649.13, 912.76); break; case 'SUPERA4': // ISO 216, 227 mm x 356 mm $sizes = array(643.46, 1009.13); break; case 'A5EXTRA': // ISO 216, 173 mm x 235 mm $sizes = array(490.39, 666.14); break; case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm $sizes = array(572.6, 782.36); break; // Japanese version of the ISO 216 B series // Japanese version of the ISO 216 B series case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm $sizes = array(2919.69, 4127.24); break; case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm $sizes = array(2063.62, 2919.69); break; case 'JB2': // JIS P 0138-61, 515 mm x 728 mm $sizes = array(1459.84, 2063.62); break; case 'JB3': // JIS P 0138-61, 364 mm x 515 mm $sizes = array(1031.81, 1459.84); break; case 'JB4': // JIS P 0138-61, 257 mm x 364 mm $sizes = array(728.5, 1031.81); break; case 'JB5': // JIS P 0138-61, 182 mm x 257 mm $sizes = array(515.91, 728.5); break; case 'JB6': // JIS P 0138-61, 128 mm x 182 mm $sizes = array(362.83, 515.91); break; case 'JB7': // JIS P 0138-61, 91 mm x 128 mm $sizes = array(257.95, 362.83); break; case 'JB8': // JIS P 0138-61, 64 mm x 91 mm $sizes = array(181.42, 257.95); break; case 'JB9': // JIS P 0138-61, 45 mm x 64 mm $sizes = array(127.56, 181.42); break; case 'JB10': // JIS P 0138-61, 32 mm x 45 mm $sizes = array(90.70999999999999, 127.56); break; // US pages // US pages case 'EXECUTIVE': // 7.25 in x 10.5 in $sizes = array(522.0, 756.0); break; case 'FOLIO': // 8.5 in x 13 in $sizes = array(612.0, 936.0); break; case 'FOOLSCAP': // 13.5 in x 17 in $sizes = array(972.0, 1224.0); break; case 'LEDGER': // 11 in x 17 in $sizes = array(792.0, 1224.0); break; case 'LEGAL': // 8.5 in x 14 in $sizes = array(612.0, 1008.0); break; case 'LETTER': // 8.5 in x 11 in $sizes = array(612.0, 792.0); break; case 'QUARTO': // 8.46 in x 10.8 in $sizes = array(609.12, 777.5); break; case 'STATEMENT': // 5.5 in x 8.5 in $sizes = array(396.0, 612.0); break; case 'USGOVT': // 8 in x 11 in $sizes = array(576.0, 792.0); break; default: $this->pageFormat = 'A4'; $sizes = array(595.28, 841.89); break; } $this->pagew = $sizes[0]; $this->pageh = $sizes[1]; } else { if ($this->pagew < 10) { throw new \DomainException('REPORT ERROR ReportBase::setup(): For custom size pages you must set "customwidth" larger then this in the XML file'); } if ($this->pageh < 10) { throw new \DomainException('REPORT ERROR ReportBase::setup(): For custom size pages you must set "customheight" larger then this in the XML file'); } } return 0; }
/** * print the information for an individual chart box * * Find and print a given individuals information for a pedigree chart * * @param string $pid The Gedcom Xref ID of the individual to print * @param string $currpid * @param string $censyear */ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent; global $natdad, $natmom, $censyear, $WT_TREE; $person = Individual::getInstance($pid, $WT_TREE); $tmp = array('M' => '', 'F' => 'F', 'U' => 'NN'); $isF = $tmp[$person->getSex()]; $spouselinks = ''; $parentlinks = ''; $step_parentlinks = ''; if ($person->canShowName()) { //-- draw a box for the family popup if (I18N::direction() === 'rtl') { $spouselinks .= "<table class=\"rtlnav person_box{$isF}\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; $spouselinks .= "<b>" . I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>"; $parentlinks .= "<table class=\"rtlnav person_box{$isF}\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; $parentlinks .= "<b>" . I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; $step_parentlinks .= "<table class=\"rtlnav person_box{$isF}\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; $step_parentlinks .= "<b>" . I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; } else { $spouselinks .= "<table class=\"ltrnav person_box{$isF}\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; $spouselinks .= "<b>" . I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>"; $parentlinks .= "<table class=\"ltrnav person_box{$isF}\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; $parentlinks .= "<b>" . I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; $step_parentlinks .= "<table class=\"ltrnav person_box{$isF}\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">"; $step_parentlinks .= "<b>" . I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>"; } $persons = ''; $person_parent = ''; $person_step = ''; // Parent families foreach ($person->getChildFamilies() as $family) { $husb = $family->getHusband(); $wife = $family->getWife(); $children = $family->getChildren(); // Get Parent Children’s Name, DOB, DOD $marrdate = $family->getMarriageDate(); if ($children) { $chBLDarray = array(); foreach ($children as $child) { $chnam = $child->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); $chdob = $child->getBirthDate()->julianDay(); $chdod = $child->getDeathDate()->julianDay(); $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } } // Parent Husband if ($husb || $children) { if ($husb) { // Parent Husbands Parents foreach ($husb->getChildFamilies() as $pfamily) { $phusb = $pfamily->getHusband(); $pwife = $pfamily->getWife(); if ($phusb) { $pHusbFBP = $phusb->getBirthPlace(); } if ($pwife) { $pHusbMBP = $pwife->getBirthPlace(); } } // Parent Husbands Details $person_parent = 'Yes'; $nam = $husb->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"return insertRowToTable("; $parentlinks .= "'" . $husb->getXref() . "',"; // pid = PID $parentlinks .= "'" . $fulln . "',"; $parentlinks .= "'" . $fulmn . "',"; if ($currpid === 'Wife' || $currpid === 'Husband') { $parentlinks .= "'Father in Law',"; // label = 1st Gen Male Relationship } else { $parentlinks .= "'Grand-Father',"; // label = 2st Gen Male Relationship } $parentlinks .= "'" . $husb->getSex() . "',"; $parentlinks .= "'',"; $parentlinks .= "'" . $marrdate->julianDay() . "',"; $parentlinks .= "'" . $husb->getBirthDate()->julianDay() . "',"; if ($husb->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } $parentlinks .= "'" . $husb->getDeathDate()->julianDay() . "',"; $parentlinks .= "'',"; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pHusbFBP)) { $parentlinks .= "'" . Filter::escapeHtml($pHusbFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace } if (isset($pHusbMBP)) { $parentlinks .= "'" . Filter::escapeHtml($pHusbMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace } if (isset($chBLDarray) && $husb->getSex() === 'F') { $chBLDarray = implode("::", $chBLDarray); $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } $parentlinks .= ");\">"; $parentlinks .= $husb->getFullName(); $parentlinks .= "</a>"; $natdad = 'yes'; } } // Parent Wife if ($wife || $children) { if ($wife) { // Parent Wifes Parents foreach ($wife->getChildFamilies() as $pfamily) { $pwhusb = $pfamily->getHusband(); $pwwife = $pfamily->getWife(); if ($pwhusb) { $pWifeFBP = $pwhusb->getBirthPlace(); } if ($pwwife) { $pWifeMBP = $pwwife->getBirthPlace(); } } // Parent Wifes Details $person_parent = 'Yes'; $nam = $wife->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"return insertRowToTable("; $parentlinks .= "'" . $wife->getXref() . "',"; // pid = PID $parentlinks .= "'" . $fulln . "',"; $parentlinks .= "'" . $fulmn . "',"; if ($currpid === 'Wife' || $currpid === 'Husband') { $parentlinks .= "'Mother in Law',"; // label = 1st Gen Female Relationship } else { $parentlinks .= "'Grand-Mother',"; // label = 2st Gen Female Relationship } $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { $parentlinks .= "'" . ($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2 . "',"; // dom = Date of Marriage (Julian) } $parentlinks .= "'" . ($wife->getBirthDate()->minimumJulianDay() + $wife->getBirthDate()->maximumJulianDay()) / 2 . "',"; // dob = Date of Birth if ($wife->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } $parentlinks .= "'" . ($wife->getDeathDate()->minimumJulianDay() + $wife->getDeathDate()->maximumJulianDay()) / 2 . "',"; // dod = Date of Death $parentlinks .= "''" . ","; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pWifeFBP)) { $parentlinks .= "'" . Filter::escapeHtml($pWifeFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($pWifeMBP)) { $parentlinks .= "'" . Filter::escapeHtml($pWifeMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } if (isset($chBLDarray) && $wife->getSex() === 'F') { $chBLDarray = implode("::", $chBLDarray); $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } $parentlinks .= ");\">"; $parentlinks .= $wife->getFullName(); $parentlinks .= "</a>"; $natmom = 'yes'; } } } // Step families foreach ($person->getChildStepFamilies() as $family) { $husb = $family->getHusband(); $wife = $family->getWife(); $children = $family->getChildren(); $marrdate = $family->getMarriageDate(); // Get StepParent’s Children’s Name, DOB, DOD if (isset($children)) { $chBLDarray = array(); foreach ($children as $child) { $chnam = $child->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); $chdob = $child->getBirthDate()->julianDay(); $chdod = $child->getDeathDate()->julianDay(); $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } } // Step Husband if ($natdad === 'yes') { } else { if (($husb || $children) && $husb !== $person) { if ($husb) { // Step Husbands Parents foreach ($husb->getChildFamilies() as $pfamily) { $phusb = $pfamily->getHusband(); $pwife = $pfamily->getWife(); if ($phusb) { $pHusbFBP = $phusb->getBirthPlace(); } if ($pwife) { $pHusbMBP = $pwife->getBirthPlace(); } } //-- Step Husband Details ------------------------------ $person_step = 'Yes'; $nam = $husb->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"return insertRowToTable("; $parentlinks .= "'" . $husb->getXref() . "',"; // pid = PID $parentlinks .= "'" . Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name $parentlinks .= "'" . Filter::escapeHtml(strip_tags($fulmn)) . "',"; // nam = Name if ($currpid === 'Wife' || $currpid === 'Husband') { $parentlinks .= "'Step Father-in-Law',"; // label = 1st Gen Male Relationship } else { $parentlinks .= "'Step Grand-Father',"; // label = 2st Gen Male Relationship } $parentlinks .= "'" . $husb->getSex() . "',"; // sex = Gender $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { $parentlinks .= "'" . ($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2 . "',"; // dom = Date of Marriage (Julian) } $parentlinks .= "'" . ($husb->getBirthDate()->minimumJulianDay() + $husb->getBirthDate()->maximumJulianDay()) / 2 . "',"; // dob = Date of Birth if ($husb->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } $parentlinks .= "'" . ($husb->getDeathDate()->minimumJulianDay() + $husb->getDeathDate()->maximumJulianDay()) / 2 . "',"; // dod = Date of Death $parentlinks .= "''" . ","; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pHusbFBP)) { $parentlinks .= "'" . Filter::escapeHtml($pHusbFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace } if (isset($pHusbMBP)) { $parentlinks .= "'" . Filter::escapeHtml($pHusbMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace } if (isset($chBLDarray) && $husb->getSex() === 'F') { $chBLDarray = implode("::", $chBLDarray); $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } $parentlinks .= ");\">"; $parentlinks .= $husb->getFullName(); // Full Name (Link) $parentlinks .= "</a>"; } } } // Step Wife if ($natmom === 'yes') { } else { // Wife if ($wife || $children) { if ($wife) { // Step Wifes Parents foreach ($wife->getChildFamilies() as $pfamily) { $pwhusb = $pfamily->getHusband(); $pwwife = $pfamily->getWife(); if ($pwhusb) { $pWifeFBP = $pwhusb->getBirthPlace(); } if ($pwwife) { $pWifeMBP = $pwwife->getBirthPlace(); } } // Step Wife Details $person_step = 'Yes'; $nam = $wife->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"return insertRowToTable("; $parentlinks .= "'" . $wife->getXref() . "',"; // pid = PID $parentlinks .= "'" . $fulln . "',"; // nam = Name $parentlinks .= "'" . $fulmn . "',"; // nam = Name if ($currpid === 'Wife' || $currpid === 'Husband') { $parentlinks .= "'Step Mother-in-Law',"; // label = 1st Gen Female Relationship } else { $parentlinks .= "'Step Grand-Mother',"; // label = 2st Gen Female Relationship } $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { $parentlinks .= "'" . ($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2 . "',"; // dom = Date of Marriage (Julian) } $parentlinks .= "'" . ($wife->getBirthDate()->minimumJulianDay() + $wife->getBirthDate()->maximumJulianDay()) / 2 . "',"; // dob = Date of Birth if ($wife->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } $parentlinks .= "'" . ($wife->getDeathDate()->minimumJulianDay() + $wife->getDeathDate()->maximumJulianDay()) / 2 . "',"; // dod = Date of Death $parentlinks .= "''" . ","; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pWifeFBP)) { $parentlinks .= "'" . Filter::escapeHtml($pWifeFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($pWifeMBP)) { $parentlinks .= "'" . Filter::escapeHtml($pWifeMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } if (isset($chBLDarray) && $wife->getSex() === 'F') { $chBLDarray = implode("::", $chBLDarray); $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $parentlinks .= "''"; } $parentlinks .= ");\">"; $parentlinks .= $wife->getFullName(); // Full Name (Link) $parentlinks .= "</a>"; } } } } // Spouse Families foreach ($person->getSpouseFamilies() as $family) { $spouse = $family->getSpouse($person); $children = $family->getChildren(); //-- Get Spouse’s Children’s Name, DOB, DOD -------------------------- $marrdate = $family->getMarriageDate(); if (isset($children)) { $chBLDarray = array(); foreach ($children as $child) { $chnam = $child->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); // Child’s Full Name $chdob = $child->getBirthDate()->julianDay(); // Child’s Date of Birth (Julian) $chdod = $child->getDeathDate()->julianDay(); // Child’s Date of Death (Julian) $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } } // Spouse if ($spouse || $children) { if ($spouse) { // Spouse Parents foreach ($spouse->getChildFamilies() as $pfamily) { $phusb = $pfamily->getHusband(); $pwife = $pfamily->getWife(); if ($phusb) { $pSpouseFBP = $phusb->getBirthPlace(); } if ($pwife) { $pSpouseMBP = $pwife->getBirthPlace(); } } // Spouse Details $nam = $spouse->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $spouselinks .= "<a href=\"#\" onclick=\"return insertRowToTable("; $spouselinks .= "'" . $spouse->getXref() . "',"; // pid = PID $spouselinks .= "'" . $fulln . "',"; $spouselinks .= "'" . $fulmn . "',"; if ($currpid === 'Son' || $currpid === 'Daughter') { if ($spouse->getSex() === 'M') { $spouselinks .= "'Son in Law',"; // label = Male Relationship } else { $spouselinks .= "'Daughter in Law',"; // label = Female Relationship } } else { if ($spouse->getSex() === 'M') { $spouselinks .= "'Brother in Law',"; // label = Male Relationship } else { $spouselinks .= "'Sister in Law',"; // label = Female Relationship } } $spouselinks .= "'" . $spouse->getSex() . "',"; // sex = Gender $spouselinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { $spouselinks .= "'" . ($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2 . "',"; } $spouselinks .= "'" . ($spouse->getBirthDate()->minimumJulianDay() + $spouse->getBirthDate()->maximumJulianDay()) / 2 . "',"; if ($spouse->getbirthyear() >= 1) { $spouselinks .= "'" . ($censyear - $spouse->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $spouselinks .= "''" . ","; // age = Undefined } $spouselinks .= "'" . ($spouse->getDeathDate()->minimumJulianDay() + $spouse->getDeathDate()->maximumJulianDay()) / 2 . "',"; // dod = Date of Death $spouselinks .= "''" . ","; // occu = Occupation $spouselinks .= "'" . Filter::escapeHtml($spouse->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pSpouseFBP)) { $spouselinks .= "'" . Filter::escapeHtml($pSpouseFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($pSpouseMBP)) { $spouselinks .= "'" . Filter::escapeHtml($pSpouseMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } if (isset($chBLDarray) && $spouse->getSex() === 'F') { $chBLDarray = implode("::", $chBLDarray); $spouselinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $spouselinks .= "''"; } $spouselinks .= ");\">"; $spouselinks .= $spouse->getFullName(); // Full Name $spouselinks .= "</a>"; if ($spouse->getFullName() != "") { $persons = 'Yes'; } } } // Children $spouselinks .= '<ul class="clist">'; foreach ($children as $child) { $persons = 'Yes'; // Child’s Parents foreach ($child->getChildFamilies() as $family) { $husb = $family->getHusband(); $wife = $family->getWife(); if ($husb) { $ChildFBP = $husb->getBirthPlace(); } if ($wife) { $ChildMBP = $wife->getBirthPlace(); } } // Child’s Children $chBLDarray = array(); foreach ($child->getSpouseFamilies() as $childfamily) { $chchildren = $childfamily->getChildren(); foreach ($chchildren as $chchild) { $chnam = $chchild->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); // Child’s Full Name $chdob = $chchild->getBirthDate()->julianDay(); // Child’s Date of Birth (Julian) $chdod = $chchild->getDeathDate()->julianDay(); // Child’s Date of Death (Julian) $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } } // Child’s marriage status $marrdate = ''; $chhusbnam = null; foreach ($child->getSpouseFamilies() as $childfamily) { $marrdate = $childfamily->getMarriageDate(); } // Childs Details ------------------------- $spouselinks .= '<li>'; $nam = $child->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $spouselinks .= "<a href=\"#\" onclick=\"return insertRowToTable("; $spouselinks .= "'" . $child->getXref() . "',"; $spouselinks .= "'" . $fulln . "',"; $spouselinks .= "'" . $fulmn . "',"; if ($currpid === 'Son' || $currpid === 'Daughter') { if ($child->getSex() === 'M') { $spouselinks .= "'Grand-Son',"; // label = Male Relationship } else { $spouselinks .= "'Grand-Daughter',"; // label = Female Relationship } } else { if ($child->getSex() === 'M') { $spouselinks .= "'Nephew',"; // label = Male Relationship } else { $spouselinks .= "'Niece',"; // label = Female Relationship } } $spouselinks .= "'" . $child->getSex() . "',"; // sex = Gender $spouselinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { $spouselinks .= "'" . ($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2 . "',"; // dom = Date of Marriage (Julian) } else { $spouselinks .= "'nm'" . ","; } $spouselinks .= "'" . ($child->getBirthDate()->minimumJulianDay() + $child->getBirthDate()->maximumJulianDay()) / 2 . "',"; // dob = Date of Birth if ($child->getbirthyear() >= 1) { $spouselinks .= "'" . ($censyear - $child->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $spouselinks .= "''" . ","; // age = Undefined } $spouselinks .= "'" . ($child->getDeathDate()->minimumJulianDay() + $child->getDeathDate()->maximumJulianDay()) / 2 . "',"; // dod = Date of Death $spouselinks .= "''" . ","; // occu = Occupation $spouselinks .= "'" . Filter::escapeHtml($child->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($ChildFBP)) { $spouselinks .= "'" . Filter::escapeHtml($ChildFBP) . "'" . ","; // fbirthpl = Fathers Birthplace } else { $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known } if (isset($ChildMBP)) { $spouselinks .= "'" . Filter::escapeHtml($ChildMBP) . "'" . ","; // mbirthpl = Mothers Birthplace } else { $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known } if (isset($chBLDarray) && $child->getSex() === 'F') { $chBLDarray = implode("::", $chBLDarray); $spouselinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate) } else { $spouselinks .= "''"; } $spouselinks .= ");\">"; $spouselinks .= $child->getFullName(); $spouselinks .= "</a>"; $spouselinks .= "</li>"; } $spouselinks .= '</ul>'; } if ($persons !== 'Yes') { $spouselinks .= '(' . I18N::translate('none') . ')</td></tr></table>'; } else { $spouselinks .= '</td></tr></table>'; } if ($person_parent !== 'Yes') { $parentlinks .= '(' . I18N::translateContext('unknown family', 'unknown') . ')</td></tr></table>'; } else { $parentlinks .= '</td></tr></table>'; } if ($person_step !== 'Yes') { $step_parentlinks .= '(' . I18N::translateContext('unknown family', 'unknown') . ')</td></tr></table>'; } else { $step_parentlinks .= '</td></tr></table>'; } } }
/** * Print the page header, using the theme * * @param bool $popup Is this a popup window * * @return $this */ public function pageHeader($popup = false) { global $WT_TREE; $this->popup = $popup; // Give Javascript access to some PHP constants $this->addInlineJavascript(' var WT_STATIC_URL = "' . Filter::escapeJs(WT_STATIC_URL) . '"; var WT_MODULES_DIR = "' . Filter::escapeJs(WT_MODULES_DIR) . '"; var WT_GEDCOM = "' . Filter::escapeJs($WT_TREE ? $WT_TREE->getName() : '') . '"; var textDirection = "' . Filter::escapeJs(I18N::direction()) . '"; var WT_SCRIPT_NAME = "' . Filter::escapeJs(WT_SCRIPT_NAME) . '"; var WT_LOCALE = "' . Filter::escapeJs(WT_LOCALE) . '"; var WT_CSRF_TOKEN = "' . Filter::escapeJs(Filter::getCsrfToken()) . '"; ', self::JS_PRIORITY_HIGH); // Temporary fix for access to main menu hover elements on android/blackberry touch devices $this->addInlineJavascript(' if(navigator.userAgent.match(/Android|PlayBook/i)) { jQuery(".primary-menu > li > a").attr("href", "#"); } '); Theme::theme()->sendHeaders(); echo Theme::theme()->doctype(); echo Theme::theme()->html(); echo Theme::theme()->head($this); if ($this->popup) { echo Theme::theme()->bodyHeaderPopupWindow(); // We've displayed the header - display the footer automatically register_shutdown_function(array($this, 'pageFooterPopupWindow'), $this->popup); } else { echo Theme::theme()->bodyHeader(); // We've displayed the header - display the footer automatically register_shutdown_function(array($this, 'pageFooter'), $this->popup); } // Flush the output, so the browser can render the header and load javascript // while we are preparing data for the page if (ini_get('output_buffering')) { ob_flush(); } flush(); return $this; }
</table> </form> <?php if ($action === 'submit') { $url = 'medialist.php?action=submit' . '&ged=' . $WT_TREE->getNameHtml() . '&folder=' . Filter::escapeUrl($folder) . '&sortby=' . Filter::escapeUrl($sortby) . '&subdirs=' . Filter::escapeUrl($subdirs) . '&filter=' . Filter::escapeUrl($filter) . '&form_type=' . Filter::escapeUrl($form_type) . '&columns=' . Filter::escapeUrl($columns) . '&max=' . Filter::escapeUrl($max); $count = count($medialist); $pages = (int) (($count + $max - 1) / $max); $page = max(min($page, $pages), 1); if ($page === $pages && $count % $max !== 0) { // Last page may have fewer than $max pages $number_on_page = $count % $max; } else { $number_on_page = $max; } if (I18N::direction() === 'ltr') { $icons = array('first' => 'ldarrow', 'previous' => 'larrow', 'next' => 'rarrow', 'last' => 'rdarrow'); } else { $icons = array('first' => 'rdarrow', 'previous' => 'rarrow', 'next' => 'larrow', 'last' => 'ldarrow'); } echo '<div><p>', I18N::translate('Media objects found'), ' ', $count, '</p>'; if ($count > 0) { echo '<table class="list_table">'; // Display controls twice - at the top and bottom of the table foreach (array('thead', 'tfoot') as $tsection) { echo '<', $tsection, '><tr><td colspan="2">'; echo '<table class="list_table_controls"><tr><td>'; if ($page > 1) { echo '<a href="', $url, '&page=1" class="icon-', $icons['first'], '"></a>'; echo '<a href="', $url, '&page=', $page - 1, '" class="icon-', $icons['previous'], '"></a>'; }
/** * Draw a person in the tree * * @param Individual $person The Person object to draw the box for * @param int $gen The number of generations up or down to print * @param int $state Whether we are going up or down the tree, -1 for descendents +1 for ancestors * @param Family $pfamily * @param string $order first (1), last(2), unique(0), or empty. Required for drawing lines between boxes * @param bool $isRoot * * @return string * * Notes : "spouse" means explicitely married partners. Thus, the word "partner" * (for "life partner") here fits much better than "spouse" or "mate" * to translate properly the modern french meaning of "conjoint" */ private function drawPerson(Individual $person, $gen, $state, Family $pfamily = null, $order = null, $isRoot = false) { if ($gen < 0) { return ''; } if (!empty($pfamily)) { $partner = $pfamily->getSpouse($person); } else { $partner = $person->getCurrentSpouse(); } if ($isRoot) { $html = '<table id="tvTreeBorder" class="tv_tree"><tbody><tr><td id="tv_tree_topleft"></td><td id="tv_tree_top"></td><td id="tv_tree_topright"></td></tr><tr><td id="tv_tree_left"></td><td>'; } else { $html = ''; } /* height 1% : this hack enable the div auto-dimensioning in td for FF & Chrome */ $html .= '<table class="tv_tree"' . ($isRoot ? ' id="tv_tree"' : '') . ' style="height: 1%"><tbody><tr>'; if ($state <= 0) { // draw children $html .= $this->drawChildren($person->getSpouseFamilies(), $gen); } else { // draw the parent’s lines $html .= $this->drawVerticalLine($order) . $this->drawHorizontalLine(); } /* draw the person. Do NOT add person or family id as an id, since a same person could appear more than once in the tree !!! */ // Fixing the width for td to the box initial width when the person is the root person fix a rare bug that happen when a person without child and without known parents is the root person : an unwanted white rectangle appear at the right of the person’s boxes, otherwise. $html .= '<td' . ($isRoot ? ' style="width:1px"' : '') . '><div class="tv_box' . ($isRoot ? ' rootPerson' : '') . '" dir="' . I18N::direction() . '" style="text-align: ' . (I18N::direction() === 'rtl' ? 'right' : 'left') . '; direction: ' . I18N::direction() . '" abbr="' . $person->getXref() . '" onclick="' . $this->name . 'Handler.expandBox(this, event);">'; $html .= $this->drawPersonName($person); $fop = array(); // $fop is fathers of partners if (!is_null($partner)) { $dashed = ''; foreach ($person->getSpouseFamilies() as $family) { $spouse = $family->getSpouse($person); if ($spouse) { if ($spouse === $partner || $this->all_partners === 'true') { $spouse_parents = $spouse->getPrimaryChildFamily(); if ($spouse_parents && $spouse_parents->getHusband()) { $fop[] = array($spouse_parents->getHusband(), $spouse_parents); } elseif ($spouse_parents && $spouse_parents->getWife()) { $fop[] = array($spouse_parents->getWife(), $spouse_parents); } $html .= $this->drawPersonName($spouse, $dashed); if ($this->all_partners !== 'true') { break; // we can stop here the foreach loop } $dashed = 'dashed'; } } } } $html .= '</div></td>'; $primaryChildFamily = $person->getPrimaryChildFamily(); if (!empty($primaryChildFamily)) { $parent = $primaryChildFamily->getHusband(); if (empty($parent)) { $parent = $primaryChildFamily->getWife(); } } if (!empty($parent) || count($fop) || $state < 0) { $html .= $this->drawHorizontalLine(); } /* draw the parents */ if ($state >= 0 && (!empty($parent) || count($fop))) { $unique = empty($parent) || count($fop) == 0; $html .= '<td align="left"><table class="tv_tree"><tbody>'; if (!empty($parent)) { $u = $unique ? 'c' : 't'; $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $primaryChildFamily->getXref() . '@' . $u . '"' : '') . '>'; $html .= $this->drawPerson($parent, $gen - 1, 1, $primaryChildFamily, $u); $html .= '</td></tr>'; } if (count($fop)) { $n = 0; $nb = count($fop); foreach ($fop as $p) { $n++; $u = $unique ? 'c' : ($n == $nb || empty($p[1]) ? 'b' : 'h'); $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $p[1]->getXref() . '@' . $u . '"' : '') . '>' . $this->drawPerson($p[0], $gen - 1, 1, $p[1], $u) . '</td></tr>'; } } $html .= '</tbody></table></td>'; } if ($state < 0) { $html .= $this->drawVerticalLine($order); } $html .= '</tr></tbody></table>'; if ($isRoot) { $html .= '</td><td id="tv_tree_right"></td></tr><tr><td id="tv_tree_bottomleft"></td><td id="tv_tree_bottom"></td><td id="tv_tree_bottomright"></td></tr></tbody></table>'; } return $html; }
/** * Populate the timeline * * @return int */ public function fillTimeline() { $rows = array(); $maxY = self::CHART_TOP; //base case if (!$this->people) { return $maxY; } foreach ($this->people as $person) { $bdate = $this->getCalendarDate($person->getEstimatedBirthDate()->minimumJulianDay()); $ddate = $this->getCalendarDate($person->getEstimatedDeathDate()->maximumJulianDay()); $birthYear = $bdate->y; $age = min($ddate->y, $this->currentYear) - $birthYear; // truncate the bar at the current year $width = max(9, $age * self::PIXELS_PER_YEAR); // min width is width of sex icon $startPos = ($birthYear - $this->timelineMinYear) * self::PIXELS_PER_YEAR; //-- calculate a good Y top value $Y = self::CHART_TOP; $ready = false; while (!$ready) { if (!isset($rows[$Y])) { $ready = true; $rows[$Y]['x1'] = $startPos; $rows[$Y]['x2'] = $startPos + $width; } else { if ($rows[$Y]['x1'] > $startPos + $width) { $ready = true; $rows[$Y]['x1'] = $startPos; } elseif ($rows[$Y]['x2'] < $startPos) { $ready = true; $rows[$Y]['x2'] = $startPos + $width; } else { //move down a line $Y += self::BAR_SPACING; } } } $facts = $person->getFacts(); foreach ($person->getSpouseFamilies() as $family) { foreach ($family->getFacts() as $fact) { $facts[] = $fact; } } Functions::sortFacts($facts); $that = $this; // PHP5.3 cannot access $this inside a closure $acceptedFacts = array_filter($facts, function (Fact $fact) use($that) { return in_array($fact->getTag(), $that->facts) && $fact->getDate()->isOK() || ($that->place_obj || $that->startDate) && $that->checkFact($fact); }); $eventList = array(); foreach ($acceptedFacts as $fact) { $tag = $fact->getTag(); //-- if the fact is a generic EVENt then get the qualifying TYPE if ($tag == "EVEN") { $tag = $fact->getAttribute('TYPE'); } $eventList[] = array('label' => GedcomTag::getLabel($tag), 'date' => $fact->getDate()->display(), 'place' => $fact->getPlace()->getFullName()); } $direction = I18N::direction() === 'ltr' ? 'left' : 'right'; $lifespan = ' ' . $person->getLifeSpan(); // put the space here so its included in the length calcs $sex = $person->getSex(); $popupClass = strtr($sex, array('M' => '', 'U' => 'NN')); $color = $sex === 'U' ? '' : sprintf("background-color: %s", $this->colors[$sex]->getNextColor()); // following lines are a nasty method of approximating // the width of a string in pixels from the character count $name_length = mb_strlen(strip_tags($person->getFullName())) * 6.5; $short_name_length = mb_strlen(strip_tags($person->getShortName())) * 6.5; $lifespan_length = mb_strlen(strip_tags($lifespan)) * 6.5; if ($width > $name_length + $lifespan_length) { $printName = $person->getFullName(); $abbrLifespan = $lifespan; } elseif ($width > $name_length) { $printName = $person->getFullName(); $abbrLifespan = '…'; } elseif ($width > $short_name_length) { $printName = $person->getShortName(); $abbrLifespan = ''; } else { $printName = ''; $abbrLifespan = ''; } // Bar framework printf(' <div class="person_box%s" style="top:%spx; %s:%spx; width:%spx; %s"> <div class="itr">%s %s %s <div class="popup person_box%s"> <div> <a href="%s">%s%s</a> </div>', $popupClass, $Y, $direction, $startPos, $width, $color, $person->getSexImage(), $printName, $abbrLifespan, $popupClass, $person->getHtmlUrl(), $person->getFullName(), $lifespan); // Add events to popup foreach ($eventList as $event) { printf("<div>%s: %s %s</div>", $event['label'], $event['date'], $event['place']); } echo '</div>' . '</div>' . '</div>'; // class=$popupclass $maxY = max($maxY, $Y); } return $maxY; }
private function pageBody(PageController $controller) { $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS')); ?> <!-- ADMIN PAGE CONTENT --> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <h2><?php echo $controller->getPageTitle(); ?> </h2> <!-- *** FORM 1 *** --> <form class="form-horizontal" method="post" name="form1"> <?php echo Filter::getCsrf(); ?> <!-- SELECT TREE --> <div class="form-group"> <label class="control-label col-sm-2" for="tree"> <?php echo I18N::translate('Family tree'); ?> </label> <div class="col-sm-4"> <select id="tree" name="NEW_FIB_TREE" class="form-control"> <?php foreach (Tree::getAll() as $tree) { ?> <?php if ($tree->getTreeId() == $this->tree_id) { ?> <option value="<?php echo $tree->getTreeId(); ?> " data-ged="<?php echo $tree->getNameHtml(); ?> " selected="selected"> <?php echo $tree->getTitleHtml(); ?> </option> <?php } else { ?> <option value="<?php echo $tree->getTreeId(); ?> " data-ged="<?php echo $tree->getNameHtml(); ?> "> <?php echo $tree->getTitleHtml(); ?> </option> <?php } ?> <?php } ?> </select> </div> </div> </form> <!-- PANEL GROUP ACCORDION --> <div class="panel-group" id="accordion"> <!-- PANEL 1 --> <div class="panel panel-default" id="panel1"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-target="#collapseOne" href="#"> <?php echo I18N::translate('Pages'); ?> </a> </h4> </div> <div id="collapseOne" class="panel-collapse collapse in"> <div class="panel-body"> <?php if (empty($FTV_SETTINGS) || !empty($FTV_SETTINGS) && !$this->searchArray($FTV_SETTINGS, 'TREE', $this->tree_id)) { ?> <div class="alert alert-info alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="' . I18N::translate('close') . '"> <span aria-hidden="true">×</span> </button> <p class="small text-muted"> <?php echo I18N::translate('Use the search form below to search for a root person. After a successful search the Fancy Treeview page will be automatically created. You can add as many root persons as you want.'); ?> </p> </div> <?php } ?> <!-- *** FORM 2 *** --> <div id="ftv-search-form" class="form-group alert alert-info"> <form class="form-inline" method="post" name="form2"> <!-- SURNAME SEARCH FIELD --> <div class="form-group"> <label class="control-label"> <?php echo I18N::translate('Search root person'); ?> </label> <input class="form-control" data-autocomplete-type="SURN" id="surname-search" name="SURNAME" placeholder="<?php echo I18N::translate('Surname'); ?> " type="text" > <label class="checkbox-inline"> <?php echo FunctionsEdit::checkbox('soundex_std') . I18N::translate('Russell'); ?> </label> <label class="checkbox-inline"> <?php echo FunctionsEdit::checkbox('soudex_dm') . I18N::translate('Daitch-Mokotoff'); ?> </label> <button name="search" class="btn btn-primary" type="submit"> <i class="fa fa-search"></i> <?php echo I18N::translate('search'); ?> </button> </div> <!-- PID SEARCH FIELD --> <?php $class = I18N::direction() === 'rtl' ? 'pull-left' : 'pull-right'; ?> <div class="form-group <?php echo $class; ?> "> <label class="control-label" for="pid-search"> <?php echo I18N::translate('Or enter an ID'); ?> </label> <input class="form-control" data-autocomplete-type="INDI" id="pid-search" name="PID" placeholder="<?php echo I18N::translate('Search ID by name'); ?> " type="text" value="" > <button name="Ok" class="btn btn-primary" type="submit"> <i class="fa fa-check"></i> <?php echo I18N::translate('ok'); ?> </button> </div> </form> <!-- *** FORM 3 *** --> <form class="form-horizontal" method="post" name="form3"> <!-- TABLE --> <table id="search-result-table" class="table" style="display: none"> <thead> <tr> <th><?php echo I18N::translate('Root person'); ?> </th> <?php if (!$this->options('use_fullname')) { ?> <th><?php echo I18N::translate('Surname in page title'); ?> </th> <?php } ?> <th><?php echo I18N::translate('Page title'); ?> </th> <th><?php echo I18N::translate('Access level'); ?> </th> <th><?php echo I18N::translate('Add'); ?> </th> </tr> </thead> <tbody> <tr> <!-- ROOT PERSONS FULL NAME --> <td id="root"> <?php if ($this->options('use_fullname')) { ?> <input name="surname" type="hidden" value="" > <?php } ?> <input name="pid" type="hidden" value="" > <input name="sort" type="hidden" value="" > <span></span> </td> <?php if (!$this->options('use_fullname')) { ?> <!-- SURNAME IN PAGE TITLE --> <td id="surn"> <label class="showname"></label> <input class="form-control editname" name="surname" type="text" value="" > </td> <?php } ?> <!-- PAGE TITLE --> <td id="title"></td> <!-- ACCESS LEVEL --> <td> <?php echo FunctionsEdit::editFieldAccessLevel('access_level', 2, 'class="form-control"'); ?> </td> <!-- ADD BUTTON --> <td> <button type="submit" name="add" class="btn btn-success btn-sm" title="<?php I18N::translate('Add'); ?> "> <i class="fa fa-plus"></i> </button> </td> </tr> </tbody> </table> </form> </div> <?php echo $this->addMessage("error", "danger", true); ?> <?php echo $this->addMessage('update-settings', 'success', true, I18N::translate('The settings for this tree are succesfully updated')); ?> <div id="fancy-treeview-form" class="form-group"> <?php if (!empty($FTV_SETTINGS) && $this->searchArray($FTV_SETTINGS, 'TREE', $this->tree_id)) { ?> <form class="form-horizontal" method="post" name="form4"> <!-- TABLE --> <table id="fancy-treeview-table" class="table table-hover"> <thead> <tr> <th><?php echo I18N::translate('Root person'); ?> </th> <?php if (!$this->options('use_fullname')) { ?> <th><?php echo I18N::translate('Surname in page title'); ?> </th> <?php } ?> <th><?php echo I18N::translate('Page title'); ?> </th> <th><?php echo I18N::translate('Access level'); ?> </th> <th><?php echo I18N::translate('Delete'); ?> </th> </tr> </thead> <tbody> <?php foreach ($FTV_SETTINGS as $key => $this_ITEM) { ?> <?php if ($this_ITEM['TREE'] == $this->tree_id) { ?> <?php if (Individual::getInstance($this_ITEM['PID'], $this->tree)) { ?> <tr class="sortme"> <!-- ROOT PERSONS FULL NAME --> <td> <input name="pid[<?php echo $key; ?> ]" type="hidden" value="<?php echo $this_ITEM['PID']; ?> " > <input name="sort[<?php echo $key; ?> ]" type="hidden" value="<?php echo $this_ITEM['SORT']; ?> " > <?php echo Individual::getInstance($this_ITEM['PID'], $this->tree)->getFullName() . ''; ?> (<?php echo Individual::getInstance($this_ITEM['PID'], $this->tree)->getLifeSpan(); ?> ) </td> <?php if (!$this->options('use_fullname')) { ?> <!-- SURNAME IN PAGE TITLE --> <td> <label class="showname"> <?php echo $this_ITEM['SURNAME']; ?> </label> <input class="form-control editname" name="surname[<?php echo $key; ?> ]" type="text" value="<?php echo $this_ITEM['SURNAME']; ?> " > </td> <?php } ?> <!-- PAGE TITLE --> <td> <a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=page&ged=<?php echo $this->tree->getNameHtml(); ?> &rootid=<?php echo $this_ITEM['PID']; ?> " target="_blank"> <?php if ($this->options('use_fullname') == true) { echo I18N::translate('Descendants of %s', Individual::getInstance($this_ITEM['PID'], $this->tree)->getFullName()); } else { echo I18N::translate('Descendants of the %s family', $this_ITEM['SURNAME']); } ?> </a> </td> <!-- ACCESS LEVEL --> <td> <?php echo FunctionsEdit::editFieldAccessLevel('access_level[' . $key . ']', $this_ITEM['ACCESS_LEVEL'], 'class="form-control"'); ?> </td> <!-- DELETE BUTTON --> <td> <button type="button" name="delete" class="btn btn-danger btn-sm" data-key="<?php echo $key; ?> " title="<?php I18N::translate('Delete'); ?> "> <i class="fa fa-trash-o"></i> </button> </td> </tr> <?php } else { ?> <tr> <!-- SURNAME --> <td class="error"> <input name="pid[<?php echo $key; ?> ]" type="hidden" value="<?php echo $this_ITEM['PID']; ?> " > <?php echo $this_ITEM['SURNAME']; ?> </td> <!-- ERROR MESSAGE --> <td colspan="4" class="error"> <?php echo I18N::translate('The person with root id %s doesn’t exist anymore in this tree', $this_ITEM['PID']); ?> </td> <!-- DELETE BUTTON --> <td> <button name="delete" type="button" class="btn btn-danger btn-sm" title="<?php I18N::translate('Delete'); ?> "> <i class="fa fa-trash-o"></i> </button> </td> </tr> <?php } ?> <?php } ?> <?php } ?> </tbody> </table> <!-- BUTTONS --> <button name="update" class="btn btn-primary" type="submit"> <i class="fa fa-check"></i> <?php echo I18N::translate('update'); ?> </button> </form> <?php } ?> </div> </div> </div> </div> <!-- PANEL 2 --> <div class="panel panel-default" id="panel2"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-target="#collapseTwo" href="#" class="collapsed"> <?php echo I18N::translate('Options for %s', $this->tree->getTitleHtml()); ?> </a> </h4> </div> <div id="collapseTwo" class="panel-collapse collapse"> <div class="panel-body"> <?php echo $this->addMessage('save-options', 'success', true, I18N::translate('The options for this tree are succesfully saved')); ?> <?php echo $this->addMessage('reset-options', 'success', true, I18N::translate('The options for this tree are succesfully reset to the default settings')); ?> <div id="ftv-options-form" class="form-group"> <form class="form-horizontal" method="post" name="form5"> <!-- USE FULLNAME IN MENU --> <div class="form-group fullname"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Use fullname in menu'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[USE_FULLNAME]', $this->options('use_fullname'), 'class="radio-inline"'); ?> </div> </div> <!-- GENERATION BLOCKS --> <div class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Number of generation blocks to show'); ?> </label> <div class="col-sm-4"> <?php echo FunctionsEdit::selectEditControl('NEW_FTV_OPTIONS[NUMBLOCKS]', array(I18N::translate('All'), '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'), null, $this->options('numblocks'), 'class="form-control"'); ?> </div> <p class="col-sm-8 col-sm-offset-4 small text-muted"> <?php echo I18N::translate('This option is especially usefull for large trees. When you notice a slow page load, here you can set the number of generation blocks to load at once to a lower level. Below the last generation block a button will appear to add the next set of generation blocks. The new blocks will be added to the blocks already loaded. Clicking on a “follow” link in the last visible generation block, will also load the next set of generation blocks.'); ?> </p> </div> <!-- SHOW SINGLES --> <div class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Show single persons'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[SHOW_SINGLES]', $this->options('show_singles'), 'class="radio-inline"'); ?> </div> <p class="col-sm-8 col-sm-offset-4 small text-muted"> <?php echo I18N::translate('Turn this option on if you want to show single persons in the generation blocks. Single persons are persons without partner and children. With this option turned on, every child of a family will be shown in a detailed way in the next generation block.'); ?> </p> </div> <!-- CHECK RELATIONSHIP --> <div class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Check relationship between partners'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[CHECK_RELATIONSHIP]', $this->options('check_relationship'), 'class="radio-inline"'); ?> </div> <p class="col-sm-8 col-sm-offset-4 small text-muted"> <?php echo I18N::translate('With this option turned on, the script checks if a (married) couple has the same ancestors. If a relationship between the partners is found, a text will appear between brackets after the spouses’ name to indicate the blood relationship.'); ?> </p> <p class="col-sm-8 col-sm-offset-4 small text-muted"> <?php echo I18N::translate('<strong>Note</strong>: this option can be time and/or memory consuming, especially on large trees. It can cause very slow page loading or an ’execution time out error’ on your server. If you notice such a behavior, reduce the number of generation blocks to load at once or don’t use it in combination with the option to show singles (see the previous options). If you still experience any problems, don’t use this option at all.'); ?> </p> </div> <!-- SHOW PLACES --> <div id="places" class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Show places?'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[SHOW_PLACES]', $this->options('show_places'), 'class="radio-inline"'); ?> </div> </div> <!-- USE GEDCOM PLACE SETTING --> <div id="gedcom_places" class="form-group<?php if (!$this->options('show_places')) { echo ' collapse'; } ?> "> <label class="control-label col-sm-4"> <?php echo I18N::translate('Use default GEDCOM settings to abbreviate place names?'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[USE_GEDCOM_PLACES]', $this->options('use_gedcom_places'), 'class="radio-inline"'); ?> </div> <p class="col-sm-8 col-sm-offset-4 small text-muted"> <?php echo I18N::translate('If you have ticked the “Show places” option, you can choose to use the default GEDCOM settings to abbreviate placenames. If you don’t set this option, full place names will be shown.'); ?> </p> </div> <!-- GET COUNTRYLIST --> <?php if ($this->getCountrylist()) { ?> <div id="country_list" class="form-group<?php if (!$this->options('show_places') || $this->options('use_gedcom_places')) { echo ' collapse'; } ?> "> <label class="control-label col-sm-4"> <?php echo I18N::translate('Select your country'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::selectEditControl('NEW_FTV_OPTIONS[COUNTRY]', $this->getCountryList(), '', $this->options('country'), 'class="form-control"'); ?> </div> <p class="col-sm-8 col-sm-offset-4 small text-muted"> <?php echo I18N::translate('If you have ticked the “Show places” option but NOT the option to abbreviate placenames, you can set your own country here. Full places will be listed on the Fancy Treeview pages, but when a place includes the name of your own country, this name will be left out. If you don’t select a country then all countries will be shown, including your own.'); ?> </p> </div> <?php } ?> <!-- SHOW OCCUPATIONS --> <div class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Show occupations'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[SHOW_OCCU]', $this->options('show_occu'), 'class="radio-inline"'); ?> </div> </div> <!-- RESIZE THUMBS --> <div id="resize_thumbs" class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Resize thumbnails'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[RESIZE_THUMBS]', $this->options('resize_thumbs'), 'class="radio-inline"'); ?> </div> <p class="col-sm-8 col-sm-offset-4 small text-muted"> <?php echo I18N::translate('Here you can choose to resize the default webtrees thumbnails especially for the Fancy Treeview pages. You can set a custom size in percentage or in pixels. If you choose “no” the default webtrees thumbnails will be used with the formats you have set on the tree configuration page.'); ?> </p> </div> <!-- THUMB SIZE --> <div id="thumb_size" class="form-group<?php if (!$this->options('resize_thumbs')) { echo ' collapse'; } ?> "> <label class="control-label col-sm-4"> <?php echo I18N::translate('Thumbnail size'); ?> </label> <div class="row"> <div class="col-sm-1"> <input class="form-control" id="NEW_FTV_OPTIONS[THUMB_SIZE]" name="NEW_FTV_OPTIONS[THUMB_SIZE]" type="text" value="<?php echo $this->options('thumb_size'); ?> " > </div> <div class="col-sm-2"> <?php echo FunctionsEdit::selectEditControl('NEW_FTV_OPTIONS[THUMB_RESIZE_FORMAT]', array('1' => I18N::translate('percent'), '2' => I18N::translate('pixels')), null, $this->options('thumb_resize_format'), 'class="form-control"'); ?> </div> </div> </div> <!-- SQUARE THUMBS --> <div id="square_thumbs" class="form-group<?php if (!$this->options('resize_thumbs')) { echo ' collapse'; } ?> "> <label class="control-label col-sm-4"> <?php echo I18N::translate('Use square thumbnails'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[USE_SQUARE_THUMBS]', $this->options('use_square_thumbs'), 'class="radio-inline"'); ?> </div> </div> <!-- SHOW USERFORM --> <div class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Show form to change start person'); ?> </label> <div class="col-sm-4"> <?php echo FunctionsEdit::editFieldAccessLevel('NEW_FTV_OPTIONS[SHOW_USERFORM]', $this->options('show_userform'), 'class="form-control"'); ?> </div> </div> <!-- SHOW PDF --> <div class="form-group"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Show PDF icon?'); ?> </label> <div class="col-sm-4"> <?php echo FunctionsEdit::editFieldAccessLevel('NEW_FTV_OPTIONS[SHOW_PDF_ICON]', $this->options('show_pdf_icon'), 'class="form-control"'); ?> </div> </div> <!-- SHOW FANCY TREEVIEW ON INDI PAGE --> <div class="form-group fullname"> <label class="control-label col-sm-4"> <?php echo I18N::translate('Show a Fancy Treeview tab on the individual page'); ?> </label> <div class="col-sm-8"> <?php echo FunctionsEdit::editFieldYesNo('NEW_FTV_OPTIONS[FTV_TAB]', $this->options('ftv_tab'), 'class="radio-inline"'); ?> </div> </div> <!-- BUTTONS --> <button name="save-options" class="btn btn-primary" type="submit"> <i class="fa fa-check"></i> <?php echo I18N::translate('save'); ?> </button> <button name="reset-options" class="btn btn-primary" type="reset"> <i class="fa fa-recycle"></i> <?php echo I18N::translate('reset'); ?> </button> </form> </div> </div> </div> </div> </div> <?php }
/* User */ { }, /* Family tree */ { } ] }); jQuery("#from,#to").parent("div").datetimepicker({ format: "YYYY-MM-DD", minDate: "' . $earliest . '", maxDate: "' . $latest . '", locale: "' . WT_LOCALE . '", icons: { time: "fa fa-clock-o", date: "fa fa-calendar", up: "fa fa-arrow-up", down: "fa fa-arrow-down", previous: "fa fa-arrow-' . (I18N::direction() === 'rtl' ? 'right' : 'left') . '", next: "fa fa-arrow-' . (I18N::direction() === 'rtl' ? 'left' : 'right') . '", today: "fa fa-trash-o", clear: "fa fa-trash-o" } }); '); $url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&to=' . rawurlencode($to) . '&type=' . rawurlencode($type) . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user='******'&gedc=' . rawurlencode($gedc); $users_array = array(); foreach (User::all() as $tmp_user) { $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName(); } ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?>
/** * A list of CSS files to include for this page. * * @return string[] */ protected function stylesheets() { $stylesheets = array(WT_BOOTSTRAP_CSS_URL, WT_FONT_AWESOME_CSS_URL, WT_FONT_AWESOME_RTL_CSS_URL); if (I18N::direction() === 'rtl') { $stylesheets[] = WT_BOOTSTRAP_RTL_CSS_URL; } return $stylesheets; }
/** * Find the couple with the most grandchildren. * * @param string $type * @param string[] $params * * @return string */ private function topTenGrandFamilyQuery($type = 'list', $params = array()) { if (isset($params[0])) { $total = (int) $params[0]; } else { $total = 10; } $rows = $this->runSql("SELECT SQL_CACHE COUNT(*) AS tot, f_id AS id" . " FROM `##families`" . " JOIN `##link` AS children ON children.l_file = {$this->tree->getTreeId()}" . " JOIN `##link` AS mchildren ON mchildren.l_file = {$this->tree->getTreeId()}" . " JOIN `##link` AS gchildren ON gchildren.l_file = {$this->tree->getTreeId()}" . " WHERE" . " f_file={$this->tree->getTreeId()} AND" . " children.l_from=f_id AND" . " children.l_type='CHIL' AND" . " children.l_to=mchildren.l_from AND" . " mchildren.l_type='FAMS' AND" . " mchildren.l_to=gchildren.l_from AND" . " gchildren.l_type='CHIL'" . " GROUP BY id" . " ORDER BY tot DESC" . " LIMIT " . $total); if (!isset($rows[0])) { return ''; } $top10 = array(); foreach ($rows as $row) { $family = Family::getInstance($row['id'], $this->tree); if ($family->canShow()) { if ($type === 'list') { $top10[] = '<li><a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a> - ' . I18N::plural('%s grandchild', '%s grandchildren', $row['tot'], I18N::number($row['tot'])); } else { $top10[] = '<a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a> - ' . I18N::plural('%s grandchild', '%s grandchildren', $row['tot'], I18N::number($row['tot'])); } } } if ($type === 'list') { $top10 = implode('', $top10); } else { $top10 = implode('; ', $top10); } if (I18N::direction() === 'rtl') { $top10 = str_replace(array('[', ']', '(', ')', '+'), array('‏[', '‏]', '‏(', '‏)', '‏+'), $top10); } if ($type === 'list') { return '<ul>' . $top10 . '</ul>'; } return $top10; }
/** * print cousins list * * @param string $famid family ID * @param int $show_full large or small box */ public static function printCousins($famid, $show_full = 1) { global $WT_TREE; if ($show_full) { $bheight = Theme::theme()->parameter('chart-box-y'); } else { $bheight = Theme::theme()->parameter('compact-chart-box-y'); } $family = Family::getInstance($famid, $WT_TREE); $fchildren = $family->getChildren(); $kids = count($fchildren); echo '<td valign="middle" height="100%">'; if ($kids) { echo '<table cellspacing="0" cellpadding="0" border="0" ><tr valign="middle">'; if ($kids > 1) { echo '<td rowspan="', $kids, '" valign="middle" align="right"><img width="3px" height="', ($bheight + 9) * ($kids - 1), 'px" src="', Theme::theme()->parameter('image-vline'), '" alt=""></td>'; } $ctkids = count($fchildren); $i = 1; foreach ($fchildren as $fchil) { if ($i == 1) { echo '<td><img width="10px" height="3px" align="top"'; } else { echo '<td><img width="10px" height="3px"'; } if (I18N::direction() === 'ltr') { echo ' style="padding-right: 2px;"'; } else { echo ' style="padding-left: 2px;"'; } echo ' src="', Theme::theme()->parameter('image-hline'), '" alt=""></td><td>'; FunctionsPrint::printPedigreePerson($fchil, $show_full); echo '</td></tr>'; if ($i < $ctkids) { echo '<tr>'; $i++; } } echo '</table>'; } else { // If there is known that there are no children (as opposed to no known children) if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) { echo ' <i class="icon-childless" title="', I18N::translate('This family remained childless'), '"></i>'; } } echo '</td>'; }
</td> <td class="optionbox center"> <?php echo FunctionsEdit::twoStateCheckbox('show_full', $controller->showFull()); ?> </td> </tr> </tbody> </table> </form> <?php if ($controller->error_message) { echo '<p class="ui-state-error">', $controller->error_message, '</p>'; return; } $posn = I18N::direction() === 'rtl' ? 'right' : 'left'; $lastgenStart = (int) floor($controller->treesize / 2); echo '<div id="pedigree_chart" class="layout', $controller->orientation, '">'; //Output the chart foreach ($controller->nodes as $i => $node) { // -- draw the box printf('<div id="sosa_%s" class="shadow" style="%s:%spx; top:%spx">', $i + 1, $posn, $node["x"], $node["y"]); if ($controller->orientation === $controller::OLDEST_AT_TOP) { if ($i >= $lastgenStart) { echo $controller->gotoPreviousGen($i); } } else { if (!$i) { echo $controller->getMenu(); } }
/** * Write text - ReportHtml * * @param string $text Text to print * @param string $color HTML RGB color code (Ex: #001122) * @param bool $useclass */ public function write($text, $color = '', $useclass = true) { $style = $this->getStyle($this->getCurrentStyle()); $htmlcode = '<span dir="' . I18N::direction() . '"'; if ($useclass) { $htmlcode .= ' class="' . $style['name'] . '"'; } if (!empty($color)) { // Check if Text Color is set and if it’s valid HTML color if (preg_match('/#?(..)(..)(..)/', $color)) { $htmlcode .= ' style="color:' . $color . ';"'; } } $htmlcode .= '>' . $text . '</span>'; $htmlcode = str_replace(array("\n", '> ', ' <'), array('<br>', '> ', ' <'), $htmlcode); echo $htmlcode; }
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $WT_TREE; $num = $this->getBlockSetting($block_id, 'num', '10'); $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table'); $block = $this->getBlockSetting($block_id, 'block', '0'); foreach (array('num', 'infoStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $stats = new Stats($WT_TREE); $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; } else { $title = ''; } if ($num == 1) { // I18N: i.e. most popular given name. $title .= I18N::translate('Top given name'); } else { // I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1 $title .= I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num)); } $content = '<div class="normal_inner_block">'; //Select List or Table switch ($infoStyle) { case "list": // Output style 1: Simple list style. Better suited to left side of page. if (I18N::direction() === 'ltr') { $padding = 'padding-left: 15px'; } else { $padding = 'padding-right: 15px'; } $params = array(1, $num, 'rcount'); // List Female names $totals = $stats->commonGivenFemaleTotals($params); if ($totals) { $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; } // List Male names $totals = $stats->commonGivenMaleTotals($params); if ($totals) { $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>'; } break; case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page $params = array(1, $num, 'rcount'); $content .= '<table style="margin:auto;"> <tr valign="top"> <td>' . $stats->commonGivenFemaleTable($params) . '</td> <td>' . $stats->commonGivenMaleTable($params) . '</td>'; $content .= '</tr></table>'; break; } $content .= "</div>"; if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
/** * Get an arrow, pointing to other generations. * * @param int $n * @param string $arrow_dir * * @return string */ public function sosaArrow($n, $arrow_dir) { $indi = $this->treeid[$n]; $arrow_dir = substr($arrow_dir, 0, 1); if (I18N::direction() === 'rtl') { if ($arrow_dir === 'l') { $arrow_dir = 'r'; } elseif ($arrow_dir === 'r') { $arrow_dir = 'l'; } } if ($indi) { $title = I18N::translate('Compact tree of %s', $indi->getFullName()); $text = '<a class="icon-' . $arrow_dir . 'arrow" title="' . strip_tags($title) . '" href="?rootid=' . $indi->getXref(); if ($this->show_thumbs) { $text .= "&show_thumbs=" . $this->show_thumbs; } $text .= "\"></a>"; } else { $text = '<i class="icon-' . $arrow_dir . 'arrow"></i>'; } return $text; }