• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Webtrees\Date类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Fisharebest\Webtrees\Date的典型用法代码示例。如果您正苦于以下问题:PHP Date类的具体用法?PHP Date怎么用?PHP Date使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: isSourced

 /**
  * Check if a fact has a date and is sourced
  * Values:
  * 		- 0, if no date is found for the fact
  * 		- -1, if the date is not precise
  * 		- -2, if the date is precise, but no source is found
  * 		- 1, if the date is precise, and a source is found
  * 		- 2, if the date is precise, a source exists, and is supported by a certificate (requires _ACT usage)
  * 		- 3, if the date is precise, a source exists, and the certificate supporting the fact is within an acceptable range of date
  *
  * @return int Level of sources
  */
 public function isSourced()
 {
     $isSourced = 0;
     $date = $this->fact->getDate();
     if ($date->isOK()) {
         $isSourced = -1;
         if ($date->qual1 == '' && $date->minimumJulianDay() == $date->maximumJulianDay()) {
             $isSourced = -2;
             $citations = $this->fact->getCitations();
             foreach ($citations as $citation) {
                 $isSourced = max($isSourced, 1);
                 if (preg_match('/3 _ACT (.*)/', $citation)) {
                     $isSourced = max($isSourced, 2);
                     preg_match_all("/4 DATE (.*)/", $citation, $datessource, PREG_SET_ORDER);
                     foreach ($datessource as $daterec) {
                         $datesource = new Date($daterec[1]);
                         if (abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN) {
                             $isSourced = max($isSourced, 3);
                             //If this level increases, do not forget to change the constant MAX_IS_SOURCED_LEVEL
                         }
                     }
                 }
             }
         }
     }
     return $isSourced;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:39,代码来源:Fact.php


示例2: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getSex() === 'F') {
         return '';
     } else {
         return (string) Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:16,代码来源:CensusColumnAgeMale.php


示例3: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getSex() === 'M') {
         return '';
     } else {
         $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
         if ($years > 15) {
             $years -= $years % 5;
         }
         return (string) $years;
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:20,代码来源:CensusColumnAgeFemale5Years.php


示例4: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getBirthDate()->isOK()) {
         foreach ($individual->getSpouseFamilies() as $family) {
             foreach ($family->getFacts('MARR', true) as $fact) {
                 if ($fact->getDate()->isOK()) {
                     return Date::getAge($individual->getBirthDate(), $fact->getDate(), 0);
                 }
             }
         }
     }
     return '';
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:21,代码来源:CensusColumnAgeMarried.php


示例5: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getSex() !== 'F') {
         return '';
     }
     $count = 0;
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getChildren() as $child) {
             if ($child->getBirthDate()->isOK() && Date::compare($child->getBirthDate(), $this->date()) < 0 && $child->getBirthDate() != $child->getDeathDate() && (!$child->getDeathDate()->isOK() || Date::compare($child->getDeathDate(), $this->date()) > 0)) {
                 $count++;
             }
         }
     }
     return (string) $count;
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:23,代码来源:CensusColumnChildrenLiving.php


