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


PHP Functions::sortFacts方法代码示例

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


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

示例1: getFacts

 /**
  * Return a list of facts
  *
  * @return Fact[]
  */
 public function getFacts()
 {
     $facts = $this->record->getFacts();
     // Add some dummy facts to show additional information
     if ($this->record->fileExists()) {
         // get height and width of image, when available
         $imgsize = $this->record->getImageAttributes();
         if (!empty($imgsize['WxH'])) {
             $facts[] = new Fact('1 __IMAGE_SIZE__ ' . $imgsize['WxH'], $this->record, 0);
         }
         //Prints the file size
         $facts[] = new Fact('1 __FILE_SIZE__ ' . $this->record->getFilesize(), $this->record, 0);
     }
     Functions::sortFacts($facts);
     return $facts;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:21,代码来源:MediaController.php

示例2: getFactsWithNotes

 /**
  * Get all the facts for an individual which contain notes.
  *
  * @return Fact[]
  */
 private function getFactsWithNotes()
 {
     global $controller;
     if ($this->facts === null) {
         $facts = $controller->record->getFacts();
         foreach ($controller->record->getSpouseFamilies() as $family) {
             if ($family->canShow()) {
                 foreach ($family->getFacts() as $fact) {
                     $facts[] = $fact;
                 }
             }
         }
         $this->facts = array();
         foreach ($facts as $fact) {
             if (preg_match('/(?:^1|\\n\\d) NOTE/', $fact->getGedcom())) {
                 $this->facts[] = $fact;
             }
         }
         Functions::sortFacts($this->facts);
     }
     return $this->facts;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:27,代码来源:NotesTabModule.php

示例3: buildIndividualMap

    /**
     * Build a map for an individual.
     *
     * @param Individual $indi
     */
    private function buildIndividualMap(Individual $indi)
    {
        $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
        $indifacts = $indi->getFacts();
        foreach ($indi->getSpouseFamilies() as $family) {
            $indifacts = array_merge($indifacts, $family->getFacts());
        }
        Functions::sortFacts($indifacts);
        // Create the markers list array
        $gmarks = array();
        $i = 0;
        foreach ($indifacts as $fact) {
            if (!$fact->getPlace()->isEmpty()) {
                $ctla = preg_match("/\\d LATI (.*)/", $fact->getGedcom(), $match1);
                $ctlo = preg_match("/\\d LONG (.*)/", $fact->getGedcom(), $match2);
                if ($fact->getParent() instanceof Family) {
                    $spouse = $fact->getParent()->getSpouse($indi);
                } else {
                    $spouse = null;
                }
                if ($ctla && $ctlo) {
                    $i++;
                    $gmarks[$i] = array('class' => 'optionbox', 'date' => $fact->getDate()->display(true), 'fact_label' => $fact->getLabel(), 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact), 'info' => $fact->getValue(), 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]), 'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '', 'pl_icon' => '', 'place' => $fact->getPlace()->getFullName(), 'sv_bearing' => '0', 'sv_elevation' => '0', 'sv_lati' => '0', 'sv_long' => '0', 'sv_zoom' => '0', 'tooltip' => $fact->getPlace()->getGedcomName());
                } else {
                    $latlongval = $this->getLatitudeAndLongitudeFromPlaceLocation($fact->getPlace()->getGedcomName());
                    if ($latlongval && $latlongval->pl_lati && $latlongval->pl_long) {
                        $i++;
                        $gmarks[$i] = array('class' => 'optionbox', 'date' => $fact->getDate()->display(true), 'fact_label' => $fact->getLabel(), 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact), 'info' => $fact->getValue(), 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval->pl_lati), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval->pl_long), 'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '', 'pl_icon' => $latlongval->pl_icon, 'place' => $fact->getPlace()->getFullName(), 'sv_bearing' => $latlongval->sv_bearing, 'sv_elevation' => $latlongval->sv_elevation, 'sv_lati' => $latlongval->sv_lati, 'sv_long' => $latlongval->sv_long, 'sv_zoom' => $latlongval->sv_zoom, 'tooltip' => $fact->getPlace()->getGedcomName());
                        if ($GM_MAX_ZOOM > $latlongval->pl_zoom) {
                            $GM_MAX_ZOOM = $latlongval->pl_zoom;
                        }
                    }
                }
            }
        }
        // Add children to the markers list array
        foreach ($indi->getSpouseFamilies() as $family) {
            foreach ($family->getChildren() as $child) {
                $birth = $child->getFirstFact('BIRT');
                if ($birth) {
                    $birthrec = $birth->getGedcom();
                    if (!$birth->getPlace()->isEmpty()) {
                        $ctla = preg_match('/\\n4 LATI (.+)/', $birthrec, $match1);
                        $ctlo = preg_match('/\\n4 LONG (.+)/', $birthrec, $match2);
                        if ($ctla && $ctlo) {
                            $i++;
                            $gmarks[$i] = array('date' => $birth->getDate()->display(true), 'image' => $child->displayImage(), 'info' => '', 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]), 'name' => '<a href="' . $child->getHtmlUrl() . '"' . $child->getFullName() . '</a>', 'pl_icon' => '', 'place' => $birth->getPlace()->getFullName(), 'sv_bearing' => '0', 'sv_elevation' => '0', 'sv_lati' => '0', 'sv_long' => '0', 'sv_zoom' => '0', 'tooltip' => $birth->getPlace()->getGedcomName());
                            switch ($child->getSex()) {
                                case 'F':
                                    $gmarks[$i]['fact_label'] = I18N::translate('daughter');
                                    $gmarks[$i]['class'] = 'person_boxF';
                                    break;
                                case 'M':
                                    $gmarks[$i]['fact_label'] = I18N::translate('son');
                                    $gmarks[$i]['class'] = 'person_box';
                                    break;
                                default:
                                    $gmarks[$i]['fact_label'] = I18N::translate('child');
                                    $gmarks[$i]['class'] = 'person_boxNN';
                                    break;
                            }
                        } else {
                            $latlongval = $this->getLatitudeAndLongitudeFromPlaceLocation($birth->getPlace()->getGedcomName());
                            if ($latlongval && $latlongval->pl_lati && $latlongval->pl_long) {
                                $i++;
                                $gmarks[$i] = array('date' => $birth->getDate()->display(true), 'image' => $child->displayImage(), 'info' => '', 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval->pl_lati), 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval->pl_long), 'name' => '<a href="' . $child->getHtmlUrl() . '"' . $child->getFullName() . '</a>', 'pl_icon' => $latlongval->pl_icon, 'place' => $birth->getPlace()->getFullName(), 'sv_bearing' => $latlongval->sv_bearing, 'sv_elevation' => $latlongval->sv_elevation, 'sv_lati' => $latlongval->sv_lati, 'sv_long' => $latlongval->sv_long, 'sv_zoom' => $latlongval->sv_zoom, 'tooltip' => $birth->getPlace()->getGedcomName());
                                switch ($child->getSex()) {
                                    case 'M':
                                        $gmarks[$i]['fact_label'] = I18N::translate('son');
                                        $gmarks[$i]['class'] = 'person_box';
                                        break;
                                    case 'F':
                                        $gmarks[$i]['fact_label'] = I18N::translate('daughter');
                                        $gmarks[$i]['class'] = 'person_boxF';
                                        break;
                                    default:
                                        $gmarks[$i]['fact_label'] = I18N::translate('child');
                                        $gmarks[$i]['class'] = 'option_boxNN';
                                        break;
                                }
                                if ($GM_MAX_ZOOM > $latlongval->pl_zoom) {
                                    $GM_MAX_ZOOM = $latlongval->pl_zoom;
                                }
                            }
                        }
                    }
                }
            }
        }
        // *** ENABLE STREETVIEW ***
        $STREETVIEW = $this->getSetting('GM_USE_STREETVIEW');
        ?>

		<script>
			// this variable will collect the html which will eventually be placed in the side_bar
