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


PHP Individual::getInstance方法代码示例

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


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

示例1: __construct

 /**
  * Create the chart controller
  *
  * @param int $show_full needed for use by charts module
  */
 public function __construct($show_full = 1)
 {
     global $WT_TREE;
     parent::__construct();
     $rootid = Filter::get('rootid', WT_REGEX_XREF);
     $this->root = Individual::getInstance($rootid, $WT_TREE);
     if (!$this->root) {
         // Missing root individual? Show the chart for someone.
         $this->root = $this->getSignificantIndividual();
     }
     if (!$this->root || !$this->root->canShowName()) {
         http_response_code(404);
         $this->error_message = I18N::translate('This individual does not exist or you do not have permission to view it.');
     }
     // Extract parameter from form
     if ($show_full) {
         $this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS'));
     } else {
         $this->show_full = 0;
     }
     $this->box = new \stdClass();
     if ($this->showFull()) {
         $this->box->width = Theme::theme()->parameter('chart-box-x');
         $this->box->height = Theme::theme()->parameter('chart-box-y');
     } else {
         $this->box->width = Theme::theme()->parameter('compact-chart-box-x');
         $this->box->height = Theme::theme()->parameter('compact-chart-box-y');
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:34,代码来源:ChartController.php

示例2: getIntance

 /**
  * Extend \Fisharebest\Webtrees\Individual getInstance, in order to retrieve directly a  object 
  * 
  * @param string $xref
  * @param Tree $tree
  * @param null|string $gedcom
  * @return null|Individual
  */
 public static function getIntance($xref, Tree $tree, $gedcom = null)
 {
     $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom);
     if ($indi) {
         return new Individual($indi);
     }
     return null;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:16,代码来源:Individual.php

示例3: getBlock

 /**
  * Generate the HTML content of this block.
  *
  * @param int      $block_id
  * @param bool     $template
  * @param string[] $cfg
  *
  * @return string
  */
 public function getBlock($block_id, $template = true, $cfg = array())
 {
     global $WT_TREE;
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = $this->getTitle();
     $anonymous = 0;
     $logged_in = array();
     $content = '';
     foreach (User::allLoggedIn() as $user) {
         if (Auth::isAdmin() || $user->getPreference('visibleonline')) {
             $logged_in[] = $user;
         } else {
             $anonymous++;
         }
     }
     $count_logged_in = count($logged_in);
     $content .= '<div class="logged_in_count">';
     if ($anonymous) {
         $content .= I18N::plural('%s anonymous signed-in user', '%s anonymous signed-in users', $anonymous, I18N::number($anonymous));
         if ($count_logged_in) {
             $content .= '&nbsp;|&nbsp;';
         }
     }
     if ($count_logged_in) {
         $content .= I18N::plural('%s signed-in user', '%s signed-in users', $count_logged_in, I18N::number($count_logged_in));
     }
     $content .= '</div>';
     $content .= '<div class="logged_in_list">';
     if (Auth::check()) {
         foreach ($logged_in as $user) {
             $individual = Individual::getInstance($WT_TREE->getUserPreference($user, 'gedcomid'), $WT_TREE);
             $content .= '<div class="logged_in_name">';
             if ($individual) {
                 $content .= '<a href="' . $individual->getHtmlUrl() . '">' . $user->getRealNameHtml() . '</a>';
             } else {
                 $content .= $user->getRealNameHtml();
             }
             $content .= ' - ' . Filter::escapeHtml($user->getUserName());
             if (Auth::id() != $user->getUserId() && $user->getPreference('contactmethod') != 'none') {
                 $content .= ' <a class="icon-email" href="#" onclick="return message(\'' . Filter::escapeHtml($user->getUserName()) . '\', \'\', \'' . Filter::escapeHtml(Functions::getQueryUrl()) . '\');" title="' . I18N::translate('Send a message') . '"></a>';
             }
             $content .= '</div>';
         }
     }
     $content .= '</div>';
     if ($anonymous === 0 && $count_logged_in === 0) {
         return '';
     }
     if ($template) {
         return Theme::theme()->formatBlock($id, $title, $class, $content);
     } else {
         return $content;
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:64,代码来源:LoggedInUsersModule.php

示例4: computeAll

 /**
  * Compute all Sosa ancestors from the user's root individual.
  * @return bool Result of the computation
  */
 public function computeAll()
 {
     $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID');
     $indi = Individual::getInstance($root_id, $this->tree);
     if ($indi) {
         $this->sosa_provider->deleteAll();
         $this->addNode($indi, 1);
         $this->flushTmpSosaTable(true);
         return true;
     }
     return false;
 }
开发者ID:jon48,项目名称:webtrees-lib,代码行数:16,代码来源:SosaCalculator.php

示例5: __construct

 /**
  * Startup activity
  */
 public function __construct()
 {
     global $WT_TREE;
     $xref = Filter::get('pid', WT_REGEX_XREF);
     $this->record = Individual::getInstance($xref, $WT_TREE);
     if (!$this->record && $WT_TREE->getPreference('USE_RIN')) {
         $rin = FunctionsDb::findRin($xref);
         $this->record = Individual::getInstance($rin, $WT_TREE);
     }
     parent::__construct();
     // If we can display the details, add them to the page header
     if ($this->record && $this->record->canShow()) {
         $this->setPageTitle($this->record->getFullName() . ' ' . $this->record->getLifespan());
         $this->tabs = Module::getActiveTabs($this->record->getTree());
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:19,代码来源:IndividualController.php

示例6: __construct

 /**
  * Startup activity
  */
 public function __construct()
 {
     global $WT_TREE;
     parent::__construct();
     $this->setPageTitle(I18N::translate('Lifespans'));
     $this->facts = explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_DEAT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV);
     $tmp = explode('\\', get_class(I18N::defaultCalendar()));
     $cal = strtolower(array_pop($tmp));
     $this->defaultCalendar = str_replace('calendar', '', $cal);
     $filterPids = false;
     // Request parameters
     $clear = Filter::getBool('clear');
     $newpid = Filter::get('newpid', WT_REGEX_XREF);
     $addfam = Filter::getBool('addFamily');
     $this->place = Filter::get('place');
     $this->beginYear = Filter::getInteger('beginYear', 0, PHP_INT_MAX, null);
     $this->endYear = Filter::getInteger('endYear', 0, PHP_INT_MAX, null);
     $this->calendar = Filter::get('calendar', null, $this->defaultCalendar);
     $this->strictDate = Filter::getBool('strictDate');
     // Set up base color parameters
     $this->colors['M'] = new ColorGenerator(240, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE * -1);
     $this->colors['F'] = new ColorGenerator(00, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE);
     // Build a list of people based on the input parameters
     if ($clear) {
         // Empty list & reset form
         $xrefs = array();
         $this->place = null;
         $this->beginYear = null;
         $this->endYear = null;
         $this->calendar = $this->defaultCalendar;
     } elseif ($this->place) {
         // Get all individual & family records found for a place
         $this->place_obj = new Place($this->place, $WT_TREE);
         $xrefs = Database::prepare("SELECT DISTINCT `i_id` FROM `##placelinks`" . " JOIN `##individuals` ON `pl_gid`=`i_id` AND `pl_file`=`i_file`" . " WHERE `i_file`=:tree_id" . " AND `pl_p_id`=:place_id" . " UNION" . " SELECT DISTINCT `f_id` FROM `##placelinks`" . " JOIN `##families` ON `pl_gid`=`f_id` AND `pl_file`=`f_file`" . " WHERE `f_file`=:tree_id" . " AND `pl_p_id`=:place_id")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'place_id' => $this->place_obj->getPlaceId()))->fetchOneColumn();
     } else {
         // Modify an existing list of records
         $xrefs = Session::get(self::SESSION_DATA, array());
         if ($newpid) {
             $xrefs = array_merge($xrefs, $this->addFamily(Individual::getInstance($newpid, $WT_TREE), $addfam));
             $xrefs = array_unique($xrefs);
         } elseif (!$xrefs) {
             $xrefs = $this->addFamily($this->getSignificantIndividual(), false);
         }
     }
     $tmp = $this->getCalendarDate(unixtojd());
     $this->currentYear = $tmp->today()->y;
     $tmp = strtoupper(strtr($this->calendar, array('jewish' => 'hebrew', 'french' => 'french r')));
     $this->calendarEscape = sprintf('@#D%s@', $tmp);
     if ($xrefs) {
         // ensure date ranges are valid in preparation for filtering list
         if ($this->beginYear || $this->endYear) {
             $filterPids = true;
             if (!$this->beginYear) {
                 $tmp = new Date($this->calendarEscape . ' 1');
                 $this->beginYear = $tmp->minimumDate()->y;
             }
             if (!$this->endYear) {
                 $this->endYear = $this->currentYear;
             }
             $this->startDate = new Date($this->calendarEscape . $this->beginYear);
             $this->endDate = new Date($this->calendarEscape . $this->endYear);
         }
         // Test each xref to see if the search criteria are met
         foreach ($xrefs as $key => $xref) {
             $valid = false;
             $person = Individual::getInstance($xref, $WT_TREE);
             if ($person) {
                 if ($person->canShow()) {
                     foreach ($person->getFacts() as $fact) {
                         if ($this->checkFact($fact)) {
                             $this->people[] = $person;
                             $valid = true;
                             break;
                         }
                     }
                 }
             } else {
                 $family = Family::getInstance($xref, $WT_TREE);
                 if ($family && $family->canShow() && $this->checkFact($family->getMarriage())) {
                     $valid = true;
                     $this->people[] = $family->getHusband();
                     $this->people[] = $family->getWife();
                 }
             }
             if (!$valid) {
                 unset($xrefs[$key]);
                 // no point in storing a xref if we can't use it
             }
         }
         Session::put(self::SESSION_DATA, $xrefs);
     } else {
         Session::forget(self::SESSION_DATA);
     }
     $this->people = array_filter(array_unique($this->people));
     $count = count($this->people);
     if ($count) {
         // Build the subtitle
//.........这里部分代码省略.........
开发者ID:tronsmit,项目名称:webtrees,代码行数:101,代码来源:LifespanController.php

示例7: foreach

         http_response_code(406);
     }
     break;
 case 'masquerade':
     $user = User::find(Filter::postInteger('user_id'));
     if ($user && Auth::isAdmin() && Auth::user() !== $user) {
         Log::addAuthenticationLog('Masquerade as user: ' . $user->getUserName());
         Auth::login($user);
     } else {
         http_response_code(406);
     }
     break;
 case 'unlink-media':
     // Remove links from an individual and their spouse-family records to a media object.
     // Used by the "unlink" option on the album (lightbox) tab.
     $source = Individual::getInstance(Filter::post('source', WT_REGEX_XREF), $WT_TREE);
     $target = Filter::post('target', WT_REGEX_XREF);
     if ($source && $source->canShow() && $source->canEdit() && $target) {
         // Consider the individual and their spouse-family records
         $sources = $source->getSpouseFamilies();
         $sources[] = $source;
         foreach ($sources as $source) {
             foreach ($source->getFacts() as $fact) {
                 if (!$fact->isPendingDeletion()) {
                     if ($fact->getValue() == '@' . $target . '@') {
                         // Level 1 links
                         $source->deleteFact($fact->getFactId(), true);
                     } elseif (strpos($fact->getGedcom(), ' @' . $target . '@')) {
                         // Level 2-3 links
                         $source->updateFact($fact->getFactId(), preg_replace(array('/\\n2 OBJE @' . $target . '@(\\n[3-9].*)*/', '/\\n3 OBJE @' . $target . '@(\\n[4-9].*)*/'), '', $fact->getGedcom()), true);
                     }
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:action.php

示例8: formatFactDate

 /**
  * Print fact DATE/TIME
  *
  * @param Fact $event event containing the date/age
  * @param GedcomRecord $record the person (or couple) whose ages should be printed
  * @param bool $anchor option to print a link to calendar
  * @param bool $time option to print TIME value
  *
  * @return string
  */
 public static function formatFactDate(Fact $event, GedcomRecord $record, $anchor, $time)
 {
     global $pid;
     $factrec = $event->getGedcom();
     $html = '';
     // Recorded age
     if (preg_match('/\\n2 AGE (.+)/', $factrec, $match)) {
         $fact_age = $match[1];
     } else {
         $fact_age = '';
     }
     if (preg_match('/\\n2 HUSB\\n3 AGE (.+)/', $factrec, $match)) {
         $husb_age = $match[1];
     } else {
         $husb_age = '';
     }
     if (preg_match('/\\n2 WIFE\\n3 AGE (.+)/', $factrec, $match)) {
         $wife_age = $match[1];
     } else {
         $wife_age = '';
     }
     // Calculated age
     if (preg_match('/\\n2 DATE (.+)/', $factrec, $match)) {
         $date = new Date($match[1]);
         $html .= ' ' . $date->display($anchor);
         // time
         if ($time && preg_match('/\\n3 TIME (.+)/', $factrec, $match)) {
             $html .= ' – <span class="date">' . $match[1] . '</span>';
         }
         $fact = $event->getTag();
         if ($record instanceof Individual) {
             if ($fact === 'BIRT' && $record->getTree()->getPreference('SHOW_PARENTS_AGE')) {
                 // age of parents at child birth
                 $html .= self::formatParentsAges($record, $date);
             } elseif ($fact !== 'CHAN' && $fact !== '_TODO') {
                 // age at event
                 $birth_date = $record->getBirthDate();
                 // Can't use getDeathDate(), as this also gives BURI/CREM events, which
                 // wouldn't give the correct "days after death" result for people with
                 // no DEAT.
                 $death_event = $record->getFirstFact('DEAT');
                 if ($death_event) {
                     $death_date = $death_event->getDate();
                 } else {
                     $death_date = new Date('');
                 }
                 $ageText = '';
                 if (Date::compare($date, $death_date) <= 0 || !$record->isDead() || $fact == 'DEAT') {
                     // Before death, print age
                     $age = Date::getAgeGedcom($birth_date, $date);
                     // Only show calculated age if it differs from recorded age
                     if ($age != '') {
                         if ($fact_age != '' && $fact_age != $age || $fact_age == '' && $husb_age == '' && $wife_age == '' || $husb_age != '' && $record->getSex() == 'M' && $husb_age != $age || $wife_age != '' && $record->getSex() == 'F' && $wife_age != $age) {
                             if ($age != "0d") {
                                 $ageText = '(' . I18N::translate('Age') . ' ' . FunctionsDate::getAgeAtEvent($age, false) . ')';
                             }
                         }
                     }
                 }
                 if ($fact != 'DEAT' && Date::compare($date, $death_date) >= 0) {
                     // After death, print time since death
                     $age = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($death_date, $date), true);
                     if ($age != '') {
                         if (Date::getAgeGedcom($death_date, $date) == "0d") {
                             $ageText = '(' . I18N::translate('on the date of death') . ')';
                         } else {
                             $ageText = '(' . $age . ' ' . I18N::translate('after death') . ')';
                             // Family events which occur after death are probably errors
                             if ($event->getParent() instanceof Family) {
                                 $ageText .= '<i class="icon-warning"></i>';
                             }
                         }
                     }
                 }
                 if ($ageText) {
                     $html .= ' <span class="age">' . $ageText . '</span>';
                 }
             }
         } elseif ($record instanceof Family) {
             $indi = Individual::getInstance($pid, $record->getTree());
             if ($indi) {
                 $birth_date = $indi->getBirthDate();
                 $death_date = $indi->getDeathDate();
                 $ageText = '';
                 if (Date::compare($date, $death_date) <= 0) {
                     $age = Date::getAgeGedcom($birth_date, $date);
                     // Only show calculated age if it differs from recorded age
                     if ($age != '' && $age > 0) {
                         if ($fact_age != '' && $fact_age != $age || $fact_age == '' && $husb_age == '' && $wife_age == '' || $husb_age != '' && $indi->getSex() == 'M' && $husb_age != $age || $wife_age != '' && $indi->getSex() == 'F' && $wife_age != $age) {
                             $ageText = '(' . I18N::translate('Age') . ' ' . FunctionsDate::getAgeAtEvent($age, false) . ')';
//.........这里部分代码省略.........
开发者ID:jflash,项目名称:webtrees,代码行数:101,代码来源:FunctionsPrint.php

示例9: pageBody


//.........这里部分代码省略.........
</th>
												<?php 
            if (!$this->options('use_fullname')) {
                ?>
													<th><?php 
                echo I18N::translate('Surname in page title');
                ?>
</th>
												<?php 
            }
            ?>
												<th><?php 
            echo I18N::translate('Page title');
            ?>
</th>
												<th><?php 
            echo I18N::translate('Access level');
            ?>
</th>
												<th><?php 
            echo I18N::translate('Delete');
            ?>
</th>
											</tr>
										</thead>
										<tbody>
											<?php 
            foreach ($FTV_SETTINGS as $key => $this_ITEM) {
                ?>
												<?php 
                if ($this_ITEM['TREE'] == $this->tree_id) {
                    ?>
													<?php 
                    if (Individual::getInstance($this_ITEM['PID'], $this->tree)) {
                        ?>
														<tr class="sortme">
															<!-- ROOT PERSONS FULL NAME -->
															<td>
																<input
																	name="pid[<?php 
                        echo $key;
                        ?>
]"
																	type="hidden"
																	value="<?php 
                        echo $this_ITEM['PID'];
                        ?>
"
																	>
																<input
																	name="sort[<?php 
                        echo $key;
                        ?>
]"
																	type="hidden"
																	value="<?php 
                        echo $this_ITEM['SORT'];
                        ?>
"
																	>
																	<?php 
                        echo Individual::getInstance($this_ITEM['PID'], $this->tree)->getFullName() . '';
                        ?>
																(<?php 
                        echo Individual::getInstance($this_ITEM['PID'], $this->tree)->getLifeSpan();
                        ?>
开发者ID:bxbroze,项目名称:webtrees,代码行数:67,代码来源:AdminTemplate.php

示例10: checkform

            if (!Auth::user()->getPreference('canadmin')) {
                // Keep a reference to the currently logged in user because after logging out this user,
                // a call to Auth::user() will not return this user anymore
                $currentUser = Auth::user();
                Auth::logout();
                $currentUser->delete();
            }
            break;
    }
    header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
    return;
}
$controller = new PageController();
$controller->setPageTitle(I18N::translate('My account'))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
$my_individual_record = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE);
$default_individual = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'rootid'), $WT_TREE);
// Form validation
?>
<script>
function checkform(frm) {
	if (frm.form_username.value=="") {
		alert("<?php 
echo I18N::translate('You must enter a user name.');
?>
");
		frm.form_username.focus();
		return false;
	}
	if (frm.form_realname.value=="") {
		alert("<?php 
echo I18N::translate('You must enter a real name.');
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:edituser.php

示例11: getTarget

 /**
  * Get the record to which this fact links
  *
  * @return Individual|Family|Source|Repository|Media|Note|null
  */
 public function getTarget()
 {
     $xref = trim($this->getValue(), '@');
     switch ($this->tag) {
         case 'FAMC':
         case 'FAMS':
             return Family::getInstance($xref, $this->getParent()->getTree());
         case 'HUSB':
         case 'WIFE':
         case 'CHIL':
             return Individual::getInstance($xref, $this->getParent()->getTree());
         case 'SOUR':
             return Source::getInstance($xref, $this->getParent()->getTree());
         case 'OBJE':
             return Media::getInstance($xref, $this->getParent()->getTree());
         case 'REPO':
             return Repository::getInstance($xref, $this->getParent()->getTree());
         case 'NOTE':
             return Note::getInstance($xref, $this->getParent()->getTree());
         default:
             return GedcomRecord::getInstance($xref, $this->getParent()->getTree());
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:28,代码来源:Fact.php

示例12: getCartList

 /**
  * A list for the side bar.
  *
  * @return string
  */
 public function getCartList()
 {
     global $WT_TREE;
     $cart = Session::get('cart', array());
     if (!array_key_exists($WT_TREE->getTreeId(), $cart)) {
         $cart[$WT_TREE->getTreeId()] = array();
     }
     $pid = Filter::get('pid', WT_REGEX_XREF);
     if (!$cart[$WT_TREE->getTreeId()]) {
         $out = I18N::translate('Your clippings cart is empty.');
     } else {
         $out = '<ul>';
         foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
             $record = GedcomRecord::getInstance($xref, $WT_TREE);
             if ($record instanceof Individual || $record instanceof Family) {
                 switch ($record::RECORD_TYPE) {
                     case 'INDI':
                         $icon = 'icon-indis';
                         break;
                     case 'FAM':
                         $icon = 'icon-sfamily';
                         break;
                 }
                 $out .= '<li>';
                 if (!empty($icon)) {
                     $out .= '<i class="' . $icon . '"></i>';
                 }
                 $out .= '<a href="' . $record->getHtmlUrl() . '">';
                 if ($record instanceof Individual) {
                     $out .= $record->getSexImage();
                 }
                 $out .= ' ' . $record->getFullName() . ' ';
                 if ($record instanceof Individual && $record->canShow()) {
                     $out .= ' (' . $record->getLifeSpan() . ')';
                 }
                 $out .= '</a>';
                 $out .= '<a class="icon-remove remove_cart" href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;remove=' . $xref . '&amp;pid=' . $pid . '" title="' . I18N::translate('Remove') . '"></a>';
                 $out .= '</li>';
             }
         }
         $out .= '</ul>';
     }
     if ($cart[$WT_TREE->getTreeId()]) {
         $out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' . I18N::translate('Empty the clippings cart') . '</a>' . '<br>' . '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' . I18N::translate('Download') . '</a>';
     }
     $record = Individual::getInstance($pid, $WT_TREE);
     if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) {
         $out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;add=' . $pid . '&amp;pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>';
     }
     return $out;
 }
开发者ID:josefpavlik,项目名称:webtrees,代码行数:56,代码来源:ClippingsCartModule.php

示例13: advancedSearch


//.........这里部分代码省略.........
                                 $sql .= " AND {$table}.n_givn = LIKE CONCAT('%', ?, '%')";
                                 $bind[] = $value;
                             }
                             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] = "{$table}.n_soundex_givn_dm LIKE CONCAT('%', ?, '%')";
                                     $bind[] = $v;
                                 }
                                 $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
                                 break;
                             } else {
                                 // No phonetic content?  Use a substring match
                                 $sql .= " AND {$table}.n_givn = LIKE CONCAT('%', ?, '%')";
                                 $bind[] = $value;
                             }
                     }
                     break;
                 case 'SURN':
                     switch ($parts[4]) {
                         case 'EXACT':
                             $sql .= " AND {$table}.n_surname=?";
                             $bind[] = $value;
                             break;
                         case 'BEGINS':
                             $sql .= " AND {$table}.n_surname LIKE CONCAT(?, '%')";
                             $bind[] = $value;
                             break;
                         case 'CONTAINS':
                             $sql .= " AND {$table}.n_surname LIKE CONCAT('%', ?, '%')";
                             $bind[] = $value;
                             break;
                         case 'SDX_STD':
                             $sdx = Soundex::russell($value);
                             if ($sdx !== null) {
                                 $sdx = explode(':', $sdx);
                                 foreach ($sdx as $k => $v) {
                                     $sdx[$k] = "{$table}.n_soundex_surn_std LIKE CONCAT('%', ?, '%')";
                                     $bind[] = $v;
                                 }
                                 $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
                             } else {
                                 // No phonetic content?  Use a substring match
                                 $sql .= " AND {$table}.n_surn = LIKE CONCAT('%', ?, '%')";
                                 $bind[] = $value;
                             }
                             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] = "{$table}.n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
                                     $bind[] = $v;
                                 }
                                 $sql .= ' AND (' . implode(' OR ', $sdx) . ')';
                             } else {
                                 // No phonetic content?  Use a substring match
                                 $sql .= " AND {$table}.n_surn = LIKE CONCAT('%', ?, '%')";
                                 $bind[] = $value;
                             }
                             break;
                     }
                     break;
             }
         } elseif ($parts[0] == 'FAMS') {
             // e.g. searches for occupation, religion, note, etc.
             $sql .= " AND fam.f_gedcom REGEXP CONCAT('\n[0-9] ', ?, '(.*\n[0-9] CONT)* [^\n]*', ?)";
             $bind[] = $parts[1];
             $bind[] = $value;
         } else {
             // e.g. searches for occupation, religion, note, etc.
             $sql .= " AND ind.i_gedcom REGEXP CONCAT('\n[0-9] ', ?, '(.*\n[0-9] CONT)* [^\n]*', ?)";
             $bind[] = $parts[0];
             $bind[] = $value;
         }
     }
     $rows = Database::prepare($sql)->execute($bind)->fetchAll();
     foreach ($rows as $row) {
         $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
         // Check for XXXX:PLAC fields, which were only partially matched by SQL
         foreach ($this->fields as $n => $field) {
             if ($this->values[$n] && preg_match('/^(' . WT_REGEX_TAG . '):PLAC$/', $field, $match)) {
                 if (!preg_match('/\\n1 ' . $match[1] . '(\\n[2-9].*)*\\n2 PLAC .*' . preg_quote($this->values[$n], '/') . '/i', $person->getGedcom())) {
                     continue 2;
                 }
             }
         }
         $this->myindilist[] = $person;
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:101,代码来源:AdvancedSearchController.php

示例14: getSignificantIndividual

 /**
  * Get significant information from this page, to allow other pages such as
  * charts and reports to initialise with the same records
  *
  * @return Individual
  */
 public function getSignificantIndividual()
 {
     global $WT_TREE;
     static $individual;
     // Only query the DB once.
     if (!$individual && $WT_TREE->getUserPreference(Auth::user(), 'rootid')) {
         $individual = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'rootid'), $WT_TREE);
     }
     if (!$individual && $WT_TREE->getUserPreference(Auth::user(), 'gedcomid')) {
         $individual = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE);
     }
     if (!$individual) {
         $individual = Individual::getInstance($WT_TREE->getPreference('PEDIGREE_ROOT_ID'), $WT_TREE);
     }
     if (!$individual) {
         $individual = Individual::getInstance(Database::prepare("SELECT MIN(i_id) FROM `##individuals` WHERE i_file=?")->execute(array($WT_TREE->getTreeId()))->fetchOne(), $WT_TREE);
     }
     if (!$individual) {
         // always return a record
         $individual = new Individual('I', '0 @I@ INDI', null, $WT_TREE);
     }
     return $individual;
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:29,代码来源:PageController.php

示例15:

				<input
					class="form-control"
					data-autocomplete-type="INDI"
					dir="ltr"
					id="PEDIGREE_ROOT_ID"
					maxlength="20"
					name="PEDIGREE_ROOT_ID"
					type="text"
					value="<?php 
    echo $WT_TREE->getPreference('PEDIGREE_ROOT_ID');
    ?>
"
				>
				<span class="input-group-addon">
					<?php 
    $person = Individual::getInstance($WT_TREE->getPreference('PEDIGREE_ROOT_ID'), $WT_TREE);
    if ($person) {
        echo $person->getFullName(), ' ', $person->getLifeSpan();
    } else {
        echo I18N::translate('Unable to find record with ID');
    }
    ?>
				</span>
			</div>
			<p class="small text-muted">
				<?php 
    echo I18N::translate('This individual will be selected by default when viewing charts and reports.');
    ?>
			</p>
		</div>
	</div>
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:admin_trees_config.php


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