.
*/
/**
* Class StoriesModule
*/
class StoriesModule extends Module implements ModuleTabInterface, ModuleConfigInterface, ModuleMenuInterface {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ I18N::translate('Stories');
}
/** {@inheritdoc} */
public function getDescription() {
return /* I18N: Description of the “Stories” module */ I18N::translate('Add narrative stories to individuals in the family tree.');
}
/** {@inheritdoc} */
public function modAction($mod_action) {
switch ($mod_action) {
case 'admin_edit':
$this->edit();
break;
case 'admin_delete':
$this->delete();
$this->config();
break;
case 'admin_config':
$this->config();
break;
case 'show_list':
$this->showList();
break;
default:
http_response_code(404);
}
}
/** {@inheritdoc} */
public function getConfigLink() {
return 'module.php?mod=' . $this->getName() . '&mod_action=admin_config';
}
/** {@inheritdoc} */
public function defaultTabOrder() {
return 55;
}
/** {@inheritdoc} */
public function getTabContent() {
global $controller, $WT_TREE;
$block_ids =
Database::prepare(
"SELECT block_id" .
" FROM `##block`" .
" WHERE module_name=?" .
" AND xref=?" .
" AND gedcom_id=?"
)->execute(array(
$this->getName(),
$controller->record->getXref(),
$controller->record->getTree()->getTreeId()
))->fetchOneColumn();
$html = '';
foreach ($block_ids as $block_id) {
// Only show this block for certain languages
$languages = get_block_setting($block_id, 'languages');
if (!$languages || in_array(WT_LOCALE, explode(',', $languages))) {
$html .= '