diff options
Diffstat (limited to 'app/Module/ChartsBlockModule.php')
| -rwxr-xr-x | app/Module/ChartsBlockModule.php | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/app/Module/ChartsBlockModule.php b/app/Module/ChartsBlockModule.php index a375f2a0a3..864bb067c3 100755 --- a/app/Module/ChartsBlockModule.php +++ b/app/Module/ChartsBlockModule.php @@ -19,13 +19,13 @@ use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Bootstrap4; use Fisharebest\Webtrees\Controller\HourglassController; use Fisharebest\Webtrees\Filter; -use Fisharebest\Webtrees\FontAwesome; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Functions\FunctionsPrint; +use Fisharebest\Webtrees\Html; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Module\InteractiveTree\TreeView; -use Fisharebest\Webtrees\Theme; +use Fisharebest\Webtrees\View; /** * Class ChartsBlockModule @@ -72,19 +72,13 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { $person = Individual::getInstance($pid, $WT_TREE); } - $id = $this->getName() . $block_id; - $class = $this->getName() . '_block'; - if ($ctype == 'gedcom' && Auth::isManager($WT_TREE) || $ctype == 'user' && Auth::check()) { - $title = FontAwesome::linkIcon('preferences', I18N::translate('Preferences'), ['class' => 'btn btn-link', 'href' => 'block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype]) . ' '; - } else { - $title = ''; - } + $title = $this->getTitle(); if ($person) { $content = ''; switch ($type) { case 'pedigree': - $title .= I18N::translate('Pedigree of %s', $person->getFullName()); + $title = I18N::translate('Pedigree of %s', $person->getFullName()); $chartController = new HourglassController($person->getXref()); $controller->addInlineJavascript($chartController->setupJavascript()); $content .= '<table cellspacing="0" cellpadding="0" border="0"><tr>'; @@ -101,7 +95,7 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { $content .= '</tr></table>'; break; case 'descendants': - $title .= I18N::translate('Descendants of %s', $person->getFullName()); + $title = I18N::translate('Descendants of %s', $person->getFullName()); $chartController = new HourglassController($person->getXref()); $controller->addInlineJavascript($chartController->setupJavascript()); ob_start(); @@ -109,7 +103,7 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { $content .= ob_get_clean(); break; case 'hourglass': - $title .= I18N::translate('Hourglass chart of %s', $person->getFullName()); + $title = I18N::translate('Hourglass chart of %s', $person->getFullName()); $chartController = new HourglassController($person->getXref()); $controller->addInlineJavascript($chartController->setupJavascript()); $content .= '<table cellspacing="0" cellpadding="0" border="0"><tr>'; @@ -126,7 +120,7 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { $content .= '</tr></table>'; break; case 'treenav': - $title .= I18N::translate('Interactive tree of %s', $person->getFullName()); + $title = I18N::translate('Interactive tree of %s', $person->getFullName()); $mod = new InteractiveTreeModule(WT_MODULES_DIR . 'tree'); $tv = new TreeView; $content .= '<script>$("head").append(\'<link rel="stylesheet" href="' . $mod->css() . '" type="text/css" />\');</script>'; @@ -140,7 +134,19 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface { } if ($template) { - return Theme::theme()->formatBlock($id, $title, $class, $content); + if ($ctype == 'gedcom' && Auth::isManager($WT_TREE) || $ctype == 'user' && Auth::check()) { + $config_url = Html::url('block_edit.php', ['block_id' => $block_id, 'ged' => $WT_TREE->getName()]); + } else { + $config_url = ''; + } + + return View::make('blocks/template', [ + 'block' => str_replace('_', '-', $this->getName()), + 'id' => $block_id, + 'config_url' => $config_url, + 'title' => $title, + 'content' => $content, + ]); } else { return $content; } |
