idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
7,300 | protected function subtitle ( int $ count , Date $ start , Date $ end , string $ placename ) : string { if ( $ start -> isOK ( ) && $ end -> isOK ( ) && $ placename !== '' ) { return I18N :: plural ( '%s individual with events in %s between %s and %s' , '%s individuals with events in %s between %s and %s' , $ count , I... | Generate a subtitle based on filter parameters |
7,301 | public function registerPage ( ServerRequestInterface $ request ) : ResponseInterface { $ this -> checkRegistrationAllowed ( ) ; $ comments = $ request -> get ( 'comments' , '' ) ; $ email = $ request -> get ( 'email' , '' ) ; $ realname = $ request -> get ( 'realname' , '' ) ; $ username = $ request -> get ( 'username... | Show a registration page . |
7,302 | public function verifyPage ( ) : ResponseInterface { $ this -> checkRegistrationAllowed ( ) ; $ title = I18N :: translate ( 'User verification' ) ; return $ this -> viewResponse ( 'register-page' , [ 'title' => $ title , ] ) ; } | Show an email verification page . |
7,303 | public static function templeNames ( ) : array { $ temple_names = [ ] ; foreach ( self :: templeCodes ( ) as $ temple_code ) { $ temple_names [ $ temple_code ] = self :: templeName ( $ temple_code ) ; } uasort ( $ temple_names , '\Fisharebest\Webtrees\I18N::strcasecmp' ) ; return $ temple_names ; } | A sorted list of all temple names |
7,304 | public function asText ( ) : string { if ( $ this -> keyword === self :: KEYWORD_STILLBORN ) { return I18N :: translate ( '(stillborn)' ) ; } if ( $ this -> keyword === self :: KEYWORD_INFANT ) { return I18N :: translate ( '(in infancy)' ) ; } if ( $ this -> keyword === self :: KEYWORD_CHILD ) { return I18N :: translat... | Convert an age to localised text . |
7,305 | public function render ( $ renderer ) { if ( $ this -> x1 === ReportBaseElement :: CURRENT_POSITION ) { $ this -> x1 = $ renderer -> GetX ( ) ; } if ( $ this -> y1 === ReportBaseElement :: CURRENT_POSITION ) { $ this -> y1 = $ renderer -> GetY ( ) ; } if ( $ this -> x2 === ReportBaseElement :: CURRENT_POSITION ) { $ th... | PDF line renderer |
7,306 | public function render ( $ renderer ) { static $ lastpicbottom , $ lastpicpage , $ lastpicleft , $ lastpicright ; if ( $ renderer -> checkPageBreakPDF ( $ this -> height + 5 ) ) { $ this -> y = $ renderer -> GetY ( ) ; } $ curx = $ renderer -> GetX ( ) ; if ( $ this -> x === ReportBaseElement :: CURRENT_POSITION ) { $ ... | PDF image renderer |
7,307 | public function getPersons ( Tree $ tree , string $ request ) : string { $ json_requests = explode ( ';' , $ request ) ; $ r = [ ] ; foreach ( $ json_requests as $ json_request ) { $ firstLetter = substr ( $ json_request , 0 , 1 ) ; $ json_request = substr ( $ json_request , 1 ) ; switch ( $ firstLetter ) { case 'c' : ... | Return a JSON structure to a JSON request |
7,308 | private function getPersonDetails ( Individual $ individual , Family $ family = null ) : string { $ chart_url = route ( 'module' , [ 'module' => 'tree' , 'action' => 'Chart' , 'xref' => $ individual -> xref ( ) , 'ged' => $ individual -> tree ( ) -> name ( ) , ] ) ; $ hmtl = $ this -> getThumbnail ( $ individual ) ; $ ... | Return the details for a person |
7,309 | private function drawChildren ( Collection $ familyList , int $ gen = 1 , bool $ ajax = false ) : string { $ html = '' ; $ children2draw = [ ] ; $ f2load = [ ] ; foreach ( $ familyList as $ f ) { $ children = $ f -> children ( ) ; if ( $ children -> isNotEmpty ( ) ) { $ f2load [ ] = $ f -> xref ( ) ; foreach ( $ childr... | Draw the children for some families |
7,310 | private function drawPersonName ( Individual $ individual , string $ dashed ) : string { $ family = $ individual -> primaryChildFamily ( ) ; if ( $ family ) { $ family_name = strip_tags ( $ family -> fullName ( ) ) ; } else { $ family_name = I18N :: translateContext ( 'unknown family' , 'unknown' ) ; } switch ( $ indiv... | Draw a person name preceded by sex icon with parents as tooltip |
7,311 | public function value ( ) : string { if ( preg_match ( '/^1 (?:' . $ this -> tag . ') ?(.*(?:(?:\n2 CONT ?.*)*))/' , $ this -> gedcom , $ match ) ) { return preg_replace ( "/\n2 CONT ?/" , "\n" , $ match [ 1 ] ) ; } return '' ; } | Get the value of level 1 data in the fact Allow for multi - line values |
7,312 | public function target ( ) { $ xref = trim ( $ this -> value ( ) , '@' ) ; switch ( $ this -> tag ) { case 'FAMC' : case 'FAMS' : return Family :: getInstance ( $ xref , $ this -> record ( ) -> tree ( ) ) ; case 'HUSB' : case 'WIFE' : case 'CHIL' : return Individual :: getInstance ( $ xref , $ this -> record ( ) -> tre... | Get the record to which this fact links |
7,313 | public function attribute ( $ tag ) : string { if ( preg_match ( '/\n2 (?:' . $ tag . ') ?(.*(?:(?:\n3 CONT ?.*)*)*)/' , $ this -> gedcom , $ match ) ) { return preg_replace ( "/\n3 CONT ?/" , "\n" , $ match [ 1 ] ) ; } return '' ; } | Get the value of level 2 data in the fact |
7,314 | public function canShow ( int $ access_level = null ) : bool { if ( $ access_level === null ) { $ access_level = Auth :: accessLevel ( $ this -> record ( ) -> tree ( ) ) ; } if ( strpos ( $ this -> gedcom , "\n2 RESN confidential" ) !== false ) { return Auth :: PRIV_NONE >= $ access_level ; } if ( strpos ( $ this -> ge... | Do the privacy rules allow us to display this fact to the current user |
7,315 | public function canEdit ( ) : bool { if ( $ this -> isPendingDeletion ( ) ) { return false ; } if ( Auth :: isManager ( $ this -> record -> tree ( ) ) ) { return true ; } return Auth :: isEditor ( $ this -> record -> tree ( ) ) && strpos ( $ this -> gedcom , "\n2 RESN locked" ) === false && $ this -> getTag ( ) !== 'RE... | Check whether this fact is protected against edit |
7,316 | public function place ( ) : Place { if ( $ this -> place === null ) { $ this -> place = new Place ( $ this -> attribute ( 'PLAC' ) , $ this -> record ( ) -> tree ( ) ) ; } return $ this -> place ; } | The place where the event occured . |
7,317 | public function date ( ) : Date { if ( $ this -> date === null ) { $ this -> date = new Date ( $ this -> attribute ( 'DATE' ) ) ; } return $ this -> date ; } | Get the date for this fact . We can call this function many times especially when sorting so keep a copy of the date . |
7,318 | public function label ( ) : string { if ( ( $ this -> tag === 'FACT' || $ this -> tag === 'EVEN' ) && $ this -> attribute ( 'TYPE' ) !== '' ) { return I18N :: translate ( e ( $ this -> attribute ( 'TYPE' ) ) ) ; } return GedcomTag :: getLabel ( $ this -> tag , $ this -> record ) ; } | Get the name of this fact type for use as a label . |
7,319 | public function getCitations ( ) : array { preg_match_all ( '/\n(2 SOUR @(' . Gedcom :: REGEX_XREF . ')@(?:\n[3-9] .*)*)/' , $ this -> gedcom ( ) , $ matches , PREG_SET_ORDER ) ; $ citations = [ ] ; foreach ( $ matches as $ match ) { $ source = Source :: getInstance ( $ match [ 2 ] , $ this -> record ( ) -> tree ( ) ) ... | Source citations linked to this fact |
7,320 | public function getMedia ( ) : array { $ media = [ ] ; preg_match_all ( '/\n2 OBJE @(' . Gedcom :: REGEX_XREF . ')@/' , $ this -> gedcom ( ) , $ matches ) ; foreach ( $ matches [ 1 ] as $ match ) { $ obje = Media :: getInstance ( $ match , $ this -> record ( ) -> tree ( ) ) ; if ( $ obje && $ obje -> canShow ( ) ) { $ ... | Media objects linked to this fact |
7,321 | private static function dateComparator ( ) : Closure { return static function ( Fact $ a , Fact $ b ) : int { if ( $ a -> date ( ) -> isOK ( ) && $ b -> date ( ) -> isOK ( ) ) { $ ret = Date :: compare ( $ a -> date ( ) , $ b -> date ( ) ) ; if ( $ ret === 0 ) { $ ret = self :: typeComparator ( ) ( $ a , $ b ) ; if ( $... | Helper functions to sort facts |
7,322 | public static function typeComparator ( ) : Closure { static $ factsort = [ ] ; if ( empty ( $ factsort ) ) { $ factsort = array_flip ( self :: FACT_ORDER ) ; } return static function ( Fact $ a , Fact $ b ) use ( $ factsort ) : int { if ( $ a -> record instanceof Family && $ b -> record instanceof Family && $ a -> rec... | Helper functions to sort facts . |
7,323 | public static function sortFacts ( Collection $ unsorted ) : Collection { $ dated = [ ] ; $ nondated = [ ] ; $ sorted = [ ] ; $ order = 0 ; foreach ( $ unsorted as $ fact ) { $ fact -> sortOrder = $ order ; $ order ++ ; if ( $ fact -> date ( ) -> isOK ( ) ) { $ dated [ ] = $ fact ; } else { $ nondated [ ] = $ fact ; } ... | A multi - key sort 1 . First divide the facts into two arrays one set with dates and one set without dates 2 . Sort each of the two new arrays the date using the compare date function the non - dated using the compare type function 3 . Then merge the arrays back into the original array using the compare type function |
7,324 | protected function splitAlignText ( string $ data , int $ maxlen ) : string { $ RTLOrd = [ 215 , 216 , 217 , 218 , 219 , ] ; $ lines = explode ( "\n" , $ data ) ; if ( count ( $ lines ) > 1 ) { $ text = '' ; foreach ( $ lines as $ line ) { $ text .= $ this -> splitAlignText ( $ line , $ maxlen ) . "\n" ; } return $ tex... | split and center text by lines |
7,325 | protected function imageColor ( $ image , string $ css_color ) : int { return imagecolorallocate ( $ image , ( int ) hexdec ( substr ( $ css_color , 0 , 2 ) ) , ( int ) hexdec ( substr ( $ css_color , 2 , 2 ) ) , ( int ) hexdec ( substr ( $ css_color , 4 , 2 ) ) ) ; } | Convert a CSS color into a GD color . |
7,326 | public function numberToRomanNumerals ( int $ number ) : string { if ( $ number < 1 ) { return ( string ) $ number ; } $ roman = '' ; foreach ( self :: ROMAN_NUMERALS as $ key => $ value ) { while ( $ number >= $ key ) { $ roman .= $ value ; $ number -= $ key ; } } return $ roman ; } | Convert a decimal number to roman numerals |
7,327 | public function romanNumeralsToNumber ( string $ roman ) : int { $ num = 0 ; foreach ( self :: ROMAN_NUMERALS as $ key => $ value ) { while ( strpos ( $ roman , $ value ) === 0 ) { $ num += $ key ; $ roman = substr ( $ roman , strlen ( $ value ) ) ; } } return $ num ; } | Convert a roman numeral to decimal |
7,328 | public function getFavorites ( Tree $ tree ) : array { return DB :: table ( 'favorite' ) -> where ( 'gedcom_id' , '=' , $ tree -> id ( ) ) -> whereNull ( 'user_id' ) -> get ( ) -> map ( static function ( stdClass $ row ) use ( $ tree ) : stdClass { if ( $ row -> xref !== null ) { $ row -> record = GedcomRecord :: getIn... | Get the favorites for a family tree |
7,329 | private function getPluginList ( ) : array { $ plugins = [ ] ; $ files = glob ( __DIR__ . '/BatchUpdate/BatchUpdate*Plugin.php' , GLOB_NOSORT ) ; foreach ( $ files as $ file ) { $ base_class = basename ( $ file , '.php' ) ; if ( $ base_class !== 'BatchUpdateBasePlugin' ) { $ class = __NAMESPACE__ . '\\BatchUpdate\\' . ... | Scan the plugin folder for a list of plugins |
7,330 | private function allData ( BatchUpdateBasePlugin $ plugin , Tree $ tree ) : array { $ tmp = [ ] ; foreach ( $ plugin -> getRecordTypesToUpdate ( ) as $ type ) { switch ( $ type ) { case 'INDI' : $ rows = DB :: table ( 'individuals' ) -> where ( 'i_file' , '=' , $ tree -> id ( ) ) -> select ( [ 'i_id AS xref' , DB :: ra... | Fetch all records that might need updating . |
7,331 | private function findNextXref ( BatchUpdateBasePlugin $ plugin , string $ xref , array $ all_data , Tree $ tree ) : string { foreach ( array_keys ( $ all_data ) as $ key ) { if ( $ key > $ xref ) { $ record = $ this -> getRecord ( $ all_data [ $ key ] , $ tree ) ; if ( $ plugin -> doesRecordNeedUpdate ( $ record ) ) { ... | Find the next record that needs to be updated . |
7,332 | private function findPrevXref ( BatchUpdateBasePlugin $ plugin , string $ xref , array $ all_data , Tree $ tree ) : string { foreach ( array_reverse ( $ all_data ) as $ key => $ value ) { if ( $ key > $ xref ) { $ record = $ this -> getRecord ( $ all_data [ $ key ] , $ tree ) ; if ( $ plugin -> doesRecordNeedUpdate ( $... | Find the previous record that needs to be updated . |
7,333 | public function getStart ( ) : string { $ str = '<' . $ this -> tag . ' ' ; foreach ( $ this -> attrs as $ key => $ value ) { $ str .= $ key . '="' . $ value . '" ' ; } $ str .= '>' ; return $ str ; } | Get the start tag . |
7,334 | public function render ( $ renderer ) { $ renderer -> clearPageHeader ( ) ; foreach ( $ this -> elements as $ element ) { $ renderer -> addPageHeader ( $ element ) ; } } | PageHeader element renderer |
7,335 | private function allMediaFolders ( ) : Collection { $ base_folders = DB :: table ( 'gedcom_setting' ) -> where ( 'setting_name' , '=' , 'MEDIA_DIRECTORY' ) -> select ( DB :: raw ( "setting_value || 'dummy.jpeg' AS path" ) ) ; return DB :: table ( 'media_file' ) -> join ( 'gedcom_setting' , 'gedcom_id' , '=' , 'm_file' ... | Generate a list of all folders from all the trees . |
7,336 | private function allDiskFiles ( string $ media_folder , string $ subfolders ) : array { return $ this -> scanFolders ( WT_DATA_DIR . $ media_folder , $ subfolders === 'include' ) ; } | Fetch a list of all files on disk |
7,337 | private function mediaObjectInfo ( Media $ media ) : string { $ html = '<b><a href="' . e ( $ media -> url ( ) ) . '">' . $ media -> fullName ( ) . '</a></b>' . '<br><i>' . e ( $ media -> getNote ( ) ) . '</i></br><br>' ; $ linked = [ ] ; foreach ( $ media -> linkedIndividuals ( 'OBJE' ) as $ link ) { $ linked [ ] = '<... | Generate some useful information and links about a media object . |
7,338 | private function allMediaFiles ( string $ media_folder , string $ subfolders ) : array { $ query = DB :: table ( 'media_file' ) -> join ( 'gedcom_setting' , 'gedcom_id' , '=' , 'm_file' ) -> where ( 'setting_name' , '=' , 'MEDIA_DIRECTORY' ) -> where ( 'multimedia_file_refn' , 'LIKE' , '%/%' ) -> where ( 'multimedia_fi... | Fetch a list of all files on in the database . |
7,339 | public static function send ( UserInterface $ from , UserInterface $ to , UserInterface $ reply_to , $ subject , $ message_text , $ message_html ) : bool { try { $ message_text = preg_replace ( '/\r?\n/' , "\r\n" , $ message_text ) ; $ message_html = preg_replace ( '/\r?\n/' , "\r\n" , $ message_html ) ; $ message = ( ... | Send an external email message Caution! gmail may rewrite the From header unless you have added the address to your account . |
7,340 | public static function transport ( ) : Swift_Transport { switch ( Site :: getPreference ( 'SMTP_ACTIVE' ) ) { case 'sendmail' : return new Swift_SendmailTransport ( ) ; case 'external' : $ smtp_host = Site :: getPreference ( 'SMTP_HOST' ) ; $ smtp_port = ( int ) Site :: getPreference ( 'SMTP_PORT' , '25' ) ; $ smtp_aut... | Create a transport mechanism for sending mail |
7,341 | public static function optionsRestrictions ( $ include_empty ) : array { $ options = [ 'none' => I18N :: translate ( 'Show to visitors' ) , 'privacy' => I18N :: translate ( 'Show to members' ) , 'confidential' => I18N :: translate ( 'Show to managers' ) , 'locked' => I18N :: translate ( 'Only managers can edit' ) , ] ;... | A list of GEDCOM restrictions for inline data . |
7,342 | public static function optionsRestrictionsRule ( ) : array { $ options = [ 'none' => I18N :: translate ( 'Show to visitors' ) , 'privacy' => I18N :: translate ( 'Show to members' ) , 'confidential' => I18N :: translate ( 'Show to managers' ) , 'hidden' => I18N :: translate ( 'Hide from everyone' ) , ] ; return $ option... | A list of GEDCOM restrictions for privacy rules . |
7,343 | public static function addSimpleTags ( Tree $ tree , $ fact ) : void { if ( $ fact === 'MARR' ) { echo self :: addSimpleTag ( $ tree , '0 ' . $ fact . ' Y' ) ; } else { echo self :: addSimpleTag ( $ tree , '0 ' . $ fact ) ; } if ( ! in_array ( $ fact , Config :: nonDateFacts ( ) , true ) ) { echo self :: addSimpleTag (... | Add some empty tags to create a new fact . |
7,344 | public static function createAddForm ( Tree $ tree , $ fact ) : void { self :: $ tags = [ ] ; if ( substr ( $ fact , 0 , 5 ) === 'MARR_' ) { self :: $ tags [ 0 ] = 'MARR' ; echo self :: addSimpleTag ( $ tree , '1 MARR' ) ; self :: insertMissingSubtags ( $ tree , $ fact ) ; } else { self :: $ tags [ 0 ] = $ fact ; if ( ... | builds the form for adding new facts |
7,345 | public function getNote ( ) : string { if ( preg_match ( '/^0 @' . Gedcom :: REGEX_XREF . '@ NOTE ?(.*(?:\n1 CONT ?.*)*)/' , $ this -> gedcom . $ this -> pending , $ match ) ) { return preg_replace ( "/\n1 CONT ?/" , "\n" , $ match [ 1 ] ) ; } return '' ; } | Get the text contents of the note |
7,346 | private function whereFamily ( bool $ fams , Builder $ query ) : void { if ( $ fams ) { $ query -> join ( 'link' , static function ( JoinClause $ join ) : void { $ join -> on ( 'l_from' , '=' , 'n_id' ) -> on ( 'l_file' , '=' , 'n_file' ) -> where ( 'l_type' , '=' , 'FAMS' ) ; } ) ; } } | Restrict a query to individuals that are a spouse in a family record . |
7,347 | public function surnameAlpha ( bool $ marnm , bool $ fams , string $ locale , string $ collation ) : array { $ n_surn = $ this -> fieldWithCollation ( 'n_surn' , $ collation ) ; $ alphas = [ ] ; $ query = DB :: table ( 'name' ) -> where ( 'n_file' , '=' , $ this -> tree -> id ( ) ) ; $ this -> whereFamily ( $ fams , $ ... | Get a list of initial surname letters . |
7,348 | public function givenAlpha ( string $ surn , string $ salpha , bool $ marnm , bool $ fams , string $ locale , string $ collation ) : array { $ alphas = [ ] ; $ query = DB :: table ( 'name' ) -> where ( 'n_file' , '=' , $ this -> tree -> id ( ) ) ; $ this -> whereFamily ( $ fams , $ query ) ; $ this -> whereMarriedName ... | Get a list of initial given name letters for indilist . php and famlist . php |
7,349 | public function surnames ( string $ surn , string $ salpha , bool $ marnm , bool $ fams , string $ locale , string $ collation ) : array { $ query = DB :: table ( 'name' ) -> where ( 'n_file' , '=' , $ this -> tree -> id ( ) ) -> select ( [ DB :: raw ( 'UPPER(n_surn /*! COLLATE ' . I18N :: collation ( ) . ' */) AS n_su... | Get a count of actual surnames and variants based on a root surname . |
7,350 | private function fieldWithCollation ( string $ field , string $ collation ) : Expression { return DB :: raw ( $ field . ' /*! COLLATE ' . $ collation . ' */' ) ; } | Use MySQL - specific comments so we can run these queries on other RDBMS . |
7,351 | private function whereInitial ( Builder $ query , string $ field , string $ letter , string $ locale , string $ collation ) : void { $ field_with_collation = $ this -> fieldWithCollation ( $ field , $ collation ) ; switch ( $ locale ) { case 'cs' : $ this -> whereInitialCzech ( $ query , $ field_with_collation , $ lett... | Modify a query to restrict a field to a given initial letter . Take account of digraphs equialent letters etc . |
7,352 | private function whereInitialHungarian ( Builder $ query , Expression $ field , string $ letter ) : void { switch ( $ letter ) { case 'C' : $ query -> where ( $ field , 'LIKE' , 'C%' ) -> where ( $ field , 'NOT LIKE' , 'CS%' ) ; break ; case 'D' : $ query -> where ( $ field , 'LIKE' , 'D%' ) -> where ( $ field , 'NOT L... | Hungarian has many digraphs and trigraphs so exclude these from prefixes . |
7,353 | public static function getValues ( GedcomRecord $ record = null ) : array { $ values = [ ] ; foreach ( self :: TYPES as $ type ) { $ values [ $ type ] = self :: getValue ( $ type , $ record ) ; } uasort ( $ values , '\Fisharebest\Webtrees\I18N::strcasecmp' ) ; return $ values ; } | A list of all possible values for RELA |
7,354 | private function commonGivenQuery ( string $ sex , string $ type , bool $ show_tot , int $ threshold , int $ maxtoshow ) { $ query = DB :: table ( 'name' ) -> join ( 'individuals' , static function ( JoinClause $ join ) : void { $ join -> on ( 'i_file' , '=' , 'n_file' ) -> on ( 'i_id' , '=' , 'n_id' ) ; } ) -> where (... | Find common given names . |
7,355 | public function statsBirthBySexQuery ( int $ year1 = - 1 , int $ year2 = - 1 ) : Builder { return $ this -> statsBirthQuery ( $ year1 , $ year2 ) -> select ( [ 'd_month' , 'i_sex' , DB :: raw ( 'COUNT(*) AS total' ) ] ) -> join ( 'individuals' , static function ( JoinClause $ join ) : void { $ join -> on ( 'i_id' , '='... | Get a count of births by month . |
7,356 | public function statsBirth ( string $ color_from = null , string $ color_to = null ) : string { return ( new ChartBirth ( $ this -> tree ) ) -> chartBirth ( $ color_from , $ color_to ) ; } | General query on births . |
7,357 | public function statsDeathBySexQuery ( int $ year1 = - 1 , int $ year2 = - 1 ) : Builder { return $ this -> statsDeathQuery ( $ year1 , $ year2 ) -> select ( [ 'd_month' , 'i_sex' , DB :: raw ( 'COUNT(*) AS total' ) ] ) -> join ( 'individuals' , static function ( JoinClause $ join ) : void { $ join -> on ( 'i_id' , '='... | Get a list of death dates . |
7,358 | public function statsDeath ( string $ color_from = null , string $ color_to = null ) : string { return ( new ChartDeath ( $ this -> tree ) ) -> chartDeath ( $ color_from , $ color_to ) ; } | General query on deaths . |
7,359 | public function statsAgeQuery ( string $ related = 'BIRT' , string $ sex = 'BOTH' , int $ year1 = - 1 , int $ year2 = - 1 ) { $ prefix = DB :: connection ( ) -> getTablePrefix ( ) ; $ query = $ this -> birthAndDeathQuery ( $ sex ) ; if ( $ year1 >= 0 && $ year2 >= 0 ) { $ query -> whereIn ( 'birth.d_type' , [ '@#DGREGO... | General query on ages . |
7,360 | public function topTenOldestFemale ( int $ total = 10 ) : string { $ records = $ this -> topTenOldestQuery ( 'F' , $ total ) ; return view ( 'statistics/individuals/top10-nolist' , [ 'records' => $ records , ] ) ; } | Find the oldest females . |
7,361 | public function topTenOldestFemaleList ( int $ total = 10 ) : string { $ records = $ this -> topTenOldestQuery ( 'F' , $ total ) ; return view ( 'statistics/individuals/top10-list' , [ 'records' => $ records , ] ) ; } | Find the oldest living females . |
7,362 | private function averageLifespanQuery ( string $ sex , bool $ show_years ) : string { $ prefix = DB :: connection ( ) -> getTablePrefix ( ) ; $ days = ( int ) $ this -> birthAndDeathQuery ( $ sex ) -> select ( DB :: raw ( 'AVG(' . $ prefix . 'death.d_julianday2 - ' . $ prefix . 'birth.d_julianday1) AS days' ) ) -> valu... | Find the average lifespan . |
7,363 | private function getPercentage ( int $ count , int $ total ) : string { return ( $ total !== 0 ) ? I18N :: percentage ( $ count / $ total , 1 ) : '' ; } | Convert totals into percentages . |
7,364 | private function totalLivingQuery ( ) : int { $ query = DB :: table ( 'individuals' ) -> where ( 'i_file' , '=' , $ this -> tree -> id ( ) ) ; foreach ( Gedcom :: DEATH_EVENTS as $ death_event ) { $ query -> where ( 'i_gedcom' , 'NOT LIKE' , "%\n1 " . $ death_event . '%' ) ; } return $ query -> count ( ) ; } | Count the number of living individuals . |
7,365 | private function totalDeceasedQuery ( ) : int { return DB :: table ( 'individuals' ) -> where ( 'i_file' , '=' , $ this -> tree -> id ( ) ) -> where ( static function ( Builder $ query ) : void { foreach ( Gedcom :: DEATH_EVENTS as $ death_event ) { $ query -> orWhere ( 'i_gedcom' , 'LIKE' , "%\n1 " . $ death_event . '... | Count the number of dead individuals . |
7,366 | private function getTotalSexQuery ( string $ sex ) : int { return DB :: table ( 'individuals' ) -> where ( 'i_file' , '=' , $ this -> tree -> id ( ) ) -> where ( 'i_sex' , '=' , $ sex ) -> count ( ) ; } | Returns the total count of a specific sex . |
7,367 | private function totalIndisWithSourcesQuery ( ) : int { return DB :: table ( 'individuals' ) -> select ( [ 'i_id' ] ) -> distinct ( ) -> join ( 'link' , static function ( JoinClause $ join ) : void { $ join -> on ( 'i_id' , '=' , 'l_from' ) -> on ( 'i_file' , '=' , 'l_file' ) ; } ) -> where ( 'l_file' , '=' , $ this ->... | How many individuals have one or more sources . |
7,368 | private function totalRecordsQuery ( ) : int { return $ this -> totalIndividualsQuery ( ) + $ this -> totalFamiliesQuery ( ) + $ this -> totalNotesQuery ( ) + $ this -> totalRepositoriesQuery ( ) + $ this -> totalSourcesQuery ( ) ; } | Returns the total number of records . |
7,369 | private function birthAndDeathQuery ( string $ sex ) : Builder { $ query = DB :: table ( 'individuals' ) -> where ( 'i_file' , '=' , $ this -> tree -> id ( ) ) -> join ( 'dates AS birth' , static function ( JoinClause $ join ) : void { $ join -> on ( 'birth.d_file' , '=' , 'i_file' ) -> on ( 'birth.d_gid' , '=' , 'i_id... | Query individuals with their births and deaths . |
7,370 | public function parent ( ) : Place { return new self ( $ this -> parts -> slice ( 1 ) -> implode ( Gedcom :: PLACE_SEPARATOR ) , $ this -> tree ) ; } | Get the higher level place . |
7,371 | public function getChildPlaces ( ) : array { if ( $ this -> place_name !== '' ) { $ parent_text = Gedcom :: PLACE_SEPARATOR . $ this -> place_name ; } else { $ parent_text = '' ; } return DB :: table ( 'places' ) -> where ( 'p_file' , '=' , $ this -> tree -> id ( ) ) -> where ( 'p_parent_id' , '=' , $ this -> id ( ) ) ... | Get the lower level places . |
7,372 | public function url ( ) : string { $ module = app ( ModuleService :: class ) -> findByComponent ( ModuleListInterface :: class , $ this -> tree , Auth :: user ( ) ) -> first ( static function ( ModuleInterface $ module ) : bool { return $ module instanceof PlaceHierarchyListModule ; } ) ; if ( $ module instanceof Place... | Create a URL to the place - hierarchy page . |
7,373 | public function placeName ( ) : string { $ place_name = $ this -> parts -> first ( ) ?? I18N :: translate ( 'unknown' ) ; return '<span dir="auto">' . e ( $ place_name ) . '</span>' ; } | Format this place for display on screen . |
7,374 | public function fullName ( bool $ link = false ) : string { if ( $ this -> parts -> isEmpty ( ) ) { return '' ; } $ full_name = $ this -> parts -> implode ( I18N :: $ list_separator ) ; if ( $ link ) { return '<a dir="auto" href="' . e ( $ this -> url ( ) ) . '">' . e ( $ full_name ) . '</a>' ; } return '<span dir="aut... | Generate the place name for display including the full hierarchy . |
7,375 | public static function marriageDateComparator ( ) : Closure { return static function ( Family $ x , Family $ y ) : int { return Date :: compare ( $ x -> getMarriageDate ( ) , $ y -> getMarriageDate ( ) ) ; } ; } | A closure which will compare families by marriage date . |
7,376 | public function spouse ( Individual $ person , $ access_level = null ) : ? Individual { if ( $ person === $ this -> wife ) { return $ this -> husband ( $ access_level ) ; } return $ this -> wife ( $ access_level ) ; } | Find the spouse of a person . |
7,377 | public function numberOfChildren ( ) : int { $ nchi = $ this -> children ( ) -> count ( ) ; foreach ( $ this -> facts ( [ 'NCHI' ] ) as $ fact ) { $ nchi = max ( $ nchi , ( int ) $ fact -> value ( ) ) ; } return $ nchi ; } | Number of children - for the individual list |
7,378 | public function getMarriagePlace ( ) : Place { $ marriage = $ this -> getMarriage ( ) ; if ( $ marriage instanceof Fact ) { return $ marriage -> place ( ) ; } return new Place ( '' , $ this -> tree ) ; } | Get the marriage place |
7,379 | public function getAllMarriagePlaces ( ) : array { foreach ( Gedcom :: MARRIAGE_EVENTS as $ event ) { $ places = $ this -> getAllEventPlaces ( [ $ event ] ) ; if ( ! empty ( $ places ) ) { return $ places ; } } return [ ] ; } | Get a list of all marriage places - for the family lists . |
7,380 | public function verify ( ServerRequestInterface $ request , Tree $ tree , UserService $ user_service ) : ResponseInterface { $ username = $ request -> get ( 'username' , '' ) ; $ token = $ request -> get ( 'token' , '' ) ; $ title = I18N :: translate ( 'User verification' ) ; $ user = $ user_service -> findByUserName (... | Respond to a verification link that was emailed to a user . |
7,381 | private function findMediaObjectsForMediaFile ( string $ file ) : array { return DB :: table ( 'media' ) -> join ( 'media_file' , static function ( JoinClause $ join ) : void { $ join -> on ( 'media_file.m_file' , '=' , 'media.m_file' ) -> on ( 'media_file.m_id' , '=' , 'media.m_id' ) ; } ) -> join ( 'gedcom_setting' ,... | Find the media object that uses a particular media file . |
7,382 | private function scaledImagePixels ( $ path ) : array { $ size = 10 ; $ sha1 = sha1_file ( $ path ) ; $ cache_file = WT_DATA_DIR . 'cache/' . $ sha1 . '.php' ; if ( file_exists ( $ cache_file ) ) { return include $ cache_file ; } $ manager = new ImageManager ( ) ; $ image = $ manager -> make ( $ path ) -> resize ( $ si... | Scale an image to 10x10 and read the individual pixels . This is a slow operation add we will do it many times on the import wetbrees 1 thumbnails page so cache the results . |
7,383 | public function header ( ) { foreach ( $ this -> headerElements as $ element ) { if ( $ element instanceof ReportBaseElement ) { $ element -> render ( $ this ) ; } elseif ( $ element === 'footnotetexts' ) { $ this -> footnotes ( ) ; } elseif ( $ element === 'addpage' ) { $ this -> newPage ( ) ; } } foreach ( $ this -> ... | PDF Header - PDF |
7,384 | public function body ( ) { $ this -> AddPage ( ) ; foreach ( $ this -> bodyElements as $ key => $ element ) { if ( $ element instanceof ReportBaseElement ) { $ element -> render ( $ this ) ; } elseif ( $ element === 'footnotetexts' ) { $ this -> footnotes ( ) ; } elseif ( $ element === 'addpage' ) { $ this -> newPage (... | PDF Body - PDF |
7,385 | public function footnotes ( ) { foreach ( $ this -> printedfootnotes as $ element ) { if ( ( $ this -> GetY ( ) + $ element -> getFootnoteHeight ( $ this ) ) > $ this -> getPageHeight ( ) ) { $ this -> AddPage ( ) ; } $ element -> renderFootnote ( $ this ) ; if ( $ this -> GetY ( ) > $ this -> getPageHeight ( ) ) { $ t... | PDF Footnotes - PDF |
7,386 | public function footer ( ) { foreach ( $ this -> footerElements as $ element ) { if ( $ element instanceof ReportBaseElement ) { $ element -> render ( $ this ) ; } elseif ( $ element === 'footnotetexts' ) { $ this -> footnotes ( ) ; } elseif ( $ element === 'addpage' ) { $ this -> newPage ( ) ; } } } | PDF Footer - PDF |
7,387 | public function setCurrentStyle ( string $ s ) { $ this -> currentStyle = $ s ; $ style = $ this -> wt_report -> getStyle ( $ s ) ; $ this -> SetFont ( $ style [ 'font' ] , $ style [ 'style' ] , $ style [ 'size' ] ) ; } | Setup a style for usage - PDF |
7,388 | public function getStyle ( string $ s ) : array { if ( ! isset ( $ this -> wt_report -> styles [ $ s ] ) ) { $ s = $ this -> getCurrentStyle ( ) ; $ this -> wt_report -> styles [ $ s ] = $ s ; } return $ this -> wt_report -> styles [ $ s ] ; } | Get the style - PDF |
7,389 | public function addMarginX ( float $ x ) : float { $ m = $ this -> getMargins ( ) ; if ( $ this -> getRTL ( ) ) { $ x += $ m [ 'right' ] ; } else { $ x += $ m [ 'left' ] ; } $ this -> SetX ( $ x ) ; return $ x ; } | Add margin when static horizontal position is used - PDF RTL supported |
7,390 | public function getMaxLineWidth ( ) { $ m = $ this -> getMargins ( ) ; if ( $ this -> getRTL ( ) ) { return ( $ this -> getRemainingWidth ( ) + $ m [ 'right' ] ) ; } return ( $ this -> getRemainingWidth ( ) + $ m [ 'left' ] ) ; } | Get the maximum line width to draw from the curren position - PDF RTL supported |
7,391 | public function getFootnotesHeight ( ) : float { $ h = 0 ; foreach ( $ this -> printedfootnotes as $ element ) { $ h += $ element -> getHeight ( $ this ) ; } return $ h ; } | Get the height of the footnote . |
7,392 | protected function formatLongYear ( ) : string { if ( $ this -> year < 0 ) { return I18N :: translate ( '%s BCE' , I18N :: digits ( - $ this -> year ) ) ; } if ( $ this -> new_old_style ) { return I18N :: translate ( '%s CE' , I18N :: digits ( sprintf ( '%d/%02d' , $ this -> year - 1 , $ this -> year % 100 ) ... | Generate the %Y format for a date . |
7,393 | protected function formatGedcomYear ( ) : string { if ( $ this -> year < 0 ) { return sprintf ( '%04d B.C.' , - $ this -> year ) ; } if ( $ this -> new_old_style ) { return sprintf ( '%04d/%02d' , $ this -> year - 1 , $ this -> year % 100 ) ; } return sprintf ( '%04d' , $ this -> year ) ; } | Generate the %E format for a date . |
7,394 | public function folder ( ServerRequestInterface $ request , Tree $ tree , Filesystem $ filesystem ) : ResponseInterface { $ query = $ request -> get ( 'query' , '' ) ; $ prefix = $ tree -> getPreference ( 'MEDIA_DIRECTORY' , '' ) ; $ media_filesystem = new Filesystem ( new ChrootAdapter ( $ filesystem , $ prefix ) ) ; ... | Autocomplete for media folders . |
7,395 | public function page ( ServerRequestInterface $ request , Tree $ tree ) : ResponseInterface { $ query = $ request -> get ( 'query' , '' ) ; $ xref = $ request -> get ( 'extra' , '' ) ; $ source = Source :: getInstance ( $ xref , $ tree ) ; Auth :: checkSourceAccess ( $ source ) ; $ regex_query = preg_quote ( strtr ( $ ... | Autocomplete for source citations . |
7,396 | private function placeSearch ( Tree $ tree , int $ page , string $ query , bool $ create ) : array { $ offset = $ page * self :: RESULTS_PER_PAGE ; $ results = [ ] ; $ found = false ; foreach ( $ this -> search_service -> searchPlaces ( $ tree , $ query ) as $ place ) { $ place_name = $ place -> gedcomName ( ) ; if ( $... | Look up a place name . |
7,397 | public function getSidebarContent ( Individual $ individual ) : string { ob_start ( ) ; foreach ( $ individual -> facts ( static :: HANDLED_FACTS ) as $ fact ) { FunctionsPrintFacts :: printFact ( $ fact , $ individual ) ; } $ html = ob_get_clean ( ) ; return strip_tags ( $ html , '<a><div><span>' ) ; } | Load this sidebar synchronously . |
7,398 | private function surnamesToAdd ( GedcomRecord $ record ) : array { $ gedcom = $ record -> gedcom ( ) ; $ tree = $ record -> tree ( ) ; $ wife_surnames = $ this -> surnames ( $ record ) ; $ husb_surnames = [ ] ; $ missing_surnames = [ ] ; preg_match_all ( '/^1 FAMS @(.+)@/m' , $ gedcom , $ fmatch ) ; foreach ( $ fmatch ... | Generate a list of married surnames that are not already present . |
7,399 | private function surnames ( GedcomRecord $ record ) : array { $ gedcom = $ record -> gedcom ( ) ; if ( preg_match_all ( '/^(?:1 NAME|2 _MARNM) .*\/(.+)\//m' , $ gedcom , $ match ) ) { return $ match [ 1 ] ; } return [ ] ; } | Extract a list of surnames from a GEDCOM record . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.