diff options
| -rw-r--r-- | app/Module/ThemeSelectModule.php | 3 | ||||
| -rw-r--r-- | app/Theme.php | 14 | ||||
| -rw-r--r-- | app/Theme/AbstractTheme.php (renamed from app/Theme/BaseTheme.php) | 7 | ||||
| -rw-r--r-- | app/Theme/AdministrationTheme.php | 96 | ||||
| -rw-r--r-- | app/Theme/CloudsTheme.php | 79 | ||||
| -rw-r--r-- | app/Theme/ColorsTheme.php | 40 | ||||
| -rw-r--r-- | app/Theme/FabTheme.php | 81 | ||||
| -rw-r--r-- | app/Theme/MinimalTheme.php | 79 | ||||
| -rw-r--r-- | app/Theme/ThemeInterface.php | 247 | ||||
| -rw-r--r-- | app/Theme/WebtreesTheme.php | 60 | ||||
| -rw-r--r-- | app/Theme/XeneaTheme.php | 66 |
11 files changed, 679 insertions, 93 deletions
diff --git a/app/Module/ThemeSelectModule.php b/app/Module/ThemeSelectModule.php index 55854f14a9..3851a971a4 100644 --- a/app/Module/ThemeSelectModule.php +++ b/app/Module/ThemeSelectModule.php @@ -17,7 +17,7 @@ namespace Fisharebest\Webtrees\Module; */ use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Theme; -use Fisharebest\Webtrees\Theme\BaseTheme; +use Fisharebest\Webtrees\Theme\AbstractTheme; /** * Class ThemeSelectModule @@ -35,7 +35,6 @@ class ThemeSelectModule extends AbstractModule implements ModuleBlockInterface { /** {@inheritdoc} */ public function getBlock($block_id, $template = true, $cfg = null) { - /** @var BaseTheme */ $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = $this->getTitle(); diff --git a/app/Theme.php b/app/Theme.php index ff6510b15b..f5fd1bf816 100644 --- a/app/Theme.php +++ b/app/Theme.php @@ -15,23 +15,23 @@ namespace Fisharebest\Webtrees; * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -use Fisharebest\Webtrees\Theme\BaseTheme; +use Fisharebest\Webtrees\Theme\ThemeInterface; /** * Class Theme - provide access to the current theme. */ class Theme { - /** @var BaseTheme The current theme*/ + /** @var ThemeInterface The current theme*/ private static $theme; - /** @var BaseTheme[] All currently installed themes */ + /** @var ThemeInterface[] All currently installed themes */ private static $installed_themes; /** * Create a list of all themes available on the system, including * any custom themes. * - * @return BaseTheme[] + * @return ThemeInterface[] */ public static function installedThemes() { if (self::$installed_themes === null) { @@ -69,13 +69,13 @@ class Theme { /** * The currently active theme * - * @param BaseTheme|null $theme + * @param ThemeInterface|null $theme * * @throws \LogicException * - * @return BaseTheme + * @return ThemeInterface */ - public static function theme(BaseTheme $theme = null) { + public static function theme(ThemeInterface $theme = null) { if ($theme) { self::$theme = $theme; diff --git a/app/Theme/BaseTheme.php b/app/Theme/AbstractTheme.php index 8ff93726b8..492182cdb4 100644 --- a/app/Theme/BaseTheme.php +++ b/app/Theme/AbstractTheme.php @@ -37,9 +37,9 @@ use Fisharebest\Webtrees\Tree; use Fisharebest\Webtrees\User; /** - * Class Base - Common functions and interfaces for all themes. + * Class AbstractTheme - Common functions and interfaces for all themes. */ -abstract class BaseTheme { +abstract class AbstractTheme { /** @var Tree The current tree */ protected $tree; @@ -64,7 +64,7 @@ abstract class BaseTheme { * * @return string */ - public function accessibilityLinks() { + protected function accessibilityLinks() { return '<div class="accessibility-links">' . '<a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">' . @@ -99,6 +99,7 @@ abstract class BaseTheme { ); } } + /** * Create the verification code for Google Webmaster Tools. * diff --git a/app/Theme/AdministrationTheme.php b/app/Theme/AdministrationTheme.php index 5eddaa8b2d..82fbd67c7b 100644 --- a/app/Theme/AdministrationTheme.php +++ b/app/Theme/AdministrationTheme.php @@ -23,8 +23,12 @@ use Fisharebest\Webtrees\Tree; /** * Class AdministrationTheme - Theme for the control panel. */ -class AdministrationTheme extends BaseTheme { - /** {@inheritdoc} */ +class AdministrationTheme extends AbstractTheme implements ThemeInterface { + /** + * A list of CSS files to include for this page. + * + * @return string[] + */ protected function stylesheets() { $stylesheets = parent::stylesheets(); $stylesheets[] = WT_DATATABLES_BOOTSTRAP_CSS_URL; @@ -34,30 +38,48 @@ class AdministrationTheme extends BaseTheme { return $stylesheets; } - /** {@inheritdoc} */ + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ public function assetUrl() { return 'themes/_administration/css-1.7.0/'; } - /** {@inheritdoc} */ + /** + * Create the contents of the <footer> tag. + * + * @return string + */ protected function footerContent() { return ''; } - /** {@inheritdoc} */ + /** + * Create the contents of the <header> tag. + * + * @return string + */ protected function headerContent() { return $this->accessibilityLinks() . $this->secondaryMenuContainer($this->secondaryMenu()); } - /** {@inheritdoc} */ + /** + * Allow themes to add extra scripts to the page footer. + * + * @return string + */ public function hookFooterExtraJavascript() { return '<script src="' . WT_BOOTSTRAP_JS_URL . '"></script>'; } /** + * Site administration functions. + * * @return Menu */ protected function menuAdminSite() { @@ -76,6 +98,8 @@ class AdministrationTheme extends BaseTheme { } /** + * Tree administration menu. + * * @return Menu */ protected function menuAdminTrees() { @@ -87,6 +111,8 @@ class AdministrationTheme extends BaseTheme { } /** + * Manage trees menu. + * * @return Menu */ protected function menuAdminTreesManage() { @@ -94,6 +120,8 @@ class AdministrationTheme extends BaseTheme { } /** + * Merge trees menu. + * * @return Menu|null */ protected function menuAdminTreesMerge() { @@ -105,6 +133,8 @@ class AdministrationTheme extends BaseTheme { } /** + * Set default blocks menu. + * * @return Menu|null */ protected function menuAdminTreesSetDefault() { @@ -116,6 +146,8 @@ class AdministrationTheme extends BaseTheme { } /** + * User administration menu. + * * @return Menu */ protected function menuAdminUsers() { @@ -129,6 +161,8 @@ class AdministrationTheme extends BaseTheme { } /** + * Media administration menu. + * * @return Menu */ protected function menuAdminMedia() { @@ -139,6 +173,8 @@ class AdministrationTheme extends BaseTheme { } /** + * Module administration menu. + * * @return Menu */ protected function menuAdminModules() { @@ -152,7 +188,11 @@ class AdministrationTheme extends BaseTheme { )); } - /** {@inheritdoc} */ + /** + * Generate a list of items for the main menu. + * + * @return Menu[] + */ protected function primaryMenu() { if (Auth::isAdmin()) { return array( @@ -169,7 +209,13 @@ class AdministrationTheme extends BaseTheme { } } - /** {@inheritdoc} */ + /** + * Add markup to the primary menu. + * + * @param Menu[] $menus + * + * @return string + */ protected function primaryMenuContainer(array $menus) { $html = ''; foreach ($menus as $menu) { @@ -195,7 +241,11 @@ class AdministrationTheme extends BaseTheme { '</nav>'; } - /** {@inheritdoc} */ + /** + * Generate a list of items for the user menu. + * + * @return Menu[] + */ protected function secondaryMenu() { return array_filter(array( $this->menuPendingChanges(), @@ -205,22 +255,42 @@ class AdministrationTheme extends BaseTheme { )); } - /** {@inheritdoc} */ + /** + * Add markup to the secondary menu. + * + * @param Menu[] $menus + * + * @return string + */ protected function secondaryMenuContainer(array $menus) { return '<div class="clearfix"><ul class="nav nav-pills small pull-right flip" role="menu">' . $this->secondaryMenuContent($menus) . '</ul></div>'; } - /** {@inheritdoc} */ + /** + * Format the secondary menu. + * + * @param Menu[] $menus + * + * @return string + */ protected function secondaryMenuContent(array $menus) { return implode('', array_map(function (Menu $menu) { return $menu->bootstrap(); }, $menus)); } - /** {@inheritdoc} */ + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ public function themeId() { return '_administration'; } - /** {@inheritdoc} */ + /** + * What is this theme called? + * + * @return string + */ public function themeName() { return 'administration'; } diff --git a/app/Theme/CloudsTheme.php b/app/Theme/CloudsTheme.php index 2b12835573..5306ca63df 100644 --- a/app/Theme/CloudsTheme.php +++ b/app/Theme/CloudsTheme.php @@ -22,24 +22,47 @@ use Fisharebest\Webtrees\Theme; /** * Class CloudsTheme - The clouds theme. */ -class CloudsTheme extends BaseTheme { - /** {@inheritdoc} */ +class CloudsTheme extends AbstractTheme implements ThemeInterface { + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ public function assetUrl() { return 'themes/clouds/css-1.7.0/'; } - /** {@inheritdoc} */ + /** + * HTML link to a "favorites icon". + * + * @return string + */ protected function favicon() { return '<link rel="icon" href="' . $this->assetUrl() . 'favicon.png" type="image/png">'; } - /** {@inheritdoc} */ + /** + * Add markup to a flash message. + * + * @param \stdClass $message + * + * @return string + */ protected function flashMessageContainer(\stdClass $message) { // This theme uses jQuery markup. return '<p class="ui-state-highlight">' . $message->text . '</p>'; } - /** {@inheritdoc} */ + /** + * Format the contents of a variable-height home-page block. + * + * @param string $id + * @param string $title + * @param string $class + * @param string $content + * + * @return string + */ public function formatBlock($id, $title, $class, $content) { return '<div id="' . $id . '" class="block" >' . @@ -50,14 +73,22 @@ class CloudsTheme extends BaseTheme { '</div>'; } - /** {@inheritdoc} */ + /** + * Create a search field and submit button for the quick search form in the header. + * + * @return string + */ protected function formQuickSearchFields() { return '<input type="search" name="query" size="15" placeholder="' . I18N::translate('Search') . '">' . '<input class="search-icon" type="image" src="' . Theme::theme()->parameter('image-search') . '" alt="' . I18N::translate('Search') . '" title="' . I18N::translate('Search') . '">'; } - /** {@inheritdoc} */ + /** + * Allow themes to add extra scripts to the page footer. + * + * @return string + */ public function hookFooterExtraJavascript() { return '<script src="' . WT_JQUERY_COLORBOX_URL . '"></script>' . @@ -75,7 +106,13 @@ class CloudsTheme extends BaseTheme { '</script>'; } - /** {@inheritdoc} */ + /** + * Misecellaneous dimensions, fonts, styles, etc. + * + * @param string $parameter_name + * + * @return string|int|float + */ public function parameter($parameter_name) { $parameters = array( 'chart-background-f' => 'e9daf1', @@ -92,7 +129,13 @@ class CloudsTheme extends BaseTheme { } } - /** {@inheritdoc} */ + /** + * Create the primary menu. + * + * @param Menu[] $menus + * + * @return string + */ protected function primaryMenuContent(array $menus) { $html = ''; @@ -111,7 +154,11 @@ class CloudsTheme extends BaseTheme { return $html; } - /** {@inheritdoc} */ + /** + * A list of CSS files to include for this page. + * + * @return string[] + */ protected function stylesheets() { return array( 'themes/clouds/jquery-ui-1.11.2/jquery-ui.css', @@ -119,12 +166,20 @@ class CloudsTheme extends BaseTheme { ); } - /** {@inheritdoc} */ + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ public function themeId() { return 'clouds'; } - /** {@inheritdoc} */ + /** + * What is this theme called? + * + * @return string + */ public function themeName() { return /* I18N: Name of a theme. */ I18N::translate('clouds'); } diff --git a/app/Theme/ColorsTheme.php b/app/Theme/ColorsTheme.php index 2d081bd537..33e905ad5d 100644 --- a/app/Theme/ColorsTheme.php +++ b/app/Theme/ColorsTheme.php @@ -25,19 +25,27 @@ use Fisharebest\Webtrees\Site; /** * Class ColorsTheme - The colors theme. */ -class ColorsTheme extends CloudsTheme { +class ColorsTheme extends CloudsTheme implements ThemeInterface { /** @var string[] A list of color palettes */ protected $palettes; /** @var string Which of the color palettes to use on this page */ protected $palette; - /** {@inheritdoc} */ + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ public function assetUrl() { return 'themes/colors/css-1.7.0/'; } - /** {@inheritdoc} */ + /** + * Add markup to the secondary menu. + * + * @return string + */ protected function formatSecondaryMenu() { return '<ul class="secondary-menu">' . @@ -48,7 +56,11 @@ class ColorsTheme extends CloudsTheme { '</ul>'; } - /** {@inheritdoc} */ + /** + * Create the contents of the <header> tag. + * + * @return string + */ protected function headerContent() { return //$this->accessibilityLinks() . @@ -58,8 +70,6 @@ class ColorsTheme extends CloudsTheme { /** * Create resources for the colors theme. - * - * {@inheritdoc} */ public function hookAfterInit() { $this->palettes = array( @@ -147,7 +157,11 @@ class ColorsTheme extends CloudsTheme { return $menu; } - /** {@inheritdoc} */ + /** + * A list of CSS files to include for this page. + * + * @return string[] + */ protected function stylesheets() { return array( 'themes/colors/jquery-ui-1.11.2/jquery-ui.css', @@ -156,12 +170,20 @@ class ColorsTheme extends CloudsTheme { ); } - /** {@inheritdoc} */ + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ public function themeId() { return 'colors'; } - /** {@inheritdoc} */ + /** + * What is this theme called? + * + * @return string + */ public function themeName() { return /* I18N: Name of a theme. */ I18N::translate('colors'); } diff --git a/app/Theme/FabTheme.php b/app/Theme/FabTheme.php index 4d747bfe8d..d3adcd66dc 100644 --- a/app/Theme/FabTheme.php +++ b/app/Theme/FabTheme.php @@ -21,24 +21,42 @@ use Fisharebest\Webtrees\Menu; /** * Class FabTheme - The F.A.B. theme. */ -class FabTheme extends BaseTheme { - /** {@inheritdoc} */ +class FabTheme extends AbstractTheme implements ThemeInterface { + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ public function assetUrl() { return 'themes/fab/css-1.7.0/'; } - /** {@inheritdoc} */ + /** + * HTML link to a "favorites icon". + * + * @return string + */ protected function favicon() { return '<link rel="icon" href="' . $this->assetUrl() . 'favicon.png" type="image/png">'; } - /** {@inheritdoc} */ + /** + * Add markup to a flash message. + * + * @param \stdClass $message + * + * @return string + */ protected function flashMessageContainer(\stdClass $message) { // This theme uses jQuery markup. return '<p class="ui-state-highlight">' . $message->text . '</p>'; } - /** {@inheritdoc} */ + /** + * Add markup to the secondary menu. + * + * @return string + */ protected function formatSecondaryMenu() { return '<ul class="secondary-menu">' . @@ -48,7 +66,12 @@ class FabTheme extends BaseTheme { '</li>' . '</ul>'; } - /** {@inheritdoc} */ + + /** + * Create the contents of the <header> tag. + * + * @return string + */ protected function headerContent() { return //$this->accessibilityLinks() . @@ -56,18 +79,32 @@ class FabTheme extends BaseTheme { $this->formatSecondaryMenu(); } - /** {@inheritdoc} */ + /** + * Add markup to an item in the secondary menu. + * + * @param Menu $menu + * + * @return string + */ protected function formatSecondaryMenuItem(Menu $menu) { return $menu->getMenuAsList(); } - /** {@inheritdoc} */ + /** + * Create a search field and submit button for the quick search form in the header. + * + * @return string + */ protected function formQuickSearchFields() { return '<input type="search" name="query" size="20" placeholder="' . I18N::translate('Search') . '">'; } - /** {@inheritdoc} */ + /** + * Allow themes to add extra scripts to the page footer. + * + * @return string + */ public function hookFooterExtraJavascript() { return '<script src="' . WT_JQUERY_COLORBOX_URL . '"></script>' . @@ -85,7 +122,13 @@ class FabTheme extends BaseTheme { '</script>'; } - /** {@inheritdoc} */ + /** + * Misecellaneous dimensions, fonts, styles, etc. + * + * @param string $parameter_name + * + * @return string|int|float + */ public function parameter($parameter_name) { $parameters = array( 'chart-background-f' => 'e9daf1', @@ -103,7 +146,11 @@ class FabTheme extends BaseTheme { } } - /** {@inheritdoc} */ + /** + * A list of CSS files to include for this page. + * + * @return string[] + */ protected function stylesheets() { return array( 'themes/fab/jquery-ui-1.11.2/jquery-ui.css', @@ -111,12 +158,20 @@ class FabTheme extends BaseTheme { ); } - /** {@inheritdoc} */ + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ public function themeId() { return 'fab'; } - /** {@inheritdoc} */ + /** + * What is this theme called? + * + * @return string + */ public function themeName() { return /* I18N: Name of a theme. */ I18N::translate('F.A.B.'); } diff --git a/app/Theme/MinimalTheme.php b/app/Theme/MinimalTheme.php index c9876a6bd6..e3bf52d863 100644 --- a/app/Theme/MinimalTheme.php +++ b/app/Theme/MinimalTheme.php @@ -20,30 +20,52 @@ use Fisharebest\Webtrees\I18N; /** * Class MinimalTheme - The Minimal theme. */ -class MinimalTheme extends BaseTheme { - /** {@inheritdoc} */ +class MinimalTheme extends AbstractTheme implements ThemeInterface { + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ public function assetUrl() { return 'themes/minimal/css-1.7.0/'; } - /** {@inheritdoc} */ + /** + * HTML link to a "favorites icon". + * + * @return string + */ protected function favicon() { return '<link rel="icon" href="' . $this->assetUrl() . 'favicon.png" type="image/png">'; } - /** {@inheritdoc} */ + /** + * Add markup to a flash message. + * + * @param \stdClass $message + * + * @return string + */ protected function flashMessageContainer(\stdClass $message) { // This theme uses jQuery markup. return '<p class="ui-state-highlight">' . $message->text . '</p>'; } - /** {@inheritdoc} */ + /** + * Create a search field and submit button for the quick search form in the header. + * + * @return string + */ protected function formQuickSearchFields() { return '<input type="search" name="query" size="20" placeholder="' . I18N::translate('Search') . '">'; } - /** {@inheritdoc} */ + /** + * Add markup to the secondary menu. + * + * @return string + */ protected function formatSecondaryMenu() { return '<ul class="secondary-menu">' . @@ -53,7 +75,12 @@ class MinimalTheme extends BaseTheme { '</li>' . '</ul>'; } - /** {@inheritdoc} */ + + /** + * Create the contents of the <header> tag. + * + * @return string + */ protected function headerContent() { return //$this->accessibilityLinks() . @@ -61,12 +88,20 @@ class MinimalTheme extends BaseTheme { $this->formatSecondaryMenu(); } - /** {@inheritdoc} */ + /** + * A small "powered by webtrees" logo for the footer. + * + * @return string + */ protected function logoPoweredBy() { return '<a href="' . WT_WEBTREES_URL . '" class="powered-by-webtrees" title="' . WT_WEBTREES_URL . '">' . WT_WEBTREES . '</a>'; } - /** {@inheritdoc} */ + /** + * Allow themes to add extra scripts to the page footer. + * + * @return string + */ public function hookFooterExtraJavascript() { return '<script src="' . WT_JQUERY_COLORBOX_URL . '"></script>' . @@ -84,7 +119,13 @@ class MinimalTheme extends BaseTheme { '</script>'; } - /** {@inheritdoc} */ + /** + * Misecellaneous dimensions, fonts, styles, etc. + * + * @param string $parameter_name + * + * @return string|int|float + */ public function parameter($parameter_name) { $parameters = array( 'chart-background-f' => 'dddddd', @@ -100,7 +141,11 @@ class MinimalTheme extends BaseTheme { } } - /** {@inheritdoc} */ + /** + * A list of CSS files to include for this page. + * + * @return string[] + */ protected function stylesheets() { return array( 'themes/minimal/jquery-ui-1.11.2/jquery-ui.css', @@ -108,12 +153,20 @@ class MinimalTheme extends BaseTheme { ); } - /** {@inheritdoc} */ + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ public function themeId() { return 'minimal'; } - /** {@inheritdoc} */ + /** + * What is this theme called? + * + * @return string + */ public function themeName() { return /* I18N: Name of a theme. */ I18N::translate('minimal'); } diff --git a/app/Theme/ThemeInterface.php b/app/Theme/ThemeInterface.php new file mode 100644 index 0000000000..eac41be6d8 --- /dev/null +++ b/app/Theme/ThemeInterface.php @@ -0,0 +1,247 @@ +<?php +namespace Fisharebest\Webtrees\Theme; + +/** + * webtrees: online genealogy + * Copyright (C) 2015 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\Controller\PageController; +use Fisharebest\Webtrees\Database; +use Fisharebest\Webtrees\Fact; +use Fisharebest\Webtrees\Filter; +use Fisharebest\Webtrees\FlashMessages; +use Fisharebest\Webtrees\Functions\Functions; +use Fisharebest\Webtrees\GedcomRecord; +use Fisharebest\Webtrees\GedcomTag; +use Fisharebest\Webtrees\HitCounter; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\Menu; +use Fisharebest\Webtrees\Module; +use Fisharebest\Webtrees\Module\FamilyTreeFavoritesModule; +use Fisharebest\Webtrees\Module\UserFavoritesModule; +use Fisharebest\Webtrees\Site; +use Fisharebest\Webtrees\Theme; +use Fisharebest\Webtrees\Tree; +use Fisharebest\Webtrees\User; + +/** + * Specification for a theme. + */ +interface ThemeInterface { + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ + public function assetUrl(); + + /** + * Create the top of the <body>. + * + * @return string + */ + public function bodyHeader(); + + /** + * Create the top of the <body> (for popup windows). + * + * @return string + */ + public function bodyHeaderPopupWindow(); + + /** + * Create a contact link for a user. + * + * @param User $user + * + * @return string + */ + public function contactLink(User $user); + + /** + * Create the <DOCTYPE> tag. + * + * @return string + */ + public function doctype(); + + /** + * Close the main content and create the <footer> tag. + * + * @return string + */ + public function footerContainer(); + + /** + * Close the main content. + * Note that popup windows are deprecated + * + * @return string + */ + public function footerContainerPopupWindow(); + + /** + * Format the contents of a variable-height home-page block. + * + * @param string $id + * @param string $title + * @param string $class + * @param string $content + * + * @return string + */ + public function formatBlock($id, $title, $class, $content); + + /** + * Create the <head> tag. + * + * @param PageController $controller The current controller + * + * @return string + */ + public function head(PageController $controller); + + /** + * Allow themes to do things after initialization (since they cannot use + * the constructor). + */ + public function hookAfterInit(); + + /** + * Allow themes to add extra scripts to the page footer. + * + * @return string + */ + public function hookFooterExtraJavascript(); + + /** + * Allow themes to add extra content to the page header. + * Typically this will be additional CSS. + * + * @return string + */ + public function hookHeaderExtraContent(); + + /** + * Create the <html> tag. + * + * @return string + */ + public function html(); + + /** + * Add HTML markup to create an alert + * + * @param string $html The content of the alert + * @param string $level One of 'success', 'info', 'warning', 'danger' + * @param bool $dismissible If true, add a close button. + * + * @return string + */ + public function htmlAlert($html, $level, $dismissible); + + /** + * Display an icon for this fact. + * + * @param Fact $fact + * + * @return string + */ + public function icon(Fact $fact); + + /** + * Display an individual in a box - for charts, etc. + * + * @param Individual $individual + * + * @return string + */ + public function individualBox(Individual $individual); + + /** + * Display an empty box - for a missing individual in a chart. + * + * @return string + */ + public function individualBoxEmpty(); + + /** + * Display an individual in a box - for charts, etc. + * + * @param Individual $individual + * + * @return string + */ + public function individualBoxLarge(Individual $individual); + + /** + * Display an individual in a box - for charts, etc. + * + * @param Individual $individual + * + * @return string + */ + public function individualBoxSmall(Individual $individual); + + /** + * Display an individual in a box - for charts, etc. + * + * @return string + */ + public function individualBoxSmallEmpty(); + + /** + * Initialise the theme. We cannot pass these in a constructor, as the construction + * happens in a theme file, and we need to be able to change it. + * + * @param Tree|null $tree The current tree (if there is one). + */ + public function init(Tree $tree = null); + + /** + * Themes menu. + * + * @return Menu|null + */ + public function menuThemes(); + + /** + * Misecellaneous dimensions, fonts, styles, etc. + * + * @param string $parameter_name + * + * @return string|int|float + */ + public function parameter($parameter_name); + + /** + * Send any HTTP headers. + */ + public function sendHeaders(); + + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ + public function themeId(); + + /** + * What is this theme called? + * + * @return string + */ + public function themeName(); +} diff --git a/app/Theme/WebtreesTheme.php b/app/Theme/WebtreesTheme.php index ef6f04f59c..807b0ded98 100644 --- a/app/Theme/WebtreesTheme.php +++ b/app/Theme/WebtreesTheme.php @@ -21,31 +21,53 @@ use Fisharebest\Webtrees\Theme; /** * Class WebtreesTheme - The webtrees (default) theme. */ -class WebtreesTheme extends BaseTheme { - /** {@inheritdoc} */ +class WebtreesTheme extends AbstractTheme implements ThemeInterface { + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ public function assetUrl() { return 'themes/webtrees/css-1.7.0/'; } - /** {@inheritdoc} */ + /** + * HTML link to a "favorites icon". + * + * @return string + */ protected function favicon() { return '<link rel="icon" href="' . $this->assetUrl() . 'favicon.png" type="image/png">'; } - /** {@inheritdoc} */ + /** + * Add markup to a flash message. + * + * @param \stdClass $message + * + * @return string + */ protected function flashMessageContainer(\stdClass $message) { // This theme uses jQuery markup. return '<p class="ui-state-highlight">' . $message->text . '</p>'; } - /** {@inheritdoc} */ + /** + * Create a search field and submit button for the quick search form in the header. + * + * @return string + */ protected function formQuickSearchFields() { return '<input type="search" name="query" size="25" placeholder="' . I18N::translate('Search') . '">' . '<input type="image" class="image" src="' . Theme::theme()->parameter('image-search') . '" alt="' . I18N::translate('Search') . '" title="' . I18N::translate('Search') . '">'; } - /** {@inheritdoc} */ + /** + * Allow themes to add extra scripts to the page footer. + * + * @return string + */ public function hookFooterExtraJavascript() { return '<script src="' . WT_JQUERY_COLORBOX_URL . '"></script>' . @@ -63,7 +85,13 @@ class WebtreesTheme extends BaseTheme { '</script>'; } - /** {@inheritdoc} */ + /** + * Misecellaneous dimensions, fonts, styles, etc. + * + * @param string $parameter_name + * + * @return string|int|float + */ public function parameter($parameter_name) { $parameters = array( 'chart-background-f' => 'e9daf1', @@ -80,7 +108,11 @@ class WebtreesTheme extends BaseTheme { } } - /** {@inheritdoc} */ + /** + * A list of CSS files to include for this page. + * + * @return string[] + */ protected function stylesheets() { return array( 'themes/webtrees/jquery-ui-1.11.2/jquery-ui.css', @@ -88,12 +120,20 @@ class WebtreesTheme extends BaseTheme { ); } - /** {@inheritdoc} */ + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ public function themeId() { return 'webtrees'; } - /** {@inheritdoc} */ + /** + * What is this theme called? + * + * @return string + */ public function themeName() { return I18N::translate('webtrees'); } diff --git a/app/Theme/XeneaTheme.php b/app/Theme/XeneaTheme.php index 050575523c..8325b429c9 100644 --- a/app/Theme/XeneaTheme.php +++ b/app/Theme/XeneaTheme.php @@ -20,31 +20,53 @@ use Fisharebest\Webtrees\I18N; /** * Class XeneaTheme - The xenea theme. */ -class XeneaTheme extends BaseTheme { - /** {@inheritdoc} */ +class XeneaTheme extends AbstractTheme implements ThemeInterface { + /** + * Where are our CSS, JS and other assets? + * + * @return string A relative path, such as "themes/foo/" + */ public function assetUrl() { return 'themes/xenea/css-1.7.0/'; } - /** {@inheritdoc} */ + /** + * HTML link to a "favorites icon". + * + * @return string + */ protected function favicon() { return '<link rel="icon" href="' . $this->assetUrl() . 'favicon.png" type="image/png">'; } - /** {@inheritdoc} */ + /** + * Add markup to a flash message. + * + * @param \stdClass $message + * + * @return string + */ protected function flashMessageContainer(\stdClass $message) { // This theme uses jQuery markup. return '<p class="ui-state-highlight">' . $message->text . '</p>'; } - /** {@inheritdoc} */ + /** + * Create a search field and submit button for the quick search form in the header. + * + * @return string + */ protected function formQuickSearchFields() { return '<input type="search" name="query" size="12" placeholder="' . I18N::translate('Search') . '">' . '<input type="submit" name="search" value=">">'; } - /** {@inheritdoc} */ + /** + * Create the contents of the <header> tag. + * + * @return string + */ protected function headerContent() { return //$this->accessibilityLinks() . @@ -57,7 +79,11 @@ class XeneaTheme extends BaseTheme { '</div>'; } - /** {@inheritdoc} */ + /** + * Allow themes to add extra scripts to the page footer. + * + * @return string + */ public function hookFooterExtraJavascript() { return '<script src="' . WT_JQUERY_COLORBOX_URL . '"></script>' . @@ -75,7 +101,13 @@ class XeneaTheme extends BaseTheme { '</script>'; } - /** {@inheritdoc} */ + /** + * Misecellaneous dimensions, fonts, styles, etc. + * + * @param string $parameter_name + * + * @return string|int|float + */ public function parameter($parameter_name) { $parameters = array( 'chart-background-f' => 'e9daf1', @@ -91,7 +123,11 @@ class XeneaTheme extends BaseTheme { } } - /** {@inheritdoc} */ + /** + * A list of CSS files to include for this page. + * + * @return string[] + */ protected function stylesheets() { return array( 'themes/xenea/jquery-ui-1.11.2/jquery-ui.css', @@ -99,12 +135,20 @@ class XeneaTheme extends BaseTheme { ); } - /** {@inheritdoc} */ + /** + * A fixed string to identify this theme, in settings, etc. + * + * @return string + */ public function themeId() { return 'xenea'; } - /** {@inheritdoc} */ + /** + * What is this theme called? + * + * @return string + */ public function themeName() { return /* I18N: Name of a theme. */ I18N::translate('xenea'); } |