示例6: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     $marriage_date = null;
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getFacts('MARR', true) as $fact) {
             if ($fact->getDate()->isOK() && Date::compare($fact->getDate(), $this->date()) <= 0) {
                 $marriage_date = $fact->getDate();
             }
         }
     }
     if ($marriage_date === null) {
         return '';
     } else {
         return (string) Date::getAge($marriage_date, $this->date(), 0);
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:24,代码来源:CensusColumnYearsMarried.php


示例7: generate

 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     $place = $individual->getBirthPlace();
     // Did we emigrate or naturalise?
     foreach ($individual->getFacts('IMMI|EMIG|NATU', true) as $fact) {
         if (Date::compare($fact->getDate(), $this->date()) <= 0) {
             $place = $fact->getPlace()->getGedcomName();
         }
     }
     $place = explode(', ', $place);
     $place = end($place);
     if ($place === 'England' || $place === 'Scotland' || $place === 'Wales') {
         return 'British';
     } else {
         return $place;
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:25,代码来源:CensusColumnNationality.php


示例8: nameAtCensusDate

 /**
  * What was an individual's likely name on a given date, allowing
  * for marriages and married names.
  *
  * @param Individual $individual
  * @param Date       $census_date
  *
  * @return string[]
  */
 protected function nameAtCensusDate(Individual $individual, Date $census_date)
 {
     $names = $individual->getAllNames();
     $name = $names[0];
     foreach ($individual->getSpouseFamilies() as $family) {
         foreach ($family->getFacts('MARR') as $marriage) {
             if ($marriage->getDate()->isOK() && Date::compare($marriage->getDate(), $census_date) < 0) {
                 $spouse = $family->getSpouse($individual);
                 foreach ($names as $individual_name) {
                     foreach ($spouse->getAllNames() as $spouse_name) {
                         if ($individual_name['type'] === '_MARNM' && $individual_name['surn'] === $spouse_name['surn']) {
                             return $individual_name;
                         }
                     }
                 }
             }
         }
     }
     return $name;
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:29,代码来源:CensusColumnFullName.php


示例9: renderContent


//.........这里部分代码省略.........
        				<a <?php 
                    echo $title . ' ' . $class;
                    ?>
 href="<?php 
                    echo $person->getHtmlUrl();
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
                    ?>
        				</a>
        				<?php 
                    echo $sex_image . FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller');
                    ?>
        				<br/>
            		<?php 
                }
                echo $person->getPrimaryParentsNames('parents details1', 'none');
                ?>
            		</td>
            		<td style="display:none;"></td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
                ?>
            		</td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
                ?>
            		</td>
            		<td>
            		<?php 
                if ($birth_dates = $person->getAllBirthDates()) {
                    foreach ($birth_dates as $num => $birth_date) {
                        if ($num) {
                            ?>
<br/><?php 
                        }
                        ?>
    						<?php 
                        echo $birth_date->display(true);
                    }
                } else {
                    $birth_date = new Date('');
                    if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
                        $birth_date = $person->getEstimatedBirthDate();
                        echo $birth_date->display(true);
                    } else {
                        echo '&nbsp;';
                    }
                    $birth_dates[0] = new Date('');
                }
                ?>
            		</td>
            		<td><?php 
                echo $birth_date->julianDay();
                ?>
</td>
        			<td>
        			<?php 
                foreach ($person->getAllBirthPlaces() as $n => $birth_place) {
                    $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree());
                    if ($n) {
                        ?>
<br><?php 
开发者ID:jon48,项目名称:webtrees-lib,代码行数:67,代码来源:SosaListIndiView.php


示例10: compare

 /**
  * Compare two dates, so they can be sorted.
  *
  * return <0 if $a<$b
  * return >0 if $b>$a
  * return  0 if dates same/overlap
  * BEF/AFT sort as the day before/after
  *
  * @param Date $a
  * @param Date $b
  *
  * @return int
  */
 public static function compare(Date $a, Date $b)
 {
     // Get min/max JD for each date.
     switch ($a->qual1) {
         case 'BEF':
             $amin = $a->minimumJulianDay() - 1;
             $amax = $amin;
             break;
         case 'AFT':
             $amax = $a->maximumJulianDay() + 1;
             $amin = $amax;
             break;
         default:
             $amin = $a->minimumJulianDay();
             $amax = $a->maximumJulianDay();
             break;
     }
     switch ($b->qual1) {
         case 'BEF':
             $bmin = $b->minimumJulianDay() - 1;
             $bmax = $bmin;
             break;
         case 'AFT':
             $bmax = $b->maximumJulianDay() + 1;
             $bmin = $bmax;
             break;
         default:
             $bmin = $b->minimumJulianDay();
             $bmax = $b->maximumJulianDay();
             break;
     }
     if ($amax < $bmin) {
         return -1;
     } elseif ($amin > $bmax && $bmax > 0) {
         return 1;
     } elseif ($amin < $bmin && $amax <= $bmax) {
         return -1;
     } elseif ($amin > $bmin && $amax >= $bmax && $bmax > 0) {
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:56,代码来源:Date.php


示例11: renderFamSosaListIndi


//.........这里部分代码省略.........
						/* 11-SURN,GIVN */ { type: "unicode", visible: false},
						/* 12-Wife Age  */ { dataSort: 13, class: "center"},
						/* 13-AGE       */ { type: "num", visible: false},
						/* 14-Marr Date */ { dataSort: 15, class: "center"},
						/* 15-MARR:DATE */ { visible: false},
						/* 16-Marr Plac */ { type: "unicode", class: "center"},
						/* 17-Marr Sour */ { dataSort : 18, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' },
						/* 18-Sort Sour */ { visible: false},
						/* 19-Children  */ { dataSort: 20, class: "center"},
						/* 20-NCHI      */ { type: "num", visible: false},
						/* 21-MARR      */ { visible: false},
						/* 22-DEAT      */ { visible: false},
						/* 23-TREE      */ { visible: false}
					],
					sorting: [[0, "asc"]],
					displayLength: 16,
					pagingType: "full_numbers"
			   });
					
				jQuery("#' . $table_id . '")
				/* Hide/show parents */
				.on("click", ".btn-toggle-parents", function() {
					jQuery(this).toggleClass("ui-state-active");
					jQuery(".parents", jQuery(this).closest("table").DataTable().rows().nodes()).slideToggle();
				})
				/* Hide/show statistics */
				.on("click",  ".btn-toggle-statistics", function() {
					jQuery(this).toggleClass("ui-state-active");
					jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle();
				})
				/* Filter buttons in table header */
				.on("click", "button[data-filter-column]", function() {
					var btn = $(this);
					// De-activate the other buttons in this button group
					btn.siblings().removeClass("ui-state-active");
					// Apply (or clear) this filter
					var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column"));
					if (btn.hasClass("ui-state-active")) {
						btn.removeClass("ui-state-active");
						col.search("").draw();
					} else {
						btn.addClass("ui-state-active");
						col.search(btn.data("filter-value")).draw();
					}
				});					
				
				jQuery("#sosa-fam-list").css("visibility", "visible");
				
				jQuery("#btn-toggle-statistics-' . $table_id . '").click();
           ');
            $stats = new Stats($WT_TREE);
            $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1;
            //-- init chart data
            $marr_by_age = array();
            for ($age = 0; $age <= $max_age; $age++) {
                $marr_by_age[$age] = '';
            }
            $birt_by_decade = array();
            $marr_by_decade = array();
            for ($year = 1550; $year < 2030; $year += 10) {
                $birt_by_decade[$year] = '';
                $marr_by_decade[$year] = '';
            }
            foreach ($listFamSosa as $sosa => $fid) {
                $sfamily = Family::getInstance($fid, $WT_TREE);
                if (!$sfamily || !$sfamily->canShow()) {
                    unset($sfamily[$sosa]);
                    continue;
                }
                $mdate = $sfamily->getMarriageDate();
                if (($husb = $sfamily->getHusband()) && ($hdate = $husb->getBirthDate()) && $hdate->isOK() && $mdate->isOK()) {
                    if (FunctionsPrint::isDateWithinChartsRange($hdate)) {
                        $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
                    }
                    $hage = Date::getAge($hdate, $mdate, 0);
                    if ($hage >= 0 && $hage <= $max_age) {
                        $marr_by_age[$hage] .= $husb->getSex();
                    }
                }
                if (($wife = $sfamily->getWife()) && ($wdate = $wife->getBirthDate()) && $wdate->isOK() && $mdate->isOK()) {
                    if (FunctionsPrint::isDateWithinChartsRange($wdate)) {
                        $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
                    }
                    $wage = Date::getAge($wdate, $mdate, 0);
                    if ($wage >= 0 && $wage <= $max_age) {
                        $marr_by_age[$wage] .= $wife->getSex();
                    }
                }
                if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) {
                    $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex();
                }
                $listFamSosa[$sosa] = $sfamily;
            }
            $this->view_bag->set('sosa_list', $listFamSosa);
            $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth')));
            $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage')));
            $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage')));
        }
        ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render();
    }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:101,代码来源:SosaListController.php


