@@ -28,29 +28,29 @@ discard block |
||
| 28 | 28 | class IsSourcedModule extends AbstractModule |
| 29 | 29 | implements ModuleSidebarInterface, HookSubscriberInterface, IndividualHeaderExtenderInterface, RecordNameTextExtenderInterface |
| 30 | 30 | { |
| 31 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 32 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 31 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 32 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * {@inheritDoc} |
|
| 36 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
| 37 | - */ |
|
| 38 | - public function getTitle() { |
|
| 39 | - return I18N::translate('Sourced events'); |
|
| 40 | - } |
|
| 34 | + /** |
|
| 35 | + * {@inheritDoc} |
|
| 36 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
| 37 | + */ |
|
| 38 | + public function getTitle() { |
|
| 39 | + return I18N::translate('Sourced events'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * {@inheritDoc} |
| 44 | 44 | * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription() |
| 45 | 45 | */ |
| 46 | - public function getDescription() { |
|
| 47 | - return I18N::translate('Indicate if events related to an record are sourced.'); |
|
| 48 | - } |
|
| 46 | + public function getDescription() { |
|
| 47 | + return I18N::translate('Indicate if events related to an record are sourced.'); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * {@inheritDoc} |
|
| 52 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 53 | - */ |
|
| 50 | + /** |
|
| 51 | + * {@inheritDoc} |
|
| 52 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 53 | + */ |
|
| 54 | 54 | public function getSubscribedHooks() { |
| 55 | 55 | return array( |
| 56 | 56 | 'hExtendIndiHeaderIcons' => 10, |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
| 64 | 64 | */ |
| 65 | 65 | public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
| 66 | - if($ctrlIndi){ |
|
| 67 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 68 | - if ($dindi->canDisplayIsSourced()) |
|
| 69 | - return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large'); |
|
| 70 | - } |
|
| 71 | - return ''; |
|
| 66 | + if($ctrlIndi){ |
|
| 67 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 68 | + if ($dindi->canDisplayIsSourced()) |
|
| 69 | + return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large'); |
|
| 70 | + } |
|
| 71 | + return ''; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
| 95 | 95 | */ |
| 96 | 96 | public function hRecordNameAppend(GedcomRecord $grec){ |
| 97 | - $html = ''; |
|
| 98 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ |
|
| 99 | - $dindi = new Individual($grec); |
|
| 100 | - $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small'); |
|
| 101 | - $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small'); |
|
| 102 | - if($grec->isDead()) |
|
| 103 | - $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small'); |
|
| 104 | - } |
|
| 105 | - return $html; |
|
| 97 | + $html = ''; |
|
| 98 | + if($grec instanceof \Fisharebest\Webtrees\Individual){ |
|
| 99 | + $dindi = new Individual($grec); |
|
| 100 | + $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small'); |
|
| 101 | + $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small'); |
|
| 102 | + if($grec->isDead()) |
|
| 103 | + $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small'); |
|
| 104 | + } |
|
| 105 | + return $html; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder() |
| 111 | 111 | */ |
| 112 | 112 | public function defaultSidebarOrder() { |
| 113 | - return 15; |
|
| 113 | + return 15; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
| 119 | 119 | */ |
| 120 | 120 | public function hasSidebarContent(){ |
| 121 | - return true; |
|
| 121 | + return true; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarAjaxContent() |
| 127 | 127 | */ |
| 128 | 128 | public function getSidebarAjaxContent() { |
| 129 | - return ''; |
|
| 129 | + return ''; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
| 135 | 135 | */ |
| 136 | 136 | public function getSidebarContent() { |
| 137 | - global $controller; |
|
| 137 | + global $controller; |
|
| 138 | 138 | |
| 139 | - ob_start(); |
|
| 140 | - $root = $controller->getSignificantIndividual(); |
|
| 141 | - if ($root) { |
|
| 142 | - $dindi = new Individual($root); |
|
| 139 | + ob_start(); |
|
| 140 | + $root = $controller->getSignificantIndividual(); |
|
| 141 | + if ($root) { |
|
| 142 | + $dindi = new Individual($root); |
|
| 143 | 143 | |
| 144 | - if (!$dindi->canDisplayIsSourced()) { |
|
| 145 | - echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>'; |
|
| 146 | - } else { |
|
| 147 | - echo ' |
|
| 144 | + if (!$dindi->canDisplayIsSourced()) { |
|
| 145 | + echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>'; |
|
| 146 | + } else { |
|
| 147 | + echo ' |
|
| 148 | 148 | <table class="issourcedtable"> |
| 149 | 149 | <tr> |
| 150 | 150 | <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td> |
@@ -155,35 +155,35 @@ discard block |
||
| 155 | 155 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1).'</td> |
| 156 | 156 | </tr>'; |
| 157 | 157 | |
| 158 | - $fams = $root->getSpouseFamilies(); |
|
| 159 | - ($ct = count($fams)) > 1 ? $nb=1 : $nb=' '; |
|
| 160 | - foreach($fams as $fam){ |
|
| 161 | - $dfam = new Family($fam); |
|
| 162 | - echo ' |
|
| 158 | + $fams = $root->getSpouseFamilies(); |
|
| 159 | + ($ct = count($fams)) > 1 ? $nb=1 : $nb=' '; |
|
| 160 | + foreach($fams as $fam){ |
|
| 161 | + $dfam = new Family($fam); |
|
| 162 | + echo ' |
|
| 163 | 163 | <tr> |
| 164 | 164 | <td class="slabel right"> |
| 165 | 165 | <a href="' . $fam->getHtmlUrl() . '"> '. GedcomTag::getLabel('MARR'); |
| 166 | - if($ct > 1){ |
|
| 167 | - echo ' ',$nb; |
|
| 168 | - $nb++; |
|
| 169 | - } |
|
| 170 | - echo ' </a> |
|
| 166 | + if($ct > 1){ |
|
| 167 | + echo ' ',$nb; |
|
| 168 | + $nb++; |
|
| 169 | + } |
|
| 170 | + echo ' </a> |
|
| 171 | 171 | </td> |
| 172 | 172 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dfam->isMarriageSourced(), 'MARR', 1).'</td> |
| 173 | 173 | </tr>'; |
| 174 | - } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - if( $root->isDead() ) |
|
| 177 | - echo ' |
|
| 176 | + if( $root->isDead() ) |
|
| 177 | + echo ' |
|
| 178 | 178 | <tr> |
| 179 | 179 | <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td> |
| 180 | 180 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td> |
| 181 | 181 | </tr>'; |
| 182 | 182 | |
| 183 | - echo '</table>'; |
|
| 184 | - } |
|
| 185 | - } |
|
| 186 | - return ob_get_clean(); |
|
| 183 | + echo '</table>'; |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | + return ob_get_clean(); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | |
@@ -24,82 +24,82 @@ |
||
| 24 | 24 | class GeoDispersionModule extends AbstractModule implements ModuleConfigInterface, DependentInterface { |
| 25 | 25 | |
| 26 | 26 | // How to update the database schema for this module |
| 27 | - const SCHEMA_TARGET_VERSION = 1; |
|
| 28 | - const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
|
| 29 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\Schema'; |
|
| 27 | + const SCHEMA_TARGET_VERSION = 1; |
|
| 28 | + const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
|
| 29 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\Schema'; |
|
| 30 | 30 | |
| 31 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 32 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 31 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 32 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * GeoDispersion analysis provider |
|
| 36 | - * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider |
|
| 37 | - */ |
|
| 38 | - protected $provider; |
|
| 34 | + /** |
|
| 35 | + * GeoDispersion analysis provider |
|
| 36 | + * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider |
|
| 37 | + */ |
|
| 38 | + protected $provider; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * {@inhericDoc} |
|
| 42 | - */ |
|
| 43 | - public function getTitle() { |
|
| 44 | - return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion'); |
|
| 45 | - } |
|
| 40 | + /** |
|
| 41 | + * {@inhericDoc} |
|
| 42 | + */ |
|
| 43 | + public function getTitle() { |
|
| 44 | + return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion'); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * {@inhericDoc} |
|
| 49 | - */ |
|
| 50 | - public function getDescription() { |
|
| 51 | - return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.'); |
|
| 52 | - } |
|
| 47 | + /** |
|
| 48 | + * {@inhericDoc} |
|
| 49 | + */ |
|
| 50 | + public function getDescription() { |
|
| 51 | + return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.'); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * {@inhericDoc} |
|
| 56 | - */ |
|
| 57 | - public function modAction($mod_action) { |
|
| 58 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 54 | + /** |
|
| 55 | + * {@inhericDoc} |
|
| 56 | + */ |
|
| 57 | + public function modAction($mod_action) { |
|
| 58 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 59 | 59 | |
| 60 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 61 | - } |
|
| 60 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * {@inhericDoc} |
|
| 65 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 66 | - */ |
|
| 67 | - public function getConfigLink() { |
|
| 68 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 63 | + /** |
|
| 64 | + * {@inhericDoc} |
|
| 65 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 66 | + */ |
|
| 67 | + public function getConfigLink() { |
|
| 68 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 69 | 69 | |
| 70 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 71 | - } |
|
| 70 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * {@inhericDoc} |
|
| 75 | - * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
| 76 | - */ |
|
| 77 | - public function validatePrerequisites() { |
|
| 78 | - return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME)); |
|
| 79 | - } |
|
| 73 | + /** |
|
| 74 | + * {@inhericDoc} |
|
| 75 | + * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
| 76 | + */ |
|
| 77 | + public function validatePrerequisites() { |
|
| 78 | + return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME)); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Get the GeoAnalysis Provider (initialise it if not done yet). |
| 83 | 83 | * |
| 84 | 84 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider |
| 85 | 85 | */ |
| 86 | - public function getProvider() { |
|
| 87 | - global $WT_TREE; |
|
| 86 | + public function getProvider() { |
|
| 87 | + global $WT_TREE; |
|
| 88 | 88 | |
| 89 | - if(!$this->provider) { |
|
| 90 | - $this->provider = new GeoAnalysisProvider($WT_TREE); |
|
| 91 | - } |
|
| 92 | - return $this->provider; |
|
| 93 | - } |
|
| 89 | + if(!$this->provider) { |
|
| 90 | + $this->provider = new GeoAnalysisProvider($WT_TREE); |
|
| 91 | + } |
|
| 92 | + return $this->provider; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * Set the GeoAnalysis Provider. |
| 97 | 97 | * |
| 98 | 98 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider |
| 99 | 99 | */ |
| 100 | - public function setProvider(GeoAnalysisProvider $provider) { |
|
| 101 | - $this->provider = $provider; |
|
| 102 | - } |
|
| 100 | + public function setProvider(GeoAnalysisProvider $provider) { |
|
| 101 | + $this->provider = $provider; |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | } |
@@ -23,64 +23,64 @@ discard block |
||
| 23 | 23 | class AdminTasksModule extends AbstractModule |
| 24 | 24 | implements ModuleConfigInterface, ModuleBlockInterface |
| 25 | 25 | { |
| 26 | - // How to update the database schema for this module |
|
| 27 | - const SCHEMA_TARGET_VERSION = 1; |
|
| 28 | - const SCHEMA_SETTING_NAME = 'MAJ_ADMTASKS_SCHEMA_VERSION'; |
|
| 29 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema'; |
|
| 26 | + // How to update the database schema for this module |
|
| 27 | + const SCHEMA_TARGET_VERSION = 1; |
|
| 28 | + const SCHEMA_SETTING_NAME = 'MAJ_ADMTASKS_SCHEMA_VERSION'; |
|
| 29 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema'; |
|
| 30 | 30 | |
| 31 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 32 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 31 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 32 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Admin Task provider |
|
| 36 | - * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider |
|
| 37 | - */ |
|
| 38 | - protected $provider; |
|
| 34 | + /** |
|
| 35 | + * Admin Task provider |
|
| 36 | + * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider |
|
| 37 | + */ |
|
| 38 | + protected $provider; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * {@inheritDoc} |
|
| 42 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
| 43 | - */ |
|
| 44 | - public function getTitle() { |
|
| 45 | - return I18N::translate('Administration Tasks'); |
|
| 46 | - } |
|
| 40 | + /** |
|
| 41 | + * {@inheritDoc} |
|
| 42 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
| 43 | + */ |
|
| 44 | + public function getTitle() { |
|
| 45 | + return I18N::translate('Administration Tasks'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * {@inheritDoc} |
| 50 | 50 | * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription() |
| 51 | 51 | */ |
| 52 | - public function getDescription() { |
|
| 53 | - return I18N::translate('Manage and run nearly-scheduled administration tasks.'); |
|
| 54 | - } |
|
| 52 | + public function getDescription() { |
|
| 53 | + return I18N::translate('Manage and run nearly-scheduled administration tasks.'); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * {@inheritDoc} |
|
| 58 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction() |
|
| 59 | - */ |
|
| 60 | - public function modAction($mod_action) { |
|
| 61 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 56 | + /** |
|
| 57 | + * {@inheritDoc} |
|
| 58 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction() |
|
| 59 | + */ |
|
| 60 | + public function modAction($mod_action) { |
|
| 61 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 62 | 62 | |
| 63 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 64 | - } |
|
| 63 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * {@inheritDoc} |
|
| 68 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 69 | - */ |
|
| 70 | - public function getConfigLink() { |
|
| 71 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 66 | + /** |
|
| 67 | + * {@inheritDoc} |
|
| 68 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 69 | + */ |
|
| 70 | + public function getConfigLink() { |
|
| 71 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 72 | 72 | |
| 73 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 74 | - } |
|
| 73 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * {@inheritDoc} |
|
| 78 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
| 79 | - */ |
|
| 80 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
| 81 | - global $controller; |
|
| 76 | + /** |
|
| 77 | + * {@inheritDoc} |
|
| 78 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
| 79 | + */ |
|
| 80 | + public function getBlock($block_id, $template = true, $cfg = array()) { |
|
| 81 | + global $controller; |
|
| 82 | 82 | |
| 83 | - $controller->addInlineJavascript(' |
|
| 83 | + $controller->addInlineJavascript(' |
|
| 84 | 84 | $(document).ready(function(){ |
| 85 | 85 | $.ajax({ |
| 86 | 86 | url: "module.php", |
@@ -91,60 +91,60 @@ discard block |
||
| 91 | 91 | }); |
| 92 | 92 | }); |
| 93 | 93 | '); |
| 94 | - return ''; |
|
| 95 | - } |
|
| 94 | + return ''; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * {@inheritDoc} |
|
| 99 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
| 100 | - */ |
|
| 101 | - public function loadAjax() { |
|
| 102 | - return false; |
|
| 103 | - } |
|
| 97 | + /** |
|
| 98 | + * {@inheritDoc} |
|
| 99 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
| 100 | + */ |
|
| 101 | + public function loadAjax() { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * {@inheritDoc} |
|
| 107 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
| 108 | - */ |
|
| 109 | - public function isGedcomBlock() { |
|
| 110 | - return true; |
|
| 111 | - } |
|
| 105 | + /** |
|
| 106 | + * {@inheritDoc} |
|
| 107 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
| 108 | + */ |
|
| 109 | + public function isGedcomBlock() { |
|
| 110 | + return true; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * {@inheritDoc} |
|
| 115 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
| 116 | - */ |
|
| 117 | - public function isUserBlock() { |
|
| 118 | - return false; |
|
| 119 | - } |
|
| 113 | + /** |
|
| 114 | + * {@inheritDoc} |
|
| 115 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
| 116 | + */ |
|
| 117 | + public function isUserBlock() { |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * {@inheritDoc} |
|
| 123 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
| 124 | - */ |
|
| 125 | - public function configureBlock($block_id) { |
|
| 121 | + /** |
|
| 122 | + * {@inheritDoc} |
|
| 123 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
| 124 | + */ |
|
| 125 | + public function configureBlock($block_id) { |
|
| 126 | 126 | |
| 127 | - } |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | - * Get the Admin Tasks Provider (initialise it if not done yet). |
|
| 131 | - * |
|
| 132 | - * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface |
|
| 133 | - */ |
|
| 134 | - public function getProvider() { |
|
| 135 | - if(!$this->provider) { |
|
| 136 | - $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/'); |
|
| 137 | - } |
|
| 138 | - return $this->provider; |
|
| 139 | - } |
|
| 130 | + * Get the Admin Tasks Provider (initialise it if not done yet). |
|
| 131 | + * |
|
| 132 | + * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface |
|
| 133 | + */ |
|
| 134 | + public function getProvider() { |
|
| 135 | + if(!$this->provider) { |
|
| 136 | + $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/'); |
|
| 137 | + } |
|
| 138 | + return $this->provider; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * Set the Admin Tasks Provider. |
| 143 | 143 | * |
| 144 | 144 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\TaskProviderInterface |
| 145 | 145 | */ |
| 146 | - public function setProvider(TaskProviderInterface $provider) { |
|
| 147 | - $this->provider = $provider; |
|
| 148 | - } |
|
| 146 | + public function setProvider(TaskProviderInterface $provider) { |
|
| 147 | + $this->provider = $provider; |
|
| 148 | + } |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | \ No newline at end of file |
@@ -34,37 +34,37 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class AdminConfigController extends MvcController |
| 36 | 36 | { |
| 37 | - /** |
|
| 38 | - * Tasks Provider |
|
| 39 | - * @var TaskProviderInterface $provider |
|
| 40 | - */ |
|
| 41 | - protected $provider; |
|
| 37 | + /** |
|
| 38 | + * Tasks Provider |
|
| 39 | + * @var TaskProviderInterface $provider |
|
| 40 | + */ |
|
| 41 | + protected $provider; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Constructor for Admin Config controller |
|
| 45 | - * @param \Fisharebest\Webtrees\Module\AbstractModule $module |
|
| 46 | - */ |
|
| 47 | - public function __construct(AbstractModule $module) { |
|
| 48 | - parent::__construct($module); |
|
| 43 | + /** |
|
| 44 | + * Constructor for Admin Config controller |
|
| 45 | + * @param \Fisharebest\Webtrees\Module\AbstractModule $module |
|
| 46 | + */ |
|
| 47 | + public function __construct(AbstractModule $module) { |
|
| 48 | + parent::__construct($module); |
|
| 49 | 49 | |
| 50 | - $this->provider = $this->module->getProvider(); |
|
| 51 | - } |
|
| 50 | + $this->provider = $this->module->getProvider(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Pages |
|
| 55 | - */ |
|
| 53 | + /** |
|
| 54 | + * Pages |
|
| 55 | + */ |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * AdminConfig@index |
|
| 59 | - */ |
|
| 60 | - public function index() { |
|
| 61 | - global $WT_TREE; |
|
| 57 | + /** |
|
| 58 | + * AdminConfig@index |
|
| 59 | + */ |
|
| 60 | + public function index() { |
|
| 61 | + global $WT_TREE; |
|
| 62 | 62 | |
| 63 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 64 | - $controller = new PageController(); |
|
| 65 | - $controller |
|
| 66 | - ->restrictAccess(Auth::isAdmin()) |
|
| 67 | - ->setPageTitle($this->module->getTitle()); |
|
| 63 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 64 | + $controller = new PageController(); |
|
| 65 | + $controller |
|
| 66 | + ->restrictAccess(Auth::isAdmin()) |
|
| 67 | + ->setPageTitle($this->module->getTitle()); |
|
| 68 | 68 | |
| 69 | 69 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
| 70 | 70 | if(is_null($token)) { |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | $this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $data = new ViewBag(); |
|
| 76 | - $data->set('title', $controller->getPageTitle()); |
|
| 75 | + $data = new ViewBag(); |
|
| 76 | + $data->set('title', $controller->getPageTitle()); |
|
| 77 | 77 | |
| 78 | - $table_id = 'table-admintasks-' . Uuid::uuid4(); |
|
| 79 | - $data->set('table_id', $table_id); |
|
| 78 | + $table_id = 'table-admintasks-' . Uuid::uuid4(); |
|
| 79 | + $data->set('table_id', $table_id); |
|
| 80 | 80 | |
| 81 | 81 | $data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger'); |
| 82 | 82 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | $this->provider->getInstalledTasks(); |
| 90 | 90 | |
| 91 | 91 | $controller |
| 92 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 93 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 94 | - ->addInlineJavascript(' |
|
| 92 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 93 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 94 | + ->addInlineJavascript(' |
|
| 95 | 95 | //Datatable initialisation |
| 96 | 96 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
| 97 | 97 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | 125 | ') |
| 126 | - ->addInlineJavascript(' |
|
| 126 | + ->addInlineJavascript(' |
|
| 127 | 127 | function generate_force_token() { |
| 128 | 128 | jQuery("#bt_genforcetoken").attr("disabled", "disabled"); |
| 129 | 129 | jQuery("#bt_tokentext").empty().html("<i class=\"fa fa-spinner fa-pulse fa-fw\"></i>"); |
@@ -171,56 +171,56 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | '); |
| 173 | 173 | |
| 174 | - ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 175 | - } |
|
| 174 | + ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - /** |
|
| 178 | - * AdminConfig@jsonTasksList |
|
| 179 | - */ |
|
| 180 | - public function jsonTasksList() { |
|
| 181 | - global $WT_TREE; |
|
| 177 | + /** |
|
| 178 | + * AdminConfig@jsonTasksList |
|
| 179 | + */ |
|
| 180 | + public function jsonTasksList() { |
|
| 181 | + global $WT_TREE; |
|
| 182 | 182 | |
| 183 | - $controller = new JsonController(); |
|
| 184 | - $controller |
|
| 185 | - ->restrictAccess(Auth::isAdmin()); |
|
| 183 | + $controller = new JsonController(); |
|
| 184 | + $controller |
|
| 185 | + ->restrictAccess(Auth::isAdmin()); |
|
| 186 | 186 | |
| 187 | - // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 188 | - $search = Filter::postArray('search'); |
|
| 189 | - if($search) $search = $search['value']; |
|
| 190 | - $start = Filter::postInteger('start'); |
|
| 191 | - $length = Filter::postInteger('length'); |
|
| 192 | - $order = Filter::postArray('order'); |
|
| 187 | + // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 188 | + $search = Filter::postArray('search'); |
|
| 189 | + if($search) $search = $search['value']; |
|
| 190 | + $start = Filter::postInteger('start'); |
|
| 191 | + $length = Filter::postInteger('length'); |
|
| 192 | + $order = Filter::postArray('order'); |
|
| 193 | 193 | |
| 194 | 194 | $order_by_name = false; |
| 195 | - foreach($order as $key => &$value) { |
|
| 196 | - switch($value['column']) { |
|
| 197 | - case 3: |
|
| 195 | + foreach($order as $key => &$value) { |
|
| 196 | + switch($value['column']) { |
|
| 197 | + case 3: |
|
| 198 | 198 | $order_by_name = true; |
| 199 | - unset($order[$key]); |
|
| 200 | - break; |
|
| 201 | - case 4; |
|
| 199 | + unset($order[$key]); |
|
| 200 | + break; |
|
| 201 | + case 4; |
|
| 202 | 202 | $value['column'] = 'majat_last_run'; |
| 203 | 203 | break; |
| 204 | 204 | case 4; |
| 205 | 205 | $value['column'] = 'majat_last_result'; |
| 206 | 206 | break; |
| 207 | - default: |
|
| 208 | - unset($order[$key]); |
|
| 209 | - } |
|
| 210 | - } |
|
| 207 | + default: |
|
| 208 | + unset($order[$key]); |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - $list = $this->provider->getFilteredTasksList($search, $order, $start, $length); |
|
| 212 | + $list = $this->provider->getFilteredTasksList($search, $order, $start, $length); |
|
| 213 | 213 | if($order_by_name) { |
| 214 | 214 | usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); }); |
| 215 | 215 | } |
| 216 | - $recordsFiltered = count($list); |
|
| 217 | - $recordsTotal = $this->provider->getTasksCount(); |
|
| 216 | + $recordsFiltered = count($list); |
|
| 217 | + $recordsTotal = $this->provider->getTasksCount(); |
|
| 218 | 218 | |
| 219 | - $data = array(); |
|
| 220 | - foreach($list as $task) { |
|
| 221 | - $datum = array(); |
|
| 219 | + $data = array(); |
|
| 220 | + foreach($list as $task) { |
|
| 221 | + $datum = array(); |
|
| 222 | 222 | |
| 223 | - $datum[0] = ' |
|
| 223 | + $datum[0] = ' |
|
| 224 | 224 | <div class="btn-group"> |
| 225 | 225 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
| 226 | 226 | <i class="fa fa-pencil"></i><span class="caret"></span> |
@@ -238,50 +238,50 @@ discard block |
||
| 238 | 238 | </li> |
| 239 | 239 | </ul> |
| 240 | 240 | </div>'; |
| 241 | - $datum[1] = $task->getName(); |
|
| 242 | - $datum[2] = $task->isEnabled() ? |
|
| 241 | + $datum[1] = $task->getName(); |
|
| 242 | + $datum[2] = $task->isEnabled() ? |
|
| 243 | 243 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
| 244 | 244 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
| 245 | - $datum[3] = $task->getTitle(); |
|
| 246 | - $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s'; |
|
| 245 | + $datum[3] = $task->getTitle(); |
|
| 246 | + $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s'; |
|
| 247 | 247 | $datum[4] = $task->getLastUpdated()->format($date_format); |
| 248 | - $datum[5] = $task->isLastRunSuccess() ? |
|
| 248 | + $datum[5] = $task->isLastRunSuccess() ? |
|
| 249 | 249 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
| 250 | 250 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
| 251 | - $dtF = new \DateTime('@0'); |
|
| 252 | - $dtT = new \DateTime('@' . ($task->getFrequency() * 60)); |
|
| 253 | - $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m')); |
|
| 251 | + $dtF = new \DateTime('@0'); |
|
| 252 | + $dtT = new \DateTime('@' . ($task->getFrequency() * 60)); |
|
| 253 | + $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m')); |
|
| 254 | 254 | $datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited'); |
| 255 | 255 | $datum[8] = $task->isRunning() ? |
| 256 | 256 | '<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : |
| 257 | 257 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>'; |
| 258 | 258 | if($task->isEnabled() && !$task->isRunning()) { |
| 259 | - $datum[9] = ' |
|
| 259 | + $datum[9] = ' |
|
| 260 | 260 | <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')"> |
| 261 | 261 | <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div> |
| 262 | 262 | </button>'; |
| 263 | 263 | } |
| 264 | 264 | else { |
| 265 | - $datum[9] = ''; |
|
| 265 | + $datum[9] = ''; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - $data[] = $datum; |
|
| 269 | - } |
|
| 268 | + $data[] = $datum; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - $controller->pageHeader(); |
|
| 271 | + $controller->pageHeader(); |
|
| 272 | 272 | |
| 273 | - echo \Zend_Json::encode(array( |
|
| 274 | - 'draw' => Filter::getInteger('draw'), |
|
| 275 | - 'recordsTotal' => $recordsTotal, |
|
| 276 | - 'recordsFiltered' => $recordsFiltered, |
|
| 277 | - 'data' => $data |
|
| 278 | - )); |
|
| 273 | + echo \Zend_Json::encode(array( |
|
| 274 | + 'draw' => Filter::getInteger('draw'), |
|
| 275 | + 'recordsTotal' => $recordsTotal, |
|
| 276 | + 'recordsFiltered' => $recordsFiltered, |
|
| 277 | + 'data' => $data |
|
| 278 | + )); |
|
| 279 | 279 | |
| 280 | - } |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | 283 | * AdminConfig@generateToken |
| 284 | - * |
|
| 284 | + * |
|
| 285 | 285 | * Ajax call to generate a new token. Display the token, if generated. |
| 286 | 286 | * Tokens call only be generated by a site administrator. |
| 287 | 287 | * |
@@ -26,166 +26,166 @@ |
||
| 26 | 26 | class LineageController extends MvcController |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Generate the patronymic lineage for this surname |
|
| 31 | - * @var string $surname Reference surname |
|
| 32 | - */ |
|
| 33 | - private $surname; |
|
| 29 | + /** |
|
| 30 | + * Generate the patronymic lineage for this surname |
|
| 31 | + * @var string $surname Reference surname |
|
| 32 | + */ |
|
| 33 | + private $surname; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Initial letter |
|
| 37 | - * @var string $alpha |
|
| 38 | - */ |
|
| 39 | - private $alpha; |
|
| 35 | + /** |
|
| 36 | + * Initial letter |
|
| 37 | + * @var string $alpha |
|
| 38 | + */ |
|
| 39 | + private $alpha; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Show all names (values: yes|no) |
|
| 43 | - * @var bool $show |
|
| 44 | - */ |
|
| 45 | - private $show_all; |
|
| 41 | + /** |
|
| 42 | + * Show all names (values: yes|no) |
|
| 43 | + * @var bool $show |
|
| 44 | + */ |
|
| 45 | + private $show_all; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Page to display (values: surn|lineage) |
|
| 49 | - * @var unknown $show |
|
| 50 | - */ |
|
| 51 | - private $show; |
|
| 47 | + /** |
|
| 48 | + * Page to display (values: surn|lineage) |
|
| 49 | + * @var unknown $show |
|
| 50 | + */ |
|
| 51 | + private $show; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Page title |
|
| 55 | - * @var string $legend |
|
| 56 | - */ |
|
| 57 | - private $legend; |
|
| 53 | + /** |
|
| 54 | + * Page title |
|
| 55 | + * @var string $legend |
|
| 56 | + */ |
|
| 57 | + private $legend; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * {@inheritDoc} |
|
| 61 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
| 62 | - */ |
|
| 63 | - public function __construct(AbstractModule $module) { |
|
| 64 | - global $WT_TREE; |
|
| 59 | + /** |
|
| 60 | + * {@inheritDoc} |
|
| 61 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
| 62 | + */ |
|
| 63 | + public function __construct(AbstractModule $module) { |
|
| 64 | + global $WT_TREE; |
|
| 65 | 65 | |
| 66 | - parent::__construct($module); |
|
| 66 | + parent::__construct($module); |
|
| 67 | 67 | |
| 68 | - $this->surname = Filter::get('surname'); |
|
| 69 | - $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
| 70 | - $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
| 71 | - // Make sure selections are consistent. |
|
| 72 | - // i.e. can’t specify show_all and surname at the same time. |
|
| 73 | - if ($this->show_all === 'yes') { |
|
| 74 | - $this->alpha = ''; |
|
| 75 | - $this->surname = ''; |
|
| 76 | - $this->legend = I18N::translate('All'); |
|
| 77 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
| 78 | - } elseif ($this->surname) { |
|
| 79 | - $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
| 80 | - $this->show_all = 'no'; |
|
| 81 | - if ($this->surname === '@N.N.') { |
|
| 82 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
| 83 | - } else { |
|
| 84 | - $this->legend = Filter::escapeHtml($this->surname); |
|
| 85 | - // The surname parameter is a root/canonical form. |
|
| 86 | - // Display it as the actual surname |
|
| 87 | - foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
| 88 | - $this->legend = implode('/', array_keys($details)); |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
| 92 | - } elseif ($this->alpha === '@') { |
|
| 93 | - $this->show_all = 'no'; |
|
| 94 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
| 95 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
| 96 | - } elseif ($this->alpha === ',') { |
|
| 97 | - $this->show_all = 'no'; |
|
| 98 | - $this->legend = I18N::translate('None'); |
|
| 99 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
| 100 | - } elseif ($this->alpha) { |
|
| 101 | - $this->show_all = 'no'; |
|
| 102 | - $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
| 103 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
| 104 | - } else { |
|
| 105 | - $this->show_all = 'no'; |
|
| 106 | - $this->legend = '…'; |
|
| 107 | - $this->show = 'none'; // Don't show lists until something is chosen |
|
| 108 | - } |
|
| 109 | - $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
| 68 | + $this->surname = Filter::get('surname'); |
|
| 69 | + $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
| 70 | + $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
| 71 | + // Make sure selections are consistent. |
|
| 72 | + // i.e. can’t specify show_all and surname at the same time. |
|
| 73 | + if ($this->show_all === 'yes') { |
|
| 74 | + $this->alpha = ''; |
|
| 75 | + $this->surname = ''; |
|
| 76 | + $this->legend = I18N::translate('All'); |
|
| 77 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
| 78 | + } elseif ($this->surname) { |
|
| 79 | + $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
| 80 | + $this->show_all = 'no'; |
|
| 81 | + if ($this->surname === '@N.N.') { |
|
| 82 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
| 83 | + } else { |
|
| 84 | + $this->legend = Filter::escapeHtml($this->surname); |
|
| 85 | + // The surname parameter is a root/canonical form. |
|
| 86 | + // Display it as the actual surname |
|
| 87 | + foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
| 88 | + $this->legend = implode('/', array_keys($details)); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
| 92 | + } elseif ($this->alpha === '@') { |
|
| 93 | + $this->show_all = 'no'; |
|
| 94 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
| 95 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
| 96 | + } elseif ($this->alpha === ',') { |
|
| 97 | + $this->show_all = 'no'; |
|
| 98 | + $this->legend = I18N::translate('None'); |
|
| 99 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
| 100 | + } elseif ($this->alpha) { |
|
| 101 | + $this->show_all = 'no'; |
|
| 102 | + $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
| 103 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
| 104 | + } else { |
|
| 105 | + $this->show_all = 'no'; |
|
| 106 | + $this->legend = '…'; |
|
| 107 | + $this->show = 'none'; // Don't show lists until something is chosen |
|
| 108 | + } |
|
| 109 | + $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
| 110 | 110 | |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Indicates whether the list of surname should be displayed |
|
| 115 | - * @return bool |
|
| 116 | - */ |
|
| 117 | - protected function isShowingSurnames() { |
|
| 118 | - return $this->show === 'surn'; |
|
| 119 | - } |
|
| 113 | + /** |
|
| 114 | + * Indicates whether the list of surname should be displayed |
|
| 115 | + * @return bool |
|
| 116 | + */ |
|
| 117 | + protected function isShowingSurnames() { |
|
| 118 | + return $this->show === 'surn'; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Indicates whether the lineages should be displayed |
|
| 123 | - * @return bool |
|
| 124 | - */ |
|
| 125 | - protected function isShowingLineages() { |
|
| 126 | - return $this->show === 'lineage'; |
|
| 127 | - } |
|
| 121 | + /** |
|
| 122 | + * Indicates whether the lineages should be displayed |
|
| 123 | + * @return bool |
|
| 124 | + */ |
|
| 125 | + protected function isShowingLineages() { |
|
| 126 | + return $this->show === 'lineage'; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Get list of surnames, starting with the specified initial |
|
| 131 | - * @return array |
|
| 132 | - */ |
|
| 133 | - protected function getSurnamesList() { |
|
| 134 | - global $WT_TREE; |
|
| 129 | + /** |
|
| 130 | + * Get list of surnames, starting with the specified initial |
|
| 131 | + * @return array |
|
| 132 | + */ |
|
| 133 | + protected function getSurnamesList() { |
|
| 134 | + global $WT_TREE; |
|
| 135 | 135 | |
| 136 | - return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
| 137 | - } |
|
| 136 | + return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Get the lineages for the controller's specified surname |
|
| 141 | - */ |
|
| 142 | - protected function getLineages() { |
|
| 139 | + /** |
|
| 140 | + * Get the lineages for the controller's specified surname |
|
| 141 | + */ |
|
| 142 | + protected function getLineages() { |
|
| 143 | 143 | global $WT_TREE; |
| 144 | 144 | |
| 145 | 145 | $builder = new LineageBuilder($this->surname, $WT_TREE); |
| 146 | 146 | $lineages = $builder->buildLineages(); |
| 147 | 147 | |
| 148 | - return $lineages; |
|
| 149 | - } |
|
| 148 | + return $lineages; |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * Pages |
|
| 153 | - */ |
|
| 151 | + /** |
|
| 152 | + * Pages |
|
| 153 | + */ |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Lineage@index |
|
| 157 | - */ |
|
| 158 | - public function index() { |
|
| 159 | - global $WT_TREE; |
|
| 155 | + /** |
|
| 156 | + * Lineage@index |
|
| 157 | + */ |
|
| 158 | + public function index() { |
|
| 159 | + global $WT_TREE; |
|
| 160 | 160 | |
| 161 | - $controller = new PageController(); |
|
| 162 | - $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
| 161 | + $controller = new PageController(); |
|
| 162 | + $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
| 163 | 163 | |
| 164 | - $view_bag = new ViewBag(); |
|
| 165 | - $view_bag->set('title', $controller->getPageTitle()); |
|
| 166 | - $view_bag->set('tree', $WT_TREE); |
|
| 167 | - $view_bag->set('alpha', $this->alpha); |
|
| 168 | - $view_bag->set('surname', $this->surname); |
|
| 169 | - $view_bag->set('legend', $this->legend); |
|
| 170 | - $view_bag->set('show_all', $this->show_all); |
|
| 171 | - if($this->isShowingSurnames()) { |
|
| 172 | - $view_bag->set('issurnames', true); |
|
| 173 | - $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
| 174 | - } |
|
| 175 | - if($this->isShowingLineages()) { |
|
| 176 | - $view_bag->set('islineages', true); |
|
| 177 | - $view_bag->set('lineages', $this->getLineages()); |
|
| 164 | + $view_bag = new ViewBag(); |
|
| 165 | + $view_bag->set('title', $controller->getPageTitle()); |
|
| 166 | + $view_bag->set('tree', $WT_TREE); |
|
| 167 | + $view_bag->set('alpha', $this->alpha); |
|
| 168 | + $view_bag->set('surname', $this->surname); |
|
| 169 | + $view_bag->set('legend', $this->legend); |
|
| 170 | + $view_bag->set('show_all', $this->show_all); |
|
| 171 | + if($this->isShowingSurnames()) { |
|
| 172 | + $view_bag->set('issurnames', true); |
|
| 173 | + $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
| 174 | + } |
|
| 175 | + if($this->isShowingLineages()) { |
|
| 176 | + $view_bag->set('islineages', true); |
|
| 177 | + $view_bag->set('lineages', $this->getLineages()); |
|
| 178 | 178 | |
| 179 | - if ($this->show_all==='no') { |
|
| 180 | - $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
| 181 | - } |
|
| 182 | - else { |
|
| 183 | - $view_bag->set('table_title', I18N::translate('All lineages')); |
|
| 184 | - } |
|
| 185 | - } |
|
| 179 | + if ($this->show_all==='no') { |
|
| 180 | + $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
| 181 | + } |
|
| 182 | + else { |
|
| 183 | + $view_bag->set('table_title', I18N::translate('All lineages')); |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
| 188 | - } |
|
| 187 | + ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | |
@@ -31,161 +31,161 @@ discard block |
||
| 31 | 31 | * {@inhericDoc} |
| 32 | 32 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 33 | 33 | */ |
| 34 | - protected function renderContent() { |
|
| 34 | + protected function renderContent() { |
|
| 35 | 35 | |
| 36 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 37 | - $tree = $this->data->get('tree'); |
|
| 36 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 37 | + $tree = $this->data->get('tree'); |
|
| 38 | 38 | |
| 39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
| 40 | - echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
| 39 | + echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
| 40 | + echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
| 41 | 41 | |
| 42 | - if($this->data->get('issurnames', false)) { |
|
| 43 | - $surns = $this->data->get('surnameslist', array()); |
|
| 44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 45 | - // Show the surname list |
|
| 46 | - switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
| 47 | - case 'style1': |
|
| 42 | + if($this->data->get('issurnames', false)) { |
|
| 43 | + $surns = $this->data->get('surnameslist', array()); |
|
| 44 | + $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 45 | + // Show the surname list |
|
| 46 | + switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
| 47 | + case 'style1': |
|
| 48 | 48 | echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $tree, $extra_params); |
| 49 | 49 | break; |
| 50 | - case 'style3': |
|
| 51 | - echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
| 52 | - break; |
|
| 53 | - case 'style2': |
|
| 54 | - default: |
|
| 55 | - echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
| 56 | - break; |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - else if ($this->data->get('islineages', false)) { |
|
| 60 | - //Link to indilist |
|
| 61 | - echo '<p class="center"><strong>'. |
|
| 62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
| 63 | - I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
| 64 | - '</a></strong></p>'; |
|
| 50 | + case 'style3': |
|
| 51 | + echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
| 52 | + break; |
|
| 53 | + case 'style2': |
|
| 54 | + default: |
|
| 55 | + echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
| 56 | + break; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + else if ($this->data->get('islineages', false)) { |
|
| 60 | + //Link to indilist |
|
| 61 | + echo '<p class="center"><strong>'. |
|
| 62 | + '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
| 63 | + I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
| 64 | + '</a></strong></p>'; |
|
| 65 | 65 | |
| 66 | - $lineages = $this->data->get('lineages', null); |
|
| 67 | - $nb_lineages = count($lineages); |
|
| 68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
| 69 | - echo '<p class="center"><span class="warning">', |
|
| 70 | - I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
| 71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
| 72 | - '</span></p>'; |
|
| 73 | - } else { |
|
| 66 | + $lineages = $this->data->get('lineages', null); |
|
| 67 | + $nb_lineages = count($lineages); |
|
| 68 | + if(is_null($lineages) || $nb_lineages == 0) { |
|
| 69 | + echo '<p class="center"><span class="warning">', |
|
| 70 | + I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
| 71 | + '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
| 72 | + '</span></p>'; |
|
| 73 | + } else { |
|
| 74 | 74 | |
| 75 | - echo '<div id="patronymiclineages">'. |
|
| 76 | - '<div class="list_label">', |
|
| 77 | - $this->data->get('table_title'), |
|
| 78 | - '</div>'; |
|
| 75 | + echo '<div id="patronymiclineages">'. |
|
| 76 | + '<div class="list_label">', |
|
| 77 | + $this->data->get('table_title'), |
|
| 78 | + '</div>'; |
|
| 79 | 79 | |
| 80 | - echo '<div class="list_value_wrap">'; |
|
| 80 | + echo '<div class="list_value_wrap">'; |
|
| 81 | 81 | |
| 82 | - foreach($lineages as $i => $lineage) { |
|
| 83 | - $this->printRootLineage($lineage); |
|
| 84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
| 85 | - } |
|
| 82 | + foreach($lineages as $i => $lineage) { |
|
| 83 | + $this->printRootLineage($lineage); |
|
| 84 | + if($i < $nb_lineages - 1) echo '<hr />'; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - echo '</div>'; |
|
| 87 | + echo '</div>'; |
|
| 88 | 88 | |
| 89 | - echo '<div class="list_label">', |
|
| 90 | - I18N::translate('%s lineages found', $nb_lineages), |
|
| 91 | - '</div>'. |
|
| 92 | - '</div>'; |
|
| 89 | + echo '<div class="list_label">', |
|
| 90 | + I18N::translate('%s lineages found', $nb_lineages), |
|
| 91 | + '</div>'. |
|
| 92 | + '</div>'; |
|
| 93 | 93 | |
| 94 | - } |
|
| 95 | - } |
|
| 96 | - } |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Get the list of initial letters |
|
| 100 | - * |
|
| 101 | - * @return string[] |
|
| 102 | - */ |
|
| 103 | - private function getInitialLettersList() { |
|
| 104 | - $list = array(); |
|
| 105 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 106 | - $tree = $this->data->get('tree'); |
|
| 98 | + /** |
|
| 99 | + * Get the list of initial letters |
|
| 100 | + * |
|
| 101 | + * @return string[] |
|
| 102 | + */ |
|
| 103 | + private function getInitialLettersList() { |
|
| 104 | + $list = array(); |
|
| 105 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 106 | + $tree = $this->data->get('tree'); |
|
| 107 | 107 | $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
| 108 | 108 | |
| 109 | - foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
| 110 | - switch ($letter) { |
|
| 111 | - case '@': |
|
| 112 | - $html = I18N::translateContext('Unknown surname', '…'); |
|
| 113 | - break; |
|
| 114 | - case ',': |
|
| 115 | - $html = I18N::translate('None'); |
|
| 116 | - break; |
|
| 117 | - default: |
|
| 118 | - $html = Filter::escapeHtml($letter); |
|
| 119 | - break; |
|
| 120 | - } |
|
| 121 | - if ($count) { |
|
| 122 | - if ($letter == $this->data->get('alpha')) { |
|
| 123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 124 | - } else { |
|
| 125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 126 | - } |
|
| 127 | - } else { |
|
| 128 | - $list[] = $html; |
|
| 129 | - } |
|
| 130 | - } |
|
| 109 | + foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
| 110 | + switch ($letter) { |
|
| 111 | + case '@': |
|
| 112 | + $html = I18N::translateContext('Unknown surname', '…'); |
|
| 113 | + break; |
|
| 114 | + case ',': |
|
| 115 | + $html = I18N::translate('None'); |
|
| 116 | + break; |
|
| 117 | + default: |
|
| 118 | + $html = Filter::escapeHtml($letter); |
|
| 119 | + break; |
|
| 120 | + } |
|
| 121 | + if ($count) { |
|
| 122 | + if ($letter == $this->data->get('alpha')) { |
|
| 123 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 124 | + } else { |
|
| 125 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 126 | + } |
|
| 127 | + } else { |
|
| 128 | + $list[] = $html; |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - // Search spiders don't get the "show all" option as the other links give them everything. |
|
| 133 | - if (!Auth::isSearchEngine()) { |
|
| 134 | - if ($this->data->get('show_all') === 'yes') { |
|
| 135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
| 136 | - } else { |
|
| 137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
| 138 | - } |
|
| 139 | - } |
|
| 132 | + // Search spiders don't get the "show all" option as the other links give them everything. |
|
| 133 | + if (!Auth::isSearchEngine()) { |
|
| 134 | + if ($this->data->get('show_all') === 'yes') { |
|
| 135 | + $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
| 136 | + } else { |
|
| 137 | + $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - return $list; |
|
| 142 | - } |
|
| 141 | + return $list; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Print a root lineage node |
|
| 146 | - * @param LineageRootNode $node |
|
| 147 | - */ |
|
| 148 | - private function printRootLineage(LineageRootNode $node) { |
|
| 149 | - print '<div class="patrolin_tree">'; |
|
| 150 | - if($node->getIndividual() === null) { |
|
| 151 | - $fam_nodes = $node->getFamiliesNodes(); |
|
| 152 | - foreach($fam_nodes as $fam){ |
|
| 153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 154 | - if($child_node) { |
|
| 155 | - $this->printLineage($child_node); |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - else { |
|
| 161 | - $this->printLineage($node); |
|
| 162 | - } |
|
| 163 | - echo '</div>'; |
|
| 144 | + /** |
|
| 145 | + * Print a root lineage node |
|
| 146 | + * @param LineageRootNode $node |
|
| 147 | + */ |
|
| 148 | + private function printRootLineage(LineageRootNode $node) { |
|
| 149 | + print '<div class="patrolin_tree">'; |
|
| 150 | + if($node->getIndividual() === null) { |
|
| 151 | + $fam_nodes = $node->getFamiliesNodes(); |
|
| 152 | + foreach($fam_nodes as $fam){ |
|
| 153 | + foreach($fam_nodes[$fam] as $child_node) { |
|
| 154 | + if($child_node) { |
|
| 155 | + $this->printLineage($child_node); |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + else { |
|
| 161 | + $this->printLineage($node); |
|
| 162 | + } |
|
| 163 | + echo '</div>'; |
|
| 164 | 164 | |
| 165 | - $places = $node->getPlaces(); |
|
| 166 | - if($places && count($places)>0){ |
|
| 167 | - echo '<div class="patrolin_places">'; |
|
| 168 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
| 169 | - echo '</div>'; |
|
| 170 | - } |
|
| 171 | - } |
|
| 165 | + $places = $node->getPlaces(); |
|
| 166 | + if($places && count($places)>0){ |
|
| 167 | + echo '<div class="patrolin_places">'; |
|
| 168 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
| 169 | + echo '</div>'; |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Print a lineage node, recursively. |
|
| 175 | - * @param LineageNode $node |
|
| 176 | - */ |
|
| 177 | - private function printLineage(LineageNode $node) { |
|
| 173 | + /** |
|
| 174 | + * Print a lineage node, recursively. |
|
| 175 | + * @param LineageNode $node |
|
| 176 | + */ |
|
| 177 | + private function printLineage(LineageNode $node) { |
|
| 178 | 178 | |
| 179 | - echo '<ul>'; |
|
| 180 | - $fam_nodes = $node->getFamiliesNodes(); |
|
| 181 | - if(count($fam_nodes) > 0) { |
|
| 182 | - $is_first_family = true; |
|
| 183 | - foreach($fam_nodes as $fam) { |
|
| 184 | - $node_indi = $node->getIndividual(); |
|
| 185 | - echo '<li>'; |
|
| 186 | - if($is_first_family){ |
|
| 187 | - echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
| 188 | - } |
|
| 179 | + echo '<ul>'; |
|
| 180 | + $fam_nodes = $node->getFamiliesNodes(); |
|
| 181 | + if(count($fam_nodes) > 0) { |
|
| 182 | + $is_first_family = true; |
|
| 183 | + foreach($fam_nodes as $fam) { |
|
| 184 | + $node_indi = $node->getIndividual(); |
|
| 185 | + echo '<li>'; |
|
| 186 | + if($is_first_family){ |
|
| 187 | + echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
| 188 | + } |
|
| 189 | 189 | else{ |
| 190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
| 191 | 191 | } |
@@ -204,32 +204,32 @@ discard block |
||
| 204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
| 205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
| 206 | 206 | } |
| 207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 208 | - if($child_node) { |
|
| 209 | - $this->printLineage($child_node); |
|
| 210 | - } |
|
| 211 | - else { |
|
| 212 | - echo '<ul><li><strong>…</strong></li></ul>'; |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - $is_first_family = false; |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - else { |
|
| 219 | - echo '<li>'; |
|
| 220 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
| 221 | - if($node->hasFollowUpSurname()) { |
|
| 222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 223 | - echo ' '. |
|
| 224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
| 225 | - '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
| 226 | - '</a>'; |
|
| 227 | - } |
|
| 228 | - echo '</li>'; |
|
| 229 | - } |
|
| 230 | - echo '</ul>'; |
|
| 207 | + foreach($fam_nodes[$fam] as $child_node) { |
|
| 208 | + if($child_node) { |
|
| 209 | + $this->printLineage($child_node); |
|
| 210 | + } |
|
| 211 | + else { |
|
| 212 | + echo '<ul><li><strong>…</strong></li></ul>'; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + $is_first_family = false; |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + else { |
|
| 219 | + echo '<li>'; |
|
| 220 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
| 221 | + if($node->hasFollowUpSurname()) { |
|
| 222 | + $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 223 | + echo ' '. |
|
| 224 | + '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
| 225 | + '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
| 226 | + '</a>'; |
|
| 227 | + } |
|
| 228 | + echo '</li>'; |
|
| 229 | + } |
|
| 230 | + echo '</ul>'; |
|
| 231 | 231 | |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | \ No newline at end of file |
@@ -31,116 +31,116 @@ discard block |
||
| 31 | 31 | * Sosa Module. |
| 32 | 32 | */ |
| 33 | 33 | class SosaModule |
| 34 | - extends AbstractModule |
|
| 35 | - implements ModuleMenuInterface, |
|
| 36 | - ModuleConfigInterface, |
|
| 37 | - HookSubscriberInterface, |
|
| 38 | - IndividualHeaderExtenderInterface, |
|
| 39 | - RecordNameTextExtenderInterface |
|
| 34 | + extends AbstractModule |
|
| 35 | + implements ModuleMenuInterface, |
|
| 36 | + ModuleConfigInterface, |
|
| 37 | + HookSubscriberInterface, |
|
| 38 | + IndividualHeaderExtenderInterface, |
|
| 39 | + RecordNameTextExtenderInterface |
|
| 40 | 40 | { |
| 41 | - // How to update the database schema for this module |
|
| 42 | - const SCHEMA_TARGET_VERSION = 1; |
|
| 43 | - const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
| 44 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema'; |
|
| 41 | + // How to update the database schema for this module |
|
| 42 | + const SCHEMA_TARGET_VERSION = 1; |
|
| 43 | + const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
| 44 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema'; |
|
| 45 | 45 | |
| 46 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 47 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * {@inhericDoc} |
|
| 51 | - */ |
|
| 52 | - public function getTitle() { |
|
| 53 | - return /* I18N: Name of the “Hooks” module */ I18N::translate('Sosa'); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * {@inhericDoc} |
|
| 58 | - */ |
|
| 59 | - public function getDescription() { |
|
| 60 | - return /* I18N: Description of the “Hooks” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * {@inhericDoc} |
|
| 65 | - */ |
|
| 66 | - public function modAction($mod_action) { |
|
| 67 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 46 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 47 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * {@inhericDoc} |
|
| 51 | + */ |
|
| 52 | + public function getTitle() { |
|
| 53 | + return /* I18N: Name of the “Hooks” module */ I18N::translate('Sosa'); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * {@inhericDoc} |
|
| 58 | + */ |
|
| 59 | + public function getDescription() { |
|
| 60 | + return /* I18N: Description of the “Hooks” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * {@inhericDoc} |
|
| 65 | + */ |
|
| 66 | + public function modAction($mod_action) { |
|
| 67 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 68 | 68 | |
| 69 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 70 | - } |
|
| 69 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /********** |
|
| 72 | + /********** |
|
| 73 | 73 | * ModuleConfigInterface |
| 74 | 74 | **********/ |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * {@inhericDoc} |
|
| 78 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 79 | - */ |
|
| 80 | - public function getConfigLink() { |
|
| 81 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 76 | + /** |
|
| 77 | + * {@inhericDoc} |
|
| 78 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 79 | + */ |
|
| 80 | + public function getConfigLink() { |
|
| 81 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 82 | 82 | |
| 83 | - return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
| 84 | - } |
|
| 83 | + return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /********** |
|
| 86 | + /********** |
|
| 87 | 87 | * ModuleMenuInterface |
| 88 | 88 | **********/ |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * {@inhericDoc} |
|
| 92 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
| 93 | - */ |
|
| 94 | - public function defaultMenuOrder() { |
|
| 95 | - return 5; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * {@inhericDoc} |
|
| 100 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
| 101 | - */ |
|
| 102 | - public function getMenu() { |
|
| 103 | - global $WT_TREE, $controller; |
|
| 90 | + /** |
|
| 91 | + * {@inhericDoc} |
|
| 92 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
| 93 | + */ |
|
| 94 | + public function defaultMenuOrder() { |
|
| 95 | + return 5; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * {@inhericDoc} |
|
| 100 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
| 101 | + */ |
|
| 102 | + public function getMenu() { |
|
| 103 | + global $WT_TREE, $controller; |
|
| 104 | 104 | |
| 105 | - $menu = null; |
|
| 106 | - if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
| 105 | + $menu = null; |
|
| 106 | + if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
| 107 | 107 | |
| 108 | - $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&'; |
|
| 109 | - $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
| 108 | + $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&'; |
|
| 109 | + $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
| 110 | 110 | |
| 111 | - $menu = clone $sosa_stat_menu; |
|
| 112 | - $menu->setClass('menu-maj-sosa'); |
|
| 111 | + $menu = clone $sosa_stat_menu; |
|
| 112 | + $menu->setClass('menu-maj-sosa'); |
|
| 113 | 113 | |
| 114 | - $submenus = array_filter(array( |
|
| 115 | - new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
| 116 | - new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
| 117 | - $sosa_stat_menu |
|
| 118 | - )); |
|
| 114 | + $submenus = array_filter(array( |
|
| 115 | + new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
| 116 | + new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
| 117 | + $sosa_stat_menu |
|
| 118 | + )); |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | - if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME) |
|
| 122 | - && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
|
| 123 | - ) |
|
| 124 | - { |
|
| 125 | - if(count($ga_list) > 0) { |
|
| 126 | - $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
| 127 | - } |
|
| 128 | - } |
|
| 121 | + if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME) |
|
| 122 | + && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
|
| 123 | + ) |
|
| 124 | + { |
|
| 125 | + if(count($ga_list) > 0) { |
|
| 126 | + $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - if(Auth::check()) { |
|
| 131 | - $submenus[] = new Menu( |
|
| 132 | - I18N::translate('Sosa Configuration'), |
|
| 133 | - $this->getConfigLink(), |
|
| 134 | - 'menu-maj-sosa-configuration', |
|
| 135 | - array('rel' => 'nofollow')); |
|
| 136 | - } |
|
| 130 | + if(Auth::check()) { |
|
| 131 | + $submenus[] = new Menu( |
|
| 132 | + I18N::translate('Sosa Configuration'), |
|
| 133 | + $this->getConfigLink(), |
|
| 134 | + 'menu-maj-sosa-configuration', |
|
| 135 | + array('rel' => 'nofollow')); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - //-- recompute Sosa submenu |
|
| 139 | - if (!empty($controller) && $controller instanceof IndividualController |
|
| 140 | - && Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID') |
|
| 141 | - ) { |
|
| 142 | - $controller |
|
| 143 | - ->addInlineJavascript(' |
|
| 138 | + //-- recompute Sosa submenu |
|
| 139 | + if (!empty($controller) && $controller instanceof IndividualController |
|
| 140 | + && Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID') |
|
| 141 | + ) { |
|
| 142 | + $controller |
|
| 143 | + ->addInlineJavascript(' |
|
| 144 | 144 | function majComputeSosaFromIndi(){ |
| 145 | 145 | if($("#computesosadlg").length == 0) { |
| 146 | 146 | $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>"); |
@@ -163,87 +163,87 @@ discard block |
||
| 163 | 163 | }); |
| 164 | 164 | }'); |
| 165 | 165 | |
| 166 | - $submenus[] = new Menu( |
|
| 167 | - I18N::translate('Complete Sosas'), |
|
| 168 | - '#', |
|
| 169 | - 'menu-maj-sosa-recompute', |
|
| 170 | - array( |
|
| 171 | - 'rel' => 'nofollow', |
|
| 172 | - 'onclick' => 'return majComputeSosaFromIndi();' |
|
| 173 | - )); |
|
| 174 | - } |
|
| 166 | + $submenus[] = new Menu( |
|
| 167 | + I18N::translate('Complete Sosas'), |
|
| 168 | + '#', |
|
| 169 | + 'menu-maj-sosa-recompute', |
|
| 170 | + array( |
|
| 171 | + 'rel' => 'nofollow', |
|
| 172 | + 'onclick' => 'return majComputeSosaFromIndi();' |
|
| 173 | + )); |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - } |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - $menu->setSubmenus($submenus); |
|
| 178 | + $menu->setSubmenus($submenus); |
|
| 179 | 179 | |
| 180 | - return $menu; |
|
| 180 | + return $menu; |
|
| 181 | 181 | |
| 182 | - } |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - /********** |
|
| 184 | + /********** |
|
| 185 | 185 | * Hooks |
| 186 | 186 | **********/ |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * {@inhericDoc} |
|
| 190 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 191 | - */ |
|
| 192 | - public function getSubscribedHooks() { |
|
| 193 | - return array( |
|
| 194 | - 'hExtendIndiHeaderIcons' => 20, |
|
| 195 | - 'hExtendIndiHeaderRight' => 20, |
|
| 196 | - 'hRecordNameAppend' => 20 |
|
| 197 | - ); |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * {@inhericDoc} |
|
| 202 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
|
| 203 | - */ |
|
| 204 | - public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
|
| 205 | - if($ctrlIndi){ |
|
| 206 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 207 | - return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
|
| 208 | - } |
|
| 209 | - return ''; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * {@inhericDoc} |
|
| 214 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() |
|
| 215 | - */ |
|
| 216 | - public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { } |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * {@inhericDoc} |
|
| 220 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
|
| 221 | - */ |
|
| 222 | - public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
|
| 223 | - if($ctrlIndi){ |
|
| 224 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 225 | - return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
| 226 | - } |
|
| 227 | - return ''; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * {@inhericDoc} |
|
| 232 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
|
| 233 | - */ |
|
| 234 | - public function hRecordNameAppend(GedcomRecord $grec) { |
|
| 235 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
| 236 | - $dindi = new Individual($grec); |
|
| 237 | - return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
|
| 238 | - } |
|
| 239 | - return ''; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * {@inhericDoc} |
|
| 244 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend() |
|
| 245 | - */ |
|
| 246 | - public function hRecordNamePrepend(GedcomRecord $grec) {} |
|
| 188 | + /** |
|
| 189 | + * {@inhericDoc} |
|
| 190 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
| 191 | + */ |
|
| 192 | + public function getSubscribedHooks() { |
|
| 193 | + return array( |
|
| 194 | + 'hExtendIndiHeaderIcons' => 20, |
|
| 195 | + 'hExtendIndiHeaderRight' => 20, |
|
| 196 | + 'hRecordNameAppend' => 20 |
|
| 197 | + ); |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * {@inhericDoc} |
|
| 202 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
|
| 203 | + */ |
|
| 204 | + public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
|
| 205 | + if($ctrlIndi){ |
|
| 206 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 207 | + return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
|
| 208 | + } |
|
| 209 | + return ''; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * {@inhericDoc} |
|
| 214 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() |
|
| 215 | + */ |
|
| 216 | + public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { } |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * {@inhericDoc} |
|
| 220 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
|
| 221 | + */ |
|
| 222 | + public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
|
| 223 | + if($ctrlIndi){ |
|
| 224 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
| 225 | + return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
| 226 | + } |
|
| 227 | + return ''; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * {@inhericDoc} |
|
| 232 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
|
| 233 | + */ |
|
| 234 | + public function hRecordNameAppend(GedcomRecord $grec) { |
|
| 235 | + if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
| 236 | + $dindi = new Individual($grec); |
|
| 237 | + return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
|
| 238 | + } |
|
| 239 | + return ''; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * {@inhericDoc} |
|
| 244 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend() |
|
| 245 | + */ |
|
| 246 | + public function hRecordNamePrepend(GedcomRecord $grec) {} |
|
| 247 | 247 | |
| 248 | 248 | |
| 249 | 249 | |
@@ -19,46 +19,46 @@ |
||
| 19 | 19 | * Hooks Module. |
| 20 | 20 | */ |
| 21 | 21 | class HooksModule extends AbstractModule implements ModuleConfigInterface { |
| 22 | - // How to update the database schema for this module |
|
| 23 | - const SCHEMA_TARGET_VERSION = 1; |
|
| 24 | - const SCHEMA_SETTING_NAME = 'MAJ_HOOKS_SCHEMA_VERSION'; |
|
| 25 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Hooks\Schema'; |
|
| 22 | + // How to update the database schema for this module |
|
| 23 | + const SCHEMA_TARGET_VERSION = 1; |
|
| 24 | + const SCHEMA_SETTING_NAME = 'MAJ_HOOKS_SCHEMA_VERSION'; |
|
| 25 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Hooks\Schema'; |
|
| 26 | 26 | |
| 27 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 28 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 27 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 28 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * {@inhericDoc} |
|
| 32 | - */ |
|
| 33 | - public function getTitle() { |
|
| 34 | - return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks'); |
|
| 35 | - } |
|
| 30 | + /** |
|
| 31 | + * {@inhericDoc} |
|
| 32 | + */ |
|
| 33 | + public function getTitle() { |
|
| 34 | + return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks'); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * {@inhericDoc} |
|
| 39 | - */ |
|
| 40 | - public function getDescription() { |
|
| 41 | - return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.'); |
|
| 42 | - } |
|
| 37 | + /** |
|
| 38 | + * {@inhericDoc} |
|
| 39 | + */ |
|
| 40 | + public function getDescription() { |
|
| 41 | + return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.'); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * {@inhericDoc} |
|
| 46 | - */ |
|
| 47 | - public function modAction($mod_action) { |
|
| 48 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 44 | + /** |
|
| 45 | + * {@inhericDoc} |
|
| 46 | + */ |
|
| 47 | + public function modAction($mod_action) { |
|
| 48 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 49 | 49 | |
| 50 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 51 | - } |
|
| 50 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * {@inhericDoc} |
|
| 55 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 56 | - */ |
|
| 57 | - public function getConfigLink() { |
|
| 58 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 53 | + /** |
|
| 54 | + * {@inhericDoc} |
|
| 55 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 56 | + */ |
|
| 57 | + public function getConfigLink() { |
|
| 58 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
| 59 | 59 | |
| 60 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 61 | - } |
|
| 60 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | } |
@@ -28,77 +28,77 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class AdminConfigController extends MvcController |
| 30 | 30 | { |
| 31 | - /** |
|
| 32 | - * Manage updates sent from the AdminConfig@index form. |
|
| 33 | - */ |
|
| 34 | - protected function update() { |
|
| 31 | + /** |
|
| 32 | + * Manage updates sent from the AdminConfig@index form. |
|
| 33 | + */ |
|
| 34 | + protected function update() { |
|
| 35 | 35 | |
| 36 | - if(Auth::isAdmin()){ |
|
| 36 | + if(Auth::isAdmin()){ |
|
| 37 | 37 | |
| 38 | - $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
|
| 39 | - $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
|
| 38 | + $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
|
| 39 | + $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
|
| 40 | 40 | |
| 41 | - if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
| 42 | - $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
|
| 43 | - } |
|
| 41 | + if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
| 42 | + $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
| 46 | - $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
|
| 47 | - } |
|
| 45 | + if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
| 46 | + $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - // Only accept valid color for MAJ_WM_FONT_COLOR |
|
| 50 | - $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
|
| 51 | - if($MAJ_WM_FONT_COLOR) { |
|
| 52 | - $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
|
| 53 | - } |
|
| 49 | + // Only accept valid color for MAJ_WM_FONT_COLOR |
|
| 50 | + $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
|
| 51 | + if($MAJ_WM_FONT_COLOR) { |
|
| 52 | + $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - // Only accept valid folders for MAJ_CERT_ROOTDIR |
|
| 56 | - $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
| 57 | - if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
|
| 58 | - $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
|
| 59 | - } |
|
| 55 | + // Only accept valid folders for MAJ_CERT_ROOTDIR |
|
| 56 | + $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
| 57 | + if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
|
| 58 | + $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - if ($MAJ_CERT_ROOTDIR) { |
|
| 62 | - if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
| 63 | - $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
| 64 | - } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
| 65 | - $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
| 66 | - FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
| 67 | - } else { |
|
| 68 | - FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
| 69 | - } |
|
| 70 | - } |
|
| 61 | + if ($MAJ_CERT_ROOTDIR) { |
|
| 62 | + if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
| 63 | + $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
| 64 | + } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
| 65 | + $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
| 66 | + FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
| 67 | + } else { |
|
| 68 | + FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success'); |
|
| 72 | + FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success'); |
|
| 73 | 73 | |
| 74 | - return; |
|
| 75 | - } |
|
| 76 | - } |
|
| 74 | + return; |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Pages |
|
| 80 | - */ |
|
| 78 | + /** |
|
| 79 | + * Pages |
|
| 80 | + */ |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * AdminConfig@index |
|
| 84 | - */ |
|
| 85 | - public function index() { |
|
| 86 | - global $WT_TREE; |
|
| 82 | + /** |
|
| 83 | + * AdminConfig@index |
|
| 84 | + */ |
|
| 85 | + public function index() { |
|
| 86 | + global $WT_TREE; |
|
| 87 | 87 | |
| 88 | - $action = Filter::post('action'); |
|
| 89 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 88 | + $action = Filter::post('action'); |
|
| 89 | + if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 90 | 90 | |
| 91 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 92 | - $ctrl = new PageController(); |
|
| 93 | - $ctrl |
|
| 94 | - ->restrictAccess(Auth::isAdmin()) |
|
| 95 | - ->setPageTitle($this->module->getTitle()); |
|
| 91 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 92 | + $ctrl = new PageController(); |
|
| 93 | + $ctrl |
|
| 94 | + ->restrictAccess(Auth::isAdmin()) |
|
| 95 | + ->setPageTitle($this->module->getTitle()); |
|
| 96 | 96 | |
| 97 | - $view_bag = new ViewBag(); |
|
| 98 | - $view_bag->set('title', $ctrl->getPageTitle()); |
|
| 99 | - $view_bag->set('module', $this->module); |
|
| 97 | + $view_bag = new ViewBag(); |
|
| 98 | + $view_bag->set('title', $ctrl->getPageTitle()); |
|
| 99 | + $view_bag->set('module', $this->module); |
|
| 100 | 100 | |
| 101 | - ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
| 102 | - } |
|
| 101 | + ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 | \ No newline at end of file |