//.........这里部分代码省略.........
开发者ID:bxbroze,项目名称:webtrees,代码行数:101,代码来源:GoogleMapsModule.php

示例4: fillTimeline

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

示例5: printFamilyFacts

 /**
  * Print the facts
  */
 public function printFamilyFacts()
 {
     global $linkToID;
     $linkToID = $this->record->getXref();
     // -- Tell addmedia.php what to link to
     $indifacts = $this->record->getFacts();
     if ($indifacts) {
         Functions::sortFacts($indifacts);
         foreach ($indifacts as $fact) {
             FunctionsPrintFacts::printFact($fact, $this->record);
         }
     } else {
         echo '<tr><td class="messagebox" colspan="2">', I18N::translate('No facts exist for this family.'), '</td></tr>';
     }
     if (Auth::isEditor($this->record->getTree())) {
         FunctionsPrint::printAddNewFact($this->record->getXref(), $indifacts, 'FAM');
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Note');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','NOTE');\">", I18N::translate('Add a note'), '</a>';
         echo '</td></tr>';
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Shared note');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SHARED_NOTE');\">", I18N::translate('Add a shared note'), '</a>';
         echo '</td></tr>';
         if ($this->record->getTree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($this->record->getTree())) {
             echo '<tr><td class="descriptionbox">';
             echo I18N::translate('Media object');
             echo '</td><td class="optionbox">';
             echo "<a href=\"#\" onclick=\"window.open('addmedia.php?action=showmediaform&amp;linktoid=" . $this->record->getXref() . "', '_blank', edit_window_specs); return false;\">", I18N::translate('Add a media object'), '</a>';
             echo FunctionsPrint::helpLink('OBJE');
             echo '<br>';
             echo "<a href=\"#\" onclick=\"window.open('inverselink.php?linktoid=" . $this->record->getXref() . "&amp;linkto=family', '_blank', find_window_specs); return false;\">", I18N::translate('Link to an existing media object'), '</a>';
             echo '</td></tr>';
         }
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Source');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SOUR');\">", I18N::translate('Add a source citation'), '</a>';
         echo '</td></tr>';
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:46,代码来源:FamilyController.php

