diff options
Diffstat (limited to 'app/Module/FamilyTreeStatisticsModule.php')
| -rw-r--r-- | app/Module/FamilyTreeStatisticsModule.php | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/app/Module/FamilyTreeStatisticsModule.php b/app/Module/FamilyTreeStatisticsModule.php index 1825afd6cb..3137ccbf47 100644 --- a/app/Module/FamilyTreeStatisticsModule.php +++ b/app/Module/FamilyTreeStatisticsModule.php @@ -1,6 +1,4 @@ <?php -namespace Fisharebest\Webtrees\Module; - /** * webtrees: online genealogy * Copyright (C) 2015 webtrees development team @@ -15,6 +13,8 @@ namespace Fisharebest\Webtrees\Module; * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +namespace Fisharebest\Webtrees\Module; + use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Filter; use Fisharebest\Webtrees\Functions\FunctionsDb; @@ -37,8 +37,16 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn return /* I18N: Description of “Statistics” module */ I18N::translate('The size of the family tree, earliest and latest events, common names, etc.'); } - /** {@inheritdoc} */ - public function getBlock($block_id, $template = true, $cfg = null) { + /** + * Generate the HTML content of this block. + * + * @param int $block_id + * @param bool $template + * @param array $cfg + * + * @return string + */ + public function getBlock($block_id, $template = true, $cfg = array()) { global $WT_TREE, $ctype; $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1'); @@ -64,11 +72,9 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn $block = '0'; $stat_link = '1'; - if ($cfg) { - foreach (array('show_common_surnames', 'stat_indi', 'stat_fam', 'stat_sour', 'stat_media', 'stat_surname', 'stat_events', 'stat_users', 'stat_first_birth', 'stat_last_birth', 'stat_first_death', 'stat_last_death', 'stat_long_life', 'stat_avg_life', 'stat_most_chil', 'stat_avg_chil', 'stat_link', 'block') as $name) { - if (array_key_exists($name, $cfg)) { - $$name = $cfg[$name]; - } + foreach (array('show_common_surnames', 'stat_indi', 'stat_fam', 'stat_sour', 'stat_media', 'stat_surname', 'stat_events', 'stat_users', 'stat_first_birth', 'stat_last_birth', 'stat_first_death', 'stat_last_death', 'stat_long_life', 'stat_avg_life', 'stat_most_chil', 'stat_avg_chil', 'stat_link', 'block') as $name) { + if (array_key_exists($name, $cfg)) { + $$name = $cfg[$name]; } } @@ -228,7 +234,11 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn return true; } - /** {@inheritdoc} */ + /** + * An HTML form to edit block settings + * + * @param int $block_id + */ public function configureBlock($block_id) { if (Filter::postBool('save') && Filter::checkCsrf()) { $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update')); |
