Fisharebest\Webtrees\Module\RecentChangesModule::configureBlock PHP Method

configureBlock() public method

public configureBlock ( $block_id )
    public function configureBlock($block_id)
    {
        if (Filter::postBool('save') && Filter::checkCsrf()) {
            $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
            $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
            $this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
            $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
        }
        $days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
        $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
        $show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
        $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
        $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Number of days to show');
        echo '</td><td class="optionbox">';
        echo '<input type="text" name="days" size="2" value="', $days, '">';
        echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Presentation style');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Sort order');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::selectEditControl('sortStyle', array('name' => I18N::translate('sort by name'), 'date_asc' => I18N::translate('sort by date, oldest first'), 'date_desc' => I18N::translate('sort by date, newest first')), null, $sortStyle, '');
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Show the user who made the change');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Add a scrollbar when block contents grow');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('block', $block);
        echo '</td></tr>';
        echo '<tr><td class="descriptionbox wrap width33">';
        echo I18N::translate('Should this block be hidden when it is empty');
        echo '</td><td class="optionbox">';
        echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
        echo '</td></tr>';
        echo '<tr><td colspan="2" class="optionbox wrap">';
        echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
        echo '</td></tr>';
    }