示例6: getTabContent

 /** {@inheritdoc} */
 public function getTabContent()
 {
     global $controller;
     $EXPAND_HISTO_EVENTS = false;
     $indifacts = array();
     // The individual’s own facts
     foreach ($controller->record->getFacts() as $fact) {
         switch ($fact->getTag()) {
             case 'SEX':
             case 'NAME':
             case 'SOUR':
             case 'OBJE':
             case 'NOTE':
             case 'FAMC':
             case 'FAMS':
                 break;
             default:
                 if (!array_key_exists('extra_info', Module::getActiveSidebars($controller->record->getTree())) || !ExtraInformationModule::showFact($fact)) {
                     $indifacts[] = $fact;
                 }
                 break;
         }
     }
     // Add spouse-family facts
     foreach ($controller->record->getSpouseFamilies() as $family) {
         foreach ($family->getFacts() as $fact) {
             switch ($fact->getTag()) {
                 case 'SOUR':
                 case 'NOTE':
                 case 'OBJE':
                 case 'CHAN':
                 case '_UID':
                 case 'RIN':
                 case 'HUSB':
                 case 'WIFE':
                 case 'CHIL':
                     break;
                 default:
                     $indifacts[] = $fact;
                     break;
             }
         }
         $spouse = $family->getSpouse($controller->record);
         if ($spouse) {
             foreach (self::spouseFacts($controller->record, $spouse) as $fact) {
                 $indifacts[] = $fact;
             }
         }
         foreach (self::childFacts($controller->record, $family, '_CHIL', '') as $fact) {
             $indifacts[] = $fact;
         }
     }
     foreach (self::parentFacts($controller->record, 1) as $fact) {
         $indifacts[] = $fact;
     }
     foreach (self::historicalFacts($controller->record) as $fact) {
         $indifacts[] = $fact;
     }
     foreach (self::associateFacts($controller->record) as $fact) {
         $indifacts[] = $fact;
     }
     Functions::sortFacts($indifacts);
     ob_start();
     echo '<table class="facts_table">';
     echo '<tbody>';
     if (!$indifacts) {
         echo '<tr><td colspan="2" class="facts_value">', I18N::translate('There are no facts for this individual.'), '</td></tr>';
     }
     echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" ';
     echo $controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS') ? 'checked' : '';
     echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', I18N::translate('Events of close relatives'), '</label>';
     if (file_exists(Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) {
         echo ' <input id="checkbox_histo" type="checkbox" ';
         echo $EXPAND_HISTO_EVENTS ? 'checked' : '';
         echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', I18N::translate('Historical facts'), '</label>';
     }
     echo '</form></td></tr>';
     foreach ($indifacts as $fact) {
         FunctionsPrintFacts::printFact($fact, $controller->record);
     }
     //-- new fact link
     if ($controller->record->canEdit()) {
         FunctionsPrint::printAddNewFact($controller->record->getXref(), $indifacts, 'INDI');
     }
     echo '</tbody>';
     echo '</table>';
     if (!$controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS')) {
         echo '<script>jQuery("tr.rela").toggle();</script>';
     }
     if (!$EXPAND_HISTO_EVENTS) {
         echo '<script>jQuery("tr.histo").toggle();</script>';
     }
     return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:95,代码来源:IndividualFactsTabModule.php

示例7: getFacts

 /**
  * The facts and events for this record.
  *
  * @param string    $filter
  * @param bool      $sort
  * @param int|null  $access_level
  * @param bool      $override     Include private records, to allow us to implement $SHOW_PRIVATE_RELATIONSHIPS and $SHOW_LIVING_NAMES.
  *
  * @return Fact[]
  */
 public function getFacts($filter = null, $sort = false, $access_level = null, $override = false)
 {
     if ($access_level === null) {
         $access_level = Auth::accessLevel($this->tree);
     }
     $facts = array();
     if ($this->canShow($access_level) || $override) {
         foreach ($this->facts as $fact) {
             if (($filter === null || preg_match('/^' . $filter . '$/', $fact->getTag())) && $fact->canShow($access_level)) {
                 $facts[] = $fact;
             }
         }
     }
     if ($sort) {
         Functions::sortFacts($facts);
     }
     return $facts;
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:28,代码来源:GedcomRecord.php

示例8: factsStartHandler

 /**
  * XML <Facts>
  *
  * @param array $attrs an array of key value pairs for the attributes
  */
 private function factsStartHandler($attrs)
 {
     global $WT_TREE;
     $this->process_repeats++;
     if ($this->process_repeats > 1) {
         return;
     }
     array_push($this->repeats_stack, array($this->repeats, $this->repeat_bytes));
     $this->repeats = array();
     $this->repeat_bytes = xml_get_current_line_number($this->parser);
     $id = "";
     $match = array();
     if (preg_match("/0 @(.+)@/", $this->gedrec, $match)) {
         $id = $match[1];
     }
     $tag = "";
     if (isset($attrs['ignore'])) {
         $tag .= $attrs['ignore'];
     }
     if (preg_match("/\\\$(.+)/", $tag, $match)) {
         $tag = $this->vars[$match[1]]['id'];
     }
     $record = GedcomRecord::getInstance($id, $WT_TREE);
     if (empty($attrs['diff']) && !empty($id)) {
         $facts = $record->getFacts();
         Functions::sortFacts($facts);
         $this->repeats = array();
         $nonfacts = explode(',', $tag);
         foreach ($facts as $event) {
             if (!in_array($event->getTag(), $nonfacts)) {
                 $this->repeats[] = $event->getGedcom();
             }
         }
     } else {
         foreach ($record->getFacts() as $fact) {
             if ($fact->isPendingAddition() && $fact->getTag() !== 'CHAN') {
                 $this->repeats[] = $fact->getGedcom();
             }
         }
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:46,代码来源:ReportParserGenerate.php

示例9: buildIndividualMap

    /**
     * Build a map for an individual.
     *
     * @param Individual $indi
     */
    private function buildIndividualMap(Individual $indi)
    {
        $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
        $facts = $indi->getFacts();
        foreach ($indi->getSpouseFamilies() as $family) {
            $facts = array_merge($facts, $family->getFacts());
            // Add birth of children from this family to the facts array
            foreach ($family->getChildren() as $child) {
                $facts[] = $child->getFirstFact('BIRT');
            }
        }
        $facts = array_values(array_filter($facts, function ($item) {
            // remove null facts (child without birth event) and
            // facts without places
            return !is_null($item) && !$item->getPlace()->isEmpty();
        }));
        Functions::sortFacts($facts);
        // At this point we have an array of valid sorted facts
        // so now build the data structures needed for the map display
        $events = array();
        $unique_places = array();
        foreach ($facts as $fact) {
            $place_data = $this->getPlaceData($fact);
            if (!empty($place_data)) {
                $index = $place_data['index'];
                if ($place_data['mapdata']['pl_zoom']) {
                    $GM_MAX_ZOOM = min($GM_MAX_ZOOM, $place_data['mapdata']['pl_zoom']);
                }
                // Produce the html for the sidebar
                $parent = $fact->getParent();
                if ($parent instanceof Individual && $parent->getXref() !== $indi->getXref()) {
                    // Childs birth
                    $name = '<a href="' . $parent->getHtmlUrl() . '">' . $parent->getFullName() . '</a>';
                    $label = strtr($parent->getSex(), array('F' => I18N::translate('Birth of a daughter'), 'M' => I18N::translate('Birth of a son'), 'U' => I18N::translate('Birth of a child')));
                    $class = 'person_box' . strtr($parent->getSex(), array('F' => 'F', 'M' => '', 'U' => 'NN'));
                    $evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>';
                } else {
                    $spouse = $parent instanceof Family ? $parent->getSpouse($indi) : null;
                    $name = $spouse ? '<a href="' . $spouse->getHtmlUrl() . '">' . $spouse->getFullName() . '</a>' : '';
                    $label = $fact->getLabel();
                    $class = 'optionbox';
                    if ($fact->getValue() && $spouse) {
                        $evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getValue() . '</div><strong>' . $name . '</strong>' . $fact->getDate()->display(true) . '</div>';
                    } elseif ($spouse) {
                        $evtStr = '<div class="gm-event">' . $label . '<div><strong>' . $name . '</strong></div>' . $fact->getDate()->display(true) . '</div>';
                    } elseif ($fact->getValue()) {
                        $evtStr = '<div class="gm-event">' . $label . '<div> ' . $fact->getValue() . '</div>' . $fact->getDate()->display(true) . '</div>';
                    } else {
                        $evtStr = '<div class="gm-event">' . $label . '<div>' . $fact->getDate()->display(true) . '</div></div>';
                    }
                }
                if (empty($unique_places[$index])) {
                    $unique_places[$index] = $place_data['mapdata'];
                }
                $unique_places[$index]['events'] .= $evtStr;
                $events[] = array('class' => $class, 'fact_label' => $label, 'date' => $fact->getDate()->display(true), 'info' => $fact->getValue(), 'name' => $name, 'place' => '<a href="' . $fact->getPlace()->getURL() . '">' . $fact->getPlace()->getFullName() . '</a>', 'placeid' => $index);
            }
        }
        if (!empty($events)) {
            $places = array_keys($unique_places);
            ob_start();
            // Create the normal googlemap sidebar of events and children
            echo '<div class="gm-events"><table class="facts_table">';
            foreach ($events as $event) {
                $index = array_search($event['placeid'], $places);
                echo '<tr>';
                echo '<td class="facts_label">';
                echo '<a href="#" onclick="return openInfowindow(\'', $index, '\')">', $event['fact_label'], '</a></td>';
                echo '<td class="', $event['class'], '">';
                if ($event['info']) {
                    echo '<div><span class="field">', Filter::escapeHtml($event['info']), '</span></div>';
                }
                if ($event['name']) {
                    echo '<div>', $event['name'], '</div>';
                }
                echo '<div>', $event['place'], '</div>';
                if ($event['date']) {
                    echo '<div>', $event['date'], '</div>';
                }
                echo '</td>';
                echo '</tr>';
            }
            echo '</table></div>';
            // *** ENABLE STREETVIEW ***
            $STREETVIEW = (bool) $this->getSetting('GM_USE_STREETVIEW');
            ?>

			<script>
				var map_center = new google.maps.LatLng(0, 0);
				var gmarkers   = [];
				var gicons     = [];
				var map        = null;
				var head       = '';
				var dir        = '';
				var svzoom     = '';
//.........这里部分代码省略.........
开发者ID:tronsmit,项目名称:webtrees,代码行数:101,代码来源:GoogleMapsModule.php

示例10: foreach

    // at a scale of 25 or higher, show every year
    $mod = 25 / $controller->scale;
    if ($mod < 1) {
        $mod = 1;
    }
    for ($i = $controller->baseyear + 1; $i < $controller->topyear; $i++) {
        if ($i % $mod === 0) {
            echo '<div id="scale' . $i . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left: ' . $basexoffset : 'right: ' . $basexoffset) . 'px; top:' . ($baseyoffset + ($i - $controller->baseyear) * $controller->scale - $controller->scale / 2) . 'px; font-size: 7pt; text-align:' . (I18N::direction() === 'ltr' ? 'left' : 'right') . ';">';
            echo $i . '—';
            echo '</div>';
        }
    }
    echo '<div id="scale' . $controller->topyear . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left: ' . $basexoffset : 'right: ' . $basexoffset) . 'px; top:' . ($baseyoffset + ($controller->topyear - $controller->baseyear) * $controller->scale) . 'px; font-size: 7pt; text-align:' . (I18N::direction() === 'ltr' ? 'left' : 'right') . ';">';
    echo $controller->topyear . '—';
    echo '</div>';
    Functions::sortFacts($controller->indifacts);
    $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 
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:timeline.php

示例11: foreach

global $WT_TREE;
use Fisharebest\Webtrees\Functions\Functions;
define('WT_SCRIPT_NAME', 'expand_view.php');
require './includes/session.php';
header('Content-Type: text/html; charset=UTF-8');
$individual = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
if (!$individual || !$individual->canShow()) {
    return I18N::translate('Private');
}
$facts = $individual->getFacts();
foreach ($individual->getSpouseFamilies() as $family) {
    foreach ($family->getFacts() as $fact) {
        $facts[] = $fact;
    }
}
Functions::sortFacts($facts);
foreach ($facts as $fact) {
    switch ($fact->getTag()) {
        case 'ADDR':
        case 'ALIA':
        case 'ASSO':
        case 'CHAN':
        case 'CHIL':
        case 'EMAIL':
        case 'FAMC':
        case 'FAMS':
        case 'HUSB':
        case 'NAME':
        case 'NOTE':
        case 'OBJE':
        case 'PHON':
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:expand_view.php


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