xref: /webtrees/app/Module/WelcomeBlockModule.php (revision 4b9ff166b3342695f2a94855b7a33368e6d55c35)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roachnamespace Fisharebest\Webtrees;
38c2e8227SGreg Roach
48c2e8227SGreg Roach/**
58c2e8227SGreg Roach * webtrees: online genealogy
68c2e8227SGreg Roach * Copyright (C) 2015 webtrees development team
78c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
88c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
98c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
108c2e8227SGreg Roach * (at your option) any later version.
118c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
128c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
138c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148c2e8227SGreg Roach * GNU General Public License for more details.
158c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
168c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
178c2e8227SGreg Roach */
188c2e8227SGreg Roach
198c2e8227SGreg Roach/**
208c2e8227SGreg Roach * Class WelcomeBlockModule
218c2e8227SGreg Roach */
228c2e8227SGreg Roachclass WelcomeBlockModule extends Module implements ModuleBlockInterface {
238c2e8227SGreg Roach	/** {@inheritdoc} */
248c2e8227SGreg Roach	public function getTitle() {
258c2e8227SGreg Roach		return /* I18N: Name of a module */ I18N::translate('Home page');
268c2e8227SGreg Roach	}
278c2e8227SGreg Roach
288c2e8227SGreg Roach	/** {@inheritdoc} */
298c2e8227SGreg Roach	public function getDescription() {
308c2e8227SGreg Roach		return /* I18N: Description of the “Home page” module */ I18N::translate('A greeting message for site visitors.');
318c2e8227SGreg Roach	}
328c2e8227SGreg Roach
338c2e8227SGreg Roach	/** {@inheritdoc} */
348c2e8227SGreg Roach	public function getBlock($block_id, $template = true, $cfg = null) {
35*4b9ff166SGreg Roach		global $controller, $WT_TREE;
368c2e8227SGreg Roach
378c2e8227SGreg Roach		$indi_xref = $controller->getSignificantIndividual()->getXref();
388c2e8227SGreg Roach		$id = $this->getName() . $block_id;
398c2e8227SGreg Roach		$class = $this->getName() . '_block';
40*4b9ff166SGreg Roach		$title = '<span dir="auto">' . $WT_TREE->getTitleHtml() . '</span>';
418c2e8227SGreg Roach		$content = '<table><tr>';
42*4b9ff166SGreg Roach		$content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>';
43*4b9ff166SGreg Roach		$content .= '<td><a href="individual.php?pid=' . $indi_xref . '&amp;ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('Default individual') . '</a></td>';
448c2e8227SGreg Roach		if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) {
458c2e8227SGreg Roach			$content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . I18N::translate('Request new user account') . '</a></td>';
468c2e8227SGreg Roach		}
478c2e8227SGreg Roach		$content .= "</tr>";
488c2e8227SGreg Roach		$content .= "</table>";
498c2e8227SGreg Roach
508c2e8227SGreg Roach		if ($template) {
518c2e8227SGreg Roach			return Theme::theme()->formatBlock($id, $title, $class, $content);
528c2e8227SGreg Roach		} else {
538c2e8227SGreg Roach			return $content;
548c2e8227SGreg Roach		}
558c2e8227SGreg Roach	}
568c2e8227SGreg Roach
578c2e8227SGreg Roach	/** {@inheritdoc} */
588c2e8227SGreg Roach	public function loadAjax() {
598c2e8227SGreg Roach		return false;
608c2e8227SGreg Roach	}
618c2e8227SGreg Roach
628c2e8227SGreg Roach	/** {@inheritdoc} */
638c2e8227SGreg Roach	public function isUserBlock() {
648c2e8227SGreg Roach		return false;
658c2e8227SGreg Roach	}
668c2e8227SGreg Roach
678c2e8227SGreg Roach	/** {@inheritdoc} */
688c2e8227SGreg Roach	public function isGedcomBlock() {
698c2e8227SGreg Roach		return true;
708c2e8227SGreg Roach	}
718c2e8227SGreg Roach
728c2e8227SGreg Roach	/** {@inheritdoc} */
738c2e8227SGreg Roach	public function configureBlock($block_id) {
748c2e8227SGreg Roach	}
758c2e8227SGreg Roach}
76