getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) { $title = ''; } else { $title = ''; } if ($num == 1) { // I18N: i.e. most popular given name. $title .= WT_I18N::translate('Top given name'); } else { // I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1 $title .= WT_I18N::plural('Top %s given name', 'Top %s given names', $num, WT_I18N::number($num)); } $content = '
'; //Select List or Table switch ($infoStyle) { case "list": // Output style 1: Simple list style. Better suited to left side of page. if ($TEXT_DIRECTION == 'ltr') { $padding = 'padding-left: 15px'; } else { $padding = 'padding-right: 15px'; } $params = array(1, $num, 'rcount'); //List Female names $totals = $stats->commonGivenFemaleTotals($params); if ($totals) { $content .= '' . WT_I18N::translate('Females') . '
' . $totals . '

'; } //List Male names $totals = $stats->commonGivenMaleTotals($params); if ($totals) { $content .= '' . WT_I18N::translate('Males') . '
' . $totals . '

'; } break; case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page $params = array(1, $num, 'rcount'); $content .= ''; $content .= '
'.$stats->commonGivenFemaleTable($params) . ' '.$stats->commonGivenMaleTable($params) . '
'; break; } $content .= "
"; if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } } /** {@inheritdoc} */ public function loadAjax() { return true; } /** {@inheritdoc} */ public function isUserBlock() { return true; } /** {@inheritdoc} */ public function isGedcomBlock() { return true; } /** {@inheritdoc} */ public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10)); set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table')); set_block_setting($block_id, 'block', WT_Filter::postBool('block')); } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $num = get_block_setting($block_id, 'num', '10'); $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); $block = get_block_setting($block_id, 'block', '0'); echo ''; echo WT_I18N::translate('Number of items to show'); echo ''; echo ''; echo ''; echo ''; echo WT_I18N::translate('Presentation style'); echo ''; echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, ''); echo ''; echo ''; echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow'); echo ''; echo edit_field_yes_no('block', $block); echo ''; } }