示例12: updateDates

 /**
  * Extract all the dates from the given record and insert them into the database.
  *
  * @param string $xref
  * @param int    $ged_id
  * @param string $gedrec
  */
 public static function updateDates($xref, $ged_id, $gedrec)
 {
     if (strpos($gedrec, '2 DATE ') && preg_match_all("/\n1 (\\w+).*(?:\n[2-9].*)*(?:\n2 DATE (.+))(?:\n[2-9].*)*/", $gedrec, $matches, PREG_SET_ORDER)) {
         foreach ($matches as $match) {
             $fact = $match[1];
             if (($fact == 'FACT' || $fact == 'EVEN') && preg_match("/\n2 TYPE ([A-Z]{3,5})/", $match[0], $tmatch)) {
                 $fact = $tmatch[1];
             }
             $date = new Date($match[2]);
             Database::prepare("INSERT INTO `##dates` (d_day,d_month,d_mon,d_year,d_julianday1,d_julianday2,d_fact,d_gid,d_file,d_type) VALUES (?,?,?,?,?,?,?,?,?,?)")->execute(array($date->minimumDate()->d, $date->minimumDate()->format('%O'), $date->minimumDate()->m, $date->minimumDate()->y, $date->minimumDate()->minJD, $date->minimumDate()->maxJD, $fact, $xref, $ged_id, $date->minimumDate()->format('%@')));
             if ($date->minimumDate() !== $date->maximumDate()) {
                 Database::prepare("INSERT INTO `##dates` (d_day,d_month,d_mon,d_year,d_julianday1,d_julianday2,d_fact,d_gid,d_file,d_type) VALUES (?,?,?,?,?,?,?,?,?,?)")->execute(array($date->maximumDate()->d, $date->maximumDate()->format('%O'), $date->maximumDate()->m, $date->maximumDate()->y, $date->maximumDate()->minJD, $date->maximumDate()->maxJD, $fact, $xref, $ged_id, $date->maximumDate()->format('%@')));
             }
         }
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:23,代码来源:FunctionsImport.php


示例13: renderContent


//.........这里部分代码省略.........
                ?>
						<th>&nbsp;</th>
						<th></th>
						<?php 
            }
            ?>
						<th><i class="icon-children" title="<?php 
            echo I18N::translate('Children');
            ?>
"></i></th>
						<th>NCHI</th>
						<th>MARR</th>
						<th>DEAT</th>
						<th>TREE</th>
					</tr>
				</thead>
				<tbody>
			
			<?php 
            foreach ($this->data->get('sosa_list') as $sosa => $family) {
                /** @var \Fisharebest\Webtrees\Family $person */
                //PERSO Create decorator for Family
                $dfamily = new Family($family);
                $husb = $family->getHusband();
                if (is_null($husb)) {
                    $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree());
                }
                $dhusb = new \MyArtJaub\Webtrees\Individual($husb);
                $wife = $family->getWife();
                if (is_null($wife)) {
                    $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree());
                }
                $dwife = new \MyArtJaub\Webtrees\Individual($wife);
                $mdate = $family->getMarriageDate();
                if ($family->isPendingAddtion()) {
                    $class = ' class="new"';
                } elseif ($family->isPendingDeletion()) {
                    $class = ' class="old"';
                } else {
                    $class = '';
                }
                ?>
			
        		<tr <?php 
                echo $class;
                ?>
