@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | /** |
| 278 | 278 | * Get an associative array of Sosa individuals in generation G. Keys are Sosa numbers, values individuals. |
| 279 | 279 | * |
| 280 | - * @param number $gen Generation |
|
| 280 | + * @param integer $gen Generation |
|
| 281 | 281 | * @return array Array of Sosa individuals |
| 282 | 282 | */ |
| 283 | 283 | public function getSosaListAtGeneration($gen){ |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | /** |
| 309 | 309 | * Get an associative array of Sosa families in generation G. Keys are Sosa numbers for the husband, values families. |
| 310 | 310 | * |
| 311 | - * @param number $gen Generation |
|
| 311 | + * @param integer $gen Generation |
|
| 312 | 312 | * @return array Array of Sosa families |
| 313 | 313 | */ |
| 314 | 314 | public function getFamilySosaListAtGeneration($gen){ |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | /** |
| 345 | 345 | * Get an associative array of Sosa individuals in generation G who are missing parents. Keys are Sosa numbers, values individuals. |
| 346 | 346 | * |
| 347 | - * @param number $gen Generation |
|
| 347 | + * @param integer $gen Generation |
|
| 348 | 348 | * @return array Array of Sosa individuals |
| 349 | 349 | */ |
| 350 | 350 | public function getMissingSosaListAtGeneration($gen){ |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | /** |
| 440 | 440 | * Get the number of Sosa in a specific generation. |
| 441 | 441 | * |
| 442 | - * @param number $gen Generation |
|
| 443 | - * @return number Number of Sosas in generation |
|
| 442 | + * @param integer $gen Generation |
|
| 443 | + * @return integer Number of Sosas in generation |
|
| 444 | 444 | */ |
| 445 | 445 | public function getSosaCountAtGeneration($gen){ |
| 446 | 446 | if(!$this->is_setup) return 0; |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | /** |
| 459 | 459 | * Get the total number of Sosa up to a specific generation. |
| 460 | 460 | * |
| 461 | - * @param number $gen Generation |
|
| 461 | + * @param integer $gen Generation |
|
| 462 | 462 | * @return number Total number of Sosas up to generation |
| 463 | 463 | */ |
| 464 | 464 | public function getSosaCountUpToGeneration($gen){ |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | /** |
| 494 | 494 | * Get the number of distinct Sosa individual up to a specific generation. |
| 495 | 495 | * |
| 496 | - * @param number $gen Generation |
|
| 496 | + * @param integer $gen Generation |
|
| 497 | 497 | * @return number Number of distinct Sosa individuals up to generation |
| 498 | 498 | */ |
| 499 | 499 | public function getDifferentSosaCountUpToGeneration($gen){ |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | * - last : Last birth year in generation |
| 517 | 517 | * - avg : Average birth year |
| 518 | 518 | * |
| 519 | - * @param number $gen Generation |
|
| 519 | + * @param integer $gen Generation |
|
| 520 | 520 | * @return array Birth statistics array |
| 521 | 521 | */ |
| 522 | 522 | public function getStatsBirthYearInGeneration($gen){ |
@@ -22,389 +22,389 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class SosaProvider { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Maximum number of generation the database is able to hold. |
|
| 27 | - * @var int MAX_DB_GENERATIONS |
|
| 28 | - */ |
|
| 29 | - const MAX_DB_GENERATIONS = 64; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * System's default user (ID -1 in the database |
|
| 33 | - * @var User $default_user |
|
| 34 | - */ |
|
| 35 | - protected static $default_user; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * Reference user |
|
| 39 | - * @var User $user |
|
| 40 | - */ |
|
| 41 | - protected $user; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Reference tree |
|
| 45 | - * @var Tree $tree |
|
| 46 | - */ |
|
| 47 | - protected $tree; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * Cached list of Sosa Individuals by generation |
|
| 51 | - * Format: key = generation, value = array ( sosa => Individual ID) |
|
| 52 | - * @var array $sosa_list_by_gen |
|
| 53 | - */ |
|
| 54 | - protected $sosa_list_by_gen; |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Cached list of Sosa Families by generation |
|
| 58 | - * Format: key = generation, value = array ( sosa => Family ID) |
|
| 59 | - * @var unknown $sosa_fam_list_by_gen |
|
| 60 | - */ |
|
| 61 | - protected $sosa_fam_list_by_gen; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Cached array of statistics by generation |
|
| 65 | - * Format: key = generation, |
|
| 66 | - * value = array( |
|
| 67 | - * sosaCount, sosaTotalCount, diffSosaTotalCount, firstBirth, lastBirth, avgBirth |
|
| 68 | - * ) |
|
| 69 | - * @var array $statistics_tab |
|
| 70 | - */ |
|
| 71 | - protected $statistics_tab; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Has the provider's initialisation completed |
|
| 75 | - * @var bool $is_setup |
|
| 76 | - */ |
|
| 77 | - protected $is_setup; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Constructor for Sosa Provider. |
|
| 81 | - * A provider is defined in relation to a specific tree and reference user. |
|
| 82 | - * |
|
| 83 | - * @param Tree $tree |
|
| 84 | - * @param User $user |
|
| 85 | - */ |
|
| 86 | - public function __construct(Tree $tree, User $user = null) { |
|
| 87 | - if(self::$default_user === null) |
|
| 88 | - self::$default_user = User::find(-1); |
|
| 25 | + /** |
|
| 26 | + * Maximum number of generation the database is able to hold. |
|
| 27 | + * @var int MAX_DB_GENERATIONS |
|
| 28 | + */ |
|
| 29 | + const MAX_DB_GENERATIONS = 64; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * System's default user (ID -1 in the database |
|
| 33 | + * @var User $default_user |
|
| 34 | + */ |
|
| 35 | + protected static $default_user; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * Reference user |
|
| 39 | + * @var User $user |
|
| 40 | + */ |
|
| 41 | + protected $user; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Reference tree |
|
| 45 | + * @var Tree $tree |
|
| 46 | + */ |
|
| 47 | + protected $tree; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * Cached list of Sosa Individuals by generation |
|
| 51 | + * Format: key = generation, value = array ( sosa => Individual ID) |
|
| 52 | + * @var array $sosa_list_by_gen |
|
| 53 | + */ |
|
| 54 | + protected $sosa_list_by_gen; |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Cached list of Sosa Families by generation |
|
| 58 | + * Format: key = generation, value = array ( sosa => Family ID) |
|
| 59 | + * @var unknown $sosa_fam_list_by_gen |
|
| 60 | + */ |
|
| 61 | + protected $sosa_fam_list_by_gen; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Cached array of statistics by generation |
|
| 65 | + * Format: key = generation, |
|
| 66 | + * value = array( |
|
| 67 | + * sosaCount, sosaTotalCount, diffSosaTotalCount, firstBirth, lastBirth, avgBirth |
|
| 68 | + * ) |
|
| 69 | + * @var array $statistics_tab |
|
| 70 | + */ |
|
| 71 | + protected $statistics_tab; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Has the provider's initialisation completed |
|
| 75 | + * @var bool $is_setup |
|
| 76 | + */ |
|
| 77 | + protected $is_setup; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Constructor for Sosa Provider. |
|
| 81 | + * A provider is defined in relation to a specific tree and reference user. |
|
| 82 | + * |
|
| 83 | + * @param Tree $tree |
|
| 84 | + * @param User $user |
|
| 85 | + */ |
|
| 86 | + public function __construct(Tree $tree, User $user = null) { |
|
| 87 | + if(self::$default_user === null) |
|
| 88 | + self::$default_user = User::find(-1); |
|
| 89 | 89 | |
| 90 | - $this->tree = $tree; |
|
| 91 | - $this->user = $user; |
|
| 92 | - $this->is_setup = true; |
|
| 93 | - if($this->user === null) $this->user = Auth::user(); |
|
| 94 | - if(strlen($this->user->getUserId()) == 0) $this->user = self::$default_user; |
|
| 90 | + $this->tree = $tree; |
|
| 91 | + $this->user = $user; |
|
| 92 | + $this->is_setup = true; |
|
| 93 | + if($this->user === null) $this->user = Auth::user(); |
|
| 94 | + if(strlen($this->user->getUserId()) == 0) $this->user = self::$default_user; |
|
| 95 | 95 | |
| 96 | - // Check if the user, or the default user, has a root already setup; |
|
| 97 | - if(empty($this->getRootIndiId())) { |
|
| 98 | - if($this->user == self::$default_user) { // If the default user is not setup |
|
| 99 | - $this->is_setup = false; |
|
| 100 | - } |
|
| 101 | - else { |
|
| 102 | - $this->user = self::$default_user; |
|
| 103 | - $this->is_setup = $this->getRootIndiId() === null; |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * Returns is the Provider has been successfully set up |
|
| 110 | - * @return bool |
|
| 111 | - */ |
|
| 112 | - public function isSetup() { |
|
| 113 | - return $this->is_setup; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Return the root individual ID for the reference tree and user. |
|
| 118 | - * @return string Individual ID |
|
| 119 | - */ |
|
| 120 | - public function getRootIndiId() { |
|
| 121 | - return $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Return the root individual for the reference tree and user. |
|
| 126 | - * @return Individual Individual |
|
| 127 | - */ |
|
| 128 | - public function getRootIndi() { |
|
| 129 | - $root_indi_id = $this->getRootIndiId(); |
|
| 130 | - if(!empty($root_indi_id)) { |
|
| 131 | - return Individual::getInstance($root_indi_id, $this->tree); |
|
| 132 | - } |
|
| 133 | - return null; |
|
| 134 | - } |
|
| 96 | + // Check if the user, or the default user, has a root already setup; |
|
| 97 | + if(empty($this->getRootIndiId())) { |
|
| 98 | + if($this->user == self::$default_user) { // If the default user is not setup |
|
| 99 | + $this->is_setup = false; |
|
| 100 | + } |
|
| 101 | + else { |
|
| 102 | + $this->user = self::$default_user; |
|
| 103 | + $this->is_setup = $this->getRootIndiId() === null; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * Returns is the Provider has been successfully set up |
|
| 110 | + * @return bool |
|
| 111 | + */ |
|
| 112 | + public function isSetup() { |
|
| 113 | + return $this->is_setup; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Return the root individual ID for the reference tree and user. |
|
| 118 | + * @return string Individual ID |
|
| 119 | + */ |
|
| 120 | + public function getRootIndiId() { |
|
| 121 | + return $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Return the root individual for the reference tree and user. |
|
| 126 | + * @return Individual Individual |
|
| 127 | + */ |
|
| 128 | + public function getRootIndi() { |
|
| 129 | + $root_indi_id = $this->getRootIndiId(); |
|
| 130 | + if(!empty($root_indi_id)) { |
|
| 131 | + return Individual::getInstance($root_indi_id, $this->tree); |
|
| 132 | + } |
|
| 133 | + return null; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /***************** |
|
| 136 | + /***************** |
|
| 137 | 137 | * DATA CRUD LAYER |
| 138 | 138 | *****************/ |
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Remove all Sosa entries related to the gedcom file and user |
|
| 142 | - */ |
|
| 143 | - public function deleteAll() { |
|
| 144 | - if(!$this->is_setup) return; |
|
| 145 | - Database::prepare( |
|
| 146 | - 'DELETE FROM `##maj_sosa`'. |
|
| 147 | - ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ') |
|
| 148 | - ->execute(array( |
|
| 149 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 150 | - 'user_id' => $this->user->getUserId() |
|
| 151 | - )); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Remove all ancestors of a sosa number |
|
| 156 | - * |
|
| 157 | - * @param int $sosa |
|
| 158 | - */ |
|
| 159 | - public function deleteAncestors($sosa) { |
|
| 160 | - if(!$this->is_setup) return; |
|
| 161 | - $gen = Functions::getGeneration($sosa); |
|
| 162 | - Database::prepare( |
|
| 163 | - 'DELETE FROM `##maj_sosa`'. |
|
| 164 | - ' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id' . |
|
| 165 | - ' AND majs_gen >= :gen' . |
|
| 166 | - ' AND FLOOR(majs_sosa / (POW(2, (majs_gen - :gen)))) = :sosa' |
|
| 167 | - )->execute(array( |
|
| 168 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 169 | - 'user_id' => $this->user->getUserId(), |
|
| 170 | - 'gen' => $gen, |
|
| 171 | - 'sosa' => $sosa |
|
| 172 | - )); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Insert (or update if already existing) a list of Sosa individuals |
|
| 177 | - * @param array $sosa_records |
|
| 178 | - */ |
|
| 179 | - public function insertOrUpdate($sosa_records) { |
|
| 180 | - if(!$this->is_setup) return; |
|
| 140 | + /** |
|
| 141 | + * Remove all Sosa entries related to the gedcom file and user |
|
| 142 | + */ |
|
| 143 | + public function deleteAll() { |
|
| 144 | + if(!$this->is_setup) return; |
|
| 145 | + Database::prepare( |
|
| 146 | + 'DELETE FROM `##maj_sosa`'. |
|
| 147 | + ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ') |
|
| 148 | + ->execute(array( |
|
| 149 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 150 | + 'user_id' => $this->user->getUserId() |
|
| 151 | + )); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Remove all ancestors of a sosa number |
|
| 156 | + * |
|
| 157 | + * @param int $sosa |
|
| 158 | + */ |
|
| 159 | + public function deleteAncestors($sosa) { |
|
| 160 | + if(!$this->is_setup) return; |
|
| 161 | + $gen = Functions::getGeneration($sosa); |
|
| 162 | + Database::prepare( |
|
| 163 | + 'DELETE FROM `##maj_sosa`'. |
|
| 164 | + ' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id' . |
|
| 165 | + ' AND majs_gen >= :gen' . |
|
| 166 | + ' AND FLOOR(majs_sosa / (POW(2, (majs_gen - :gen)))) = :sosa' |
|
| 167 | + )->execute(array( |
|
| 168 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 169 | + 'user_id' => $this->user->getUserId(), |
|
| 170 | + 'gen' => $gen, |
|
| 171 | + 'sosa' => $sosa |
|
| 172 | + )); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Insert (or update if already existing) a list of Sosa individuals |
|
| 177 | + * @param array $sosa_records |
|
| 178 | + */ |
|
| 179 | + public function insertOrUpdate($sosa_records) { |
|
| 180 | + if(!$this->is_setup) return; |
|
| 181 | 181 | |
| 182 | - $treeid = $this->tree->getTreeId(); |
|
| 183 | - $userid = $this->user->getUserId(); |
|
| 184 | - $questionmarks_table = array(); |
|
| 185 | - $values_table = array(); |
|
| 182 | + $treeid = $this->tree->getTreeId(); |
|
| 183 | + $userid = $this->user->getUserId(); |
|
| 184 | + $questionmarks_table = array(); |
|
| 185 | + $values_table = array(); |
|
| 186 | 186 | |
| 187 | - $i = 0; |
|
| 188 | - foreach ($sosa_records as $row) { |
|
| 189 | - $gen = Functions::getGeneration($row['sosa']); |
|
| 190 | - if($gen <= self::MAX_DB_GENERATIONS) { |
|
| 191 | - $questionmarks_table[] = |
|
| 192 | - '(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.', :indi_id'.$i.', :gen'.$i.', :byear'.$i.', :dyear'.$i.')'; |
|
| 193 | - $values_table = array_merge( |
|
| 194 | - $values_table, |
|
| 195 | - array( |
|
| 196 | - 'tree_id'.$i => $treeid, |
|
| 197 | - 'user_id'.$i => $userid, |
|
| 198 | - 'sosa'.$i => $row['sosa'], |
|
| 199 | - 'indi_id'.$i => $row['indi'], |
|
| 200 | - 'gen'.$i => Functions::getGeneration($row['sosa']), |
|
| 201 | - 'byear'.$i => $row['birth_year'], |
|
| 202 | - 'dyear'.$i => $row['death_year'] |
|
| 203 | - ) |
|
| 204 | - ); |
|
| 205 | - } |
|
| 206 | - $i++; |
|
| 207 | - } |
|
| 187 | + $i = 0; |
|
| 188 | + foreach ($sosa_records as $row) { |
|
| 189 | + $gen = Functions::getGeneration($row['sosa']); |
|
| 190 | + if($gen <= self::MAX_DB_GENERATIONS) { |
|
| 191 | + $questionmarks_table[] = |
|
| 192 | + '(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.', :indi_id'.$i.', :gen'.$i.', :byear'.$i.', :dyear'.$i.')'; |
|
| 193 | + $values_table = array_merge( |
|
| 194 | + $values_table, |
|
| 195 | + array( |
|
| 196 | + 'tree_id'.$i => $treeid, |
|
| 197 | + 'user_id'.$i => $userid, |
|
| 198 | + 'sosa'.$i => $row['sosa'], |
|
| 199 | + 'indi_id'.$i => $row['indi'], |
|
| 200 | + 'gen'.$i => Functions::getGeneration($row['sosa']), |
|
| 201 | + 'byear'.$i => $row['birth_year'], |
|
| 202 | + 'dyear'.$i => $row['death_year'] |
|
| 203 | + ) |
|
| 204 | + ); |
|
| 205 | + } |
|
| 206 | + $i++; |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - $sql = 'REPLACE INTO `##maj_sosa`' . |
|
| 210 | - ' (majs_gedcom_id, majs_user_id, majs_sosa, majs_i_id, majs_gen, majs_birth_year, majs_death_year)' . |
|
| 211 | - ' VALUES '. implode(',', $questionmarks_table); |
|
| 212 | - Database::prepare($sql)->execute($values_table); |
|
| 213 | - } |
|
| 209 | + $sql = 'REPLACE INTO `##maj_sosa`' . |
|
| 210 | + ' (majs_gedcom_id, majs_user_id, majs_sosa, majs_i_id, majs_gen, majs_birth_year, majs_death_year)' . |
|
| 211 | + ' VALUES '. implode(',', $questionmarks_table); |
|
| 212 | + Database::prepare($sql)->execute($values_table); |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - /**************** |
|
| 215 | + /**************** |
|
| 216 | 216 | * SIMPLE QUERIES |
| 217 | 217 | ****************/ |
| 218 | 218 | |
| 219 | - /** |
|
| 220 | - * Returns the list of Sosa numbers to which an individual is related. |
|
| 221 | - * Format: key = sosa number, value = generation for the Sosa number |
|
| 222 | - * |
|
| 223 | - * @param Individual $indi |
|
| 224 | - * @return array Array of sosa numbers |
|
| 225 | - */ |
|
| 226 | - public function getSosaNumbers(Individual $indi) { |
|
| 227 | - if(!$this->is_setup) return array(); |
|
| 228 | - return Database::prepare( |
|
| 229 | - 'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'. |
|
| 230 | - ' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
|
| 231 | - )->execute(array( |
|
| 232 | - 'indi_id' => $indi->getXref(), |
|
| 233 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 234 | - 'user_id' => $this->user->getUserId() |
|
| 235 | - ))->fetchAssoc(); |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * Get the last generation of Sosa ancestors |
|
| 240 | - * |
|
| 241 | - * @return number Last generation if found, 1 otherwise |
|
| 242 | - */ |
|
| 243 | - public function getLastGeneration() { |
|
| 244 | - if(!$this->is_setup) return; |
|
| 245 | - return Database::prepare( |
|
| 246 | - 'SELECT MAX(majs_gen) FROM `##maj_sosa`'. |
|
| 247 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
|
| 248 | - )->execute(array( |
|
| 249 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 250 | - 'user_id' => $this->user->getUserId() |
|
| 251 | - ))->fetchOne() ?: 1; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - /************* |
|
| 219 | + /** |
|
| 220 | + * Returns the list of Sosa numbers to which an individual is related. |
|
| 221 | + * Format: key = sosa number, value = generation for the Sosa number |
|
| 222 | + * |
|
| 223 | + * @param Individual $indi |
|
| 224 | + * @return array Array of sosa numbers |
|
| 225 | + */ |
|
| 226 | + public function getSosaNumbers(Individual $indi) { |
|
| 227 | + if(!$this->is_setup) return array(); |
|
| 228 | + return Database::prepare( |
|
| 229 | + 'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'. |
|
| 230 | + ' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
|
| 231 | + )->execute(array( |
|
| 232 | + 'indi_id' => $indi->getXref(), |
|
| 233 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 234 | + 'user_id' => $this->user->getUserId() |
|
| 235 | + ))->fetchAssoc(); |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * Get the last generation of Sosa ancestors |
|
| 240 | + * |
|
| 241 | + * @return number Last generation if found, 1 otherwise |
|
| 242 | + */ |
|
| 243 | + public function getLastGeneration() { |
|
| 244 | + if(!$this->is_setup) return; |
|
| 245 | + return Database::prepare( |
|
| 246 | + 'SELECT MAX(majs_gen) FROM `##maj_sosa`'. |
|
| 247 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
|
| 248 | + )->execute(array( |
|
| 249 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 250 | + 'user_id' => $this->user->getUserId() |
|
| 251 | + ))->fetchOne() ?: 1; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + /************* |
|
| 255 | 255 | * SOSA LISTS |
| 256 | 256 | *************/ |
| 257 | 257 | |
| 258 | - /** |
|
| 259 | - * Return the list of all sosas, with the generations it belongs to |
|
| 260 | - * |
|
| 261 | - * @return array Associative array of Sosa ancestors, with their generation, comma separated |
|
| 262 | - */ |
|
| 263 | - public function getAllSosaWithGenerations(){ |
|
| 264 | - if(!$this->is_setup) return array(); |
|
| 265 | - return Database::prepare( |
|
| 266 | - 'SELECT majs_i_id AS indi,' . |
|
| 267 | - ' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' . |
|
| 268 | - ' FROM `##maj_sosa`' . |
|
| 269 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' . |
|
| 270 | - ' GROUP BY majs_i_id' |
|
| 271 | - )->execute(array( |
|
| 272 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 273 | - 'user_id' => $this->user->getUserId() |
|
| 274 | - ))->fetchAssoc(); |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - /** |
|
| 278 | - * Get an associative array of Sosa individuals in generation G. Keys are Sosa numbers, values individuals. |
|
| 279 | - * |
|
| 280 | - * @param number $gen Generation |
|
| 281 | - * @return array Array of Sosa individuals |
|
| 282 | - */ |
|
| 283 | - public function getSosaListAtGeneration($gen){ |
|
| 284 | - if(!$this->is_setup) return array(); |
|
| 285 | - if(!$this->sosa_list_by_gen) |
|
| 286 | - $this->sosa_list_by_gen = array(); |
|
| 258 | + /** |
|
| 259 | + * Return the list of all sosas, with the generations it belongs to |
|
| 260 | + * |
|
| 261 | + * @return array Associative array of Sosa ancestors, with their generation, comma separated |
|
| 262 | + */ |
|
| 263 | + public function getAllSosaWithGenerations(){ |
|
| 264 | + if(!$this->is_setup) return array(); |
|
| 265 | + return Database::prepare( |
|
| 266 | + 'SELECT majs_i_id AS indi,' . |
|
| 267 | + ' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' . |
|
| 268 | + ' FROM `##maj_sosa`' . |
|
| 269 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' . |
|
| 270 | + ' GROUP BY majs_i_id' |
|
| 271 | + )->execute(array( |
|
| 272 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 273 | + 'user_id' => $this->user->getUserId() |
|
| 274 | + ))->fetchAssoc(); |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + /** |
|
| 278 | + * Get an associative array of Sosa individuals in generation G. Keys are Sosa numbers, values individuals. |
|
| 279 | + * |
|
| 280 | + * @param number $gen Generation |
|
| 281 | + * @return array Array of Sosa individuals |
|
| 282 | + */ |
|
| 283 | + public function getSosaListAtGeneration($gen){ |
|
| 284 | + if(!$this->is_setup) return array(); |
|
| 285 | + if(!$this->sosa_list_by_gen) |
|
| 286 | + $this->sosa_list_by_gen = array(); |
|
| 287 | 287 | |
| 288 | - if($gen){ |
|
| 289 | - if(!isset($this->sosa_list_by_gen[$gen])){ |
|
| 290 | - $this->sosa_list_by_gen[$gen] = Database::prepare( |
|
| 291 | - 'SELECT majs_sosa AS sosa, majs_i_id AS indi'. |
|
| 292 | - ' FROM `##maj_sosa`'. |
|
| 293 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 294 | - ' AND majs_gen = :gen'. |
|
| 295 | - ' ORDER BY majs_sosa ASC') |
|
| 296 | - ->execute(array( |
|
| 297 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 298 | - 'user_id' => $this->user->getUserId(), |
|
| 299 | - 'gen' => $gen |
|
| 300 | - )) |
|
| 301 | - ->fetchAssoc(); |
|
| 302 | - } |
|
| 303 | - return $this->sosa_list_by_gen[$gen]; |
|
| 304 | - } |
|
| 305 | - return array(); |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * Get an associative array of Sosa families in generation G. Keys are Sosa numbers for the husband, values families. |
|
| 310 | - * |
|
| 311 | - * @param number $gen Generation |
|
| 312 | - * @return array Array of Sosa families |
|
| 313 | - */ |
|
| 314 | - public function getFamilySosaListAtGeneration($gen){ |
|
| 315 | - if(!$this->is_setup) return array(); |
|
| 316 | - if(!$this->sosa_fam_list_by_gen) |
|
| 317 | - $this->sosa_fam_list_by_gen = array(); |
|
| 288 | + if($gen){ |
|
| 289 | + if(!isset($this->sosa_list_by_gen[$gen])){ |
|
| 290 | + $this->sosa_list_by_gen[$gen] = Database::prepare( |
|
| 291 | + 'SELECT majs_sosa AS sosa, majs_i_id AS indi'. |
|
| 292 | + ' FROM `##maj_sosa`'. |
|
| 293 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 294 | + ' AND majs_gen = :gen'. |
|
| 295 | + ' ORDER BY majs_sosa ASC') |
|
| 296 | + ->execute(array( |
|
| 297 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 298 | + 'user_id' => $this->user->getUserId(), |
|
| 299 | + 'gen' => $gen |
|
| 300 | + )) |
|
| 301 | + ->fetchAssoc(); |
|
| 302 | + } |
|
| 303 | + return $this->sosa_list_by_gen[$gen]; |
|
| 304 | + } |
|
| 305 | + return array(); |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * Get an associative array of Sosa families in generation G. Keys are Sosa numbers for the husband, values families. |
|
| 310 | + * |
|
| 311 | + * @param number $gen Generation |
|
| 312 | + * @return array Array of Sosa families |
|
| 313 | + */ |
|
| 314 | + public function getFamilySosaListAtGeneration($gen){ |
|
| 315 | + if(!$this->is_setup) return array(); |
|
| 316 | + if(!$this->sosa_fam_list_by_gen) |
|
| 317 | + $this->sosa_fam_list_by_gen = array(); |
|
| 318 | 318 | |
| 319 | - if($gen){ |
|
| 320 | - if(!isset($this->sosa_fam_list_by_gen[$gen])){ |
|
| 321 | - $this->sosa_fam_list_by_gen[$gen] = Database::prepare( |
|
| 322 | - 'SELECT s1.majs_sosa AS sosa, f_id AS fam'. |
|
| 323 | - ' FROM `##families`'. |
|
| 324 | - ' INNER JOIN `##maj_sosa` AS s1 ON (`##families`.f_husb = s1.majs_i_id AND `##families`.f_file = s1.majs_gedcom_id)'. |
|
| 325 | - ' INNER JOIN `##maj_sosa` AS s2 ON (`##families`.f_wife = s2.majs_i_id AND `##families`.f_file = s2.majs_gedcom_id)'. |
|
| 326 | - ' WHERE s1.majs_sosa + 1 = s2.majs_sosa'. |
|
| 327 | - ' AND s1.majs_gedcom_id= :tree_id AND s1.majs_user_id=:user_id'. |
|
| 328 | - ' AND s2.majs_gedcom_id= :tree_id AND s2.majs_user_id=:user_id'. |
|
| 329 | - ' AND s1.majs_gen = :gen'. |
|
| 330 | - ' ORDER BY s1.majs_sosa ASC' |
|
| 331 | - ) |
|
| 332 | - ->execute(array( |
|
| 333 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 334 | - 'user_id' => $this->user->getUserId(), |
|
| 335 | - 'gen' => $gen |
|
| 336 | - )) |
|
| 337 | - ->fetchAssoc(); |
|
| 338 | - } |
|
| 339 | - return $this->sosa_fam_list_by_gen[$gen]; |
|
| 340 | - } |
|
| 341 | - return array(); |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * Get an associative array of Sosa individuals in generation G who are missing parents. Keys are Sosa numbers, values individuals. |
|
| 346 | - * |
|
| 347 | - * @param number $gen Generation |
|
| 348 | - * @return array Array of Sosa individuals |
|
| 349 | - */ |
|
| 350 | - public function getMissingSosaListAtGeneration($gen){ |
|
| 351 | - if(!$this->is_setup) return array(); |
|
| 352 | - if($gen){ |
|
| 353 | - return $this->sosa_list_by_gen[$gen] = Database::prepare( |
|
| 354 | - 'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'. |
|
| 355 | - ' FROM `##maj_sosa` schild'. |
|
| 356 | - ' LEFT JOIN `##maj_sosa` sfat ON ((schild.majs_sosa * 2) = sfat.majs_sosa AND schild.majs_gedcom_id = sfat.majs_gedcom_id AND schild.majs_user_id = sfat.majs_user_id)'. |
|
| 357 | - ' LEFT JOIN `##maj_sosa` smot ON ((schild.majs_sosa * 2 + 1) = smot.majs_sosa AND schild.majs_gedcom_id = smot.majs_gedcom_id AND schild.majs_user_id = smot.majs_user_id)'. |
|
| 358 | - ' WHERE schild.majs_gedcom_id = :tree_id AND schild.majs_user_id = :user_id'. |
|
| 359 | - ' AND schild.majs_gen = :gen'. |
|
| 360 | - ' AND (sfat.majs_sosa IS NULL OR smot.majs_sosa IS NULL)'. |
|
| 361 | - ' ORDER BY schild.majs_sosa ASC') |
|
| 362 | - ->execute(array( |
|
| 363 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 364 | - 'user_id' => $this->user->getUserId(), |
|
| 365 | - 'gen' => $gen - 1 |
|
| 366 | - ))->fetchAll(\PDO::FETCH_ASSOC); |
|
| 367 | - } |
|
| 368 | - return array(); |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - |
|
| 372 | - |
|
| 373 | - /************* |
|
| 319 | + if($gen){ |
|
| 320 | + if(!isset($this->sosa_fam_list_by_gen[$gen])){ |
|
| 321 | + $this->sosa_fam_list_by_gen[$gen] = Database::prepare( |
|
| 322 | + 'SELECT s1.majs_sosa AS sosa, f_id AS fam'. |
|
| 323 | + ' FROM `##families`'. |
|
| 324 | + ' INNER JOIN `##maj_sosa` AS s1 ON (`##families`.f_husb = s1.majs_i_id AND `##families`.f_file = s1.majs_gedcom_id)'. |
|
| 325 | + ' INNER JOIN `##maj_sosa` AS s2 ON (`##families`.f_wife = s2.majs_i_id AND `##families`.f_file = s2.majs_gedcom_id)'. |
|
| 326 | + ' WHERE s1.majs_sosa + 1 = s2.majs_sosa'. |
|
| 327 | + ' AND s1.majs_gedcom_id= :tree_id AND s1.majs_user_id=:user_id'. |
|
| 328 | + ' AND s2.majs_gedcom_id= :tree_id AND s2.majs_user_id=:user_id'. |
|
| 329 | + ' AND s1.majs_gen = :gen'. |
|
| 330 | + ' ORDER BY s1.majs_sosa ASC' |
|
| 331 | + ) |
|
| 332 | + ->execute(array( |
|
| 333 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 334 | + 'user_id' => $this->user->getUserId(), |
|
| 335 | + 'gen' => $gen |
|
| 336 | + )) |
|
| 337 | + ->fetchAssoc(); |
|
| 338 | + } |
|
| 339 | + return $this->sosa_fam_list_by_gen[$gen]; |
|
| 340 | + } |
|
| 341 | + return array(); |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * Get an associative array of Sosa individuals in generation G who are missing parents. Keys are Sosa numbers, values individuals. |
|
| 346 | + * |
|
| 347 | + * @param number $gen Generation |
|
| 348 | + * @return array Array of Sosa individuals |
|
| 349 | + */ |
|
| 350 | + public function getMissingSosaListAtGeneration($gen){ |
|
| 351 | + if(!$this->is_setup) return array(); |
|
| 352 | + if($gen){ |
|
| 353 | + return $this->sosa_list_by_gen[$gen] = Database::prepare( |
|
| 354 | + 'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'. |
|
| 355 | + ' FROM `##maj_sosa` schild'. |
|
| 356 | + ' LEFT JOIN `##maj_sosa` sfat ON ((schild.majs_sosa * 2) = sfat.majs_sosa AND schild.majs_gedcom_id = sfat.majs_gedcom_id AND schild.majs_user_id = sfat.majs_user_id)'. |
|
| 357 | + ' LEFT JOIN `##maj_sosa` smot ON ((schild.majs_sosa * 2 + 1) = smot.majs_sosa AND schild.majs_gedcom_id = smot.majs_gedcom_id AND schild.majs_user_id = smot.majs_user_id)'. |
|
| 358 | + ' WHERE schild.majs_gedcom_id = :tree_id AND schild.majs_user_id = :user_id'. |
|
| 359 | + ' AND schild.majs_gen = :gen'. |
|
| 360 | + ' AND (sfat.majs_sosa IS NULL OR smot.majs_sosa IS NULL)'. |
|
| 361 | + ' ORDER BY schild.majs_sosa ASC') |
|
| 362 | + ->execute(array( |
|
| 363 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 364 | + 'user_id' => $this->user->getUserId(), |
|
| 365 | + 'gen' => $gen - 1 |
|
| 366 | + ))->fetchAll(\PDO::FETCH_ASSOC); |
|
| 367 | + } |
|
| 368 | + return array(); |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + |
|
| 372 | + |
|
| 373 | + /************* |
|
| 374 | 374 | * STATISTICS |
| 375 | 375 | *************/ |
| 376 | - /** |
|
| 377 | - * Get the statistic array detailed by generation. |
|
| 378 | - * Statistics for each generation are: |
|
| 379 | - * - The number of Sosa in generation |
|
| 380 | - * - The number of Sosa up to generation |
|
| 381 | - * - The number of distinct Sosa up to generation |
|
| 382 | - * - The year of the first birth in generation |
|
| 383 | - * - The year of the last birth in generation |
|
| 384 | - * - The average year of birth in generation |
|
| 385 | - * |
|
| 386 | - * @return array Statistics array |
|
| 387 | - */ |
|
| 388 | - public function getStatisticsByGeneration() { |
|
| 389 | - if(!$this->is_setup) return array(); |
|
| 390 | - if(!$this->statistics_tab) { |
|
| 391 | - $this->statistics_tab = array(); |
|
| 392 | - if($maxGeneration = $this->getLastGeneration()) { |
|
| 393 | - for ($gen = 1; $gen <= $maxGeneration; $gen++) { |
|
| 394 | - $birthStats = $this->getStatsBirthYearInGeneration($gen); |
|
| 395 | - $this->statistics_tab[$gen] = array( |
|
| 396 | - 'sosaCount' => $this->getSosaCountAtGeneration($gen), |
|
| 397 | - 'sosaTotalCount' => $this->getSosaCountUpToGeneration($gen), |
|
| 398 | - 'diffSosaTotalCount' => $this->getDifferentSosaCountUpToGeneration($gen), |
|
| 399 | - 'firstBirth' => $birthStats['first'], |
|
| 400 | - 'lastBirth' => $birthStats['last'], |
|
| 401 | - 'avgBirth' => $birthStats['avg'] |
|
| 402 | - ); |
|
| 403 | - } |
|
| 404 | - } |
|
| 405 | - } |
|
| 406 | - return $this->statistics_tab; |
|
| 407 | - } |
|
| 376 | + /** |
|
| 377 | + * Get the statistic array detailed by generation. |
|
| 378 | + * Statistics for each generation are: |
|
| 379 | + * - The number of Sosa in generation |
|
| 380 | + * - The number of Sosa up to generation |
|
| 381 | + * - The number of distinct Sosa up to generation |
|
| 382 | + * - The year of the first birth in generation |
|
| 383 | + * - The year of the last birth in generation |
|
| 384 | + * - The average year of birth in generation |
|
| 385 | + * |
|
| 386 | + * @return array Statistics array |
|
| 387 | + */ |
|
| 388 | + public function getStatisticsByGeneration() { |
|
| 389 | + if(!$this->is_setup) return array(); |
|
| 390 | + if(!$this->statistics_tab) { |
|
| 391 | + $this->statistics_tab = array(); |
|
| 392 | + if($maxGeneration = $this->getLastGeneration()) { |
|
| 393 | + for ($gen = 1; $gen <= $maxGeneration; $gen++) { |
|
| 394 | + $birthStats = $this->getStatsBirthYearInGeneration($gen); |
|
| 395 | + $this->statistics_tab[$gen] = array( |
|
| 396 | + 'sosaCount' => $this->getSosaCountAtGeneration($gen), |
|
| 397 | + 'sosaTotalCount' => $this->getSosaCountUpToGeneration($gen), |
|
| 398 | + 'diffSosaTotalCount' => $this->getDifferentSosaCountUpToGeneration($gen), |
|
| 399 | + 'firstBirth' => $birthStats['first'], |
|
| 400 | + 'lastBirth' => $birthStats['last'], |
|
| 401 | + 'avgBirth' => $birthStats['avg'] |
|
| 402 | + ); |
|
| 403 | + } |
|
| 404 | + } |
|
| 405 | + } |
|
| 406 | + return $this->statistics_tab; |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | 409 | /** |
| 410 | 410 | * How many individuals exist in the tree. |
@@ -412,205 +412,205 @@ discard block |
||
| 412 | 412 | * @return int |
| 413 | 413 | */ |
| 414 | 414 | public function getTotalIndividuals() { |
| 415 | - if(!$this->is_setup) return 0; |
|
| 416 | - return Database::prepare( |
|
| 417 | - 'SELECT SQL_CACHE COUNT(*) FROM `##individuals`' . |
|
| 418 | - ' WHERE i_file = :tree_id') |
|
| 419 | - ->execute(array('tree_id' => $this->tree->getTreeId())) |
|
| 420 | - ->fetchOne() ?: 0; |
|
| 415 | + if(!$this->is_setup) return 0; |
|
| 416 | + return Database::prepare( |
|
| 417 | + 'SELECT SQL_CACHE COUNT(*) FROM `##individuals`' . |
|
| 418 | + ' WHERE i_file = :tree_id') |
|
| 419 | + ->execute(array('tree_id' => $this->tree->getTreeId())) |
|
| 420 | + ->fetchOne() ?: 0; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - /** |
|
| 424 | - * Get the total Sosa count for all generations |
|
| 425 | - * |
|
| 426 | - * @return number Number of Sosas |
|
| 427 | - */ |
|
| 428 | - public function getSosaCount(){ |
|
| 429 | - if(!$this->is_setup) return 0; |
|
| 430 | - return Database::prepare( |
|
| 431 | - 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 432 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
|
| 433 | - ->execute(array( |
|
| 434 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 435 | - 'user_id' => $this->user->getUserId() |
|
| 436 | - ))->fetchOne() ?: 0; |
|
| 437 | - } |
|
| 438 | - |
|
| 439 | - /** |
|
| 440 | - * Get the number of Sosa in a specific generation. |
|
| 441 | - * |
|
| 442 | - * @param number $gen Generation |
|
| 443 | - * @return number Number of Sosas in generation |
|
| 444 | - */ |
|
| 445 | - public function getSosaCountAtGeneration($gen){ |
|
| 446 | - if(!$this->is_setup) return 0; |
|
| 447 | - return Database::prepare( |
|
| 448 | - 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 449 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 450 | - ' AND majs_gen= :gen') |
|
| 451 | - ->execute(array( |
|
| 452 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 453 | - 'user_id' => $this->user->getUserId(), |
|
| 454 | - 'gen' => $gen |
|
| 455 | - ))->fetchOne() ?: 0; |
|
| 456 | - } |
|
| 457 | - |
|
| 458 | - /** |
|
| 459 | - * Get the total number of Sosa up to a specific generation. |
|
| 460 | - * |
|
| 461 | - * @param number $gen Generation |
|
| 462 | - * @return number Total number of Sosas up to generation |
|
| 463 | - */ |
|
| 464 | - public function getSosaCountUpToGeneration($gen){ |
|
| 465 | - if(!$this->is_setup) return 0; |
|
| 466 | - return Database::prepare( |
|
| 467 | - 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 468 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 469 | - ' AND majs_gen <= :gen') |
|
| 470 | - ->execute(array( |
|
| 471 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 472 | - 'user_id' => $this->user->getUserId(), |
|
| 473 | - 'gen' => $gen |
|
| 474 | - ))->fetchOne() ?: 0; |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - /** |
|
| 478 | - * Get the total number of distinct Sosa individual for all generations. |
|
| 479 | - * |
|
| 480 | - * @return number Total number of distinct individual |
|
| 481 | - */ |
|
| 482 | - public function getDifferentSosaCount(){ |
|
| 483 | - if(!$this->is_setup) return 0; |
|
| 484 | - return Database::prepare( |
|
| 485 | - 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
|
| 486 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
|
| 487 | - ->execute(array( |
|
| 488 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 489 | - 'user_id' => $this->user->getUserId() |
|
| 490 | - ))->fetchOne() ?: 0; |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - /** |
|
| 494 | - * Get the number of distinct Sosa individual up to a specific generation. |
|
| 495 | - * |
|
| 496 | - * @param number $gen Generation |
|
| 497 | - * @return number Number of distinct Sosa individuals up to generation |
|
| 498 | - */ |
|
| 499 | - public function getDifferentSosaCountUpToGeneration($gen){ |
|
| 500 | - if(!$this->is_setup) return 0; |
|
| 501 | - return Database::prepare( |
|
| 502 | - 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
|
| 503 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 504 | - ' AND majs_gen <= :gen') |
|
| 505 | - ->execute(array( |
|
| 506 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 507 | - 'user_id' => $this->user->getUserId(), |
|
| 508 | - 'gen' => $gen |
|
| 509 | - ))->fetchOne() ?: 0; |
|
| 510 | - } |
|
| 511 | - |
|
| 512 | - /** |
|
| 513 | - * Get an array of birth statistics for a specific generation |
|
| 514 | - * Statistics are : |
|
| 515 | - * - first : First birth year in generation |
|
| 516 | - * - last : Last birth year in generation |
|
| 517 | - * - avg : Average birth year |
|
| 518 | - * |
|
| 519 | - * @param number $gen Generation |
|
| 520 | - * @return array Birth statistics array |
|
| 521 | - */ |
|
| 522 | - public function getStatsBirthYearInGeneration($gen){ |
|
| 523 | - if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0); |
|
| 524 | - return Database::prepare( |
|
| 525 | - 'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'. |
|
| 526 | - ' FROM `##maj_sosa`' . |
|
| 527 | - ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 528 | - ' AND majs_gen=:gen AND NOT majs_birth_year = :birth_year') |
|
| 529 | - ->execute(array( |
|
| 530 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 531 | - 'user_id' => $this->user->getUserId(), |
|
| 532 | - 'gen' => $gen, |
|
| 533 | - 'birth_year' => 0)) |
|
| 534 | - ->fetchOneRow(\PDO::FETCH_ASSOC) ?: array('first' => 0, 'avg' => 0, 'last' => 0); |
|
| 535 | - } |
|
| 536 | - |
|
| 537 | - /** |
|
| 538 | - * Get the mean generation time, based on a linear regression of birth years and generations |
|
| 539 | - * |
|
| 540 | - * @return number|NULL Mean generation time |
|
| 541 | - */ |
|
| 542 | - public function getMeanGenerationTime(){ |
|
| 543 | - if(!$this->is_setup) return; |
|
| 544 | - if(!$this->statistics_tab){ |
|
| 545 | - $this->getStatisticsByGeneration(); |
|
| 546 | - } |
|
| 547 | - //Linear regression on x=generation and y=birthdate |
|
| 548 | - $sum_xy = 0; |
|
| 549 | - $sum_x=0; |
|
| 550 | - $sum_y=0; |
|
| 551 | - $sum_x2=0; |
|
| 552 | - $n=count($this->statistics_tab); |
|
| 553 | - foreach($this->statistics_tab as $gen=>$stats){ |
|
| 554 | - $sum_xy+=$gen*$stats['avgBirth']; |
|
| 555 | - $sum_x+=$gen; |
|
| 556 | - $sum_y+=$stats['avgBirth']; |
|
| 557 | - $sum_x2+=$gen*$gen; |
|
| 558 | - } |
|
| 559 | - $denom=($n*$sum_x2)-($sum_x*$sum_x); |
|
| 560 | - if($denom!=0){ |
|
| 561 | - return -(($n*$sum_xy)-($sum_x*$sum_y))/($denom); |
|
| 562 | - } |
|
| 563 | - return null; |
|
| 564 | - } |
|
| 565 | - |
|
| 566 | - /** |
|
| 567 | - * Return a computed array of statistics about the dispersion of ancestors across the ancestors |
|
| 568 | - * at a specified generation. |
|
| 569 | - * This statistics cannot be used for generations above 11, as it would cause a out of range in MySQL |
|
| 570 | - * |
|
| 571 | - * Format: |
|
| 572 | - * - key : a base-2 representation of the ancestor at generation G for which exclusive ancestors have been found, |
|
| 573 | - * -1 is used for shared ancestors |
|
| 574 | - * For instance base2(0100) = base10(4) represent the maternal grand father |
|
| 575 | - * - values: number of ancestors exclusively in the ancestors of the ancestor in key |
|
| 576 | - * |
|
| 577 | - * For instance a result at generation 3 could be : |
|
| 578 | - * array ( -1 => 12 -> 12 ancestors are shared by the grand-parents |
|
| 579 | - * base10(1) => 32 -> 32 ancestors are exclusive to the paternal grand-father |
|
| 580 | - * base10(2) => 25 -> 25 ancestors are exclusive to the paternal grand-mother |
|
| 581 | - * base10(4) => 12 -> 12 ancestors are exclusive to the maternal grand-father |
|
| 582 | - * base10(8) => 30 -> 30 ancestors are exclusive to the maternal grand-mother |
|
| 583 | - * ) |
|
| 584 | - * |
|
| 585 | - * @param int $gen Reference generation |
|
| 586 | - * @return array |
|
| 587 | - */ |
|
| 588 | - public function getAncestorDispersionForGen($gen) { |
|
| 589 | - if(!$this->is_setup || $gen > 11) return array(); // Going further than 11 gen will be out of range in the query |
|
| 590 | - return Database::prepare( |
|
| 591 | - 'SELECT branches, count(i_id)'. |
|
| 592 | - ' FROM ('. |
|
| 593 | - ' SELECT i_id,'. |
|
| 594 | - ' CASE'. |
|
| 595 | - ' WHEN CEIL(LOG2(SUM(branch))) = LOG2(SUM(branch)) THEN SUM(branch)'. |
|
| 596 | - ' ELSE -1'. // We put all ancestors shared between some branches in the same bucket |
|
| 597 | - ' END branches'. |
|
| 598 | - ' FROM ('. |
|
| 599 | - ' SELECT DISTINCT majs_i_id i_id,'. |
|
| 600 | - ' POW(2, FLOOR(majs_sosa / POW(2, (majs_gen - :gen))) - POW(2, :gen -1)) branch'. |
|
| 601 | - ' FROM `##maj_sosa`'. |
|
| 602 | - ' WHERE majs_gedcom_id = :tree_id AND majs_user_id = :user_id'. |
|
| 603 | - ' AND majs_gen >= :gen'. |
|
| 604 | - ' ) indistat'. |
|
| 605 | - ' GROUP BY i_id'. |
|
| 606 | - ') grouped'. |
|
| 607 | - ' GROUP BY branches') |
|
| 608 | - ->execute(array( |
|
| 609 | - 'tree_id' => $this->tree->getTreeId(), |
|
| 610 | - 'user_id' => $this->user->getUserId(), |
|
| 611 | - 'gen' => $gen |
|
| 612 | - ))->fetchAssoc() ?: array(); |
|
| 613 | - } |
|
| 423 | + /** |
|
| 424 | + * Get the total Sosa count for all generations |
|
| 425 | + * |
|
| 426 | + * @return number Number of Sosas |
|
| 427 | + */ |
|
| 428 | + public function getSosaCount(){ |
|
| 429 | + if(!$this->is_setup) return 0; |
|
| 430 | + return Database::prepare( |
|
| 431 | + 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 432 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
|
| 433 | + ->execute(array( |
|
| 434 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 435 | + 'user_id' => $this->user->getUserId() |
|
| 436 | + ))->fetchOne() ?: 0; |
|
| 437 | + } |
|
| 438 | + |
|
| 439 | + /** |
|
| 440 | + * Get the number of Sosa in a specific generation. |
|
| 441 | + * |
|
| 442 | + * @param number $gen Generation |
|
| 443 | + * @return number Number of Sosas in generation |
|
| 444 | + */ |
|
| 445 | + public function getSosaCountAtGeneration($gen){ |
|
| 446 | + if(!$this->is_setup) return 0; |
|
| 447 | + return Database::prepare( |
|
| 448 | + 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 449 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 450 | + ' AND majs_gen= :gen') |
|
| 451 | + ->execute(array( |
|
| 452 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 453 | + 'user_id' => $this->user->getUserId(), |
|
| 454 | + 'gen' => $gen |
|
| 455 | + ))->fetchOne() ?: 0; |
|
| 456 | + } |
|
| 457 | + |
|
| 458 | + /** |
|
| 459 | + * Get the total number of Sosa up to a specific generation. |
|
| 460 | + * |
|
| 461 | + * @param number $gen Generation |
|
| 462 | + * @return number Total number of Sosas up to generation |
|
| 463 | + */ |
|
| 464 | + public function getSosaCountUpToGeneration($gen){ |
|
| 465 | + if(!$this->is_setup) return 0; |
|
| 466 | + return Database::prepare( |
|
| 467 | + 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 468 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 469 | + ' AND majs_gen <= :gen') |
|
| 470 | + ->execute(array( |
|
| 471 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 472 | + 'user_id' => $this->user->getUserId(), |
|
| 473 | + 'gen' => $gen |
|
| 474 | + ))->fetchOne() ?: 0; |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + /** |
|
| 478 | + * Get the total number of distinct Sosa individual for all generations. |
|
| 479 | + * |
|
| 480 | + * @return number Total number of distinct individual |
|
| 481 | + */ |
|
| 482 | + public function getDifferentSosaCount(){ |
|
| 483 | + if(!$this->is_setup) return 0; |
|
| 484 | + return Database::prepare( |
|
| 485 | + 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
|
| 486 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
|
| 487 | + ->execute(array( |
|
| 488 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 489 | + 'user_id' => $this->user->getUserId() |
|
| 490 | + ))->fetchOne() ?: 0; |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + /** |
|
| 494 | + * Get the number of distinct Sosa individual up to a specific generation. |
|
| 495 | + * |
|
| 496 | + * @param number $gen Generation |
|
| 497 | + * @return number Number of distinct Sosa individuals up to generation |
|
| 498 | + */ |
|
| 499 | + public function getDifferentSosaCountUpToGeneration($gen){ |
|
| 500 | + if(!$this->is_setup) return 0; |
|
| 501 | + return Database::prepare( |
|
| 502 | + 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
|
| 503 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 504 | + ' AND majs_gen <= :gen') |
|
| 505 | + ->execute(array( |
|
| 506 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 507 | + 'user_id' => $this->user->getUserId(), |
|
| 508 | + 'gen' => $gen |
|
| 509 | + ))->fetchOne() ?: 0; |
|
| 510 | + } |
|
| 511 | + |
|
| 512 | + /** |
|
| 513 | + * Get an array of birth statistics for a specific generation |
|
| 514 | + * Statistics are : |
|
| 515 | + * - first : First birth year in generation |
|
| 516 | + * - last : Last birth year in generation |
|
| 517 | + * - avg : Average birth year |
|
| 518 | + * |
|
| 519 | + * @param number $gen Generation |
|
| 520 | + * @return array Birth statistics array |
|
| 521 | + */ |
|
| 522 | + public function getStatsBirthYearInGeneration($gen){ |
|
| 523 | + if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0); |
|
| 524 | + return Database::prepare( |
|
| 525 | + 'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'. |
|
| 526 | + ' FROM `##maj_sosa`' . |
|
| 527 | + ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
|
| 528 | + ' AND majs_gen=:gen AND NOT majs_birth_year = :birth_year') |
|
| 529 | + ->execute(array( |
|
| 530 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 531 | + 'user_id' => $this->user->getUserId(), |
|
| 532 | + 'gen' => $gen, |
|
| 533 | + 'birth_year' => 0)) |
|
| 534 | + ->fetchOneRow(\PDO::FETCH_ASSOC) ?: array('first' => 0, 'avg' => 0, 'last' => 0); |
|
| 535 | + } |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * Get the mean generation time, based on a linear regression of birth years and generations |
|
| 539 | + * |
|
| 540 | + * @return number|NULL Mean generation time |
|
| 541 | + */ |
|
| 542 | + public function getMeanGenerationTime(){ |
|
| 543 | + if(!$this->is_setup) return; |
|
| 544 | + if(!$this->statistics_tab){ |
|
| 545 | + $this->getStatisticsByGeneration(); |
|
| 546 | + } |
|
| 547 | + //Linear regression on x=generation and y=birthdate |
|
| 548 | + $sum_xy = 0; |
|
| 549 | + $sum_x=0; |
|
| 550 | + $sum_y=0; |
|
| 551 | + $sum_x2=0; |
|
| 552 | + $n=count($this->statistics_tab); |
|
| 553 | + foreach($this->statistics_tab as $gen=>$stats){ |
|
| 554 | + $sum_xy+=$gen*$stats['avgBirth']; |
|
| 555 | + $sum_x+=$gen; |
|
| 556 | + $sum_y+=$stats['avgBirth']; |
|
| 557 | + $sum_x2+=$gen*$gen; |
|
| 558 | + } |
|
| 559 | + $denom=($n*$sum_x2)-($sum_x*$sum_x); |
|
| 560 | + if($denom!=0){ |
|
| 561 | + return -(($n*$sum_xy)-($sum_x*$sum_y))/($denom); |
|
| 562 | + } |
|
| 563 | + return null; |
|
| 564 | + } |
|
| 565 | + |
|
| 566 | + /** |
|
| 567 | + * Return a computed array of statistics about the dispersion of ancestors across the ancestors |
|
| 568 | + * at a specified generation. |
|
| 569 | + * This statistics cannot be used for generations above 11, as it would cause a out of range in MySQL |
|
| 570 | + * |
|
| 571 | + * Format: |
|
| 572 | + * - key : a base-2 representation of the ancestor at generation G for which exclusive ancestors have been found, |
|
| 573 | + * -1 is used for shared ancestors |
|
| 574 | + * For instance base2(0100) = base10(4) represent the maternal grand father |
|
| 575 | + * - values: number of ancestors exclusively in the ancestors of the ancestor in key |
|
| 576 | + * |
|
| 577 | + * For instance a result at generation 3 could be : |
|
| 578 | + * array ( -1 => 12 -> 12 ancestors are shared by the grand-parents |
|
| 579 | + * base10(1) => 32 -> 32 ancestors are exclusive to the paternal grand-father |
|
| 580 | + * base10(2) => 25 -> 25 ancestors are exclusive to the paternal grand-mother |
|
| 581 | + * base10(4) => 12 -> 12 ancestors are exclusive to the maternal grand-father |
|
| 582 | + * base10(8) => 30 -> 30 ancestors are exclusive to the maternal grand-mother |
|
| 583 | + * ) |
|
| 584 | + * |
|
| 585 | + * @param int $gen Reference generation |
|
| 586 | + * @return array |
|
| 587 | + */ |
|
| 588 | + public function getAncestorDispersionForGen($gen) { |
|
| 589 | + if(!$this->is_setup || $gen > 11) return array(); // Going further than 11 gen will be out of range in the query |
|
| 590 | + return Database::prepare( |
|
| 591 | + 'SELECT branches, count(i_id)'. |
|
| 592 | + ' FROM ('. |
|
| 593 | + ' SELECT i_id,'. |
|
| 594 | + ' CASE'. |
|
| 595 | + ' WHEN CEIL(LOG2(SUM(branch))) = LOG2(SUM(branch)) THEN SUM(branch)'. |
|
| 596 | + ' ELSE -1'. // We put all ancestors shared between some branches in the same bucket |
|
| 597 | + ' END branches'. |
|
| 598 | + ' FROM ('. |
|
| 599 | + ' SELECT DISTINCT majs_i_id i_id,'. |
|
| 600 | + ' POW(2, FLOOR(majs_sosa / POW(2, (majs_gen - :gen))) - POW(2, :gen -1)) branch'. |
|
| 601 | + ' FROM `##maj_sosa`'. |
|
| 602 | + ' WHERE majs_gedcom_id = :tree_id AND majs_user_id = :user_id'. |
|
| 603 | + ' AND majs_gen >= :gen'. |
|
| 604 | + ' ) indistat'. |
|
| 605 | + ' GROUP BY i_id'. |
|
| 606 | + ') grouped'. |
|
| 607 | + ' GROUP BY branches') |
|
| 608 | + ->execute(array( |
|
| 609 | + 'tree_id' => $this->tree->getTreeId(), |
|
| 610 | + 'user_id' => $this->user->getUserId(), |
|
| 611 | + 'gen' => $gen |
|
| 612 | + ))->fetchAssoc() ?: array(); |
|
| 613 | + } |
|
| 614 | 614 | |
| 615 | 615 | |
| 616 | 616 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return string List of elements |
| 32 | 32 | */ |
| 33 | 33 | public static function getListFromArray(array $array) { |
| 34 | - $n=count($array); |
|
| 34 | + $n = count($array); |
|
| 35 | 35 | switch ($n) { |
| 36 | 36 | case 0: |
| 37 | 37 | return ''; |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | default: |
| 41 | 41 | return implode( |
| 42 | 42 | /* I18N: list separator */ I18N::translate(', '), |
| 43 | - array_slice($array, 0, $n-1) |
|
| 44 | - ) . |
|
| 45 | - /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and ') . |
|
| 46 | - $array[$n-1]; |
|
| 43 | + array_slice($array, 0, $n - 1) |
|
| 44 | + ). |
|
| 45 | + /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and '). |
|
| 46 | + $array[$n - 1]; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | \MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider |
| 60 | 60 | ) { |
| 61 | 61 | $place = $fact->getPlace(); |
| 62 | - if(!$place->isEmpty()) { |
|
| 63 | - $iconPlace= $mapProvider->getPlaceIcon($place); |
|
| 64 | - if($iconPlace && strlen($iconPlace) > 0){ |
|
| 65 | - return '<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>'; |
|
| 62 | + if (!$place->isEmpty()) { |
|
| 63 | + $iconPlace = $mapProvider->getPlaceIcon($place); |
|
| 64 | + if ($iconPlace && strlen($iconPlace) > 0) { |
|
| 65 | + return '<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>'; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | return ''; |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | * @param number $size |
| 77 | 77 | * @return string HTML code of the inserted flag |
| 78 | 78 | */ |
| 79 | - public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
|
| 80 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 79 | + public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) { |
|
| 80 | + return '<img class="flag_gm_h'.$size.'" src="'.$icon_path.'" title="'.$place->getGedcomName().'" alt="'.$place->getGedcomName().'" />'; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $minimum = PHP_INT_MAX; |
| 96 | 96 | $maximum = 1; |
| 97 | 97 | foreach ($list as $params) { |
| 98 | - if(array_key_exists('count', $params)) { |
|
| 98 | + if (array_key_exists('count', $params)) { |
|
| 99 | 99 | $maximum = max($maximum, $params['count']); |
| 100 | 100 | $minimum = min($minimum, $params['count']); |
| 101 | 101 | } |
@@ -113,15 +113,15 @@ discard block |
||
| 113 | 113 | $size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $html .= '<a style="font-size:' . $size . '%" href="' . $url . '">'; |
|
| 116 | + $html .= '<a style="font-size:'.$size.'%" href="'.$url.'">'; |
|
| 117 | 117 | if ($totals) { |
| 118 | - $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $text . '</span>', I18N::number($count)); |
|
| 118 | + $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">'.$text.'</span>', I18N::number($count)); |
|
| 119 | 119 | } else { |
| 120 | 120 | $html .= $text; |
| 121 | 121 | } |
| 122 | 122 | $html .= '</a>'; |
| 123 | 123 | } |
| 124 | - return '<div class="tag_cloud">' . $html . '</div>'; |
|
| 124 | + return '<div class="tag_cloud">'.$html.'</div>'; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | * @param bool $isStrong Bolden the name ? |
| 157 | 157 | * @return string HTML Code for individual item |
| 158 | 158 | */ |
| 159 | - public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
|
| 159 | + public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) { |
|
| 160 | 160 | $html = ''; |
| 161 | 161 | $tag = 'em'; |
| 162 | - if($isStrong) $tag = 'strong'; |
|
| 163 | - if($individual && $individual->canShow()){ |
|
| 162 | + if ($isStrong) $tag = 'strong'; |
|
| 163 | + if ($individual && $individual->canShow()) { |
|
| 164 | 164 | $dindi = new Individual($individual); |
| 165 | 165 | $html = $individual->getSexImage(); |
| 166 | 166 | $html .= '<a class="list_item" href="'. |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $html .= '</a>'; |
| 176 | 176 | } |
| 177 | 177 | else { |
| 178 | - $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
|
| 178 | + $html .= '<span class=\"list_item\"><'.$tag.'>'.I18N::translate('Private').'</'.$tag.'></span>'; |
|
| 179 | 179 | } |
| 180 | 180 | return $html; |
| 181 | 181 | } |
@@ -187,22 +187,22 @@ discard block |
||
| 187 | 187 | * @param boolean $anchor option to print a link to calendar |
| 188 | 188 | * @return string HTML code for short date |
| 189 | 189 | */ |
| 190 | - public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor=false) { |
|
| 190 | + public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) { |
|
| 191 | 191 | global $SEARCH_SPIDER; |
| 192 | 192 | |
| 193 | - $html=''; |
|
| 193 | + $html = ''; |
|
| 194 | 194 | $date = $fact->getDate(); |
| 195 | - if($date->isOK()){ |
|
| 196 | - $html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
|
| 195 | + if ($date->isOK()) { |
|
| 196 | + $html .= ' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
|
| 197 | 197 | } |
| 198 | - else{ |
|
| 198 | + else { |
|
| 199 | 199 | // 1 DEAT Y with no DATE => print YES |
| 200 | 200 | // 1 BIRT 2 SOUR @S1@ => print YES |
| 201 | 201 | // 1 DEAT N is not allowed |
| 202 | 202 | // It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen. |
| 203 | 203 | $factdetail = explode(' ', trim($fact->getGedcom())); |
| 204 | 204 | if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) { |
| 205 | - $html.=I18N::translate('yes'); |
|
| 205 | + $html .= I18N::translate('yes'); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | return $html; |
@@ -216,12 +216,12 @@ discard block |
||
| 216 | 216 | * @param boolean $anchor option to print a link to placelist |
| 217 | 217 | * @return string HTML code for short place |
| 218 | 218 | */ |
| 219 | - public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
|
| 220 | - $html=''; |
|
| 219 | + public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) { |
|
| 220 | + $html = ''; |
|
| 221 | 221 | |
| 222 | 222 | if ($fact === null) return $html; |
| 223 | 223 | $place = $fact->getPlace(); |
| 224 | - if($place){ |
|
| 224 | + if ($place) { |
|
| 225 | 225 | $dplace = new Place($place); |
| 226 | 226 | $html .= $dplace->htmlFormattedName($format, $anchor); |
| 227 | 227 | } |
@@ -239,21 +239,21 @@ discard block |
||
| 239 | 239 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
| 240 | 240 | * @return string HTML code for the formatted Sosa numbers |
| 241 | 241 | */ |
| 242 | - public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){ |
|
| 242 | + public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') { |
|
| 243 | 243 | $html = ''; |
| 244 | - switch($format){ |
|
| 244 | + switch ($format) { |
|
| 245 | 245 | case 1: |
| 246 | - if(count($sosatab)>0){ |
|
| 246 | + if (count($sosatab) > 0) { |
|
| 247 | 247 | $html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>'; |
| 248 | 248 | } |
| 249 | 249 | break; |
| 250 | 250 | case 2: |
| 251 | - if(count($sosatab)>0){ |
|
| 251 | + if (count($sosatab) > 0) { |
|
| 252 | 252 | ksort($sosatab); |
| 253 | 253 | $tmp_html = array(); |
| 254 | 254 | foreach ($sosatab as $sosa => $gen) { |
| 255 | 255 | $tmp_html[] = sprintf( |
| 256 | - '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen) .'</strong>', |
|
| 256 | + '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen).'</strong>', |
|
| 257 | 257 | $size, |
| 258 | 258 | $sosa |
| 259 | 259 | ); |
@@ -279,15 +279,15 @@ discard block |
||
| 279 | 279 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
| 280 | 280 | * @return string HTML code for IsSourced icon |
| 281 | 281 | */ |
| 282 | - public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){ |
|
| 283 | - $html=''; |
|
| 284 | - $image=null; |
|
| 285 | - $title=null; |
|
| 286 | - switch($format){ |
|
| 282 | + public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') { |
|
| 283 | + $html = ''; |
|
| 284 | + $image = null; |
|
| 285 | + $title = null; |
|
| 286 | + switch ($format) { |
|
| 287 | 287 | case 1: |
| 288 | - switch($sourceType){ |
|
| 288 | + switch ($sourceType) { |
|
| 289 | 289 | case 'E': |
| 290 | - switch($isSourced){ |
|
| 290 | + switch ($isSourced) { |
|
| 291 | 291 | case 0: |
| 292 | 292 | $image = 'event_unknown'; |
| 293 | 293 | $title = I18N::translate('%s not found', GedcomTag::getLabel($tag)); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | break; |
| 319 | 319 | case 'R': |
| 320 | - switch($isSourced){ |
|
| 320 | + switch ($isSourced) { |
|
| 321 | 321 | case -1: |
| 322 | 322 | $image = 'record_notsourced'; |
| 323 | 323 | $title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag)); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | default: |
| 338 | 338 | break; |
| 339 | 339 | } |
| 340 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 340 | + if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 341 | 341 | break; |
| 342 | 342 | default: |
| 343 | 343 | break; |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId() |
| 26 | 26 | */ |
| 27 | 27 | public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) { |
| 28 | - if(!$place->isEmpty()) { |
|
| 29 | - $parent = array_reverse(explode (',', $place->getGedcomName())); |
|
| 28 | + if (!$place->isEmpty()) { |
|
| 29 | + $parent = array_reverse(explode(',', $place->getGedcomName())); |
|
| 30 | 30 | $place_id = 0; |
| 31 | 31 | $nb_levels = count($parent); |
| 32 | - for ($i=0; $i < $nb_levels; $i++) { |
|
| 32 | + for ($i = 0; $i < $nb_levels; $i++) { |
|
| 33 | 33 | $parent[$i] = trim($parent[$i]); |
| 34 | - if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , , |
|
| 35 | - $pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
| 34 | + if (empty($parent[$i])) $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
| 35 | + $pl_id = Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
| 36 | 36 | ->execute(array($i, $place_id, $parent[$i])) |
| 37 | 37 | ->fetchOne(); |
| 38 | 38 | if (empty($pl_id)) break; |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getPlaceIcon() |
| 49 | 49 | */ |
| 50 | 50 | public function getPlaceIcon(\Fisharebest\Webtrees\Place $place) { |
| 51 | - if(!$place->isEmpty()){ |
|
| 51 | + if (!$place->isEmpty()) { |
|
| 52 | 52 | $place_details = |
| 53 | 53 | Database::prepare('SELECT SQL_CACHE pl_icon FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place') |
| 54 | 54 | ->execute(array($this->getProviderPlaceId($place))) |
| 55 | 55 | ->fetchOneRow(); |
| 56 | - if($place_details){ |
|
| 56 | + if ($place_details) { |
|
| 57 | 57 | return WT_MODULES_DIR.'googlemap/'.$place_details->pl_icon; |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * {@inhericDoc} |
| 31 | 31 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 32 | 32 | */ |
| 33 | - protected function renderContent() { |
|
| 33 | + protected function renderContent() { |
|
| 34 | 34 | |
| 35 | - if($this->data->get('has_sosa', false)) { |
|
| 36 | - $table_id = $this->data->get('table_id'); |
|
| 37 | - ?> |
|
| 35 | + if($this->data->get('has_sosa', false)) { |
|
| 36 | + $table_id = $this->data->get('table_id'); |
|
| 37 | + ?> |
|
| 38 | 38 | |
| 39 | 39 | <div id="sosa-indi-list" class="sosa-list"> |
| 40 | 40 | <table id="<?php echo $table_id;?>"> |
@@ -185,42 +185,42 @@ discard block |
||
| 185 | 185 | <tbody> |
| 186 | 186 | |
| 187 | 187 | <?php foreach($this->data->get('sosa_list') as $sosa => $person) { |
| 188 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 189 | - if ($person->isPendingAddtion()) { |
|
| 190 | - $class = ' class="new"'; |
|
| 191 | - } elseif ($person->isPendingDeletion()) { |
|
| 192 | - $class = ' class="old"'; |
|
| 193 | - } else { |
|
| 194 | - $class = ''; |
|
| 195 | - } |
|
| 196 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 197 | - ?> |
|
| 188 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 189 | + if ($person->isPendingAddtion()) { |
|
| 190 | + $class = ' class="new"'; |
|
| 191 | + } elseif ($person->isPendingDeletion()) { |
|
| 192 | + $class = ' class="old"'; |
|
| 193 | + } else { |
|
| 194 | + $class = ''; |
|
| 195 | + } |
|
| 196 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 197 | + ?> |
|
| 198 | 198 | <tr <?php echo $class?>> |
| 199 | 199 | <td class="transparent"><?php echo $sosa; ?></td> |
| 200 | 200 | <td class="transparent"><?php echo $person->getXref(); ?></td> |
| 201 | 201 | <td colspan="2"> |
| 202 | 202 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 203 | - if ($name['type']=='NAME') { |
|
| 204 | - $title=''; |
|
| 205 | - } else { |
|
| 206 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 207 | - } |
|
| 208 | - if ($num==$person->getPrimaryName()) { |
|
| 209 | - $class=' class="name2"'; |
|
| 210 | - $sex_image=$person->getSexImage(); |
|
| 211 | - list($surn, $givn)=explode(',', $name['sort']); |
|
| 212 | - } else { |
|
| 213 | - $class=''; |
|
| 214 | - $sex_image=''; |
|
| 215 | - } ?> |
|
| 203 | + if ($name['type']=='NAME') { |
|
| 204 | + $title=''; |
|
| 205 | + } else { |
|
| 206 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 207 | + } |
|
| 208 | + if ($num==$person->getPrimaryName()) { |
|
| 209 | + $class=' class="name2"'; |
|
| 210 | + $sex_image=$person->getSexImage(); |
|
| 211 | + list($surn, $givn)=explode(',', $name['sort']); |
|
| 212 | + } else { |
|
| 213 | + $class=''; |
|
| 214 | + $sex_image=''; |
|
| 215 | + } ?> |
|
| 216 | 216 | <a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>"> |
| 217 | 217 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
| 218 | 218 | </a> |
| 219 | 219 | <?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller'); ?> |
| 220 | 220 | <br/> |
| 221 | 221 | <?php } |
| 222 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 223 | - ?> |
|
| 222 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 223 | + ?> |
|
| 224 | 224 | </td> |
| 225 | 225 | <td style="display:none;"></td> |
| 226 | 226 | <td> |
@@ -231,35 +231,35 @@ discard block |
||
| 231 | 231 | </td> |
| 232 | 232 | <td> |
| 233 | 233 | <?php |
| 234 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 235 | - foreach ($birth_dates as $num=>$birth_date) { |
|
| 236 | - if ($num) { ?><br/><?php } ?> |
|
| 234 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
| 235 | + foreach ($birth_dates as $num=>$birth_date) { |
|
| 236 | + if ($num) { ?><br/><?php } ?> |
|
| 237 | 237 | <?php echo $birth_date->display(true); |
| 238 | - } |
|
| 239 | - } else { |
|
| 240 | - $birth_date = new Date(''); |
|
| 241 | - if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
| 242 | - $birth_date=$person->getEstimatedBirthDate(); |
|
| 243 | - echo $birth_date->display(true); |
|
| 244 | - } else { |
|
| 245 | - echo ' '; |
|
| 246 | - } |
|
| 247 | - $birth_dates[0] = new Date(''); |
|
| 248 | - } |
|
| 249 | - ?> |
|
| 238 | + } |
|
| 239 | + } else { |
|
| 240 | + $birth_date = new Date(''); |
|
| 241 | + if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
| 242 | + $birth_date=$person->getEstimatedBirthDate(); |
|
| 243 | + echo $birth_date->display(true); |
|
| 244 | + } else { |
|
| 245 | + echo ' '; |
|
| 246 | + } |
|
| 247 | + $birth_dates[0] = new Date(''); |
|
| 248 | + } |
|
| 249 | + ?> |
|
| 250 | 250 | </td> |
| 251 | 251 | <td><?php echo $birth_date->julianDay();?></td> |
| 252 | 252 | <td> |
| 253 | 253 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
| 254 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 255 | - if ($n) { ?><br><?php } ?> |
|
| 254 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 255 | + if ($n) { ?><br><?php } ?> |
|
| 256 | 256 | <a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>"> |
| 257 | 257 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?> |
| 258 | 258 | </a> |
| 259 | 259 | <?php } ?> |
| 260 | 260 | </td> |
| 261 | 261 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 262 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 262 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 263 | 263 | <td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium'); ?></td> |
| 264 | 264 | <td><?php echo $isBSourced; ?></td> |
| 265 | 265 | <?php } else { ?> |
@@ -269,38 +269,38 @@ discard block |
||
| 269 | 269 | <td> |
| 270 | 270 | <?php |
| 271 | 271 | if ($death_dates = $person->getAllDeathDates()) { |
| 272 | - foreach ($death_dates as $num => $death_date) { |
|
| 273 | - if ($num) { ?><br/><?php } ?> |
|
| 272 | + foreach ($death_dates as $num => $death_date) { |
|
| 273 | + if ($num) { ?><br/><?php } ?> |
|
| 274 | 274 | <?php echo $death_date->display(true); |
| 275 | - } |
|
| 276 | - } else { |
|
| 277 | - $death_date = $person->getEstimatedDeathDate(); |
|
| 278 | - if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->minimumJulianDay() < WT_CLIENT_JD) { |
|
| 279 | - echo $death_date->display(true); |
|
| 280 | - } elseif ($person->isDead()) { |
|
| 281 | - echo I18N::translate('yes'); |
|
| 282 | - $death_date = new Date(''); |
|
| 283 | - } else { |
|
| 284 | - echo ' '; |
|
| 285 | - $death_date = new Date(''); |
|
| 286 | - } |
|
| 287 | - $death_dates[0] = new Date(''); |
|
| 288 | - } ?> |
|
| 275 | + } |
|
| 276 | + } else { |
|
| 277 | + $death_date = $person->getEstimatedDeathDate(); |
|
| 278 | + if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->minimumJulianDay() < WT_CLIENT_JD) { |
|
| 279 | + echo $death_date->display(true); |
|
| 280 | + } elseif ($person->isDead()) { |
|
| 281 | + echo I18N::translate('yes'); |
|
| 282 | + $death_date = new Date(''); |
|
| 283 | + } else { |
|
| 284 | + echo ' '; |
|
| 285 | + $death_date = new Date(''); |
|
| 286 | + } |
|
| 287 | + $death_dates[0] = new Date(''); |
|
| 288 | + } ?> |
|
| 289 | 289 | </td> |
| 290 | 290 | <td><?php echo $death_date->julianDay(); ?></td> |
| 291 | 291 | <td><?php echo Date::getAge($birth_dates[0], $death_dates[0], 2); ?></td> |
| 292 | 292 | <td><?php echo Date::getAge($birth_dates[0], $death_dates[0], 1); ?></td> |
| 293 | 293 | <td> |
| 294 | 294 | <?php foreach ($person->getAllDeathPlaces() as $n => $death_place) { |
| 295 | - $tmp = new Place($death_place, $person->getTree()); |
|
| 296 | - if ($n) { ?><br><?php } ?> |
|
| 295 | + $tmp = new Place($death_place, $person->getTree()); |
|
| 296 | + if ($n) { ?><br><?php } ?> |
|
| 297 | 297 | <a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>"> |
| 298 | 298 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?> |
| 299 | 299 | </a> |
| 300 | 300 | <?php } ?> |
| 301 | 301 | </td> |
| 302 | 302 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 303 | - $isDSourced = $dperson->isDeathSourced(); ?> |
|
| 303 | + $isDSourced = $dperson->isDeathSourced(); ?> |
|
| 304 | 304 | <td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isDSourced, 'DEAT', 1, 'medium'); ?></td> |
| 305 | 305 | <td><?php echo $isDSourced; ?></td> |
| 306 | 306 | <?php } else { ?> |
@@ -310,29 +310,29 @@ discard block |
||
| 310 | 310 | <td><?php echo $person->getSex(); ?></td> |
| 311 | 311 | <td> |
| 312 | 312 | <?php if (!$person->canShow() || Date::compare($birth_date, new Date(date('Y') - 100)) > 0) { |
| 313 | - echo 'Y100'; |
|
| 314 | - } else { |
|
| 315 | - echo 'YES'; |
|
| 316 | - } ?> |
|
| 313 | + echo 'Y100'; |
|
| 314 | + } else { |
|
| 315 | + echo 'YES'; |
|
| 316 | + } ?> |
|
| 317 | 317 | </td> |
| 318 | 318 | <td> |
| 319 | 319 | <?php if (Date::compare($death_dates[0], new Date(date('Y') - 100)) > 0) { |
| 320 | - echo 'Y100'; |
|
| 321 | - } elseif ($death_dates[0]->minimumJulianDay() || $person->isDead()) { |
|
| 322 | - echo 'YES'; |
|
| 323 | - } else { |
|
| 324 | - echo 'N'; |
|
| 325 | - } ?> |
|
| 320 | + echo 'Y100'; |
|
| 321 | + } elseif ($death_dates[0]->minimumJulianDay() || $person->isDead()) { |
|
| 322 | + echo 'YES'; |
|
| 323 | + } else { |
|
| 324 | + echo 'N'; |
|
| 325 | + } ?> |
|
| 326 | 326 | </td> |
| 327 | 327 | <td> |
| 328 | 328 | <?php if (!$person->getChildFamilies()) { |
| 329 | - echo 'R'; |
|
| 329 | + echo 'R'; |
|
| 330 | 330 | } // roots |
| 331 | 331 | elseif (!$person->isDead() && $person->getNumberOfChildren() < 1) { |
| 332 | - echo 'L'; |
|
| 332 | + echo 'L'; |
|
| 333 | 333 | } // leaves |
| 334 | 334 | else { |
| 335 | - echo ' '; |
|
| 335 | + echo ' '; |
|
| 336 | 336 | } ?> |
| 337 | 337 | </td> |
| 338 | 338 | </tr> |
@@ -343,12 +343,12 @@ discard block |
||
| 343 | 343 | <th class="ui-state-default" colspan="22"> |
| 344 | 344 | <div class="center"> |
| 345 | 345 | <?php echo I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)', |
| 346 | - I18N::number($this->data->get('sosa_count')), |
|
| 347 | - I18N::number($this->data->get('sosa_theo')), |
|
| 348 | - I18N::percentage($this->data->get('sosa_ratio'),2) |
|
| 349 | - ); ?> |
|
| 346 | + I18N::number($this->data->get('sosa_count')), |
|
| 347 | + I18N::number($this->data->get('sosa_theo')), |
|
| 348 | + I18N::percentage($this->data->get('sosa_ratio'),2) |
|
| 349 | + ); ?> |
|
| 350 | 350 | <?php if($this->data->get('sosa_hidden') > 0) { |
| 351 | - echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 351 | + echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 352 | 352 | } ?> |
| 353 | 353 | </div> |
| 354 | 354 | </th> |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | </div> |
| 383 | 383 | </div> |
| 384 | 384 | <?php |
| 385 | - } |
|
| 386 | - } |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | 387 | |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | \ No newline at end of file |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected function renderContent() { |
| 34 | 34 | |
| 35 | - if($this->data->get('has_sosa', false)) { |
|
| 35 | + if ($this->data->get('has_sosa', false)) { |
|
| 36 | 36 | $table_id = $this->data->get('table_id'); |
| 37 | 37 | ?> |
| 38 | 38 | |
| 39 | 39 | <div id="sosa-indi-list" class="sosa-list"> |
| 40 | - <table id="<?php echo $table_id;?>"> |
|
| 40 | + <table id="<?php echo $table_id; ?>"> |
|
| 41 | 41 | <thead> |
| 42 | 42 | <tr> |
| 43 | 43 | <th colspan="22"> |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | </thead> |
| 185 | 185 | <tbody> |
| 186 | 186 | |
| 187 | - <?php foreach($this->data->get('sosa_list') as $sosa => $person) { |
|
| 187 | + <?php foreach ($this->data->get('sosa_list') as $sosa => $person) { |
|
| 188 | 188 | /** @var \Fisharebest\Webtrees\Individual $person */ |
| 189 | 189 | if ($person->isPendingAddtion()) { |
| 190 | 190 | $class = ' class="new"'; |
@@ -200,18 +200,18 @@ discard block |
||
| 200 | 200 | <td class="transparent"><?php echo $person->getXref(); ?></td> |
| 201 | 201 | <td colspan="2"> |
| 202 | 202 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 203 | - if ($name['type']=='NAME') { |
|
| 204 | - $title=''; |
|
| 203 | + if ($name['type'] == 'NAME') { |
|
| 204 | + $title = ''; |
|
| 205 | 205 | } else { |
| 206 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 206 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 207 | 207 | } |
| 208 | - if ($num==$person->getPrimaryName()) { |
|
| 209 | - $class=' class="name2"'; |
|
| 210 | - $sex_image=$person->getSexImage(); |
|
| 211 | - list($surn, $givn)=explode(',', $name['sort']); |
|
| 208 | + if ($num == $person->getPrimaryName()) { |
|
| 209 | + $class = ' class="name2"'; |
|
| 210 | + $sex_image = $person->getSexImage(); |
|
| 211 | + list($surn, $givn) = explode(',', $name['sort']); |
|
| 212 | 212 | } else { |
| 213 | - $class=''; |
|
| 214 | - $sex_image=''; |
|
| 213 | + $class = ''; |
|
| 214 | + $sex_image = ''; |
|
| 215 | 215 | } ?> |
| 216 | 216 | <a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>"> |
| 217 | 217 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
@@ -224,14 +224,14 @@ discard block |
||
| 224 | 224 | </td> |
| 225 | 225 | <td style="display:none;"></td> |
| 226 | 226 | <td> |
| 227 | - <?php echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)); ?> |
|
| 227 | + <?php echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)).'AAAA'.Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)); ?> |
|
| 228 | 228 | </td> |
| 229 | 229 | <td> |
| 230 | - <?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?> |
|
| 230 | + <?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)).'AAAA'.Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?> |
|
| 231 | 231 | </td> |
| 232 | 232 | <td> |
| 233 | 233 | <?php |
| 234 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 234 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
| 235 | 235 | foreach ($birth_dates as $num=>$birth_date) { |
| 236 | 236 | if ($num) { ?><br/><?php } ?> |
| 237 | 237 | <?php echo $birth_date->display(true); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } else { |
| 240 | 240 | $birth_date = new Date(''); |
| 241 | 241 | if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
| 242 | - $birth_date=$person->getEstimatedBirthDate(); |
|
| 242 | + $birth_date = $person->getEstimatedBirthDate(); |
|
| 243 | 243 | echo $birth_date->display(true); |
| 244 | 244 | } else { |
| 245 | 245 | echo ' '; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | ?> |
| 250 | 250 | </td> |
| 251 | - <td><?php echo $birth_date->julianDay();?></td> |
|
| 251 | + <td><?php echo $birth_date->julianDay(); ?></td> |
|
| 252 | 252 | <td> |
| 253 | 253 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
| 254 | 254 | $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
@@ -345,10 +345,10 @@ discard block |
||
| 345 | 345 | <?php echo I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)', |
| 346 | 346 | I18N::number($this->data->get('sosa_count')), |
| 347 | 347 | I18N::number($this->data->get('sosa_theo')), |
| 348 | - I18N::percentage($this->data->get('sosa_ratio'),2) |
|
| 348 | + I18N::percentage($this->data->get('sosa_ratio'), 2) |
|
| 349 | 349 | ); ?> |
| 350 | - <?php if($this->data->get('sosa_hidden') > 0) { |
|
| 351 | - echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 350 | + <?php if ($this->data->get('sosa_hidden') > 0) { |
|
| 351 | + echo '['.I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
| 352 | 352 | } ?> |
| 353 | 353 | </div> |
| 354 | 354 | </th> |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | <button type="button" class="ui-state-default btn-toggle-parents"> |
| 361 | 361 | <?php echo I18N::translate('Show parents') ?> |
| 362 | 362 | </button> |
| 363 | - <button id="btn-toggle-statistics-<?php echo $table_id ;?>" type="button" class="ui-state-default btn-toggle-statistics"> |
|
| 363 | + <button id="btn-toggle-statistics-<?php echo $table_id; ?>" type="button" class="ui-state-default btn-toggle-statistics"> |
|
| 364 | 364 | <?php echo I18N::translate('Show statistics charts') ?> |
| 365 | 365 | </button> |
| 366 | 366 | </div> |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | * {@inhericDoc} |
| 25 | 25 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 26 | 26 | */ |
| 27 | - protected function renderContent() { |
|
| 27 | + protected function renderContent() { |
|
| 28 | 28 | |
| 29 | - ?> |
|
| 29 | + ?> |
|
| 30 | 30 | |
| 31 | 31 | <div id="maj-sosa-config-page"> |
| 32 | 32 | <h2><?php echo $this->data->get('title'); ?></h2> |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | </div> |
| 47 | 47 | <div class="value"> |
| 48 | 48 | <?php |
| 49 | - $users = $this->data->get('users_settings'); |
|
| 50 | - if(count($users) == 1) { |
|
| 51 | - $root_indi = $users[0]['rootid']; ?> |
|
| 49 | + $users = $this->data->get('users_settings'); |
|
| 50 | + if(count($users) == 1) { |
|
| 51 | + $root_indi = $users[0]['rootid']; ?> |
|
| 52 | 52 | <label> |
| 53 | 53 | <input id="maj_sosa_input_userid" type="hidden" name="userid" value="<?php echo $users[0]['user']->getUserId(); ?>" /> |
| 54 | 54 | <?php echo $users[0]['user']->getRealNameHtml() ?> |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | <?php } else if(count($users) > 1) { ?> |
| 57 | 57 | <select id='maj-sosa-config-select' name="userid"> |
| 58 | 58 | <?php |
| 59 | - $root_indi = $users[0]['rootid']; |
|
| 60 | - foreach ($this->data->get('users_settings') as $user) { ?> |
|
| 59 | + $root_indi = $users[0]['rootid']; |
|
| 60 | + foreach ($this->data->get('users_settings') as $user) { ?> |
|
| 61 | 61 | <option value="<?php echo $user['user']->getUserId(); ?>"><?php echo $user['user']->getRealNameHtml() ?></option> |
| 62 | 62 | <?php } ?> |
| 63 | 63 | </select> |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | </form> |
| 81 | 81 | |
| 82 | 82 | <?php |
| 83 | - } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | \ No newline at end of file |
@@ -47,13 +47,13 @@ |
||
| 47 | 47 | <div class="value"> |
| 48 | 48 | <?php |
| 49 | 49 | $users = $this->data->get('users_settings'); |
| 50 | - if(count($users) == 1) { |
|
| 51 | - $root_indi = $users[0]['rootid']; ?> |
|
| 50 | + if (count($users) == 1) { |
|
| 51 | + $root_indi = $users[0]['rootid']; ?> |
|
| 52 | 52 | <label> |
| 53 | 53 | <input id="maj_sosa_input_userid" type="hidden" name="userid" value="<?php echo $users[0]['user']->getUserId(); ?>" /> |
| 54 | 54 | <?php echo $users[0]['user']->getRealNameHtml() ?> |
| 55 | 55 | </label> |
| 56 | - <?php } else if(count($users) > 1) { ?> |
|
| 56 | + <?php } else if (count($users) > 1) { ?> |
|
| 57 | 57 | <select id='maj-sosa-config-select' name="userid"> |
| 58 | 58 | <?php |
| 59 | 59 | $root_indi = $users[0]['rootid']; |
@@ -29,16 +29,16 @@ discard block |
||
| 29 | 29 | * {@inhericDoc} |
| 30 | 30 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 31 | 31 | */ |
| 32 | - protected function renderContent() { |
|
| 33 | - ?> |
|
| 32 | + protected function renderContent() { |
|
| 33 | + ?> |
|
| 34 | 34 | <div id="maj-sosa-missing-page" class="center"> |
| 35 | 35 | <h2><?php echo $this->data->get('title'); ?></h2> |
| 36 | 36 | |
| 37 | 37 | <?php if($this->data->get('is_setup')) { |
| 38 | - $this->renderSosaHeader(); |
|
| 39 | - if($this->data->get('has_missing', false)) { |
|
| 40 | - $table_id = $this->data->get('table_id'); |
|
| 41 | - ?> |
|
| 38 | + $this->renderSosaHeader(); |
|
| 39 | + if($this->data->get('has_missing', false)) { |
|
| 40 | + $table_id = $this->data->get('table_id'); |
|
| 41 | + ?> |
|
| 42 | 42 | <div id="sosa-indi-missing" class="smissing-list"> |
| 43 | 43 | <table id="<?php echo $table_id;?>"> |
| 44 | 44 | <thead> |
@@ -109,44 +109,44 @@ discard block |
||
| 109 | 109 | <tbody> |
| 110 | 110 | |
| 111 | 111 | <?php foreach($this->data->get('missing_list') as $missing_tab) { |
| 112 | - $person = $missing_tab['indi']; |
|
| 112 | + $person = $missing_tab['indi']; |
|
| 113 | 113 | |
| 114 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 115 | - if ($person->isPendingAddtion()) { |
|
| 116 | - $class = ' class="new"'; |
|
| 117 | - } elseif ($person->isPendingDeletion()) { |
|
| 118 | - $class = ' class="old"'; |
|
| 119 | - } else { |
|
| 120 | - $class = ''; |
|
| 121 | - } |
|
| 122 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 123 | - ?> |
|
| 114 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 115 | + if ($person->isPendingAddtion()) { |
|
| 116 | + $class = ' class="new"'; |
|
| 117 | + } elseif ($person->isPendingDeletion()) { |
|
| 118 | + $class = ' class="old"'; |
|
| 119 | + } else { |
|
| 120 | + $class = ''; |
|
| 121 | + } |
|
| 122 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 123 | + ?> |
|
| 124 | 124 | <tr <?php echo $class?>> |
| 125 | 125 | <td class="transparent"><?php echo $missing_tab['sosa']; ?></td> |
| 126 | 126 | <td class="transparent"><?php echo $person->getXref(); ?></td> |
| 127 | 127 | <td colspan="2"> |
| 128 | 128 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 129 | - if ($name['type']=='NAME') { |
|
| 130 | - $title=''; |
|
| 131 | - } else { |
|
| 132 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 133 | - } |
|
| 134 | - if ($num==$person->getPrimaryName()) { |
|
| 135 | - $class=' class="name2"'; |
|
| 136 | - $sex_image=$person->getSexImage(); |
|
| 137 | - list($surn, $givn)=explode(',', $name['sort']); |
|
| 138 | - } else { |
|
| 139 | - $class=''; |
|
| 140 | - $sex_image=''; |
|
| 141 | - } ?> |
|
| 129 | + if ($name['type']=='NAME') { |
|
| 130 | + $title=''; |
|
| 131 | + } else { |
|
| 132 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 133 | + } |
|
| 134 | + if ($num==$person->getPrimaryName()) { |
|
| 135 | + $class=' class="name2"'; |
|
| 136 | + $sex_image=$person->getSexImage(); |
|
| 137 | + list($surn, $givn)=explode(',', $name['sort']); |
|
| 138 | + } else { |
|
| 139 | + $class=''; |
|
| 140 | + $sex_image=''; |
|
| 141 | + } ?> |
|
| 142 | 142 | <a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>"> |
| 143 | 143 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
| 144 | 144 | </a> |
| 145 | 145 | <?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller'); ?> |
| 146 | 146 | <br/> |
| 147 | 147 | <?php } |
| 148 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 149 | - ?> |
|
| 148 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 149 | + ?> |
|
| 150 | 150 | </td> |
| 151 | 151 | <td style="display:none;"></td> |
| 152 | 152 | <td> |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | <?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?> |
| 157 | 157 | </td> |
| 158 | 158 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 159 | - $isISourced = $dperson->isSourced(); ?> |
|
| 159 | + $isISourced = $dperson->isSourced(); ?> |
|
| 160 | 160 | <td><?php echo FunctionsPrint::formatIsSourcedIcon('R', $isISourced, 'INDI', 1, 'medium'); ?></td> |
| 161 | 161 | <td><?php echo $isISourced; ?></td> |
| 162 | 162 | <?php } else { ?> |
@@ -167,35 +167,35 @@ discard block |
||
| 167 | 167 | <td><?php echo $missing_tab['has_mother'] ? ' ' : 'X';?></td> |
| 168 | 168 | <td> |
| 169 | 169 | <?php |
| 170 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 171 | - foreach ($birth_dates as $num=>$birth_date) { |
|
| 172 | - if ($num) { ?><br/><?php } ?> |
|
| 170 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
| 171 | + foreach ($birth_dates as $num=>$birth_date) { |
|
| 172 | + if ($num) { ?><br/><?php } ?> |
|
| 173 | 173 | <?php echo $birth_date->display(true); |
| 174 | - } |
|
| 175 | - } else { |
|
| 176 | - $birth_date = new Date(''); |
|
| 177 | - if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
| 178 | - $birth_date=$person->getEstimatedBirthDate(); |
|
| 179 | - echo $birth_date->display(true); |
|
| 180 | - } else { |
|
| 181 | - echo ' '; |
|
| 182 | - } |
|
| 183 | - $birth_dates[0] = new Date(''); |
|
| 184 | - } |
|
| 185 | - ?> |
|
| 174 | + } |
|
| 175 | + } else { |
|
| 176 | + $birth_date = new Date(''); |
|
| 177 | + if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
| 178 | + $birth_date=$person->getEstimatedBirthDate(); |
|
| 179 | + echo $birth_date->display(true); |
|
| 180 | + } else { |
|
| 181 | + echo ' '; |
|
| 182 | + } |
|
| 183 | + $birth_dates[0] = new Date(''); |
|
| 184 | + } |
|
| 185 | + ?> |
|
| 186 | 186 | </td> |
| 187 | 187 | <td><?php echo $birth_date->julianDay();?></td> |
| 188 | 188 | <td> |
| 189 | 189 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
| 190 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 191 | - if ($n) { ?><br><?php } ?> |
|
| 190 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 191 | + if ($n) { ?><br><?php } ?> |
|
| 192 | 192 | <a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>"> |
| 193 | 193 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?> |
| 194 | 194 | </a> |
| 195 | 195 | <?php } ?> |
| 196 | 196 | </td> |
| 197 | 197 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 198 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 198 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 199 | 199 | <td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium'); ?></td> |
| 200 | 200 | <td><?php echo $isBSourced; ?></td> |
| 201 | 201 | <?php } else { ?> |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | <?php } else if ($this->data->get('generation', 0) > 0) { ?> |
| 223 | 223 | <p><?php echo I18N::translate('No ancestors are missing for this generation. Generation complete at %s.', I18N::percentage($this->data->get('perc_sosa'), 2)); ?></p> |
| 224 | 224 | <?php } |
| 225 | - } else { ?> |
|
| 225 | + } else { ?> |
|
| 226 | 226 | <p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/> |
| 227 | 227 | <ul> |
| 228 | 228 | <li><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></li> |
@@ -233,6 +233,6 @@ discard block |
||
| 233 | 233 | <?php } ?> |
| 234 | 234 | </div> |
| 235 | 235 | <?php |
| 236 | - } |
|
| 236 | + } |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | \ No newline at end of file |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | <div id="maj-sosa-missing-page" class="center"> |
| 35 | 35 | <h2><?php echo $this->data->get('title'); ?></h2> |
| 36 | 36 | |
| 37 | - <?php if($this->data->get('is_setup')) { |
|
| 37 | + <?php if ($this->data->get('is_setup')) { |
|
| 38 | 38 | $this->renderSosaHeader(); |
| 39 | - if($this->data->get('has_missing', false)) { |
|
| 39 | + if ($this->data->get('has_missing', false)) { |
|
| 40 | 40 | $table_id = $this->data->get('table_id'); |
| 41 | 41 | ?> |
| 42 | 42 | <div id="sosa-indi-missing" class="smissing-list"> |
| 43 | - <table id="<?php echo $table_id;?>"> |
|
| 43 | + <table id="<?php echo $table_id; ?>"> |
|
| 44 | 44 | <thead> |
| 45 | 45 | <tr> |
| 46 | 46 | <th colspan="16"> |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | </thead> |
| 109 | 109 | <tbody> |
| 110 | 110 | |
| 111 | - <?php foreach($this->data->get('missing_list') as $missing_tab) { |
|
| 111 | + <?php foreach ($this->data->get('missing_list') as $missing_tab) { |
|
| 112 | 112 | $person = $missing_tab['indi']; |
| 113 | 113 | |
| 114 | 114 | /** @var \Fisharebest\Webtrees\Individual $person */ |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | <td class="transparent"><?php echo $person->getXref(); ?></td> |
| 127 | 127 | <td colspan="2"> |
| 128 | 128 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 129 | - if ($name['type']=='NAME') { |
|
| 130 | - $title=''; |
|
| 129 | + if ($name['type'] == 'NAME') { |
|
| 130 | + $title = ''; |
|
| 131 | 131 | } else { |
| 132 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 132 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 133 | 133 | } |
| 134 | - if ($num==$person->getPrimaryName()) { |
|
| 135 | - $class=' class="name2"'; |
|
| 136 | - $sex_image=$person->getSexImage(); |
|
| 137 | - list($surn, $givn)=explode(',', $name['sort']); |
|
| 134 | + if ($num == $person->getPrimaryName()) { |
|
| 135 | + $class = ' class="name2"'; |
|
| 136 | + $sex_image = $person->getSexImage(); |
|
| 137 | + list($surn, $givn) = explode(',', $name['sort']); |
|
| 138 | 138 | } else { |
| 139 | - $class=''; |
|
| 140 | - $sex_image=''; |
|
| 139 | + $class = ''; |
|
| 140 | + $sex_image = ''; |
|
| 141 | 141 | } ?> |
| 142 | 142 | <a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>"> |
| 143 | 143 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | </td> |
| 151 | 151 | <td style="display:none;"></td> |
| 152 | 152 | <td> |
| 153 | - <?php echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)); ?> |
|
| 153 | + <?php echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)).'AAAA'.Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)); ?> |
|
| 154 | 154 | </td> |
| 155 | 155 | <td> |
| 156 | - <?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?> |
|
| 156 | + <?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)).'AAAA'.Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?> |
|
| 157 | 157 | </td> |
| 158 | 158 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 159 | 159 | $isISourced = $dperson->isSourced(); ?> |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | <td> </td> |
| 164 | 164 | <td></td> |
| 165 | 165 | <?php } ?> |
| 166 | - <td><?php echo $missing_tab['has_father'] ? ' ' : 'X';?></td> |
|
| 167 | - <td><?php echo $missing_tab['has_mother'] ? ' ' : 'X';?></td> |
|
| 166 | + <td><?php echo $missing_tab['has_father'] ? ' ' : 'X'; ?></td> |
|
| 167 | + <td><?php echo $missing_tab['has_mother'] ? ' ' : 'X'; ?></td> |
|
| 168 | 168 | <td> |
| 169 | 169 | <?php |
| 170 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 170 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
| 171 | 171 | foreach ($birth_dates as $num=>$birth_date) { |
| 172 | 172 | if ($num) { ?><br/><?php } ?> |
| 173 | 173 | <?php echo $birth_date->display(true); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } else { |
| 176 | 176 | $birth_date = new Date(''); |
| 177 | 177 | if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
| 178 | - $birth_date=$person->getEstimatedBirthDate(); |
|
| 178 | + $birth_date = $person->getEstimatedBirthDate(); |
|
| 179 | 179 | echo $birth_date->display(true); |
| 180 | 180 | } else { |
| 181 | 181 | echo ' '; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | ?> |
| 186 | 186 | </td> |
| 187 | - <td><?php echo $birth_date->julianDay();?></td> |
|
| 187 | + <td><?php echo $birth_date->julianDay(); ?></td> |
|
| 188 | 188 | <td> |
| 189 | 189 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
| 190 | 190 | $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | <td class="ui-state-default" colspan="16"> |
| 212 | 212 | <div class="center"> |
| 213 | 213 | <?php echo I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count'))); ?> |
| 214 | - <?php if($this->data->get('missing_hidden') > 0) echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
| 215 | - <?php echo ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)); ?> |
|
| 216 | - <?php echo ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'),2)).']'; ?> |
|
| 214 | + <?php if ($this->data->get('missing_hidden') > 0) echo ' ['.I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
| 215 | + <?php echo ' - '.I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)); ?> |
|
| 216 | + <?php echo ' ['.I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'), 2)).']'; ?> |
|
| 217 | 217 | </div> |
| 218 | 218 | </td> |
| 219 | 219 | </tr> |
@@ -31,116 +31,116 @@ discard block |
||
| 31 | 31 | * Sosa Module. |
| 32 | 32 | */ |
| 33 | 33 | class SosaModule |
| 34 | - extends AbstractModule |
|
| 35 | - implements ModuleMenuInterface, |
|
| 36 | - ModuleConfigInterface, |
|
| 37 | - HookSubscriberInterface, |
|
| 38 | - IndividualHeaderExtenderInterface, |
|
| 39 | - RecordNameTextExtenderInterface |
|
| 34 | + extends AbstractModule |
|
| 35 | + implements ModuleMenuInterface, |
|
| 36 | + ModuleConfigInterface, |
|
| 37 | + HookSubscriberInterface, |
|
| 38 | + IndividualHeaderExtenderInterface, |
|
| 39 | + RecordNameTextExtenderInterface |
|
| 40 | 40 | { |
| 41 | - // How to update the database schema for this module |
|
| 42 | - const SCHEMA_TARGET_VERSION = 1; |
|
| 43 | - const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
| 44 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema'; |
|
| 41 | + // How to update the database schema for this module |
|
| 42 | + const SCHEMA_TARGET_VERSION = 1; |
|
| 43 | + const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
| 44 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema'; |
|
| 45 | 45 | |
| 46 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 47 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * {@inhericDoc} |
|
| 51 | - */ |
|
| 52 | - public function getTitle() { |
|
| 53 | - return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * {@inhericDoc} |
|
| 58 | - */ |
|
| 59 | - public function getDescription() { |
|
| 60 | - return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * {@inhericDoc} |
|
| 65 | - */ |
|
| 66 | - public function modAction($mod_action) { |
|
| 67 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 46 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 47 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * {@inhericDoc} |
|
| 51 | + */ |
|
| 52 | + public function getTitle() { |
|
| 53 | + return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * {@inhericDoc} |
|
| 58 | + */ |
|
| 59 | + public function getDescription() { |
|
| 60 | + return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * {@inhericDoc} |
|
| 65 | + */ |
|
| 66 | + public function modAction($mod_action) { |
|
| 67 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 68 | 68 | |
| 69 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 70 | - } |
|
| 69 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /********** |
|
| 72 | + /********** |
|
| 73 | 73 | * ModuleConfigInterface |
| 74 | 74 | **********/ |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * {@inhericDoc} |
|
| 78 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 79 | - */ |
|
| 80 | - public function getConfigLink() { |
|
| 81 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 76 | + /** |
|
| 77 | + * {@inhericDoc} |
|
| 78 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 79 | + */ |
|
| 80 | + public function getConfigLink() { |
|
| 81 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 82 | 82 | |
| 83 | - return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
| 84 | - } |
|
| 83 | + return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /********** |
|
| 86 | + /********** |
|
| 87 | 87 | * ModuleMenuInterface |
| 88 | 88 | **********/ |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * {@inhericDoc} |
|
| 92 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
| 93 | - */ |
|
| 94 | - public function defaultMenuOrder() { |
|
| 95 | - return 5; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * {@inhericDoc} |
|
| 100 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
| 101 | - */ |
|
| 102 | - public function getMenu() { |
|
| 103 | - global $WT_TREE, $controller; |
|
| 90 | + /** |
|
| 91 | + * {@inhericDoc} |
|
| 92 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
| 93 | + */ |
|
| 94 | + public function defaultMenuOrder() { |
|
| 95 | + return 5; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * {@inhericDoc} |
|
| 100 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
| 101 | + */ |
|
| 102 | + public function getMenu() { |
|
| 103 | + global $WT_TREE, $controller; |
|
| 104 | 104 | |
| 105 | - $menu = null; |
|
| 106 | - if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
| 105 | + $menu = null; |
|
| 106 | + if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
| 107 | 107 | |
| 108 | - $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&'; |
|
| 109 | - $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
| 108 | + $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&'; |
|
| 109 | + $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
| 110 | 110 | |
| 111 | - $menu = clone $sosa_stat_menu; |
|
| 112 | - $menu->setClass('menu-maj-sosa'); |
|
| 111 | + $menu = clone $sosa_stat_menu; |
|
| 112 | + $menu->setClass('menu-maj-sosa'); |
|
| 113 | 113 | |
| 114 | - $submenus = array_filter(array( |
|
| 115 | - new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
| 116 | - new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
| 117 | - $sosa_stat_menu |
|
| 118 | - )); |
|
| 114 | + $submenus = array_filter(array( |
|
| 115 | + new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
| 116 | + new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
| 117 | + $sosa_stat_menu |
|
| 118 | + )); |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | - if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME) |
|
| 122 | - && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
|
| 123 | - ) |
|
| 124 | - { |
|
| 125 | - if(count($ga_list) > 0) { |
|
| 126 | - $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
| 127 | - } |
|
| 128 | - } |
|
| 121 | + if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME) |
|
| 122 | + && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
|
| 123 | + ) |
|
| 124 | + { |
|
| 125 | + if(count($ga_list) > 0) { |
|
| 126 | + $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - if(Auth::check()) { |
|
| 131 | - $submenus[] = new Menu( |
|
| 132 | - I18N::translate('Sosa Configuration'), |
|
| 133 | - $this->getConfigLink(), |
|
| 134 | - 'menu-maj-sosa-configuration', |
|
| 135 | - array('rel' => 'nofollow')); |
|
| 136 | - } |
|
| 130 | + if(Auth::check()) { |
|
| 131 | + $submenus[] = new Menu( |
|
| 132 | + I18N::translate('Sosa Configuration'), |
|
| 133 | + $this->getConfigLink(), |
|
| 134 | + 'menu-maj-sosa-configuration', |
|
| 135 | + array('rel' => 'nofollow')); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - //-- recompute Sosa submenu |
|
| 139 | - if (!empty($controller) && $controller instanceof IndividualController |
|
| 140 | - && Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID') |
|
| 141 | - ) { |
|
| 142 | - $controller |
|
| 143 | - ->addInlineJavascript(' |
|
| 138 | + //-- recompute Sosa submenu |
|
| 139 | + if (!empty($controller) && $controller instanceof IndividualController |
|
| 140 | + && Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID') |
|
| 141 | + ) { |
|
| 142 | + $controller |
|
| 143 | + ->addInlineJavascript(' |
|
| 144 | 144 | function majComputeSosaFromIndi(){ |
| 145 | 145 | if($("#computesosadlg").length == 0) { |
| 146 | 146 | $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>"); |
@@ -163,87 +163,87 @@ discard block |
||
| 163 | 163 | }); |
| 164 | 164 | }'); |
| 165 | 165 | |
| 166 | - $submenus[] = new Menu( |
|
| 167 | - I18N::translate('Complete Sosas'), |
|
| 168 | - '#', |
|
| 169 | - 'menu-maj-sosa-recompute', |
|
| 170 | - array( |
|
| 171 | - 'rel' => 'nofollow', |
|
| 172 | - 'onclick' => 'return majComputeSosaFromIndi();' |
|
| 173 | - )); |
|
| 174 | - } |
|
| 166 | + $submenus[] = new Menu( |
|
| 167 | + I18N::translate('Complete Sosas'), |
|
| 168 | + '#', |
|
| 169 | + 'menu-maj-sosa-recompute', |
|
| 170 | + array( |
|
| 171 | + 'rel' => 'nofollow', |
|
| 172 | + 'onclick' => 'return majComputeSosaFromIndi();' |
|
| 173 | + )); |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - } |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - $menu->setSubmenus($submenus); |
|
| 178 | + $menu->setSubmenus($submenus); |
|
| 179 | 179 | |
| 180 | - return $menu; |
|
| 180 | + return $menu; |
|
| 181 | 181 | |
| 182 | - } |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - /********** |
|
| 184 | + /********** |
|
| 185 | 185 | * Hooks |
| 186 | 186 | **********/ |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * {@inhericDoc} |
|
| 190 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 191 | - */ |
|
| 192 | - public function getSubscribedHooks() { |
|
| 193 | - return array( |
|
| 194 | - 'hExtendIndiHeaderIcons' => 20, |
|
| 195 | - 'hExtendIndiHeaderRight' => 20, |
|
| 196 | - 'hRecordNameAppend' => 20 |
|
| 197 | - ); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * {@inhericDoc} |
|
| 202 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
|
| 203 | - */ |
|
| 204 | - public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
|
| 205 | - if($ctrlIndi){ |
|
| 206 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 207 | - return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
|
| 208 | - } |
|
| 209 | - return ''; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * {@inhericDoc} |
|
| 214 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() |
|
| 215 | - */ |
|
| 216 | - public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { } |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * {@inhericDoc} |
|
| 220 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
|
| 221 | - */ |
|
| 222 | - public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
|
| 223 | - if($ctrlIndi){ |
|
| 224 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 225 | - return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
| 226 | - } |
|
| 227 | - return ''; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * {@inhericDoc} |
|
| 232 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
|
| 233 | - */ |
|
| 234 | - public function hRecordNameAppend(GedcomRecord $grec) { |
|
| 235 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
| 236 | - $dindi = new Individual($grec); |
|
| 237 | - return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
|
| 238 | - } |
|
| 239 | - return ''; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * {@inhericDoc} |
|
| 244 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend() |
|
| 245 | - */ |
|
| 246 | - public function hRecordNamePrepend(GedcomRecord $grec) {} |
|
| 188 | + /** |
|
| 189 | + * {@inhericDoc} |
|
| 190 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 191 | + */ |
|
| 192 | + public function getSubscribedHooks() { |
|
| 193 | + return array( |
|
| 194 | + 'hExtendIndiHeaderIcons' => 20, |
|
| 195 | + 'hExtendIndiHeaderRight' => 20, |
|
| 196 | + 'hRecordNameAppend' => 20 |
|
| 197 | + ); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * {@inhericDoc} |
|
| 202 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
|
| 203 | + */ |
|
| 204 | + public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
|
| 205 | + if($ctrlIndi){ |
|
| 206 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 207 | + return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
|
| 208 | + } |
|
| 209 | + return ''; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * {@inhericDoc} |
|
| 214 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() |
|
| 215 | + */ |
|
| 216 | + public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { } |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * {@inhericDoc} |
|
| 220 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
|
| 221 | + */ |
|
| 222 | + public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
|
| 223 | + if($ctrlIndi){ |
|
| 224 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 225 | + return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
| 226 | + } |
|
| 227 | + return ''; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * {@inhericDoc} |
|
| 232 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
|
| 233 | + */ |
|
| 234 | + public function hRecordNameAppend(GedcomRecord $grec) { |
|
| 235 | + if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
| 236 | + $dindi = new Individual($grec); |
|
| 237 | + return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
|
| 238 | + } |
|
| 239 | + return ''; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * {@inhericDoc} |
|
| 244 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend() |
|
| 245 | + */ |
|
| 246 | + public function hRecordNamePrepend(GedcomRecord $grec) {} |
|
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | |