当前位置: 首页>>代码示例>>PHP>>正文


PHP I18N::direction方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\I18N::direction方法的典型用法代码示例。如果您正苦于以下问题:PHP I18N::direction方法的具体用法?PHP I18N::direction怎么用?PHP I18N::direction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\I18N的用法示例。


在下文中一共展示了I18N::direction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pageBody

    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');
    }
开发者ID:JustCarmen,项目名称:fancy_treeview_pdf,代码行数:60,代码来源:PdfTemplate.php

示例2: pageBody

    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.'));
        }
    }
开发者ID:bxbroze,项目名称:webtrees,代码行数:59,代码来源:PdfTemplate.php

示例3: pageHeader

    /**
     * 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;
    }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:36,代码来源:PageController.php

示例4: printDescendency

 /**
  * 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">';
//.........这里部分代码省略.........
开发者ID:tunandras,项目名称:webtrees,代码行数:101,代码来源:HourglassController.php

示例5: formatSecondaryMenu

 /** {@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>';
 }
开发者ID:bxbroze,项目名称:justlight,代码行数:10,代码来源:theme.php

示例6: getMenu

 /**
  * 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>';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:Menu.php

示例7: printTimeFact

 /**
  * 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 {
//.........这里部分代码省略.........
开发者ID:tronsmit,项目名称:webtrees,代码行数:101,代码来源:TimelineController.php

示例8: finishCurrentSpan

 /**
  * 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 . '&nbsp;', '&nbsp;');
         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, '&nbsp;');
         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);
//.........这里部分代码省略.........
开发者ID:tunandras,项目名称:webtrees,代码行数:101,代码来源:FunctionsRtl.php

示例9: display

 /**
  * 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;
//.........这里部分代码省略.........
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:101,代码来源:Date.php

示例10: __construct

 /**
  * 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) {
//.........这里部分代码省略.........
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:101,代码来源:PedigreeController.php

示例11: foreach

    $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 
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:timeline.php

示例12: setup

 /**
  * 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);
//.........这里部分代码省略.........
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:101,代码来源:ReportBase.php

示例13: print_pedigree_person_nav_cens

/**
 * 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
//.........这里部分代码省略.........
开发者ID:jflash,项目名称:webtrees,代码行数:101,代码来源:census-edit.php

示例14: pageHeader

    /**
     * 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;
    }
开发者ID:jflash,项目名称:webtrees,代码行数:48,代码来源:PageController.php

示例15: count

	</table>
</form>

<?php 
if ($action === 'submit') {
    $url = 'medialist.php?action=submit' . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;folder=' . Filter::escapeUrl($folder) . '&amp;sortby=' . Filter::escapeUrl($sortby) . '&amp;subdirs=' . Filter::escapeUrl($subdirs) . '&amp;filter=' . Filter::escapeUrl($filter) . '&amp;form_type=' . Filter::escapeUrl($form_type) . '&amp;columns=' . Filter::escapeUrl($columns) . '&amp;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, '&amp;page=1" class="icon-', $icons['first'], '"></a>';
                echo '<a href="', $url, '&amp;page=', $page - 1, '" class="icon-', $icons['previous'], '"></a>';
            }
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:medialist.php


注:本文中的Fisharebest\Webtrees\I18N::direction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。