@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | <input type="hidden" name="ged" value="<?= $this->data->get('url_ged') ?>"> |
| 40 | 40 | <select name="city"> |
| 41 | 41 | <?php foreach ($cities as $city) { ?> |
| 42 | - <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if(trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option> |
|
| 42 | + <option value="<?= Functions::encryptToSafeBase64($city) ?>" <?php if (trim($city) == trim($selected_city)) echo 'selected="selected"'?> ><?= $city ?></option> |
|
| 43 | 43 | <?php } ?> |
| 44 | 44 | </select> |
| 45 | 45 | <input type="submit" value="<?= I18N::translate('Show') ?>" /> |
| 46 | 46 | </form> |
| 47 | 47 | |
| 48 | - <?php if($this->data->get('has_list', false)) { ?> |
|
| 48 | + <?php if ($this->data->get('has_list', false)) { ?> |
|
| 49 | 49 | <div class="loading-image"> </div> |
| 50 | 50 | <div class="certificate-list"> |
| 51 | 51 | <table id="<?= $this->data->get('table_id') ?>"> |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | ?> |
| 63 | 63 | <tr> |
| 64 | 64 | <!-- Certificate date --> |
| 65 | - <?php if($date = $certificate->getCertificateDate()) { ?> |
|
| 65 | + <?php if ($date = $certificate->getCertificateDate()) { ?> |
|
| 66 | 66 | <td data-sort="<?= $date->julianDay() ?>"><?= $date->display() ?></td> |
| 67 | 67 | <?php } else { ?> |
| 68 | 68 | <td data-sort="0"> </td> |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | <?php |
| 74 | 74 | $name = $certificate->getCertificateDetails() ?: ''; |
| 75 | 75 | $sortname = ""; |
| 76 | - $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | - if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 76 | + $ct_names = preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | + if ($ct_names > 0) $sortname = $match[1].'_'; |
|
| 78 | 78 | $sortname .= $name; |
| 79 | 79 | ?> |
| 80 | 80 | <td data-sort="<?= Filter::escapeHtml($sortname) ?>"> |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | <div id="maj-sosa-missing-page" class="center"> |
| 36 | 36 | <h2><?= $this->data->get('title') ?></h2> |
| 37 | 37 | |
| 38 | - <?php if($this->data->get('is_setup')) { |
|
| 38 | + <?php if ($this->data->get('is_setup')) { |
|
| 39 | 39 | $this->renderSosaHeader(); |
| 40 | - if($this->data->get('has_missing', false)) { |
|
| 40 | + if ($this->data->get('has_missing', false)) { |
|
| 41 | 41 | $table_id = $this->data->get('table_id'); |
| 42 | 42 | ?> |
| 43 | 43 | <div id="sosa-indi-missing" class="smissing-list"> |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | </thead> |
| 103 | 103 | <tbody> |
| 104 | 104 | |
| 105 | - <?php foreach($this->data->get('missing_list') as $missing_tab) { |
|
| 105 | + <?php foreach ($this->data->get('missing_list') as $missing_tab) { |
|
| 106 | 106 | $person = $missing_tab['indi']; |
| 107 | 107 | |
| 108 | 108 | /** @var \Fisharebest\Webtrees\Individual $person */ |
@@ -121,17 +121,17 @@ discard block |
||
| 121 | 121 | <td class="transparent"><?= $person->getXref() ?></td> |
| 122 | 122 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 123 | 123 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 124 | - if ($name['type']=='NAME') { |
|
| 125 | - $title=''; |
|
| 124 | + if ($name['type'] == 'NAME') { |
|
| 125 | + $title = ''; |
|
| 126 | 126 | } else { |
| 127 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 127 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 128 | 128 | } |
| 129 | - if ($num==$person->getPrimaryName()) { |
|
| 130 | - $class=' class="name2"'; |
|
| 131 | - $sex_image=$person->getSexImage(); |
|
| 129 | + if ($num == $person->getPrimaryName()) { |
|
| 130 | + $class = ' class="name2"'; |
|
| 131 | + $sex_image = $person->getSexImage(); |
|
| 132 | 132 | } else { |
| 133 | - $class=''; |
|
| 134 | - $sex_image=''; |
|
| 133 | + $class = ''; |
|
| 134 | + $sex_image = ''; |
|
| 135 | 135 | } ?> |
| 136 | 136 | <a <?= $title.' '.$class ?> href="<?= $person->getHtmlUrl() ?>"> |
| 137 | 137 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | <td class="ui-state-default" colspan="11"> |
| 185 | 185 | <div class="center"> |
| 186 | 186 | <?= I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count'))) ?> |
| 187 | - <?php if($this->data->get('missing_hidden') > 0) echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
| 188 | - <?= ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)) ?> |
|
| 189 | - <?= ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'),2)).']' ?> |
|
| 187 | + <?php if ($this->data->get('missing_hidden') > 0) echo ' ['.I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
| 188 | + <?= ' - '.I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)) ?> |
|
| 189 | + <?= ' ['.I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'), 2)).']' ?> |
|
| 190 | 190 | </div> |
| 191 | 191 | </td> |
| 192 | 192 | </tr> |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | protected $gedcomrecord; |
| 24 | 24 | |
| 25 | 25 | /** @var bool Is the GedcomRecord sourced (cache) */ |
| 26 | - protected $_issourced=null; |
|
| 26 | + protected $_issourced = null; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Contructor for the decorator |
| 30 | 30 | * |
| 31 | 31 | * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend |
| 32 | 32 | */ |
| 33 | - public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){ |
|
| 33 | + public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) { |
|
| 34 | 34 | $this->gedcomrecord = $gedcomrecord_in; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record |
| 41 | 41 | */ |
| 42 | - public function getDerivedRecord(){ |
|
| 42 | + public function getDerivedRecord() { |
|
| 43 | 43 | return $this->gedcomrecord; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
| 71 | 71 | switch ($style) { |
| 72 | 72 | case 10: |
| 73 | - return '<i>'.$fact->getLabel().' '. mw\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
| 73 | + return '<i>'.$fact->getLabel().' '.mw\Functions\FunctionsPrint::formatFactDateShort($fact).' '.mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>'; |
|
| 74 | 74 | default: |
| 75 | 75 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
| 76 | 76 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | * @param int $access_level |
| 86 | 86 | * @return boolean |
| 87 | 87 | */ |
| 88 | - public function canDisplayIsSourced($access_level = null){ |
|
| 88 | + public function canDisplayIsSourced($access_level = null) { |
|
| 89 | 89 | global $global_facts; |
| 90 | 90 | |
| 91 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 92 | - if($access_level === null ) |
|
| 91 | + if (!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 92 | + if ($access_level === null) |
|
| 93 | 93 | $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
| 94 | 94 | |
| 95 | 95 | if (isset($global_facts['SOUR'])) { |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return int Level of sources |
| 110 | 110 | */ |
| 111 | - public function isSourced(){ |
|
| 112 | - if($this->_issourced !== null) return $this->_issourced; |
|
| 113 | - $this->_issourced=-1; |
|
| 111 | + public function isSourced() { |
|
| 112 | + if ($this->_issourced !== null) return $this->_issourced; |
|
| 113 | + $this->_issourced = -1; |
|
| 114 | 114 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
| 115 | - foreach($sourcesfacts as $sourcefact){ |
|
| 116 | - $this->_issourced=max($this->_issourced, 1); |
|
| 117 | - if($sourcefact->getAttribute('_ACT')){ |
|
| 118 | - $this->_issourced=max($this->_issourced, 2); |
|
| 115 | + foreach ($sourcesfacts as $sourcefact) { |
|
| 116 | + $this->_issourced = max($this->_issourced, 1); |
|
| 117 | + if ($sourcefact->getAttribute('_ACT')) { |
|
| 118 | + $this->_issourced = max($this->_issourced, 2); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | return $this->_issourced; |
@@ -127,19 +127,19 @@ discard block |
||
| 127 | 127 | * @param string $eventslist |
| 128 | 128 | * @return int Level of sources |
| 129 | 129 | */ |
| 130 | - public function isFactSourced($eventslist){ |
|
| 131 | - if(empty($eventslist)) return 0; |
|
| 132 | - $isSourced=0; |
|
| 130 | + public function isFactSourced($eventslist) { |
|
| 131 | + if (empty($eventslist)) return 0; |
|
| 132 | + $isSourced = 0; |
|
| 133 | 133 | $facts = $this->gedcomrecord->getFacts($eventslist); |
| 134 | - foreach($facts as $fact){ |
|
| 135 | - if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){ |
|
| 134 | + foreach ($facts as $fact) { |
|
| 135 | + if ($isSourced < Fact::MAX_IS_SOURCED_LEVEL) { |
|
| 136 | 136 | $dfact = new Fact($fact); |
| 137 | 137 | $tmpIsSourced = $dfact->isSourced(); |
| 138 | - if($tmpIsSourced != 0) { |
|
| 139 | - if($isSourced==0) { |
|
| 140 | - $isSourced = $tmpIsSourced; |
|
| 138 | + if ($tmpIsSourced != 0) { |
|
| 139 | + if ($isSourced == 0) { |
|
| 140 | + $isSourced = $tmpIsSourced; |
|
| 141 | 141 | } |
| 142 | - else{ |
|
| 142 | + else { |
|
| 143 | 143 | $isSourced = max($isSourced, $tmpIsSourced); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | return $wb_controller->config($block_id); |
| 92 | 92 | } |
| 93 | 93 | catch (MvcException $ex) { |
| 94 | - if($ex->getHttpCode() != 200) throw $ex; |
|
| 94 | + if ($ex->getHttpCode() != 200) throw $ex; |
|
| 95 | 95 | return; |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | public function getConfigLink() { |
| 81 | 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'; |
|
| 83 | + return 'module.php?mod='.$this->getName().'&mod_action=SosaConfig'; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /********** |
@@ -103,17 +103,17 @@ discard block |
||
| 103 | 103 | global $WT_TREE, $controller; |
| 104 | 104 | |
| 105 | 105 | $menu = null; |
| 106 | - if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
| 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 | 111 | $menu = clone $sosa_stat_menu; |
| 112 | 112 | $menu->setClass('menu-maj-sosa'); |
| 113 | 113 | |
| 114 | 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')), |
|
| 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 | 117 | $sosa_stat_menu |
| 118 | 118 | )); |
| 119 | 119 | |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
| 123 | 123 | ) |
| 124 | 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'); |
|
| 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 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if(Auth::check()) { |
|
| 130 | + if (Auth::check()) { |
|
| 131 | 131 | $submenus[] = new Menu( |
| 132 | 132 | I18N::translate('Sosa Configuration'), |
| 133 | 133 | $this->getConfigLink(), |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ->addInlineJavascript(' |
| 144 | 144 | function majComputeSosaFromIndi(){ |
| 145 | 145 | if($("#computesosadlg").length == 0) { |
| 146 | - $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>"); |
|
| 146 | + $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation').'\"><div id=\"sosaloadingarea\"></div></div>"); |
|
| 147 | 147 | } |
| 148 | 148 | $("#computesosadlg").dialog({ |
| 149 | 149 | modal: true, |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | open: function(event, ui) { |
| 153 | 153 | $("button.ui-dialog-titlebar-close").hide(); |
| 154 | 154 | $("#sosaloadingarea").empty().html("<i class=\"icon-loading-small\"></i>"); |
| 155 | - $("#sosaloadingarea").load("module.php?mod=' . $this->getName() . '&mod_action=SosaConfig@computePartial&ged='. $WT_TREE->getNameUrl() .'&userid='.Auth::user()->getUserId().'&pid=' . $controller->getSignificantIndividual()->getXref() . '", |
|
| 155 | + $("#sosaloadingarea").load("module.php?mod=' . $this->getName().'&mod_action=SosaConfig@computePartial&ged='.$WT_TREE->getNameUrl().'&userid='.Auth::user()->getUserId().'&pid='.$controller->getSignificantIndividual()->getXref().'", |
|
| 156 | 156 | function(){ |
| 157 | 157 | $("button.ui-dialog-titlebar-close").show(); |
| 158 | 158 | setTimeout(function(){ |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
| 203 | 203 | */ |
| 204 | 204 | public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
| 205 | - if($ctrlIndi){ |
|
| 205 | + if ($ctrlIndi) { |
|
| 206 | 206 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
| 207 | 207 | return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
| 208 | 208 | } |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
| 221 | 221 | */ |
| 222 | 222 | public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
| 223 | - if($ctrlIndi){ |
|
| 223 | + if ($ctrlIndi) { |
|
| 224 | 224 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
| 225 | - return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
| 225 | + return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
| 226 | 226 | } |
| 227 | 227 | return ''; |
| 228 | 228 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
| 233 | 233 | */ |
| 234 | 234 | public function hRecordNameAppend(GedcomRecord $grec) { |
| 235 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
| 235 | + if ($grec instanceof \Fisharebest\Webtrees\Individual) { // Only apply to individuals |
|
| 236 | 236 | $dindi = new Individual($grec); |
| 237 | 237 | return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
| 238 | 238 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->view_bag = new ViewBag(); |
| 71 | 71 | $this->view_bag->set('generation', $this->generation); |
| 72 | 72 | $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
| 73 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 73 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0) > 0); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 93 | 93 | |
| 94 | - if($this->view_bag->get('is_setup', false)) { |
|
| 94 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 95 | 95 | $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
| 96 | 96 | $this->view_bag->set('url_module', $this->module->getName()); |
| 97 | 97 | $this->view_bag->set('url_action', 'SosaList'); |
| 98 | 98 | $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
| 99 | 99 | $this->view_bag->set('min_gen', 1); |
| 100 | 100 | |
| 101 | - if($this->view_bag->get('has_sosa', false)) { |
|
| 101 | + if ($this->view_bag->get('has_sosa', false)) { |
|
| 102 | 102 | $controller->addInlineJavascript(' |
| 103 | 103 | jQuery("#sosalist-tabs").tabs(); |
| 104 | 104 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | "mod" : "'.$this->module->getName().'", |
| 110 | 110 | "mod_action": "SosaList@sosalist", |
| 111 | - "ged" : "' . $WT_TREE->getNameUrl(). '", |
|
| 111 | + "ged" : "' . $WT_TREE->getNameUrl().'", |
|
| 112 | 112 | "type" : "indi", |
| 113 | 113 | "gen" : "'.$this->generation.'" |
| 114 | 114 | }, |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | "mod" : "'.$this->module->getName().'", |
| 135 | 135 | "mod_action": "SosaList@sosalist", |
| 136 | - "ged" : "' . $WT_TREE->getNameUrl(). '", |
|
| 136 | + "ged" : "' . $WT_TREE->getNameUrl().'", |
|
| 137 | 137 | "type" : "fam", |
| 138 | 138 | "gen" : "'.$this->generation.'" |
| 139 | 139 | }, |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 174 | 174 | |
| 175 | - if($this->view_bag->get('is_setup', false)) { |
|
| 175 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 176 | 176 | $this->view_bag->set('url_module', $this->module->getName()); |
| 177 | 177 | $this->view_bag->set('url_action', 'SosaList@missing'); |
| 178 | 178 | $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
| 182 | 182 | $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
| 183 | 183 | |
| 184 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 184 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); |
|
| 185 | 185 | $this->view_bag->set('perc_sosa', $perc_sosa); |
| 186 | 186 | |
| 187 | - if($this->view_bag->get('has_missing', false)) { |
|
| 188 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 187 | + if ($this->view_bag->get('has_missing', false)) { |
|
| 188 | + $table_id = 'table-sosa-missing-'.Uuid::uuid4(); |
|
| 189 | 189 | $this->view_bag->set('table_id', $table_id); |
| 190 | 190 | |
| 191 | 191 | $controller |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 196 | 196 | |
| 197 | 197 | jQuery("#'.$table_id.'").dataTable( { |
| 198 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 198 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 199 | 199 | '.I18N::datatablesI18N().', |
| 200 | 200 | jQueryUI: true, |
| 201 | 201 | autoWidth:false, |
@@ -221,14 +221,14 @@ discard block |
||
| 221 | 221 | pagingType: "full_numbers" |
| 222 | 222 | }); |
| 223 | 223 | |
| 224 | - jQuery("#' . $table_id . '") |
|
| 224 | + jQuery("#' . $table_id.'") |
|
| 225 | 225 | /* Filter buttons in table header */ |
| 226 | 226 | .on("click", "button[data-filter-column]", function() { |
| 227 | 227 | var btn = jQuery(this); |
| 228 | 228 | // De-activate the other buttons in this button group |
| 229 | 229 | btn.siblings().removeClass("ui-state-active"); |
| 230 | 230 | // Apply (or clear) this filter |
| 231 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 231 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 232 | 232 | if (btn.hasClass("ui-state-active")) { |
| 233 | 233 | btn.removeClass("ui-state-active"); |
| 234 | 234 | col.search("").draw(); |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | $unique_indis = array(); |
| 246 | 246 | $sum_missing_different = 0; |
| 247 | 247 | $sum_missing_different_without_hidden = 0; |
| 248 | - foreach($missing_list as $num => $missing_tab) { |
|
| 249 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 248 | + foreach ($missing_list as $num => $missing_tab) { |
|
| 249 | + if (isset($unique_indis[$missing_tab['indi']])) { |
|
| 250 | 250 | unset($missing_list[$num]); |
| 251 | 251 | continue; |
| 252 | 252 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $this->view_bag->set('missing_list', $missing_list); |
| 265 | 265 | $this->view_bag->set('missing_diff_count', $sum_missing_different); |
| 266 | 266 | $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
| 267 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 267 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); |
|
| 268 | 268 | $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
| 269 | 269 | } |
| 270 | 270 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $controller = new AjaxController(); |
| 283 | 283 | $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
| 284 | 284 | |
| 285 | - switch ($type){ |
|
| 285 | + switch ($type) { |
|
| 286 | 286 | case 'indi': |
| 287 | 287 | $this->renderSosaListIndi($controller); |
| 288 | 288 | break; |
@@ -305,9 +305,9 @@ discard block |
||
| 305 | 305 | $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
| 306 | 306 | $this->view_bag->set('has_sosa', false); |
| 307 | 307 | |
| 308 | - if(count($listSosa) > 0) { |
|
| 308 | + if (count($listSosa) > 0) { |
|
| 309 | 309 | $this->view_bag->set('has_sosa', true); |
| 310 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 310 | + $table_id = 'table-sosa-indi-'.Uuid::uuid4(); |
|
| 311 | 311 | $this->view_bag->set('table_id', $table_id); |
| 312 | 312 | |
| 313 | 313 | $controller |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 318 | 318 | |
| 319 | 319 | jQuery("#'.$table_id.'").dataTable( { |
| 320 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 321 | - ' . I18N::datatablesI18N() . ', |
|
| 320 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 321 | + ' . I18N::datatablesI18N().', |
|
| 322 | 322 | jQueryUI: true, |
| 323 | 323 | autoWidth: false, |
| 324 | 324 | processing: true, |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | pagingType: "full_numbers" |
| 348 | 348 | }); |
| 349 | 349 | |
| 350 | - jQuery("#' . $table_id . '") |
|
| 350 | + jQuery("#' . $table_id.'") |
|
| 351 | 351 | /* Hide/show parents */ |
| 352 | 352 | .on("click", ".btn-toggle-parents", function() { |
| 353 | 353 | jQuery(this).toggleClass("ui-state-active"); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | /* Hide/show statistics */ |
| 357 | 357 | .on("click", ".btn-toggle-statistics", function() { |
| 358 | 358 | jQuery(this).toggleClass("ui-state-active"); |
| 359 | - jQuery("#indi_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 359 | + jQuery("#indi_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 360 | 360 | }) |
| 361 | 361 | /* Filter buttons in table header */ |
| 362 | 362 | .on("click", "button[data-filter-column]", function() { |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | // De-activate the other buttons in this button group |
| 365 | 365 | btn.siblings().removeClass("ui-state-active"); |
| 366 | 366 | // Apply (or clear) this filter |
| 367 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 367 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 368 | 368 | if (btn.hasClass("ui-state-active")) { |
| 369 | 369 | btn.removeClass("ui-state-active"); |
| 370 | 370 | col.search("").draw(); |
@@ -399,30 +399,30 @@ discard block |
||
| 399 | 399 | $nb_displayed = 0; |
| 400 | 400 | |
| 401 | 401 | Individual::load($WT_TREE, $listSosa); |
| 402 | - foreach($listSosa as $sosa => $pid) { |
|
| 402 | + foreach ($listSosa as $sosa => $pid) { |
|
| 403 | 403 | $person = Individual::getInstance($pid, $WT_TREE); |
| 404 | 404 | if (!$person || !$person->canShowName()) { |
| 405 | 405 | unset($listSosa[$sosa]); |
| 406 | 406 | continue; |
| 407 | 407 | } |
| 408 | 408 | $nb_displayed++; |
| 409 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 409 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
| 410 | 410 | if ( |
| 411 | 411 | FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
| 412 | 412 | !isset($unique_indis[$person->getXref()]) |
| 413 | 413 | ) { |
| 414 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 414 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | else { |
| 418 | - $birth_dates[0]=new Date(''); |
|
| 418 | + $birth_dates[0] = new Date(''); |
|
| 419 | 419 | } |
| 420 | 420 | if ($death_dates = $person->getAllDeathDates()) { |
| 421 | 421 | if ( |
| 422 | 422 | FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
| 423 | 423 | !isset($unique_indis[$person->getXref()]) |
| 424 | 424 | ) { |
| 425 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 425 | + $deat_by_decade[(int)($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | else { |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $this->view_bag->set('sosa_list', $listSosa); |
| 439 | 439 | |
| 440 | 440 | $this->view_bag->set('sosa_count', count($listSosa)); |
| 441 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 441 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation - 1)); |
|
| 442 | 442 | $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
| 443 | 443 | |
| 444 | 444 | $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
@@ -458,12 +458,12 @@ discard block |
||
| 458 | 458 | protected function renderFamSosaListIndi(AjaxController $controller) { |
| 459 | 459 | global $WT_TREE; |
| 460 | 460 | |
| 461 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 461 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation); ; |
|
| 462 | 462 | $this->view_bag->set('has_sosa', false); |
| 463 | 463 | |
| 464 | - if(count($listFamSosa) > 0) { |
|
| 464 | + if (count($listFamSosa) > 0) { |
|
| 465 | 465 | $this->view_bag->set('has_sosa', true); |
| 466 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 466 | + $table_id = 'table-sosa-fam-'.Uuid::uuid4(); |
|
| 467 | 467 | $this->view_bag->set('table_id', $table_id); |
| 468 | 468 | |
| 469 | 469 | $controller |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 474 | 474 | |
| 475 | 475 | jQuery("#'.$table_id.'").dataTable( { |
| 476 | - dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 476 | + dom: \'<"H"<"filtersH_' . $table_id.'"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 477 | 477 | '.I18N::datatablesI18N(array(16, 32, 64, 128, -1)).', |
| 478 | 478 | jQueryUI: true, |
| 479 | 479 | autoWidth: false, |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | pagingType: "full_numbers" |
| 501 | 501 | }); |
| 502 | 502 | |
| 503 | - jQuery("#' . $table_id . '") |
|
| 503 | + jQuery("#' . $table_id.'") |
|
| 504 | 504 | /* Hide/show parents */ |
| 505 | 505 | .on("click", ".btn-toggle-parents", function() { |
| 506 | 506 | jQuery(this).toggleClass("ui-state-active"); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | /* Hide/show statistics */ |
| 510 | 510 | .on("click", ".btn-toggle-statistics", function() { |
| 511 | 511 | jQuery(this).toggleClass("ui-state-active"); |
| 512 | - jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 512 | + jQuery("#fam_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 513 | 513 | }) |
| 514 | 514 | /* Filter buttons in table header */ |
| 515 | 515 | .on("click", "button[data-filter-column]", function() { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | // De-activate the other buttons in this button group |
| 518 | 518 | btn.siblings().removeClass("ui-state-active"); |
| 519 | 519 | // Apply (or clear) this filter |
| 520 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 520 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 521 | 521 | if (btn.hasClass("ui-state-active")) { |
| 522 | 522 | btn.removeClass("ui-state-active"); |
| 523 | 523 | col.search("").draw(); |
@@ -537,29 +537,29 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | //-- init chart data |
| 539 | 539 | $marr_by_age = array(); |
| 540 | - for ($age=0; $age<=$max_age; $age++) { |
|
| 540 | + for ($age = 0; $age <= $max_age; $age++) { |
|
| 541 | 541 | $marr_by_age[$age] = ''; |
| 542 | 542 | } |
| 543 | 543 | $birt_by_decade = array(); |
| 544 | 544 | $marr_by_decade = array(); |
| 545 | - for ($year=1550; $year<2030; $year+=10) { |
|
| 545 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
| 546 | 546 | $birt_by_decade[$year] = ''; |
| 547 | 547 | $marr_by_decade[$year] = ''; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - foreach($listFamSosa as $sosa => $fid) { |
|
| 550 | + foreach ($listFamSosa as $sosa => $fid) { |
|
| 551 | 551 | $sfamily = Family::getInstance($fid, $WT_TREE); |
| 552 | - if(!$sfamily || !$sfamily->canShow()) { |
|
| 552 | + if (!$sfamily || !$sfamily->canShow()) { |
|
| 553 | 553 | unset($listFamSosa[$sosa]); |
| 554 | 554 | continue; |
| 555 | 555 | } |
| 556 | - $mdate=$sfamily->getMarriageDate(); |
|
| 556 | + $mdate = $sfamily->getMarriageDate(); |
|
| 557 | 557 | |
| 558 | - if( ($husb = $sfamily->getHusband()) && |
|
| 558 | + if (($husb = $sfamily->getHusband()) && |
|
| 559 | 559 | ($hdate = $husb->getBirthDate()) && |
| 560 | 560 | $hdate->isOK() && $mdate->isOK()) { |
| 561 | 561 | if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
| 562 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 562 | + $birt_by_decade[(int)($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 563 | 563 | } |
| 564 | 564 | $hage = Date::getAge($hdate, $mdate, 0); |
| 565 | 565 | if ($hage >= 0 && $hage <= $max_age) { |
@@ -567,11 +567,11 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - if(($wife = $sfamily->getWife()) && |
|
| 571 | - ($wdate=$wife->getBirthDate()) && |
|
| 570 | + if (($wife = $sfamily->getWife()) && |
|
| 571 | + ($wdate = $wife->getBirthDate()) && |
|
| 572 | 572 | $wdate->isOK() && $mdate->isOK()) { |
| 573 | 573 | if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
| 574 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 574 | + $birt_by_decade[(int)($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 575 | 575 | } |
| 576 | 576 | $wage = Date::getAge($wdate, $mdate, 0); |
| 577 | 577 | if ($wage >= 0 && $wage <= $max_age) { |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
| 583 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 583 | + $marr_by_decade[(int)($mdate->gregorianYear() / 10) * 10] .= $husb->getSex().$wife->getSex(); |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | $listFamSosa[$sosa] = $sfamily; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->tree = $tree; |
| 59 | 59 | $this->user = $user; |
| 60 | 60 | |
| 61 | - $this->sosa_provider = new SosaProvider($this->tree, $this->user);; |
|
| 61 | + $this->sosa_provider = new SosaProvider($this->tree, $this->user); ; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function computeAll() { |
| 69 | 69 | $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
| 70 | 70 | $indi = Individual::getInstance($root_id, $this->tree); |
| 71 | - if($indi){ |
|
| 71 | + if ($indi) { |
|
| 72 | 72 | $this->sosa_provider->deleteAll(); |
| 73 | 73 | $this->addNode($indi, 1); |
| 74 | 74 | $this->flushTmpSosaTable(true); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public function computeFromIndividual(Individual $indi) { |
| 86 | 86 | $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
| 87 | 87 | $current_sosas = $dindi->getSosaNumbers(); |
| 88 | - foreach($current_sosas as $current_sosa => $gen) { |
|
| 88 | + foreach ($current_sosas as $current_sosa => $gen) { |
|
| 89 | 89 | $this->sosa_provider->deleteAncestors($current_sosa); |
| 90 | 90 | $this->addNode($indi, $current_sosa); |
| 91 | 91 | } |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $this->flushTmpSosaTable(); |
| 113 | 113 | |
| 114 | - if($fam = $indi->getPrimaryChildFamily()) { |
|
| 115 | - if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
| 116 | - if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
| 114 | + if ($fam = $indi->getPrimaryChildFamily()) { |
|
| 115 | + if ($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
| 116 | + if ($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | * @param bool $force Should the flush be forced |
| 124 | 124 | */ |
| 125 | 125 | protected function flushTmpSosaTable($force = false) { |
| 126 | - if( count($this->tmp_sosa_table)> 0 && |
|
| 127 | - ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){ |
|
| 126 | + if (count($this->tmp_sosa_table) > 0 && |
|
| 127 | + ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)) { |
|
| 128 | 128 | $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table); |
| 129 | 129 | $this->tmp_sosa_table = array(); |
| 130 | 130 | } |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | * @param User $user |
| 85 | 85 | */ |
| 86 | 86 | public function __construct(Tree $tree, User $user = null) { |
| 87 | - if(self::$default_user === null) |
|
| 87 | + if (self::$default_user === null) |
|
| 88 | 88 | self::$default_user = User::find(-1); |
| 89 | 89 | |
| 90 | 90 | $this->tree = $tree; |
| 91 | 91 | $this->user = $user; |
| 92 | 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; |
|
| 93 | + if ($this->user === null) $this->user = Auth::user(); |
|
| 94 | + if (strlen($this->user->getUserId()) == 0) $this->user = self::$default_user; |
|
| 95 | 95 | |
| 96 | 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 |
|
| 97 | + if (empty($this->getRootIndiId())) { |
|
| 98 | + if ($this->user == self::$default_user) { // If the default user is not setup |
|
| 99 | 99 | $this->is_setup = false; |
| 100 | 100 | } |
| 101 | 101 | else { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function getRootIndi() { |
| 129 | 129 | $root_indi_id = $this->getRootIndiId(); |
| 130 | - if(!empty($root_indi_id)) { |
|
| 130 | + if (!empty($root_indi_id)) { |
|
| 131 | 131 | return Individual::getInstance($root_indi_id, $this->tree); |
| 132 | 132 | } |
| 133 | 133 | return null; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * Remove all Sosa entries related to the gedcom file and user |
| 142 | 142 | */ |
| 143 | 143 | public function deleteAll() { |
| 144 | - if(!$this->is_setup) return; |
|
| 144 | + if (!$this->is_setup) return; |
|
| 145 | 145 | Database::prepare( |
| 146 | 146 | 'DELETE FROM `##maj_sosa`'. |
| 147 | 147 | ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ') |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | * @param int $sosa |
| 158 | 158 | */ |
| 159 | 159 | public function deleteAncestors($sosa) { |
| 160 | - if(!$this->is_setup) return; |
|
| 160 | + if (!$this->is_setup) return; |
|
| 161 | 161 | $gen = Functions::getGeneration($sosa); |
| 162 | 162 | Database::prepare( |
| 163 | 163 | 'DELETE FROM `##maj_sosa`'. |
| 164 | - ' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id' . |
|
| 165 | - ' AND majs_gen >= :gen' . |
|
| 164 | + ' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id'. |
|
| 165 | + ' AND majs_gen >= :gen'. |
|
| 166 | 166 | ' AND FLOOR(majs_sosa / (POW(2, (majs_gen - :gen)))) = :sosa' |
| 167 | 167 | )->execute(array( |
| 168 | 168 | 'tree_id' => $this->tree->getTreeId(), |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param array $sosa_records |
| 178 | 178 | */ |
| 179 | 179 | public function insertOrUpdate($sosa_records) { |
| 180 | - if(!$this->is_setup) return; |
|
| 180 | + if (!$this->is_setup) return; |
|
| 181 | 181 | |
| 182 | 182 | $treeid = $this->tree->getTreeId(); |
| 183 | 183 | $userid = $this->user->getUserId(); |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | $values_table = array(); |
| 186 | 186 | |
| 187 | 187 | $i = 0; |
| 188 | - foreach ($sosa_records as $row) { |
|
| 188 | + foreach ($sosa_records as $row) { |
|
| 189 | 189 | $gen = Functions::getGeneration($row['sosa']); |
| 190 | - if($gen <= self::MAX_DB_GENERATIONS) { |
|
| 190 | + if ($gen <= self::MAX_DB_GENERATIONS) { |
|
| 191 | 191 | $questionmarks_table[] = |
| 192 | 192 | '(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.', :indi_id'.$i.', :gen'.$i.', :byear'.$i.', :dyear'.$i.')'; |
| 193 | 193 | $values_table = array_merge( |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | $i++; |
| 207 | 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); |
|
| 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 | 212 | Database::prepare($sql)->execute($values_table); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @return array Array of sosa numbers |
| 225 | 225 | */ |
| 226 | 226 | public function getSosaNumbers(Individual $indi) { |
| 227 | - if(!$this->is_setup) return array(); |
|
| 227 | + if (!$this->is_setup) return array(); |
|
| 228 | 228 | return Database::prepare( |
| 229 | 229 | 'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'. |
| 230 | 230 | ' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @return number Last generation if found, 1 otherwise |
| 242 | 242 | */ |
| 243 | 243 | public function getLastGeneration() { |
| 244 | - if(!$this->is_setup) return; |
|
| 244 | + if (!$this->is_setup) return; |
|
| 245 | 245 | return Database::prepare( |
| 246 | 246 | 'SELECT MAX(majs_gen) FROM `##maj_sosa`'. |
| 247 | 247 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | * |
| 261 | 261 | * @return array Associative array of Sosa ancestors, with their generation, comma separated |
| 262 | 262 | */ |
| 263 | - public function getAllSosaWithGenerations(){ |
|
| 264 | - if(!$this->is_setup) return array(); |
|
| 263 | + public function getAllSosaWithGenerations() { |
|
| 264 | + if (!$this->is_setup) return array(); |
|
| 265 | 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' . |
|
| 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 | 270 | ' GROUP BY majs_i_id' |
| 271 | 271 | )->execute(array( |
| 272 | 272 | 'tree_id' => $this->tree->getTreeId(), |
@@ -280,13 +280,13 @@ discard block |
||
| 280 | 280 | * @param number $gen Generation |
| 281 | 281 | * @return array Array of Sosa individuals |
| 282 | 282 | */ |
| 283 | - public function getSosaListAtGeneration($gen){ |
|
| 284 | - if(!$this->is_setup) return array(); |
|
| 285 | - if(!$this->sosa_list_by_gen) |
|
| 283 | + public function getSosaListAtGeneration($gen) { |
|
| 284 | + if (!$this->is_setup) return array(); |
|
| 285 | + if (!$this->sosa_list_by_gen) |
|
| 286 | 286 | $this->sosa_list_by_gen = array(); |
| 287 | 287 | |
| 288 | - if($gen){ |
|
| 289 | - if(!isset($this->sosa_list_by_gen[$gen])){ |
|
| 288 | + if ($gen) { |
|
| 289 | + if (!isset($this->sosa_list_by_gen[$gen])) { |
|
| 290 | 290 | $this->sosa_list_by_gen[$gen] = Database::prepare( |
| 291 | 291 | 'SELECT majs_sosa AS sosa, majs_i_id AS indi'. |
| 292 | 292 | ' FROM `##maj_sosa`'. |
@@ -311,13 +311,13 @@ discard block |
||
| 311 | 311 | * @param number $gen Generation |
| 312 | 312 | * @return array Array of Sosa families |
| 313 | 313 | */ |
| 314 | - public function getFamilySosaListAtGeneration($gen){ |
|
| 315 | - if(!$this->is_setup) return array(); |
|
| 316 | - if(!$this->sosa_fam_list_by_gen) |
|
| 314 | + public function getFamilySosaListAtGeneration($gen) { |
|
| 315 | + if (!$this->is_setup) return array(); |
|
| 316 | + if (!$this->sosa_fam_list_by_gen) |
|
| 317 | 317 | $this->sosa_fam_list_by_gen = array(); |
| 318 | 318 | |
| 319 | - if($gen){ |
|
| 320 | - if(!isset($this->sosa_fam_list_by_gen[$gen])){ |
|
| 319 | + if ($gen) { |
|
| 320 | + if (!isset($this->sosa_fam_list_by_gen[$gen])) { |
|
| 321 | 321 | $this->sosa_fam_list_by_gen[$gen] = Database::prepare( |
| 322 | 322 | 'SELECT s1.majs_sosa AS sosa, f_id AS fam'. |
| 323 | 323 | ' FROM `##families`'. |
@@ -347,9 +347,9 @@ discard block |
||
| 347 | 347 | * @param number $gen Generation |
| 348 | 348 | * @return array Array of Sosa individuals |
| 349 | 349 | */ |
| 350 | - public function getMissingSosaListAtGeneration($gen){ |
|
| 351 | - if(!$this->is_setup) return array(); |
|
| 352 | - if($gen){ |
|
| 350 | + public function getMissingSosaListAtGeneration($gen) { |
|
| 351 | + if (!$this->is_setup) return array(); |
|
| 352 | + if ($gen) { |
|
| 353 | 353 | return $this->sosa_list_by_gen[$gen] = Database::prepare( |
| 354 | 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 | 355 | ' FROM `##maj_sosa` schild'. |
@@ -386,10 +386,10 @@ discard block |
||
| 386 | 386 | * @return array Statistics array |
| 387 | 387 | */ |
| 388 | 388 | public function getStatisticsByGeneration() { |
| 389 | - if(!$this->is_setup) return array(); |
|
| 390 | - if(!$this->statistics_tab) { |
|
| 389 | + if (!$this->is_setup) return array(); |
|
| 390 | + if (!$this->statistics_tab) { |
|
| 391 | 391 | $this->statistics_tab = array(); |
| 392 | - if($maxGeneration = $this->getLastGeneration()) { |
|
| 392 | + if ($maxGeneration = $this->getLastGeneration()) { |
|
| 393 | 393 | for ($gen = 1; $gen <= $maxGeneration; $gen++) { |
| 394 | 394 | $birthStats = $this->getStatsBirthYearInGeneration($gen); |
| 395 | 395 | $this->statistics_tab[$gen] = array( |
@@ -412,9 +412,9 @@ discard block |
||
| 412 | 412 | * @return int |
| 413 | 413 | */ |
| 414 | 414 | public function getTotalIndividuals() { |
| 415 | - if(!$this->is_setup) return 0; |
|
| 415 | + if (!$this->is_setup) return 0; |
|
| 416 | 416 | return Database::prepare( |
| 417 | - 'SELECT SQL_CACHE COUNT(*) FROM `##individuals`' . |
|
| 417 | + 'SELECT SQL_CACHE COUNT(*) FROM `##individuals`'. |
|
| 418 | 418 | ' WHERE i_file = :tree_id') |
| 419 | 419 | ->execute(array('tree_id' => $this->tree->getTreeId())) |
| 420 | 420 | ->fetchOne() ?: 0; |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | * |
| 426 | 426 | * @return number Number of Sosas |
| 427 | 427 | */ |
| 428 | - public function getSosaCount(){ |
|
| 429 | - if(!$this->is_setup) return 0; |
|
| 428 | + public function getSosaCount() { |
|
| 429 | + if (!$this->is_setup) return 0; |
|
| 430 | 430 | return Database::prepare( |
| 431 | - 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 431 | + 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`'. |
|
| 432 | 432 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
| 433 | 433 | ->execute(array( |
| 434 | 434 | 'tree_id' => $this->tree->getTreeId(), |
@@ -442,10 +442,10 @@ discard block |
||
| 442 | 442 | * @param number $gen Generation |
| 443 | 443 | * @return number Number of Sosas in generation |
| 444 | 444 | */ |
| 445 | - public function getSosaCountAtGeneration($gen){ |
|
| 446 | - if(!$this->is_setup) return 0; |
|
| 445 | + public function getSosaCountAtGeneration($gen) { |
|
| 446 | + if (!$this->is_setup) return 0; |
|
| 447 | 447 | return Database::prepare( |
| 448 | - 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 448 | + 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`'. |
|
| 449 | 449 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
| 450 | 450 | ' AND majs_gen= :gen') |
| 451 | 451 | ->execute(array( |
@@ -461,10 +461,10 @@ discard block |
||
| 461 | 461 | * @param number $gen Generation |
| 462 | 462 | * @return number Total number of Sosas up to generation |
| 463 | 463 | */ |
| 464 | - public function getSosaCountUpToGeneration($gen){ |
|
| 465 | - if(!$this->is_setup) return 0; |
|
| 464 | + public function getSosaCountUpToGeneration($gen) { |
|
| 465 | + if (!$this->is_setup) return 0; |
|
| 466 | 466 | return Database::prepare( |
| 467 | - 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' . |
|
| 467 | + 'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`'. |
|
| 468 | 468 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
| 469 | 469 | ' AND majs_gen <= :gen') |
| 470 | 470 | ->execute(array( |
@@ -479,10 +479,10 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @return number Total number of distinct individual |
| 481 | 481 | */ |
| 482 | - public function getDifferentSosaCount(){ |
|
| 483 | - if(!$this->is_setup) return 0; |
|
| 482 | + public function getDifferentSosaCount() { |
|
| 483 | + if (!$this->is_setup) return 0; |
|
| 484 | 484 | return Database::prepare( |
| 485 | - 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
|
| 485 | + 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`'. |
|
| 486 | 486 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id') |
| 487 | 487 | ->execute(array( |
| 488 | 488 | 'tree_id' => $this->tree->getTreeId(), |
@@ -496,10 +496,10 @@ discard block |
||
| 496 | 496 | * @param number $gen Generation |
| 497 | 497 | * @return number Number of distinct Sosa individuals up to generation |
| 498 | 498 | */ |
| 499 | - public function getDifferentSosaCountUpToGeneration($gen){ |
|
| 500 | - if(!$this->is_setup) return 0; |
|
| 499 | + public function getDifferentSosaCountUpToGeneration($gen) { |
|
| 500 | + if (!$this->is_setup) return 0; |
|
| 501 | 501 | return Database::prepare( |
| 502 | - 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' . |
|
| 502 | + 'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`'. |
|
| 503 | 503 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
| 504 | 504 | ' AND majs_gen <= :gen') |
| 505 | 505 | ->execute(array( |
@@ -519,11 +519,11 @@ discard block |
||
| 519 | 519 | * @param number $gen Generation |
| 520 | 520 | * @return array Birth statistics array |
| 521 | 521 | */ |
| 522 | - public function getStatsBirthYearInGeneration($gen){ |
|
| 523 | - if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0); |
|
| 522 | + public function getStatsBirthYearInGeneration($gen) { |
|
| 523 | + if (!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0); |
|
| 524 | 524 | return Database::prepare( |
| 525 | 525 | 'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'. |
| 526 | - ' FROM `##maj_sosa`' . |
|
| 526 | + ' FROM `##maj_sosa`'. |
|
| 527 | 527 | ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'. |
| 528 | 528 | ' AND majs_gen=:gen AND NOT majs_birth_year = :birth_year') |
| 529 | 529 | ->execute(array( |
@@ -539,26 +539,26 @@ discard block |
||
| 539 | 539 | * |
| 540 | 540 | * @return number|NULL Mean generation time |
| 541 | 541 | */ |
| 542 | - public function getMeanGenerationTime(){ |
|
| 543 | - if(!$this->is_setup) return; |
|
| 544 | - if(!$this->statistics_tab){ |
|
| 542 | + public function getMeanGenerationTime() { |
|
| 543 | + if (!$this->is_setup) return; |
|
| 544 | + if (!$this->statistics_tab) { |
|
| 545 | 545 | $this->getStatisticsByGeneration(); |
| 546 | 546 | } |
| 547 | 547 | //Linear regression on x=generation and y=birthdate |
| 548 | 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; |
|
| 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 | 558 | } |
| 559 | - $denom=($n*$sum_x2)-($sum_x*$sum_x); |
|
| 560 | - if($denom!=0){ |
|
| 561 | - return -(($n*$sum_xy)-($sum_x*$sum_y))/($denom); |
|
| 559 | + $denom = ($n * $sum_x2) - ($sum_x * $sum_x); |
|
| 560 | + if ($denom != 0) { |
|
| 561 | + return -(($n * $sum_xy) - ($sum_x * $sum_y)) / ($denom); |
|
| 562 | 562 | } |
| 563 | 563 | return null; |
| 564 | 564 | } |
@@ -586,14 +586,14 @@ discard block |
||
| 586 | 586 | * @return array |
| 587 | 587 | */ |
| 588 | 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 |
|
| 589 | + if (!$this->is_setup || $gen > 11) return array(); // Going further than 11 gen will be out of range in the query |
|
| 590 | 590 | return Database::prepare( |
| 591 | 591 | 'SELECT branches, count(i_id)'. |
| 592 | 592 | ' FROM ('. |
| 593 | 593 | ' SELECT i_id,'. |
| 594 | 594 | ' CASE'. |
| 595 | 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 |
|
| 596 | + ' ELSE -1'.// We put all ancestors shared between some branches in the same bucket |
|
| 597 | 597 | ' END branches'. |
| 598 | 598 | ' FROM ('. |
| 599 | 599 | ' SELECT DISTINCT majs_i_id i_id,'. |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $view_bag->set('title', $controller->getPageTitle()); |
| 64 | 64 | $view_bag->set('is_setup', false); |
| 65 | 65 | |
| 66 | - if($this->sosa_provider->isSetup()) { |
|
| 66 | + if ($this->sosa_provider->isSetup()) { |
|
| 67 | 67 | $view_bag->set('is_setup', true); |
| 68 | 68 | |
| 69 | 69 | $view_bag->set('root_indi', $this->sosa_provider->getRootIndi()); |
@@ -84,23 +84,23 @@ discard block |
||
| 84 | 84 | $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen='); |
| 85 | 85 | $view_bag->set('sosaanc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList&ged='.$WT_TREE->getNameUrl().'&gen='); |
| 86 | 86 | |
| 87 | - $gen_theoretical=1; |
|
| 88 | - $total_theoretical=0; |
|
| 89 | - $prev_diff=0; |
|
| 90 | - $prev_known=0.5; |
|
| 91 | - $gen_equiv=0; |
|
| 87 | + $gen_theoretical = 1; |
|
| 88 | + $total_theoretical = 0; |
|
| 89 | + $prev_diff = 0; |
|
| 90 | + $prev_known = 0.5; |
|
| 91 | + $gen_equiv = 0; |
|
| 92 | 92 | $generation_stats = array(); |
| 93 | 93 | |
| 94 | - foreach($stats_gen as $gen => $tab){ |
|
| 95 | - $genY1= I18N::translate('-'); |
|
| 96 | - $genY2= I18N::translate('-'); |
|
| 97 | - if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
| 98 | - if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
| 94 | + foreach ($stats_gen as $gen => $tab) { |
|
| 95 | + $genY1 = I18N::translate('-'); |
|
| 96 | + $genY2 = I18N::translate('-'); |
|
| 97 | + if ($tab['firstBirth'] > 0) $genY1 = $tab['firstBirth']; |
|
| 98 | + if ($tab['lastBirth'] > 0) $genY2 = $tab['lastBirth']; |
|
| 99 | 99 | $total_theoretical += $gen_theoretical; |
| 100 | 100 | $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
| 101 | 101 | $gen_equiv += $perc_sosa_count_theor; |
| 102 | - $missing=2*$prev_known - $tab['sosaCount']; |
|
| 103 | - $gen_diff=$tab['diffSosaTotalCount']-$prev_diff; |
|
| 102 | + $missing = 2 * $prev_known - $tab['sosaCount']; |
|
| 103 | + $gen_diff = $tab['diffSosaTotalCount'] - $prev_diff; |
|
| 104 | 104 | |
| 105 | 105 | $generation_stats[$gen] = array( |
| 106 | 106 | 'gen_min_birth' => $genY1, |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | 'known' => $tab['sosaCount'], |
| 110 | 110 | 'perc_known' => $perc_sosa_count_theor, |
| 111 | 111 | 'missing' => $missing, |
| 112 | - 'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known), |
|
| 112 | + 'perc_missing' => 1 - Functions::safeDivision($tab['sosaCount'], 2 * $prev_known), |
|
| 113 | 113 | 'total_known' => $tab['sosaTotalCount'], |
| 114 | 114 | 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), |
| 115 | 115 | 'different' => $gen_diff, |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | 121 | $gen_theoretical = $gen_theoretical * 2; |
| 122 | - $prev_known=$tab['sosaCount']; |
|
| 123 | - $prev_diff=$tab['diffSosaTotalCount']; |
|
| 122 | + $prev_known = $tab['sosaCount']; |
|
| 123 | + $prev_diff = $tab['diffSosaTotalCount']; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $view_bag->set('generation_stats', $generation_stats); |
@@ -141,27 +141,27 @@ discard block |
||
| 141 | 141 | private function htmlAncestorDispersionG2() |
| 142 | 142 | { |
| 143 | 143 | $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
| 144 | - if(count($ancestorsDispGen2) == 0) return; |
|
| 144 | + if (count($ancestorsDispGen2) == 0) return; |
|
| 145 | 145 | |
| 146 | 146 | $size = '600x300'; |
| 147 | 147 | |
| 148 | 148 | $total = array_sum($ancestorsDispGen2); |
| 149 | 149 | $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0; |
| 150 | - $father = array ( |
|
| 150 | + $father = array( |
|
| 151 | 151 | 'color' => '84beff', |
| 152 | 152 | 'count' => $father_count, |
| 153 | 153 | 'perc' => Functions::safeDivision($father_count, $total), |
| 154 | 154 | 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat') |
| 155 | 155 | ); |
| 156 | 156 | $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0; |
| 157 | - $mother = array ( |
|
| 157 | + $mother = array( |
|
| 158 | 158 | 'color' => 'ffd1dc', |
| 159 | 159 | 'count' => $mother_count, |
| 160 | 160 | 'perc' => Functions::safeDivision($mother_count, $total), |
| 161 | 161 | 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot') |
| 162 | 162 | ); |
| 163 | 163 | $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
| 164 | - $shared = array ( |
|
| 164 | + $shared = array( |
|
| 165 | 165 | 'color' => '777777', |
| 166 | 166 | 'count' => $shared_count, |
| 167 | 167 | 'perc' => Functions::safeDivision($shared_count, $total), |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc'])); |
| 172 | 172 | $chart_title = I18N::translate('Known Sosa ancestors\' dispersion'); |
| 173 | 173 | $chl = |
| 174 | - $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' . |
|
| 175 | - $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' . |
|
| 176 | - $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1); |
|
| 177 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
| 174 | + $father['name'].' - '.I18N::percentage($father['perc'], 1).'|'. |
|
| 175 | + $shared['name'].' - '.I18N::percentage($shared['perc'], 1).'|'. |
|
| 176 | + $mother['name'].' - '.I18N::percentage($mother['perc'], 1); |
|
| 177 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />"; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0; |
| 199 | 199 | $total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0; |
| 200 | 200 | $total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
| 201 | - $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha; |
|
| 201 | + $total = $total_fatfat + $total_fatmot + $total_motfat + $total_motmot + $total_sha; |
|
| 202 | 202 | |
| 203 | 203 | $chd = $this->arrayToExtendedEncoding(array( |
| 204 | 204 | 4095 * Functions::safeDivision($total_fatfat, $total), |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | )); |
| 210 | 210 | $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3'); |
| 211 | 211 | $chl = |
| 212 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . |
|
| 213 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . |
|
| 214 | - I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . |
|
| 215 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . |
|
| 216 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
| 217 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
| 212 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat').' - '.I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1).'|'. |
|
| 213 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot').' - '.I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1).'|'. |
|
| 214 | + I18N::translate('Shared').' - '.I18N::percentage(Functions::safeDivision($total_sha, $total), 1).'|'. |
|
| 215 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat').' - '.I18N::percentage(Functions::safeDivision($total_motfat, $total), 1).'|'. |
|
| 216 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot').' - '.I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
| 217 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />"; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | if ($value < 0) { |
| 231 | 231 | $value = 0; |
| 232 | 232 | } |
| 233 | - $first = (int) ($value / 64); |
|
| 233 | + $first = (int)($value / 64); |
|
| 234 | 234 | $second = $value % 64; |
| 235 | - $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
| 235 | + $encoding .= $xencoding[(int)$first].$xencoding[(int)$second]; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | return $encoding; |