>
        			<td class="transparent"><?php 
                echo I18N::translate('%1$d/%2$d', $sosa, ($sosa + 1) % 10);
                ?>
</td>
        			<td class="transparent"><?php 
                echo $sosa;
                ?>
</td>
        			<!--  HUSBAND -->
        			<td colspan="2">
        			<?php 
                foreach ($husb->getAllNames() as $num => $name) {
                    if ($name['type'] == 'NAME') {
                        $title = '';
                    } else {
                        $title = 'title="' . strip_tags(GedcomTag::getLabel($name['type'], $husb)) . '"';
                    }
                    if ($num == $husb->getPrimaryName()) {
                        $class = ' class="name2"';
开发者ID:jon48,项目名称:webtrees-lib,代码行数:67,代码来源:SosaListFamView.php


示例14: foreach

         $gedrec .= FunctionsEdit::addNewFact($match);
     }
 }
 $gedrec .= "\n" . GedcomCodePedi::createNewFamcPedi($PEDI, $xref);
 if (Filter::postBool('SOUR_INDI')) {
     $gedrec = FunctionsEdit::handleUpdates($gedrec);
 } else {
     $gedrec = FunctionsEdit::updateRest($gedrec);
 }
 // Create the new child
 $new_child = $family->getTree()->createRecord($gedrec);
 // Insert new child at the right place
 $done = false;
 foreach ($family->getFacts('CHIL') as $fact) {
     $old_child = $fact->getTarget();
     if ($old_child && Date::compare($new_child->getEstimatedBirthDate(), $old_child->getEstimatedBirthDate()) < 0) {
         // Insert before this child
         $family->updateFact($fact->getFactId(), '1 CHIL @' . $new_child->getXref() . "@\n" . $fact->getGedcom(), !$keep_chan);
         $done = true;
         break;
     }
 }
 if (!$done) {
     // Append child at end
     $family->createFact('1 CHIL @' . $new_child->getXref() . '@', !$keep_chan);
 }
 if (Filter::post('goto') === 'new') {
     $controller->addInlineJavascript('closePopupAndReloadParent("' . $new_child->getRawUrl() . '");');
 } else {
     $controller->addInlineJavascript('closePopupAndReloadParent();');
 }
