1<?php 2namespace Fisharebest\Webtrees; 3 4/** 5 * webtrees: online genealogy 6 * Copyright (C) 2015 webtrees development team 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19/** 20 * Class WelcomeBlockModule 21 */ 22class WelcomeBlockModule extends Module implements ModuleBlockInterface { 23 /** {@inheritdoc} */ 24 public function getTitle() { 25 return /* I18N: Name of a module */ I18N::translate('Home page'); 26 } 27 28 /** {@inheritdoc} */ 29 public function getDescription() { 30 return /* I18N: Description of the “Home page” module */ I18N::translate('A greeting message for site visitors.'); 31 } 32 33 /** {@inheritdoc} */ 34 public function getBlock($block_id, $template = true, $cfg = null) { 35 global $controller, $WT_TREE; 36 37 $indi_xref = $controller->getSignificantIndividual()->getXref(); 38 $id = $this->getName() . $block_id; 39 $class = $this->getName() . '_block'; 40 $title = '<span dir="auto">' . $WT_TREE->getTitleHtml() . '</span>'; 41 $content = '<table><tr>'; 42 $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>'; 43 $content .= '<td><a href="individual.php?pid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('Default individual') . '</a></td>'; 44 if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) { 45 $content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . I18N::translate('Request new user account') . '</a></td>'; 46 } 47 $content .= "</tr>"; 48 $content .= "</table>"; 49 50 if ($template) { 51 return Theme::theme()->formatBlock($id, $title, $class, $content); 52 } else { 53 return $content; 54 } 55 } 56 57 /** {@inheritdoc} */ 58 public function loadAjax() { 59 return false; 60 } 61 62 /** {@inheritdoc} */ 63 public function isUserBlock() { 64 return false; 65 } 66 67 /** {@inheritdoc} */ 68 public function isGedcomBlock() { 69 return true; 70 } 71 72 /** {@inheritdoc} */ 73 public function configureBlock($block_id) { 74 } 75} 76