diff options
Diffstat (limited to 'app/Module/FamilyTreeNewsModule.php')
| -rw-r--r-- | app/Module/FamilyTreeNewsModule.php | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/app/Module/FamilyTreeNewsModule.php b/app/Module/FamilyTreeNewsModule.php index 142b2f8028..8ec2f7e943 100644 --- a/app/Module/FamilyTreeNewsModule.php +++ b/app/Module/FamilyTreeNewsModule.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\Database; use Fisharebest\Webtrees\Filter; @@ -27,7 +27,11 @@ use Fisharebest\Webtrees\Theme; * Class FamilyTreeNewsModule */ class FamilyTreeNewsModule extends AbstractModule implements ModuleBlockInterface { - /** {@inheritdoc} */ + /** + * Create a new module. + * + * @param string $directory Where is this module installed + */ public function __construct($directory) { parent::__construct($directory); @@ -35,18 +39,34 @@ class FamilyTreeNewsModule extends AbstractModule implements ModuleBlockInterfac Database::updateSchema('\Fisharebest\Webtrees\Module\FamilyTreeNews\Schema', 'NB_SCHEMA_VERSION', 3); } - /** {@inheritdoc} */ + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ public function getTitle() { return /* I18N: Name of a module */ I18N::translate('News'); } - /** {@inheritdoc} */ + /** + * A sentence describing what this module does. + * + * @return string + */ public function getDescription() { return /* I18N: Description of the “GEDCOM News” module */ I18N::translate('Family news and site announcements.'); } - /** {@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 $ctype, $WT_TREE; switch (Filter::get('action')) { @@ -69,11 +89,9 @@ class FamilyTreeNewsModule extends AbstractModule implements ModuleBlockInterfac $limit = $this->getBlockSetting($block_id, 'limit', 'nolimit'); } } - if ($cfg) { - foreach (array('limit', 'flag') as $name) { - if (array_key_exists($name, $cfg)) { - $$name = $cfg[$name]; - } + foreach (array('limit', 'flag') as $name) { + if (array_key_exists($name, $cfg)) { + $$name = $cfg[$name]; } } $usernews = Database::prepare( @@ -154,7 +172,11 @@ class FamilyTreeNewsModule extends AbstractModule implements ModuleBlockInterfac 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, 'limit', Filter::post('limit')); |