开发者ID:jflash,项目名称:webtrees,代码行数:31,代码来源:edit_interface.php


示例15: eventQuery

 /**
  * Events
  *
  * @param string $type
  * @param string $direction
  * @param string $facts
  *
  * @return string
  */
 private function eventQuery($type, $direction, $facts)
 {
     $eventTypes = array('BIRT' => I18N::translate('birth'), 'DEAT' => I18N::translate('death'), 'MARR' => I18N::translate('marriage'), 'ADOP' => I18N::translate('adoption'), 'BURI' => I18N::translate('burial'), 'CENS' => I18N::translate('census added'));
     $fact_query = "IN ('" . str_replace('|', "','", $facts) . "')";
     if ($direction != 'ASC') {
         $direction = 'DESC';
     }
     $rows = $this->runSql('' . ' SELECT SQL_CACHE' . ' d_gid AS id,' . ' d_year AS year,' . ' d_fact AS fact,' . ' d_type AS type' . ' FROM' . " `##dates`" . ' WHERE' . " d_file={$this->tree->getTreeId()} AND" . " d_gid<>'HEAD' AND" . " d_fact {$fact_query} AND" . ' d_julianday1<>0' . ' ORDER BY' . " d_julianday1 {$direction}, d_type LIMIT 1");
     if (!isset($rows[0])) {
         return '';
     }
     $row = $rows[0];
     $record = GedcomRecord::getInstance($row['id'], $this->tree);
     switch ($type) {
         default:
         case 'full':
             if ($record->canShow()) {
                 $result = $record->formatList('span', false, $record->getFullName());
             } else {
                 $result = I18N::translate('This information is private and cannot be shown.');
             }
             break;
         case 'year':
             $date = new Date($row['type'] . ' ' . $row['year']);
             $result = $date->display();
             break;
         case 'type':
             if (isset($eventTypes[$row['fact']])) {
                 $result = $eventTypes[$row['fact']];
             } else {
                 $result = GedcomTag::getLabel($row['fact']);
             }
             break;
         case 'name':
             $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>";
             break;
         case 'place':
             $fact = $record->getFirstFact($row['fact']);
             if ($fact) {
                 $result = FunctionsPrint::formatFactPlace($fact, true, true, true);
             } else {
                 $result = I18N::translate('Private');
             }
             break;
     }
     return $result;
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:56,代码来源:Stats.php


示例16: Date

use Fisharebest\Webtrees\Census\CensusInterface;
use Fisharebest\Webtrees\Controller\SimpleController;
use Fisharebest\Webtrees\Module\CensusAssistantModule;
/** @var SimpleController $controller */
global $controller;
/** @var Tree $WT_TREE */
global $WT_TREE;
$xref = Filter::get('xref', WT_REGEX_XREF);
$census = Filter::get('census');
$head = Individual::getInstance($xref, $WT_TREE);
check_record_access($head);
$controller->restrictAccess(class_exists($census));
/** @var CensusInterface */
$census = new $census();
$controller->restrictAccess($census instanceof CensusInterface);
$date = new Date($census->censusDate());
$year = strip_tags($date->display(false, '%Y', false));
$headImg = '<i class="icon-button_head"></i>';
$controller->setPageTitle(I18N::translate('Create a new shared note using assistant'))->addInlineJavascript('jQuery("head").append(\'<link rel="stylesheet" href="' . WT_STATIC_URL . WT_MODULES_DIR . 'GEDFact_assistant/census/style.css" type="text/css">\');' . 'jQuery("#tblSample").on("click", ".icon-remove", function() { jQuery(this).closest("tr").remove(); });')->pageHeader();
?>

<h2>
	<?php 
echo $controller->getPageTitle();
?>
</h2>

<form method="post" action="edit_interface.php" onsubmit="updateCensusText();">
	<input type="hidden" name="action" value="addnoteaction_assisted">
	<input type="hidden" name="noteid" value="newnote">
	<input id="pid_array" type="hidden" name="pid_array" value="none">
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:census-edit.php


示例17: compareDate

 /**
  * Static Helper functions to sort events
  *
  * @param Fact $a Fact one
  * @param Fact $b Fact two
  *
  * @return int
  */
 public static function compareDate(Fact $a, Fact $b)
 {
     if ($a->getDate()->isOK() && $b->getDate()->isOK()) {
         // If both events have dates, compare by date
         $ret = Date::compare($a->getDate(), $b->getDate());
         if ($ret == 0) {
             // If dates are the same, compare by fact type
             $ret = self::compareType($a, $b);
             // If the fact type is also the same, retain the initial order
             if ($ret == 0) {
                 $ret = $a->sortOrder - $b->sortOrder;
             }
         }
         return $ret;
     } else {
         // One or both events have no date - retain the initial order
         return $a->sortOrder - $b->sortOrder;
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:27,代码来源:Fact.php


示例18: advancedSearch


//.........这里部分代码省略.........
                             }
                             break;
                         case 'SDX':
                             // SDX uses DM by default.
                         // SDX uses DM by default.
                         case 'SDX_DM':
                             $sdx = Soundex::daitchMokotoff($value);
                             if ($sdx !== null) {
                                 $sdx = explode(':', $sdx);
                                 foreach ($sdx as $k => $v) {
                                     $sdx[$k] = "i_n.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
                                     $bind[] = $v;
                                 }
                                 $sql .= " AND (" . implode(' OR ', $sdx) . ")";
                                 break;
                             } else {
                                 // No phonetic content?  Use a substring match
                                 $sql .= " AND i_n.n_surn LIKE CONCAT('%', ?, '%')";
                                 $bind[] = $value;
                             }
                     }
                     break;
                 case 'NICK':
                 case '_MARNM':
                 case '_HEB':
                 case '_AKA':
                     $sql .= " AND i_n.n_type=? AND i_n.n_full LIKE CONCAT('%', ?, '%')";
                     $bind[] = $parts[1];
                     $bind[] = $value;
                     break;
             }
         } elseif ($parts[1] == 'DATE') {
             // *:DATE
             $date = new Date($value);
             if ($date->isOK()) {
                 $jd1 = $date->minimumJulianDay();
                 $jd2 = $date->maximumJulianDay();
                 if (!empty($this->plusminus[$i])) {
                     $adjd = $this->plusminus[$i] * 365;
                     $jd1 -= $adjd;
                     $jd2 += $adjd;
                 }
                 $sql .= " AND i_d.d_fact=? AND i_d.d_julianday1>=? AND i_d.d_julianday2<=?";
                 $bind[] = $parts[0];
                 $bind[] = $jd1;
                 $bind[] = $jd2;
             }
         } elseif ($parts[0] == 'FAMS' && $parts[2] == 'DATE') {
             // FAMS:*:DATE
             $date = new Date($value);
             if ($date->isOK()) {
                 $jd1 = $date->minimumJulianDay();
                 $jd2 = $date->maximumJulianDay();
                 if (!empty($this->plusminus[$i])) {
                     $adjd = $this->plusminus[$i] * 365;
                     $jd1 -= $adjd;
                     $jd2 += $adjd;
                 }
                 $sql .= " AND f_d.d_fact=? AND f_d.d_julianday1>=? AND f_d.d_julianday2<=?";
                 $bind[] = $parts[1];
                 $bind[] = $jd1;
                 $bind[] = $jd2;
             }
         } elseif ($parts[1] == 'PLAC') {
             // *:PLAC
             // SQL can only link a place to a person/family, not to an event.
开发者ID:tunandras,项目名称:webtrees,代码行数:67,代码来源:AdvancedSearchController.php


示例19: Date

use Fisharebest\Webtrees\Census\CensusInterface;
use Fisharebest\Webtrees\Controller\SimpleController;
use Fisharebest\Webtrees\Module\CensusAssistantModule;
/** @var SimpleController $controller */
global $controller;
/** @var Tree $WT_TREE */
global $WT_TREE;
$xref = Filter::get('xref', WT_REGEX_XREF);
$census = Filter::get('census');
$head = Individual::getInstance($xref, $WT_TREE);
check_record_access($head);
$controller->restrictAccess(class_exists($census));
/** @var CensusInterface */
$census = new $census();
$controller->restrictAccess($census instanceof CensusInterface);
$date = new Date($census->censusDate());
$year = $date->minimumDate()->format('%Y');
$headImg = '<i class="icon-button_head"></i>';
$controller->setPageTitle(I18N::translate('Create a shared note using the census assistant'))->addInlineJavascript('jQuery("head").append(\'<link rel="stylesheet" href="' . WT_STATIC_URL . WT_MODULES_DIR . 'GEDFact_assistant/census/style.css" type="text/css">\');' . 'jQuery("#tblSample").on("click", ".icon-remove", function() { jQuery(this).closest("tr").remove(); });')->pageHeader();
?>

<h2>
	<?php 
echo $controller->getPageTitle();
?>
</h2>

<form method="post" action="edit_interface.php" onsubmit="updateCensusText();">
	<input type="hidden" name="action" value="addnoteaction_assisted">
	<input id="pid_array" type="hidden" name="pid_array" value="none">
	<input type="hidden" name="NOTE" id="NOTE">
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:census-edit.php


示例20: PageController

/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
define('WT_SCRIPT_NAME', 'admin_trees_config.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE));
$calendars = array('none' => I18N::translate('No calendar conversion')) + Date::calendarNames();
$french_calendar_start = new Date('22 SEP 1792');
$french_calendar_end = new Date('31 DEC 1805');
$gregorian_calendar_start = new Date('15 OCT 1582');
$hide_show = array(0 => I18N::translate('hide'), 1 => I18N::translate('show'));
$surname_list_styles = array('style1' => I18N::translate('list'), 'style2' => I18N::translate('table'), 'style3' => I18N::translate('tag cloud'));
$layouts = array(0 => I18N::translate('Portrait'), 1 => I18N::translate('Landscape'));
$one_to_nine = array();
for ($n = 1; $n <= 9; ++$n) {
    $one_to_nine[$n] = I18N::number($n);
}
$formats = array('' => I18N::translate('none'), 'markdown' => I18N::translate('markdown'));
$source_types = array(0 => I18N::translate('none'), 1 => I18N::translate('facts'), 2 => I18N::translate('records'));
$no_yes = array(0 => I18N::translate('no'), 1 => I18N::translate('yes'));
$PRIVACY_CONSTANTS = array('none' => I18N::translate('Show to visitors'), 'privacy' => I18N::translate('Show to members'), 'confidential' => I18N::translate('Show to managers'), 'hidden' => I18N::translate('Hide from everyone'));
$privacy = array(Auth::PRIV_PRIVATE => I18N::translate('Show to visitors'), Auth::PRIV_USER => I18N::translate('Show to members'), Auth::PRIV_NONE => I18N::translate('Show to managers'), Auth::PRIV_HIDE => I18N::translate('Hide from everyone'));
$tags = array_unique(array_merge(explode(',', $WT_TREE->getPreference('INDI_FACTS_ADD')), explode(',', $WT_TREE->getPreference('INDI_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('FAM_FACTS_ADD')), explode(',', $WT_TREE->getPreference('FAM_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('NOTE_FACTS_ADD')), explode(',', $WT_TREE->getPreference('NOTE_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('SOUR_FACTS_ADD')), explode(',', $WT_TREE->getPreference('SOUR_FACTS_UNIQUE')), explode(',', $WT_TREE->getPreference('REPO_FACTS_ADD')), explode(',', $WT_TREE->getPreference('REPO_FACTS_UNIQUE')), array('SOUR', 'REPO', 'OBJE', '_PRIM', 'NOTE', 'SUBM', 'SUBN', '_UID', 'CHAN')));
$all_tags = array();
foreach ($tags as $tag) {
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_trees_config.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Webtrees\Family类代码示例发布时间:2022-05-23
下一篇:
PHP Webtrees\Database类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap