@@ -14,17 +14,17 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class Constants { |
| 16 | 16 | |
| 17 | - const LIB_NAMESPACE = __NAMESPACE__; |
|
| 17 | + const LIB_NAMESPACE = __NAMESPACE__; |
|
| 18 | 18 | |
| 19 | - /** Internal name of the Certificates Module |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates'; |
|
| 19 | + /** Internal name of the Certificates Module |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates'; |
|
| 23 | 23 | |
| 24 | - /** Internal name of the GeoDispersion Module |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 27 | - const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion'; |
|
| 24 | + /** Internal name of the GeoDispersion Module |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion'; |
|
| 28 | 28 | |
| 29 | 29 | /** Internal name of the Hooks Module |
| 30 | 30 | * @var string |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return string $WT_RAPHAEL_JS_URL |
| 62 | 62 | */ |
| 63 | 63 | public static function WT_RAPHAEL_JS_URL() { |
| 64 | - return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js'; |
|
| 64 | + return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | * @return string $WT_RAPHAEL_JS_URL |
| 62 | 62 | */ |
| 63 | 63 | public static function WT_RAPHAEL_JS_URL() { |
| 64 | - return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js'; |
|
| 64 | + return WT_STATIC_URL.'packages/raphael-2.1.4/raphael-min.js'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface ModuleMenuItemInterface |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Returns a menu item for the module. |
|
| 20 | - * |
|
| 21 | - * @param \Fisharebest\Webtrees\Tree|null $tree |
|
| 22 | - * @param mixed $reference |
|
| 23 | - */ |
|
| 24 | - public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference); |
|
| 18 | + /** |
|
| 19 | + * Returns a menu item for the module. |
|
| 20 | + * |
|
| 21 | + * @param \Fisharebest\Webtrees\Tree|null $tree |
|
| 22 | + * @param mixed $reference |
|
| 23 | + */ |
|
| 24 | + public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference); |
|
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -114,8 +114,12 @@ |
||
| 114 | 114 | $this->flushTmpSosaTable(); |
| 115 | 115 | |
| 116 | 116 | if($fam = $indi->getPrimaryChildFamily()) { |
| 117 | - if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
| 118 | - if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
| 117 | + if($husb = $fam->getHusband()) { |
|
| 118 | + $this->addNode($husb, 2 * $sosa); |
|
| 119 | + } |
|
| 120 | + if($wife = $fam->getWife()) { |
|
| 121 | + $this->addNode($wife, 2 * $sosa + 1); |
|
| 122 | + } |
|
| 119 | 123 | } |
| 120 | 124 | } |
| 121 | 125 | |
@@ -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 | } |
@@ -19,121 +19,121 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class SosaCalculator { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Maximium size for the temporary Sosa table |
|
| 24 | - * @var int TMP_SOSA_TABLE_LIMIT |
|
| 25 | - */ |
|
| 26 | - const TMP_SOSA_TABLE_LIMIT = 1000; |
|
| 22 | + /** |
|
| 23 | + * Maximium size for the temporary Sosa table |
|
| 24 | + * @var int TMP_SOSA_TABLE_LIMIT |
|
| 25 | + */ |
|
| 26 | + const TMP_SOSA_TABLE_LIMIT = 1000; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Reference user |
|
| 30 | - * @var Fisharebest\Webtrees\User $user |
|
| 31 | - */ |
|
| 32 | - protected $user; |
|
| 28 | + /** |
|
| 29 | + * Reference user |
|
| 30 | + * @var Fisharebest\Webtrees\User $user |
|
| 31 | + */ |
|
| 32 | + protected $user; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Reference tree |
|
| 36 | - * @var Fisharebest\Webtrees\Tree $tree |
|
| 37 | - */ |
|
| 38 | - protected $tree; |
|
| 34 | + /** |
|
| 35 | + * Reference tree |
|
| 36 | + * @var Fisharebest\Webtrees\Tree $tree |
|
| 37 | + */ |
|
| 38 | + protected $tree; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Sosa Provider for the calculator |
|
| 42 | - * @var \MyArtJaub\Webtrees\Module\Sosa\Model\SosaCalculator $sosa_provider |
|
| 43 | - */ |
|
| 44 | - protected $sosa_provider; |
|
| 40 | + /** |
|
| 41 | + * Sosa Provider for the calculator |
|
| 42 | + * @var \MyArtJaub\Webtrees\Module\Sosa\Model\SosaCalculator $sosa_provider |
|
| 43 | + */ |
|
| 44 | + protected $sosa_provider; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Temporary Sosa table, used during construction |
|
| 48 | - * @var array $tmp_sosa_table |
|
| 49 | - */ |
|
| 50 | - protected $tmp_sosa_table; |
|
| 46 | + /** |
|
| 47 | + * Temporary Sosa table, used during construction |
|
| 48 | + * @var array $tmp_sosa_table |
|
| 49 | + */ |
|
| 50 | + protected $tmp_sosa_table; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Constructor for the Sosa Calculator |
|
| 54 | - * @param Tree $tree |
|
| 55 | - * @param User $user |
|
| 56 | - */ |
|
| 57 | - public function __construct(Tree $tree, User $user) { |
|
| 58 | - $this->tree = $tree; |
|
| 59 | - $this->user = $user; |
|
| 52 | + /** |
|
| 53 | + * Constructor for the Sosa Calculator |
|
| 54 | + * @param Tree $tree |
|
| 55 | + * @param User $user |
|
| 56 | + */ |
|
| 57 | + public function __construct(Tree $tree, User $user) { |
|
| 58 | + $this->tree = $tree; |
|
| 59 | + $this->user = $user; |
|
| 60 | 60 | |
| 61 | - $this->sosa_provider = new SosaProvider($this->tree, $this->user);; |
|
| 62 | - } |
|
| 61 | + $this->sosa_provider = new SosaProvider($this->tree, $this->user);; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Compute all Sosa ancestors from the user's root individual. |
|
| 66 | - * @return bool Result of the computation |
|
| 67 | - */ |
|
| 68 | - public function computeAll() { |
|
| 69 | - $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
| 70 | - $indi = Individual::getInstance($root_id, $this->tree); |
|
| 71 | - if($indi){ |
|
| 72 | - $this->sosa_provider->deleteAll(); |
|
| 73 | - $this->addNode($indi, 1); |
|
| 74 | - $this->flushTmpSosaTable(true); |
|
| 75 | - return true; |
|
| 76 | - } |
|
| 77 | - return false; |
|
| 78 | - } |
|
| 64 | + /** |
|
| 65 | + * Compute all Sosa ancestors from the user's root individual. |
|
| 66 | + * @return bool Result of the computation |
|
| 67 | + */ |
|
| 68 | + public function computeAll() { |
|
| 69 | + $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
| 70 | + $indi = Individual::getInstance($root_id, $this->tree); |
|
| 71 | + if($indi){ |
|
| 72 | + $this->sosa_provider->deleteAll(); |
|
| 73 | + $this->addNode($indi, 1); |
|
| 74 | + $this->flushTmpSosaTable(true); |
|
| 75 | + return true; |
|
| 76 | + } |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Compute all Sosa Ancestors from a specified Individual |
|
| 82 | - * @param Individual $indi |
|
| 83 | - * @return bool Result of the computation |
|
| 84 | - */ |
|
| 85 | - public function computeFromIndividual(Individual $indi) { |
|
| 86 | - $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
|
| 87 | - $current_sosas = $dindi->getSosaNumbers(); |
|
| 88 | - foreach($current_sosas as $current_sosa => $gen) { |
|
| 89 | - $this->sosa_provider->deleteAncestors($current_sosa); |
|
| 90 | - $this->addNode($indi, $current_sosa); |
|
| 91 | - } |
|
| 92 | - $this->flushTmpSosaTable(true); |
|
| 93 | - return true; |
|
| 94 | - } |
|
| 80 | + /** |
|
| 81 | + * Compute all Sosa Ancestors from a specified Individual |
|
| 82 | + * @param Individual $indi |
|
| 83 | + * @return bool Result of the computation |
|
| 84 | + */ |
|
| 85 | + public function computeFromIndividual(Individual $indi) { |
|
| 86 | + $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
|
| 87 | + $current_sosas = $dindi->getSosaNumbers(); |
|
| 88 | + foreach($current_sosas as $current_sosa => $gen) { |
|
| 89 | + $this->sosa_provider->deleteAncestors($current_sosa); |
|
| 90 | + $this->addNode($indi, $current_sosa); |
|
| 91 | + } |
|
| 92 | + $this->flushTmpSosaTable(true); |
|
| 93 | + return true; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Recursive method to add individual to the Sosa table, and flush it regularly |
|
| 98 | - * @param Individual $indi Individual to add |
|
| 99 | - * @param int $sosa Individual's sosa |
|
| 100 | - */ |
|
| 101 | - protected function addNode(Individual $indi, $sosa) { |
|
| 102 | - $birth_year = $indi->getBirthDate()->gregorianYear(); |
|
| 103 | - $birth_year_est = $birth_year === 0 ? $indi->getEstimatedBirthDate()->gregorianYear() : $birth_year; |
|
| 96 | + /** |
|
| 97 | + * Recursive method to add individual to the Sosa table, and flush it regularly |
|
| 98 | + * @param Individual $indi Individual to add |
|
| 99 | + * @param int $sosa Individual's sosa |
|
| 100 | + */ |
|
| 101 | + protected function addNode(Individual $indi, $sosa) { |
|
| 102 | + $birth_year = $indi->getBirthDate()->gregorianYear(); |
|
| 103 | + $birth_year_est = $birth_year === 0 ? $indi->getEstimatedBirthDate()->gregorianYear() : $birth_year; |
|
| 104 | 104 | |
| 105 | - $death_year = $indi->getDeathDate()->gregorianYear(); |
|
| 106 | - $death_year_est = $death_year === 0 ? $indi->getEstimatedDeathDate()->gregorianYear() : $death_year; |
|
| 105 | + $death_year = $indi->getDeathDate()->gregorianYear(); |
|
| 106 | + $death_year_est = $death_year === 0 ? $indi->getEstimatedDeathDate()->gregorianYear() : $death_year; |
|
| 107 | 107 | |
| 108 | - $this->tmp_sosa_table[] = array( |
|
| 109 | - 'indi' => $indi->getXref(), |
|
| 110 | - 'sosa' => $sosa, |
|
| 111 | - 'birth_year' => $birth_year === 0 ? null : $birth_year, |
|
| 112 | - 'birth_year_est' => $birth_year_est === 0 ? null : $birth_year_est, |
|
| 113 | - 'death_year' => $death_year === 0 ? null : $death_year, |
|
| 114 | - 'death_year_est' => $death_year_est === 0 ? null : $death_year_est |
|
| 115 | - ); |
|
| 108 | + $this->tmp_sosa_table[] = array( |
|
| 109 | + 'indi' => $indi->getXref(), |
|
| 110 | + 'sosa' => $sosa, |
|
| 111 | + 'birth_year' => $birth_year === 0 ? null : $birth_year, |
|
| 112 | + 'birth_year_est' => $birth_year_est === 0 ? null : $birth_year_est, |
|
| 113 | + 'death_year' => $death_year === 0 ? null : $death_year, |
|
| 114 | + 'death_year_est' => $death_year_est === 0 ? null : $death_year_est |
|
| 115 | + ); |
|
| 116 | 116 | |
| 117 | - $this->flushTmpSosaTable(); |
|
| 117 | + $this->flushTmpSosaTable(); |
|
| 118 | 118 | |
| 119 | - if($fam = $indi->getPrimaryChildFamily()) { |
|
| 120 | - if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
| 121 | - if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
| 122 | - } |
|
| 123 | - } |
|
| 119 | + if($fam = $indi->getPrimaryChildFamily()) { |
|
| 120 | + if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
| 121 | + if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * Write sosas in the table, if the number of items is superior to the limit, or if forced. |
|
| 127 | - * |
|
| 128 | - * @param bool $force Should the flush be forced |
|
| 129 | - */ |
|
| 130 | - protected function flushTmpSosaTable($force = false) { |
|
| 131 | - if( count($this->tmp_sosa_table)> 0 && |
|
| 132 | - ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){ |
|
| 133 | - $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table); |
|
| 134 | - $this->tmp_sosa_table = array(); |
|
| 135 | - } |
|
| 136 | - } |
|
| 125 | + /** |
|
| 126 | + * Write sosas in the table, if the number of items is superior to the limit, or if forced. |
|
| 127 | + * |
|
| 128 | + * @param bool $force Should the flush be forced |
|
| 129 | + */ |
|
| 130 | + protected function flushTmpSosaTable($force = false) { |
|
| 131 | + if( count($this->tmp_sosa_table)> 0 && |
|
| 132 | + ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){ |
|
| 133 | + $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table); |
|
| 134 | + $this->tmp_sosa_table = array(); |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | \ No newline at end of file |
@@ -431,8 +431,7 @@ discard block |
||
| 431 | 431 | ) { |
| 432 | 432 | $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
| 433 | 433 | } |
| 434 | - } |
|
| 435 | - else { |
|
| 434 | + } else { |
|
| 436 | 435 | $birth_dates[0]=new Date(''); |
| 437 | 436 | } |
| 438 | 437 | if ($death_dates = $person->getAllDeathDates()) { |
@@ -443,8 +442,7 @@ discard block |
||
| 443 | 442 | ) { |
| 444 | 443 | $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
| 445 | 444 | } |
| 446 | - } |
|
| 447 | - else { |
|
| 445 | + } else { |
|
| 448 | 446 | $death_dates[0] = new Date(''); |
| 449 | 447 | } |
| 450 | 448 | $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
@@ -37,67 +37,67 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | class SosaListController extends MvcController |
| 39 | 39 | { |
| 40 | - /** |
|
| 41 | - * Sosa Provider for the controller |
|
| 42 | - * @var SosaProvider $sosa_provider |
|
| 43 | - */ |
|
| 44 | - protected $sosa_provider; |
|
| 40 | + /** |
|
| 41 | + * Sosa Provider for the controller |
|
| 42 | + * @var SosaProvider $sosa_provider |
|
| 43 | + */ |
|
| 44 | + protected $sosa_provider; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Generation used for the controller |
|
| 48 | - * @var int $generation |
|
| 49 | - */ |
|
| 50 | - protected $generation; |
|
| 46 | + /** |
|
| 47 | + * Generation used for the controller |
|
| 48 | + * @var int $generation |
|
| 49 | + */ |
|
| 50 | + protected $generation; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * ViewBag to hold data for the controller |
|
| 54 | - * @var ViewBag $view_bag |
|
| 55 | - */ |
|
| 56 | - protected $view_bag; |
|
| 52 | + /** |
|
| 53 | + * ViewBag to hold data for the controller |
|
| 54 | + * @var ViewBag $view_bag |
|
| 55 | + */ |
|
| 56 | + protected $view_bag; |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * {@inheritDoc} |
|
| 60 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
| 61 | - */ |
|
| 62 | - public function __construct(AbstractModule $module) { |
|
| 63 | - parent::__construct($module); |
|
| 58 | + /** |
|
| 59 | + * {@inheritDoc} |
|
| 60 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
| 61 | + */ |
|
| 62 | + public function __construct(AbstractModule $module) { |
|
| 63 | + parent::__construct($module); |
|
| 64 | 64 | |
| 65 | - $this->sosa_provider = new SosaProvider(Globals::getTree(), Auth::user()); |
|
| 65 | + $this->sosa_provider = new SosaProvider(Globals::getTree(), Auth::user()); |
|
| 66 | 66 | |
| 67 | - $this->generation = Filter::getInteger('gen'); |
|
| 67 | + $this->generation = Filter::getInteger('gen'); |
|
| 68 | 68 | |
| 69 | - $this->view_bag = new ViewBag(); |
|
| 70 | - $this->view_bag->set('generation', $this->generation); |
|
| 71 | - $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
| 72 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 69 | + $this->view_bag = new ViewBag(); |
|
| 70 | + $this->view_bag->set('generation', $this->generation); |
|
| 71 | + $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
| 72 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 73 | 73 | |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Pages |
|
| 79 | - */ |
|
| 77 | + /** |
|
| 78 | + * Pages |
|
| 79 | + */ |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * SosaList@index |
|
| 83 | - */ |
|
| 84 | - public function index() { |
|
| 85 | - $wt_tree = Globals::getTree(); |
|
| 86 | - $controller = new PageController(); |
|
| 87 | - $controller |
|
| 88 | - ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
| 81 | + /** |
|
| 82 | + * SosaList@index |
|
| 83 | + */ |
|
| 84 | + public function index() { |
|
| 85 | + $wt_tree = Globals::getTree(); |
|
| 86 | + $controller = new PageController(); |
|
| 87 | + $controller |
|
| 88 | + ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
| 89 | 89 | |
| 90 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 90 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 91 | 91 | |
| 92 | - if($this->view_bag->get('is_setup', false)) { |
|
| 93 | - $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
| 94 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
| 95 | - $this->view_bag->set('url_action', 'SosaList'); |
|
| 96 | - $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
|
| 97 | - $this->view_bag->set('min_gen', 1); |
|
| 92 | + if($this->view_bag->get('is_setup', false)) { |
|
| 93 | + $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
| 94 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
| 95 | + $this->view_bag->set('url_action', 'SosaList'); |
|
| 96 | + $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
|
| 97 | + $this->view_bag->set('min_gen', 1); |
|
| 98 | 98 | |
| 99 | - if($this->view_bag->get('has_sosa', false)) { |
|
| 100 | - $controller->addInlineJavascript(' |
|
| 99 | + if($this->view_bag->get('has_sosa', false)) { |
|
| 100 | + $controller->addInlineJavascript(' |
|
| 101 | 101 | jQuery("#sosalist-tabs").tabs(); |
| 102 | 102 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
| 103 | 103 | |
@@ -151,43 +151,43 @@ discard block |
||
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | 153 | '); |
| 154 | - } |
|
| 155 | - } |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
| 158 | - } |
|
| 157 | + ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * SosaList@missing |
|
| 163 | - */ |
|
| 164 | - public function missing() { |
|
| 165 | - $wt_tree = Globals::getTree(); |
|
| 166 | - $controller = new PageController(); |
|
| 167 | - $controller |
|
| 168 | - ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
| 161 | + /** |
|
| 162 | + * SosaList@missing |
|
| 163 | + */ |
|
| 164 | + public function missing() { |
|
| 165 | + $wt_tree = Globals::getTree(); |
|
| 166 | + $controller = new PageController(); |
|
| 167 | + $controller |
|
| 168 | + ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
| 169 | 169 | |
| 170 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 170 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 171 | 171 | |
| 172 | - if($this->view_bag->get('is_setup', false)) { |
|
| 173 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
| 174 | - $this->view_bag->set('url_action', 'SosaList@missing'); |
|
| 175 | - $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
|
| 176 | - $this->view_bag->set('min_gen', 2); |
|
| 172 | + if($this->view_bag->get('is_setup', false)) { |
|
| 173 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
| 174 | + $this->view_bag->set('url_action', 'SosaList@missing'); |
|
| 175 | + $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
|
| 176 | + $this->view_bag->set('min_gen', 2); |
|
| 177 | 177 | |
| 178 | - $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
| 179 | - $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
| 178 | + $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
| 179 | + $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
| 180 | 180 | |
| 181 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 182 | - $this->view_bag->set('perc_sosa', $perc_sosa); |
|
| 181 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 182 | + $this->view_bag->set('perc_sosa', $perc_sosa); |
|
| 183 | 183 | |
| 184 | - if($this->view_bag->get('has_missing', false)) { |
|
| 185 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 186 | - $this->view_bag->set('table_id', $table_id); |
|
| 184 | + if($this->view_bag->get('has_missing', false)) { |
|
| 185 | + $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 186 | + $this->view_bag->set('table_id', $table_id); |
|
| 187 | 187 | |
| 188 | - $controller |
|
| 189 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 190 | - ->addInlineJavascript(' |
|
| 188 | + $controller |
|
| 189 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 190 | + ->addInlineJavascript(' |
|
| 191 | 191 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 192 | 192 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 193 | 193 | |
@@ -239,76 +239,76 @@ discard block |
||
| 239 | 239 | jQuery(".loading-image").css("display", "none"); |
| 240 | 240 | '); |
| 241 | 241 | |
| 242 | - $unique_indis = array(); |
|
| 243 | - $sum_missing_different = 0; |
|
| 244 | - $sum_missing_different_without_hidden = 0; |
|
| 245 | - foreach($missing_list as $num => $missing_tab) { |
|
| 246 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 247 | - unset($missing_list[$num]); |
|
| 248 | - continue; |
|
| 249 | - } |
|
| 250 | - $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 251 | - $person = Individual::getInstance($missing_tab['indi'], $wt_tree); |
|
| 252 | - if (!$person || !$person->canShowName()) { |
|
| 253 | - unset($missing_list[$num]); |
|
| 254 | - continue; |
|
| 255 | - } |
|
| 256 | - $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 257 | - $unique_indis[$person->getXref()] = true; |
|
| 258 | - $missing_tab['indi'] = $person; |
|
| 259 | - $missing_list[$num] = $missing_tab; |
|
| 260 | - } |
|
| 261 | - $this->view_bag->set('missing_list', $missing_list); |
|
| 262 | - $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
| 263 | - $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
| 264 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 265 | - $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
| 266 | - } |
|
| 267 | - } |
|
| 242 | + $unique_indis = array(); |
|
| 243 | + $sum_missing_different = 0; |
|
| 244 | + $sum_missing_different_without_hidden = 0; |
|
| 245 | + foreach($missing_list as $num => $missing_tab) { |
|
| 246 | + if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 247 | + unset($missing_list[$num]); |
|
| 248 | + continue; |
|
| 249 | + } |
|
| 250 | + $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 251 | + $person = Individual::getInstance($missing_tab['indi'], $wt_tree); |
|
| 252 | + if (!$person || !$person->canShowName()) { |
|
| 253 | + unset($missing_list[$num]); |
|
| 254 | + continue; |
|
| 255 | + } |
|
| 256 | + $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 257 | + $unique_indis[$person->getXref()] = true; |
|
| 258 | + $missing_tab['indi'] = $person; |
|
| 259 | + $missing_list[$num] = $missing_tab; |
|
| 260 | + } |
|
| 261 | + $this->view_bag->set('missing_list', $missing_list); |
|
| 262 | + $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
| 263 | + $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
| 264 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 265 | + $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
| 266 | + } |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
| 270 | - } |
|
| 269 | + ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - /** |
|
| 273 | - * SosaList@sosalist |
|
| 274 | - */ |
|
| 275 | - public function sosalist() { |
|
| 272 | + /** |
|
| 273 | + * SosaList@sosalist |
|
| 274 | + */ |
|
| 275 | + public function sosalist() { |
|
| 276 | 276 | |
| 277 | - $type = Filter::get('type', 'indi|fam', null); |
|
| 277 | + $type = Filter::get('type', 'indi|fam', null); |
|
| 278 | 278 | |
| 279 | - $controller = new AjaxController(); |
|
| 280 | - $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
| 279 | + $controller = new AjaxController(); |
|
| 280 | + $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
| 281 | 281 | |
| 282 | - switch ($type){ |
|
| 283 | - case 'indi': |
|
| 284 | - $this->renderSosaListIndi($controller); |
|
| 285 | - break; |
|
| 286 | - case 'fam': |
|
| 287 | - $this->renderFamSosaListIndi($controller); |
|
| 288 | - break; |
|
| 289 | - default: |
|
| 290 | - break; |
|
| 291 | - } |
|
| 282 | + switch ($type){ |
|
| 283 | + case 'indi': |
|
| 284 | + $this->renderSosaListIndi($controller); |
|
| 285 | + break; |
|
| 286 | + case 'fam': |
|
| 287 | + $this->renderFamSosaListIndi($controller); |
|
| 288 | + break; |
|
| 289 | + default: |
|
| 290 | + break; |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - } |
|
| 293 | + } |
|
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Render the Ajax response for the sortable table of Sosa individuals |
|
| 297 | - * @param AjaxController $controller |
|
| 298 | - */ |
|
| 299 | - protected function renderSosaListIndi(AjaxController $controller) { |
|
| 300 | - $wt_tree = Globals::getTree(); |
|
| 301 | - $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
| 302 | - $this->view_bag->set('has_sosa', false); |
|
| 295 | + /** |
|
| 296 | + * Render the Ajax response for the sortable table of Sosa individuals |
|
| 297 | + * @param AjaxController $controller |
|
| 298 | + */ |
|
| 299 | + protected function renderSosaListIndi(AjaxController $controller) { |
|
| 300 | + $wt_tree = Globals::getTree(); |
|
| 301 | + $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
| 302 | + $this->view_bag->set('has_sosa', false); |
|
| 303 | 303 | |
| 304 | - if(count($listSosa) > 0) { |
|
| 305 | - $this->view_bag->set('has_sosa', true); |
|
| 306 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 307 | - $this->view_bag->set('table_id', $table_id); |
|
| 304 | + if(count($listSosa) > 0) { |
|
| 305 | + $this->view_bag->set('has_sosa', true); |
|
| 306 | + $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 307 | + $this->view_bag->set('table_id', $table_id); |
|
| 308 | 308 | |
| 309 | - $controller |
|
| 310 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 311 | - ->addInlineJavascript(' |
|
| 309 | + $controller |
|
| 310 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 311 | + ->addInlineJavascript(' |
|
| 312 | 312 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 313 | 313 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 314 | 314 | |
@@ -375,95 +375,95 @@ discard block |
||
| 375 | 375 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
| 376 | 376 | '); |
| 377 | 377 | |
| 378 | - $stats = new Stats($wt_tree); |
|
| 378 | + $stats = new Stats($wt_tree); |
|
| 379 | 379 | |
| 380 | - // Bad data can cause "longest life" to be huge, blowing memory limits |
|
| 381 | - $max_age = min($wt_tree->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
| 382 | - // Inititialise chart data |
|
| 383 | - $deat_by_age = array(); |
|
| 384 | - for ($age = 0; $age <= $max_age; $age++) { |
|
| 385 | - $deat_by_age[$age] = ''; |
|
| 386 | - } |
|
| 387 | - $birt_by_decade = array(); |
|
| 388 | - $deat_by_decade = array(); |
|
| 389 | - for ($year = 1550; $year < 2030; $year += 10) { |
|
| 390 | - $birt_by_decade[$year] = ''; |
|
| 391 | - $deat_by_decade[$year] = ''; |
|
| 392 | - } |
|
| 380 | + // Bad data can cause "longest life" to be huge, blowing memory limits |
|
| 381 | + $max_age = min($wt_tree->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
| 382 | + // Inititialise chart data |
|
| 383 | + $deat_by_age = array(); |
|
| 384 | + for ($age = 0; $age <= $max_age; $age++) { |
|
| 385 | + $deat_by_age[$age] = ''; |
|
| 386 | + } |
|
| 387 | + $birt_by_decade = array(); |
|
| 388 | + $deat_by_decade = array(); |
|
| 389 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
| 390 | + $birt_by_decade[$year] = ''; |
|
| 391 | + $deat_by_decade[$year] = ''; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | - $unique_indis = array(); // Don't double-count indis with multiple names. |
|
| 395 | - $nb_displayed = 0; |
|
| 394 | + $unique_indis = array(); // Don't double-count indis with multiple names. |
|
| 395 | + $nb_displayed = 0; |
|
| 396 | 396 | |
| 397 | - Individual::load($wt_tree, $listSosa); |
|
| 398 | - foreach($listSosa as $sosa => $pid) { |
|
| 399 | - $person = Individual::getInstance($pid, $wt_tree); |
|
| 400 | - if (!$person || !$person->canShowName()) { |
|
| 401 | - unset($listSosa[$sosa]); |
|
| 402 | - continue; |
|
| 403 | - } |
|
| 404 | - $nb_displayed++; |
|
| 405 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 406 | - if ( |
|
| 407 | - FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
| 408 | - !isset($unique_indis[$person->getXref()]) |
|
| 409 | - ) { |
|
| 410 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 411 | - } |
|
| 412 | - } |
|
| 413 | - else { |
|
| 414 | - $birth_dates[0]=new Date(''); |
|
| 415 | - } |
|
| 416 | - if ($death_dates = $person->getAllDeathDates()) { |
|
| 417 | - if ( |
|
| 418 | - FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
| 419 | - !isset($unique_indis[$person->getXref()]) |
|
| 420 | - ) { |
|
| 421 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 422 | - } |
|
| 423 | - } |
|
| 424 | - else { |
|
| 425 | - $death_dates[0] = new Date(''); |
|
| 426 | - } |
|
| 427 | - $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 428 | - if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
| 429 | - $deat_by_age[$age] .= $person->getSex(); |
|
| 430 | - } |
|
| 431 | - $listSosa[$sosa] = $person; |
|
| 432 | - $unique_indis[$person->getXref()] = true; |
|
| 433 | - } |
|
| 434 | - $this->view_bag->set('sosa_list', $listSosa); |
|
| 397 | + Individual::load($wt_tree, $listSosa); |
|
| 398 | + foreach($listSosa as $sosa => $pid) { |
|
| 399 | + $person = Individual::getInstance($pid, $wt_tree); |
|
| 400 | + if (!$person || !$person->canShowName()) { |
|
| 401 | + unset($listSosa[$sosa]); |
|
| 402 | + continue; |
|
| 403 | + } |
|
| 404 | + $nb_displayed++; |
|
| 405 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
| 406 | + if ( |
|
| 407 | + FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
| 408 | + !isset($unique_indis[$person->getXref()]) |
|
| 409 | + ) { |
|
| 410 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 411 | + } |
|
| 412 | + } |
|
| 413 | + else { |
|
| 414 | + $birth_dates[0]=new Date(''); |
|
| 415 | + } |
|
| 416 | + if ($death_dates = $person->getAllDeathDates()) { |
|
| 417 | + if ( |
|
| 418 | + FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
| 419 | + !isset($unique_indis[$person->getXref()]) |
|
| 420 | + ) { |
|
| 421 | + $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 422 | + } |
|
| 423 | + } |
|
| 424 | + else { |
|
| 425 | + $death_dates[0] = new Date(''); |
|
| 426 | + } |
|
| 427 | + $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 428 | + if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
| 429 | + $deat_by_age[$age] .= $person->getSex(); |
|
| 430 | + } |
|
| 431 | + $listSosa[$sosa] = $person; |
|
| 432 | + $unique_indis[$person->getXref()] = true; |
|
| 433 | + } |
|
| 434 | + $this->view_bag->set('sosa_list', $listSosa); |
|
| 435 | 435 | |
| 436 | - $this->view_bag->set('sosa_count', count($listSosa)); |
|
| 437 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 438 | - $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
| 436 | + $this->view_bag->set('sosa_count', count($listSosa)); |
|
| 437 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 438 | + $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
| 439 | 439 | |
| 440 | - $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
| 440 | + $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
| 441 | 441 | |
| 442 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 443 | - $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
| 444 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
| 445 | - } |
|
| 442 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 443 | + $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
| 444 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
| 445 | + } |
|
| 446 | 446 | |
| 447 | - ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
| 448 | - } |
|
| 447 | + ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
| 448 | + } |
|
| 449 | 449 | |
| 450 | - /** |
|
| 451 | - * Render the Ajax response for the sortable table of Sosa family |
|
| 452 | - * @param AjaxController $controller |
|
| 453 | - */ |
|
| 454 | - protected function renderFamSosaListIndi(AjaxController $controller) { |
|
| 455 | - $wt_tree = Globals::getTree(); |
|
| 456 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 457 | - $this->view_bag->set('has_sosa', false); |
|
| 450 | + /** |
|
| 451 | + * Render the Ajax response for the sortable table of Sosa family |
|
| 452 | + * @param AjaxController $controller |
|
| 453 | + */ |
|
| 454 | + protected function renderFamSosaListIndi(AjaxController $controller) { |
|
| 455 | + $wt_tree = Globals::getTree(); |
|
| 456 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 457 | + $this->view_bag->set('has_sosa', false); |
|
| 458 | 458 | |
| 459 | - if(count($listFamSosa) > 0) { |
|
| 460 | - $this->view_bag->set('has_sosa', true); |
|
| 461 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 462 | - $this->view_bag->set('table_id', $table_id); |
|
| 459 | + if(count($listFamSosa) > 0) { |
|
| 460 | + $this->view_bag->set('has_sosa', true); |
|
| 461 | + $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 462 | + $this->view_bag->set('table_id', $table_id); |
|
| 463 | 463 | |
| 464 | - $controller |
|
| 465 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 466 | - ->addInlineJavascript(' |
|
| 464 | + $controller |
|
| 465 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 466 | + ->addInlineJavascript(' |
|
| 467 | 467 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 468 | 468 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 469 | 469 | |
@@ -527,67 +527,67 @@ discard block |
||
| 527 | 527 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
| 528 | 528 | '); |
| 529 | 529 | |
| 530 | - $stats = new Stats($wt_tree); |
|
| 531 | - $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
| 530 | + $stats = new Stats($wt_tree); |
|
| 531 | + $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
| 532 | 532 | |
| 533 | - //-- init chart data |
|
| 534 | - $marr_by_age = array(); |
|
| 535 | - for ($age=0; $age<=$max_age; $age++) { |
|
| 536 | - $marr_by_age[$age] = ''; |
|
| 537 | - } |
|
| 538 | - $birt_by_decade = array(); |
|
| 539 | - $marr_by_decade = array(); |
|
| 540 | - for ($year=1550; $year<2030; $year+=10) { |
|
| 541 | - $birt_by_decade[$year] = ''; |
|
| 542 | - $marr_by_decade[$year] = ''; |
|
| 543 | - } |
|
| 533 | + //-- init chart data |
|
| 534 | + $marr_by_age = array(); |
|
| 535 | + for ($age=0; $age<=$max_age; $age++) { |
|
| 536 | + $marr_by_age[$age] = ''; |
|
| 537 | + } |
|
| 538 | + $birt_by_decade = array(); |
|
| 539 | + $marr_by_decade = array(); |
|
| 540 | + for ($year=1550; $year<2030; $year+=10) { |
|
| 541 | + $birt_by_decade[$year] = ''; |
|
| 542 | + $marr_by_decade[$year] = ''; |
|
| 543 | + } |
|
| 544 | 544 | |
| 545 | - foreach($listFamSosa as $sosa => $fid) { |
|
| 546 | - $sfamily = Family::getInstance($fid, $wt_tree); |
|
| 547 | - if(!$sfamily || !$sfamily->canShow()) { |
|
| 548 | - unset($listFamSosa[$sosa]); |
|
| 549 | - continue; |
|
| 550 | - } |
|
| 551 | - $mdate=$sfamily->getMarriageDate(); |
|
| 545 | + foreach($listFamSosa as $sosa => $fid) { |
|
| 546 | + $sfamily = Family::getInstance($fid, $wt_tree); |
|
| 547 | + if(!$sfamily || !$sfamily->canShow()) { |
|
| 548 | + unset($listFamSosa[$sosa]); |
|
| 549 | + continue; |
|
| 550 | + } |
|
| 551 | + $mdate=$sfamily->getMarriageDate(); |
|
| 552 | 552 | |
| 553 | - if( ($husb = $sfamily->getHusband()) && |
|
| 554 | - ($hdate = $husb->getBirthDate()) && |
|
| 555 | - $hdate->isOK() && $mdate->isOK()) { |
|
| 556 | - if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
| 557 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 558 | - } |
|
| 559 | - $hage = Date::getAge($hdate, $mdate, 0); |
|
| 560 | - if ($hage >= 0 && $hage <= $max_age) { |
|
| 561 | - $marr_by_age[$hage] .= $husb->getSex(); |
|
| 562 | - } |
|
| 563 | - } |
|
| 553 | + if( ($husb = $sfamily->getHusband()) && |
|
| 554 | + ($hdate = $husb->getBirthDate()) && |
|
| 555 | + $hdate->isOK() && $mdate->isOK()) { |
|
| 556 | + if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
| 557 | + $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 558 | + } |
|
| 559 | + $hage = Date::getAge($hdate, $mdate, 0); |
|
| 560 | + if ($hage >= 0 && $hage <= $max_age) { |
|
| 561 | + $marr_by_age[$hage] .= $husb->getSex(); |
|
| 562 | + } |
|
| 563 | + } |
|
| 564 | 564 | |
| 565 | - if(($wife = $sfamily->getWife()) && |
|
| 566 | - ($wdate=$wife->getBirthDate()) && |
|
| 567 | - $wdate->isOK() && $mdate->isOK()) { |
|
| 568 | - if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
| 569 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 570 | - } |
|
| 571 | - $wage = Date::getAge($wdate, $mdate, 0); |
|
| 572 | - if ($wage >= 0 && $wage <= $max_age) { |
|
| 573 | - $marr_by_age[$wage] .= $wife->getSex(); |
|
| 574 | - } |
|
| 575 | - } |
|
| 565 | + if(($wife = $sfamily->getWife()) && |
|
| 566 | + ($wdate=$wife->getBirthDate()) && |
|
| 567 | + $wdate->isOK() && $mdate->isOK()) { |
|
| 568 | + if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
| 569 | + $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 570 | + } |
|
| 571 | + $wage = Date::getAge($wdate, $mdate, 0); |
|
| 572 | + if ($wage >= 0 && $wage <= $max_age) { |
|
| 573 | + $marr_by_age[$wage] .= $wife->getSex(); |
|
| 574 | + } |
|
| 575 | + } |
|
| 576 | 576 | |
| 577 | - if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
| 578 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 579 | - } |
|
| 577 | + if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
| 578 | + $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 579 | + } |
|
| 580 | 580 | |
| 581 | - $listFamSosa[$sosa] = $sfamily; |
|
| 582 | - } |
|
| 583 | - $this->view_bag->set('sosa_list', $listFamSosa); |
|
| 581 | + $listFamSosa[$sosa] = $sfamily; |
|
| 582 | + } |
|
| 583 | + $this->view_bag->set('sosa_list', $listFamSosa); |
|
| 584 | 584 | |
| 585 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 586 | - $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
| 587 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
| 588 | - } |
|
| 585 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 586 | + $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
| 587 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
| 588 | + } |
|
| 589 | 589 | |
| 590 | - ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
| 591 | - } |
|
| 590 | + ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
| 591 | + } |
|
| 592 | 592 | |
| 593 | 593 | } |
| 594 | 594 | \ No newline at end of file |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->view_bag = new ViewBag(); |
| 70 | 70 | $this->view_bag->set('generation', $this->generation); |
| 71 | 71 | $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
| 72 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 72 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0) > 0); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 91 | 91 | |
| 92 | - if($this->view_bag->get('is_setup', false)) { |
|
| 92 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 93 | 93 | $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
| 94 | 94 | $this->view_bag->set('url_module', $this->module->getName()); |
| 95 | 95 | $this->view_bag->set('url_action', 'SosaList'); |
| 96 | 96 | $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
| 97 | 97 | $this->view_bag->set('min_gen', 1); |
| 98 | 98 | |
| 99 | - if($this->view_bag->get('has_sosa', false)) { |
|
| 99 | + if ($this->view_bag->get('has_sosa', false)) { |
|
| 100 | 100 | $controller->addInlineJavascript(' |
| 101 | 101 | jQuery("#sosalist-tabs").tabs(); |
| 102 | 102 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | "mod" : "'.$this->module->getName().'", |
| 108 | 108 | "mod_action": "SosaList@sosalist", |
| 109 | - "ged" : "' . $wt_tree->getNameUrl(). '", |
|
| 109 | + "ged" : "' . $wt_tree->getNameUrl().'", |
|
| 110 | 110 | "type" : "indi", |
| 111 | 111 | "gen" : "'.$this->generation.'" |
| 112 | 112 | }, |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | "mod" : "'.$this->module->getName().'", |
| 133 | 133 | "mod_action": "SosaList@sosalist", |
| 134 | - "ged" : "' . $wt_tree->getNameUrl(). '", |
|
| 134 | + "ged" : "' . $wt_tree->getNameUrl().'", |
|
| 135 | 135 | "type" : "fam", |
| 136 | 136 | "gen" : "'.$this->generation.'" |
| 137 | 137 | }, |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 171 | 171 | |
| 172 | - if($this->view_bag->get('is_setup', false)) { |
|
| 172 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 173 | 173 | $this->view_bag->set('url_module', $this->module->getName()); |
| 174 | 174 | $this->view_bag->set('url_action', 'SosaList@missing'); |
| 175 | 175 | $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
| 179 | 179 | $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
| 180 | 180 | |
| 181 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 181 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); |
|
| 182 | 182 | $this->view_bag->set('perc_sosa', $perc_sosa); |
| 183 | 183 | |
| 184 | - if($this->view_bag->get('has_missing', false)) { |
|
| 185 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 184 | + if ($this->view_bag->get('has_missing', false)) { |
|
| 185 | + $table_id = 'table-sosa-missing-'.Uuid::uuid4(); |
|
| 186 | 186 | $this->view_bag->set('table_id', $table_id); |
| 187 | 187 | |
| 188 | 188 | $controller |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 193 | 193 | |
| 194 | 194 | jQuery("#'.$table_id.'").dataTable( { |
| 195 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 195 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 196 | 196 | '.I18N::datatablesI18N().', |
| 197 | 197 | jQueryUI: true, |
| 198 | 198 | autoWidth:false, |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | pagingType: "full_numbers" |
| 219 | 219 | }); |
| 220 | 220 | |
| 221 | - jQuery("#' . $table_id . '") |
|
| 221 | + jQuery("#' . $table_id.'") |
|
| 222 | 222 | /* Filter buttons in table header */ |
| 223 | 223 | .on("click", "button[data-filter-column]", function() { |
| 224 | 224 | var btn = jQuery(this); |
| 225 | 225 | // De-activate the other buttons in this button group |
| 226 | 226 | btn.siblings().removeClass("ui-state-active"); |
| 227 | 227 | // Apply (or clear) this filter |
| 228 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 228 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 229 | 229 | if (btn.hasClass("ui-state-active")) { |
| 230 | 230 | btn.removeClass("ui-state-active"); |
| 231 | 231 | col.search("").draw(); |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | $unique_indis = array(); |
| 243 | 243 | $sum_missing_different = 0; |
| 244 | 244 | $sum_missing_different_without_hidden = 0; |
| 245 | - foreach($missing_list as $num => $missing_tab) { |
|
| 246 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 245 | + foreach ($missing_list as $num => $missing_tab) { |
|
| 246 | + if (isset($unique_indis[$missing_tab['indi']])) { |
|
| 247 | 247 | unset($missing_list[$num]); |
| 248 | 248 | continue; |
| 249 | 249 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $this->view_bag->set('missing_list', $missing_list); |
| 262 | 262 | $this->view_bag->set('missing_diff_count', $sum_missing_different); |
| 263 | 263 | $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
| 264 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 264 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); |
|
| 265 | 265 | $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $controller = new AjaxController(); |
| 280 | 280 | $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
| 281 | 281 | |
| 282 | - switch ($type){ |
|
| 282 | + switch ($type) { |
|
| 283 | 283 | case 'indi': |
| 284 | 284 | $this->renderSosaListIndi($controller); |
| 285 | 285 | break; |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
| 302 | 302 | $this->view_bag->set('has_sosa', false); |
| 303 | 303 | |
| 304 | - if(count($listSosa) > 0) { |
|
| 304 | + if (count($listSosa) > 0) { |
|
| 305 | 305 | $this->view_bag->set('has_sosa', true); |
| 306 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 306 | + $table_id = 'table-sosa-indi-'.Uuid::uuid4(); |
|
| 307 | 307 | $this->view_bag->set('table_id', $table_id); |
| 308 | 308 | |
| 309 | 309 | $controller |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 314 | 314 | |
| 315 | 315 | jQuery("#'.$table_id.'").dataTable( { |
| 316 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 317 | - ' . I18N::datatablesI18N() . ', |
|
| 316 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 317 | + ' . I18N::datatablesI18N().', |
|
| 318 | 318 | jQueryUI: true, |
| 319 | 319 | autoWidth: false, |
| 320 | 320 | processing: true, |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | pagingType: "full_numbers" |
| 344 | 344 | }); |
| 345 | 345 | |
| 346 | - jQuery("#' . $table_id . '") |
|
| 346 | + jQuery("#' . $table_id.'") |
|
| 347 | 347 | /* Hide/show parents */ |
| 348 | 348 | .on("click", ".btn-toggle-parents", function() { |
| 349 | 349 | jQuery(this).toggleClass("ui-state-active"); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | /* Hide/show statistics */ |
| 353 | 353 | .on("click", ".btn-toggle-statistics", function() { |
| 354 | 354 | jQuery(this).toggleClass("ui-state-active"); |
| 355 | - jQuery("#indi_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 355 | + jQuery("#indi_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 356 | 356 | }) |
| 357 | 357 | /* Filter buttons in table header */ |
| 358 | 358 | .on("click", "button[data-filter-column]", function() { |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | // De-activate the other buttons in this button group |
| 361 | 361 | btn.siblings().removeClass("ui-state-active"); |
| 362 | 362 | // Apply (or clear) this filter |
| 363 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 363 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 364 | 364 | if (btn.hasClass("ui-state-active")) { |
| 365 | 365 | btn.removeClass("ui-state-active"); |
| 366 | 366 | col.search("").draw(); |
@@ -395,30 +395,30 @@ discard block |
||
| 395 | 395 | $nb_displayed = 0; |
| 396 | 396 | |
| 397 | 397 | Individual::load($wt_tree, $listSosa); |
| 398 | - foreach($listSosa as $sosa => $pid) { |
|
| 398 | + foreach ($listSosa as $sosa => $pid) { |
|
| 399 | 399 | $person = Individual::getInstance($pid, $wt_tree); |
| 400 | 400 | if (!$person || !$person->canShowName()) { |
| 401 | 401 | unset($listSosa[$sosa]); |
| 402 | 402 | continue; |
| 403 | 403 | } |
| 404 | 404 | $nb_displayed++; |
| 405 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 405 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
| 406 | 406 | if ( |
| 407 | 407 | FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
| 408 | 408 | !isset($unique_indis[$person->getXref()]) |
| 409 | 409 | ) { |
| 410 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 410 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | else { |
| 414 | - $birth_dates[0]=new Date(''); |
|
| 414 | + $birth_dates[0] = new Date(''); |
|
| 415 | 415 | } |
| 416 | 416 | if ($death_dates = $person->getAllDeathDates()) { |
| 417 | 417 | if ( |
| 418 | 418 | FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
| 419 | 419 | !isset($unique_indis[$person->getXref()]) |
| 420 | 420 | ) { |
| 421 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 421 | + $deat_by_decade[(int)($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | else { |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | $this->view_bag->set('sosa_list', $listSosa); |
| 435 | 435 | |
| 436 | 436 | $this->view_bag->set('sosa_count', count($listSosa)); |
| 437 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 437 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation - 1)); |
|
| 438 | 438 | $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
| 439 | 439 | |
| 440 | 440 | $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
@@ -453,12 +453,12 @@ discard block |
||
| 453 | 453 | */ |
| 454 | 454 | protected function renderFamSosaListIndi(AjaxController $controller) { |
| 455 | 455 | $wt_tree = Globals::getTree(); |
| 456 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 456 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation); ; |
|
| 457 | 457 | $this->view_bag->set('has_sosa', false); |
| 458 | 458 | |
| 459 | - if(count($listFamSosa) > 0) { |
|
| 459 | + if (count($listFamSosa) > 0) { |
|
| 460 | 460 | $this->view_bag->set('has_sosa', true); |
| 461 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 461 | + $table_id = 'table-sosa-fam-'.Uuid::uuid4(); |
|
| 462 | 462 | $this->view_bag->set('table_id', $table_id); |
| 463 | 463 | |
| 464 | 464 | $controller |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 469 | 469 | |
| 470 | 470 | jQuery("#'.$table_id.'").dataTable( { |
| 471 | - dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 471 | + dom: \'<"H"<"filtersH_' . $table_id.'"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 472 | 472 | '.I18N::datatablesI18N(array(16, 32, 64, 128, -1)).', |
| 473 | 473 | jQueryUI: true, |
| 474 | 474 | autoWidth: false, |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | pagingType: "full_numbers" |
| 496 | 496 | }); |
| 497 | 497 | |
| 498 | - jQuery("#' . $table_id . '") |
|
| 498 | + jQuery("#' . $table_id.'") |
|
| 499 | 499 | /* Hide/show parents */ |
| 500 | 500 | .on("click", ".btn-toggle-parents", function() { |
| 501 | 501 | jQuery(this).toggleClass("ui-state-active"); |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | /* Hide/show statistics */ |
| 505 | 505 | .on("click", ".btn-toggle-statistics", function() { |
| 506 | 506 | jQuery(this).toggleClass("ui-state-active"); |
| 507 | - jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 507 | + jQuery("#fam_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 508 | 508 | }) |
| 509 | 509 | /* Filter buttons in table header */ |
| 510 | 510 | .on("click", "button[data-filter-column]", function() { |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | // De-activate the other buttons in this button group |
| 513 | 513 | btn.siblings().removeClass("ui-state-active"); |
| 514 | 514 | // Apply (or clear) this filter |
| 515 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 515 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 516 | 516 | if (btn.hasClass("ui-state-active")) { |
| 517 | 517 | btn.removeClass("ui-state-active"); |
| 518 | 518 | col.search("").draw(); |
@@ -532,29 +532,29 @@ discard block |
||
| 532 | 532 | |
| 533 | 533 | //-- init chart data |
| 534 | 534 | $marr_by_age = array(); |
| 535 | - for ($age=0; $age<=$max_age; $age++) { |
|
| 535 | + for ($age = 0; $age <= $max_age; $age++) { |
|
| 536 | 536 | $marr_by_age[$age] = ''; |
| 537 | 537 | } |
| 538 | 538 | $birt_by_decade = array(); |
| 539 | 539 | $marr_by_decade = array(); |
| 540 | - for ($year=1550; $year<2030; $year+=10) { |
|
| 540 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
| 541 | 541 | $birt_by_decade[$year] = ''; |
| 542 | 542 | $marr_by_decade[$year] = ''; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - foreach($listFamSosa as $sosa => $fid) { |
|
| 545 | + foreach ($listFamSosa as $sosa => $fid) { |
|
| 546 | 546 | $sfamily = Family::getInstance($fid, $wt_tree); |
| 547 | - if(!$sfamily || !$sfamily->canShow()) { |
|
| 547 | + if (!$sfamily || !$sfamily->canShow()) { |
|
| 548 | 548 | unset($listFamSosa[$sosa]); |
| 549 | 549 | continue; |
| 550 | 550 | } |
| 551 | - $mdate=$sfamily->getMarriageDate(); |
|
| 551 | + $mdate = $sfamily->getMarriageDate(); |
|
| 552 | 552 | |
| 553 | - if( ($husb = $sfamily->getHusband()) && |
|
| 553 | + if (($husb = $sfamily->getHusband()) && |
|
| 554 | 554 | ($hdate = $husb->getBirthDate()) && |
| 555 | 555 | $hdate->isOK() && $mdate->isOK()) { |
| 556 | 556 | if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
| 557 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 557 | + $birt_by_decade[(int)($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 558 | 558 | } |
| 559 | 559 | $hage = Date::getAge($hdate, $mdate, 0); |
| 560 | 560 | if ($hage >= 0 && $hage <= $max_age) { |
@@ -562,11 +562,11 @@ discard block |
||
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - if(($wife = $sfamily->getWife()) && |
|
| 566 | - ($wdate=$wife->getBirthDate()) && |
|
| 565 | + if (($wife = $sfamily->getWife()) && |
|
| 566 | + ($wdate = $wife->getBirthDate()) && |
|
| 567 | 567 | $wdate->isOK() && $mdate->isOK()) { |
| 568 | 568 | if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
| 569 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 569 | + $birt_by_decade[(int)($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 570 | 570 | } |
| 571 | 571 | $wage = Date::getAge($wdate, $mdate, 0); |
| 572 | 572 | if ($wage >= 0 && $wage <= $max_age) { |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
| 578 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 578 | + $marr_by_decade[(int)($mdate->gregorianYear() / 10) * 10] .= $husb->getSex().$wife->getSex(); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | $listFamSosa[$sosa] = $sfamily; |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | * {@inhericDoc} |
| 24 | 24 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 25 | 25 | */ |
| 26 | - protected function renderContent() { |
|
| 27 | - ?> |
|
| 26 | + protected function renderContent() { |
|
| 27 | + ?> |
|
| 28 | 28 | <div id="maj-sosa-list-page" class="center"> |
| 29 | 29 | <h2><?php echo $this->data->get('title'); ?></h2> |
| 30 | 30 | |
| 31 | 31 | <?php if($this->data->get('is_setup')) { |
| 32 | - $selectedgen = $this->data->get('generation'); |
|
| 33 | - $this->renderSosaHeader(); |
|
| 34 | - if($this->data->get('has_sosa') ) { |
|
| 35 | - if($selectedgen > 0) { |
|
| 36 | - ?> |
|
| 32 | + $selectedgen = $this->data->get('generation'); |
|
| 33 | + $this->renderSosaHeader(); |
|
| 34 | + if($this->data->get('has_sosa') ) { |
|
| 35 | + if($selectedgen > 0) { |
|
| 36 | + ?> |
|
| 37 | 37 | <div id="sosalist-tabs"> |
| 38 | 38 | <ul> |
| 39 | 39 | <li><a href="#sosalist-indi"><?php echo I18N::translate('Individuals'); ?></a></li> |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | <?php } else { ?> |
| 54 | 54 | <p class="warning"><?php echo I18N::translate('No ancestor has been found for generation %d', $selectedgen); ?></p> |
| 55 | 55 | <?php } |
| 56 | - } |
|
| 56 | + } |
|
| 57 | 57 | } else { ?> |
| 58 | 58 | <p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/> |
| 59 | 59 | <ul> |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | <?php } ?> |
| 65 | 65 | </div> |
| 66 | 66 | <?php |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Render the common header to Sosa Lists, made of the generation selector, and the generation navigator |
|
| 71 | - */ |
|
| 72 | - protected function renderSosaHeader() { |
|
| 73 | - $selectedgen = $this->data->get('generation'); |
|
| 74 | - $max_gen = $this->data->get('max_gen'); |
|
| 75 | - ?> |
|
| 69 | + /** |
|
| 70 | + * Render the common header to Sosa Lists, made of the generation selector, and the generation navigator |
|
| 71 | + */ |
|
| 72 | + protected function renderSosaHeader() { |
|
| 73 | + $selectedgen = $this->data->get('generation'); |
|
| 74 | + $max_gen = $this->data->get('max_gen'); |
|
| 75 | + ?> |
|
| 76 | 76 | |
| 77 | 77 | <form method="get" name="setgen" action="module.php"> |
| 78 | 78 | <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module');?>"> |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | 119 | } |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | \ No newline at end of file |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | <div id="maj-sosa-list-page" class="center"> |
| 29 | 29 | <h2><?php echo $this->data->get('title'); ?></h2> |
| 30 | 30 | |
| 31 | - <?php if($this->data->get('is_setup')) { |
|
| 31 | + <?php if ($this->data->get('is_setup')) { |
|
| 32 | 32 | $selectedgen = $this->data->get('generation'); |
| 33 | 33 | $this->renderSosaHeader(); |
| 34 | - if($this->data->get('has_sosa') ) { |
|
| 35 | - if($selectedgen > 0) { |
|
| 34 | + if ($this->data->get('has_sosa')) { |
|
| 35 | + if ($selectedgen > 0) { |
|
| 36 | 36 | ?> |
| 37 | 37 | <div id="sosalist-tabs"> |
| 38 | 38 | <ul> |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | ?> |
| 76 | 76 | |
| 77 | 77 | <form method="get" name="setgen" action="module.php"> |
| 78 | - <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module');?>"> |
|
| 79 | - <input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action');?>"> |
|
| 80 | - <input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged');?>"> |
|
| 78 | + <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module'); ?>"> |
|
| 79 | + <input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action'); ?>"> |
|
| 80 | + <input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged'); ?>"> |
|
| 81 | 81 | <div class="maj-table"> |
| 82 | 82 | <div class="maj-row"> |
| 83 | 83 | <div class="label"><?php echo I18N::translate('Choose generation') ?></div> |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | <div class="maj-row"> |
| 86 | 86 | <div class="value"> |
| 87 | 87 | <select name="gen"> |
| 88 | - <?php for($i=$this->data->get('min_gen'); $i <= $max_gen;$i++) {?> |
|
| 88 | + <?php for ($i = $this->data->get('min_gen'); $i <= $max_gen; $i++) {?> |
|
| 89 | 89 | <option value="<?php echo $i; ?>" |
| 90 | - <?php if($selectedgen && $selectedgen==$i) { ?> selected="true" <?php } ?> |
|
| 90 | + <?php if ($selectedgen && $selectedgen == $i) { ?> selected="true" <?php } ?> |
|
| 91 | 91 | ><?php echo I18N::translate('Generation %d', $i); ?> |
| 92 | 92 | </option> |
| 93 | 93 | <?php } ?> |
@@ -95,21 +95,21 @@ discard block |
||
| 95 | 95 | </div> |
| 96 | 96 | </div> |
| 97 | 97 | </div> |
| 98 | - <input type="submit" value="<?php echo I18N::translate('Show');?>" /> |
|
| 98 | + <input type="submit" value="<?php echo I18N::translate('Show'); ?>" /> |
|
| 99 | 99 | <br /> |
| 100 | 100 | </form> |
| 101 | - <?php if($selectedgen > 0) { ?> |
|
| 101 | + <?php if ($selectedgen > 0) { ?> |
|
| 102 | 102 | <h4> |
| 103 | - <?php if($selectedgen > $this->data->get('min_gen')) { ?> |
|
| 104 | - <a href="module.php?mod=<?php echo $this->data->get('url_module');?>&mod_action=<?php echo $this->data->get('url_action');?>&ged=<?php echo $this->data->get('url_ged');?>&gen=<?php echo $selectedgen-1; ?>"> |
|
| 103 | + <?php if ($selectedgen > $this->data->get('min_gen')) { ?> |
|
| 104 | + <a href="module.php?mod=<?php echo $this->data->get('url_module'); ?>&mod_action=<?php echo $this->data->get('url_action'); ?>&ged=<?php echo $this->data->get('url_ged'); ?>&gen=<?php echo $selectedgen - 1; ?>"> |
|
| 105 | 105 | <i class="icon-ldarrow" title="<?php echo I18N::translate('Previous generation'); ?>" ></i> |
| 106 | 106 | </a> |
| 107 | 107 | |
| 108 | 108 | <?php } ?> |
| 109 | 109 | <?php echo I18N::translate('Generation %d', $selectedgen); ?> |
| 110 | - <?php if($selectedgen < $max_gen) { ?> |
|
| 110 | + <?php if ($selectedgen < $max_gen) { ?> |
|
| 111 | 111 | |
| 112 | - <a href="module.php?mod=<?php echo $this->data->get('url_module');?>&mod_action=<?php echo $this->data->get('url_action');?>&ged=<?php echo $this->data->get('url_ged');?>&gen=<?php echo $selectedgen+1; ?>"> |
|
| 112 | + <a href="module.php?mod=<?php echo $this->data->get('url_module'); ?>&mod_action=<?php echo $this->data->get('url_action'); ?>&ged=<?php echo $this->data->get('url_ged'); ?>&gen=<?php echo $selectedgen + 1; ?>"> |
|
| 113 | 113 | <i class="icon-rdarrow" title="<?php echo I18N::translate('Next generation'); ?>" ></i> |
| 114 | 114 | </a> |
| 115 | 115 | <?php } ?> |
@@ -23,17 +23,17 @@ |
||
| 23 | 23 | |
| 24 | 24 | Database::exec( |
| 25 | 25 | "CREATE TABLE IF NOT EXISTS `##maj_hooks` (". |
| 26 | - " majh_id INTEGER AUTO_INCREMENT NOT NULL,". |
|
| 27 | - " majh_hook_function VARCHAR(32) NOT NULL,". |
|
| 26 | + " majh_id INTEGER AUTO_INCREMENT NOT NULL,". |
|
| 27 | + " majh_hook_function VARCHAR(32) NOT NULL,". |
|
| 28 | 28 | " majh_hook_context VARCHAR(32) NOT NULL DEFAULT 'all',". |
| 29 | - " majh_module_name VARCHAR(32) NOT NULL,". |
|
| 30 | - " majh_module_priority INTEGER NOT NULL DEFAULT 99,". |
|
| 31 | - " majh_status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',". |
|
| 32 | - " PRIMARY KEY (majh_id),". |
|
| 33 | - " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),". |
|
| 34 | - " FOREIGN KEY `##module_name_fk1` (majh_module_name)". |
|
| 29 | + " majh_module_name VARCHAR(32) NOT NULL,". |
|
| 30 | + " majh_module_priority INTEGER NOT NULL DEFAULT 99,". |
|
| 31 | + " majh_status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',". |
|
| 32 | + " PRIMARY KEY (majh_id),". |
|
| 33 | + " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),". |
|
| 34 | + " FOREIGN KEY `##module_name_fk1` (majh_module_name)". |
|
| 35 | 35 | " REFERENCES `##module` (module_name) ON DELETE CASCADE ON UPDATE CASCADE". |
| 36 | - ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
| 36 | + ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
| 37 | 37 | ); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | * {@inhericDoc} |
| 26 | 26 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 27 | 27 | */ |
| 28 | - protected function renderContent() { |
|
| 28 | + protected function renderContent() { |
|
| 29 | 29 | |
| 30 | - $table_id = $this->data->get('table_id'); |
|
| 30 | + $table_id = $this->data->get('table_id'); |
|
| 31 | 31 | |
| 32 | - ?> |
|
| 32 | + ?> |
|
| 33 | 33 | <ol class="breadcrumb small"> |
| 34 | 34 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
| 35 | 35 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | </div> |
| 80 | 80 | |
| 81 | 81 | <?php |
| 82 | - } |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | \ No newline at end of file |
@@ -60,13 +60,13 @@ |
||
| 60 | 60 | ?> |
| 61 | 61 | <tr> |
| 62 | 62 | <td> |
| 63 | - <input type="hidden" name="hook-<?php echo $hook->id;?>" value="yes" > |
|
| 64 | - <?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), ($hook->status)=='enabled'); ?> |
|
| 63 | + <input type="hidden" name="hook-<?php echo $hook->id; ?>" value="yes" > |
|
| 64 | + <?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), ($hook->status) == 'enabled'); ?> |
|
| 65 | 65 | </td> |
| 66 | - <td><?php echo (($hook->status)=='enabled'); ?></td> |
|
| 66 | + <td><?php echo (($hook->status) == 'enabled'); ?></td> |
|
| 67 | 67 | <td><?php echo $hook->hook; ?></td> |
| 68 | 68 | <td><?php echo $hook->context; ?></td> |
| 69 | - <td><?php if($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td> |
|
| 69 | + <td><?php if ($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td> |
|
| 70 | 70 | <td><input type="text" class="center" size="2" value="<?php echo $hook->priority; ?>" name="moduleorder-<?php echo $hook->id; ?>" /></td> |
| 71 | 71 | <td><?php echo $hook->priority; ?></td> |
| 72 | 72 | </tr> |
@@ -66,7 +66,10 @@ |
||
| 66 | 66 | <td><?php echo (($hook->status)=='enabled'); ?></td> |
| 67 | 67 | <td><?php echo $hook->hook; ?></td> |
| 68 | 68 | <td><?php echo $hook->context; ?></td> |
| 69 | - <td><?php if($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td> |
|
| 69 | + <td><?php if($mod = Module::getModuleByName($hook->module)) { |
|
| 70 | + echo $mod->getTitle(); |
|
| 71 | +} |
|
| 72 | +?></td> |
|
| 70 | 73 | <td><input type="text" class="center" size="2" value="<?php echo $hook->priority; ?>" name="moduleorder-<?php echo $hook->id; ?>" /></td> |
| 71 | 74 | <td><?php echo $hook->priority; ?></td> |
| 72 | 75 | </tr> |
@@ -49,62 +49,62 @@ |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Protected constructor. |
|
| 53 | - */ |
|
| 54 | - protected function __construct() |
|
| 55 | - { |
|
| 56 | - $this->modules_list = array(); |
|
| 57 | - } |
|
| 52 | + * Protected constructor. |
|
| 53 | + */ |
|
| 54 | + protected function __construct() |
|
| 55 | + { |
|
| 56 | + $this->modules_list = array(); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * {@inheritDoc} |
|
| 61 | - * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational() |
|
| 62 | - */ |
|
| 63 | - public function isOperational($moduleName) { |
|
| 64 | - if(!array_key_exists($moduleName, $this->modules_list)) { |
|
| 65 | - if($module = fw\Module::getModuleByName($moduleName)) { |
|
| 66 | - if($module instanceof DependentInterface) { |
|
| 67 | - if($module->validatePrerequisites()) { |
|
| 68 | - $this->modules_list[$moduleName] = TRUE; |
|
| 69 | - return true; |
|
| 70 | - } else { |
|
| 71 | - // Do not cache the result, |
|
| 72 | - // as they could change by the next call to the method |
|
| 73 | - return false; |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - else { |
|
| 77 | - $this->modules_list[$moduleName] = TRUE; |
|
| 78 | - return true; |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - else { |
|
| 82 | - $this->modules_list[$moduleName] = FALSE; |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - return $this->modules_list[$moduleName]; |
|
| 59 | + /** |
|
| 60 | + * {@inheritDoc} |
|
| 61 | + * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational() |
|
| 62 | + */ |
|
| 63 | + public function isOperational($moduleName) { |
|
| 64 | + if(!array_key_exists($moduleName, $this->modules_list)) { |
|
| 65 | + if($module = fw\Module::getModuleByName($moduleName)) { |
|
| 66 | + if($module instanceof DependentInterface) { |
|
| 67 | + if($module->validatePrerequisites()) { |
|
| 68 | + $this->modules_list[$moduleName] = TRUE; |
|
| 69 | + return true; |
|
| 70 | + } else { |
|
| 71 | + // Do not cache the result, |
|
| 72 | + // as they could change by the next call to the method |
|
| 73 | + return false; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + else { |
|
| 77 | + $this->modules_list[$moduleName] = TRUE; |
|
| 78 | + return true; |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + else { |
|
| 82 | + $this->modules_list[$moduleName] = FALSE; |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + return $this->modules_list[$moduleName]; |
|
| 86 | 86 | |
| 87 | - } |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Private clone method to prevent cloning of the instance of the |
|
| 92 | - * *ModuleManager* instance. |
|
| 93 | - * |
|
| 94 | - * @return void |
|
| 95 | - */ |
|
| 96 | - private function __clone() |
|
| 97 | - { |
|
| 98 | - } |
|
| 90 | + /** |
|
| 91 | + * Private clone method to prevent cloning of the instance of the |
|
| 92 | + * *ModuleManager* instance. |
|
| 93 | + * |
|
| 94 | + * @return void |
|
| 95 | + */ |
|
| 96 | + private function __clone() |
|
| 97 | + { |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Private unserialize method to prevent unserializing of the *ModuleManager* |
|
| 102 | - * instance. |
|
| 103 | - * |
|
| 104 | - * @return void |
|
| 105 | - */ |
|
| 106 | - private function __wakeup() |
|
| 107 | - { |
|
| 108 | - } |
|
| 100 | + /** |
|
| 101 | + * Private unserialize method to prevent unserializing of the *ModuleManager* |
|
| 102 | + * instance. |
|
| 103 | + * |
|
| 104 | + * @return void |
|
| 105 | + */ |
|
| 106 | + private function __wakeup() |
|
| 107 | + { |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | } |
@@ -61,10 +61,10 @@ |
||
| 61 | 61 | * @see \MyArtJaub\Webtrees\Module\ModuleManagerInterface::isOperational() |
| 62 | 62 | */ |
| 63 | 63 | public function isOperational($moduleName) { |
| 64 | - if(!array_key_exists($moduleName, $this->modules_list)) { |
|
| 65 | - if($module = fw\Module::getModuleByName($moduleName)) { |
|
| 66 | - if($module instanceof DependentInterface) { |
|
| 67 | - if($module->validatePrerequisites()) { |
|
| 64 | + if (!array_key_exists($moduleName, $this->modules_list)) { |
|
| 65 | + if ($module = fw\Module::getModuleByName($moduleName)) { |
|
| 66 | + if ($module instanceof DependentInterface) { |
|
| 67 | + if ($module->validatePrerequisites()) { |
|
| 68 | 68 | $this->modules_list[$moduleName] = TRUE; |
| 69 | 69 | return true; |
| 70 | 70 | } else { |
@@ -72,13 +72,11 @@ |
||
| 72 | 72 | // as they could change by the next call to the method |
| 73 | 73 | return false; |
| 74 | 74 | } |
| 75 | - } |
|
| 76 | - else { |
|
| 75 | + } else { |
|
| 77 | 76 | $this->modules_list[$moduleName] = TRUE; |
| 78 | 77 | return true; |
| 79 | 78 | } |
| 80 | - } |
|
| 81 | - else { |
|
| 79 | + } else { |
|
| 82 | 80 | $this->modules_list[$moduleName] = FALSE; |
| 83 | 81 | } |
| 84 | 82 | } |
@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | * {@inhericDoc} |
| 29 | 29 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 30 | 30 | */ |
| 31 | - protected function renderContent() { |
|
| 31 | + protected function renderContent() { |
|
| 32 | 32 | |
| 33 | - if (Module::getModuleByName('ckeditor')) { |
|
| 34 | - CkeditorModule::enableEditor($this->ctrl); |
|
| 35 | - } |
|
| 33 | + if (Module::getModuleByName('ckeditor')) { |
|
| 34 | + CkeditorModule::enableEditor($this->ctrl); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** @var AbstractModule $module */ |
|
| 38 | - $module = $this->data->get('module'); |
|
| 39 | - ?> |
|
| 37 | + /** @var AbstractModule $module */ |
|
| 38 | + $module = $this->data->get('module'); |
|
| 39 | + ?> |
|
| 40 | 40 | <ol class="breadcrumb small"> |
| 41 | 41 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
| 42 | 42 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | </form> |
| 188 | 188 | |
| 189 | 189 | <?php |
| 190 | - } |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | \ No newline at end of file |