18c2e8227SGreg Roach<?php 2*0e62c4b8SGreg Roachnamespace Fisharebest\Webtrees\Module; 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 */ 18*0e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth; 19*0e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 20*0e62c4b8SGreg Roachuse Fisharebest\Webtrees\Theme; 218c2e8227SGreg Roach 228c2e8227SGreg Roach/** 238c2e8227SGreg Roach * Class UserWelcomeModule 248c2e8227SGreg Roach */ 25e2a378d3SGreg Roachclass UserWelcomeModule extends AbstractModule implements ModuleBlockInterface { 268c2e8227SGreg Roach /** {@inheritdoc} */ 278c2e8227SGreg Roach public function getTitle() { 288c2e8227SGreg Roach return /* I18N: Name of a module */ I18N::translate('My page'); 298c2e8227SGreg Roach } 308c2e8227SGreg Roach 318c2e8227SGreg Roach /** {@inheritdoc} */ 328c2e8227SGreg Roach public function getDescription() { 338c2e8227SGreg Roach return /* I18N: Description of the “My page” module */ I18N::translate('A greeting message and useful links for a user.'); 348c2e8227SGreg Roach } 358c2e8227SGreg Roach 368c2e8227SGreg Roach /** {@inheritdoc} */ 378c2e8227SGreg Roach public function getBlock($block_id, $template = true, $cfg = null) { 384b9ff166SGreg Roach global $WT_TREE; 394b9ff166SGreg Roach 408c2e8227SGreg Roach $id = $this->getName() . $block_id; 418c2e8227SGreg Roach $class = $this->getName() . '_block'; 42524c0fabSGreg Roach $title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>'; 438c2e8227SGreg Roach $content = '<table><tr>'; 448c2e8227SGreg Roach $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>'; 458c2e8227SGreg Roach 464b9ff166SGreg Roach $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid'); 474b9ff166SGreg Roach if ($gedcomid) { 484b9ff166SGreg Roach $content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>'; 494b9ff166SGreg Roach $content .= '<td><a href="individual.php?pid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>'; 508c2e8227SGreg Roach } 518c2e8227SGreg Roach $content .= '</tr></table>'; 528c2e8227SGreg Roach 538c2e8227SGreg Roach if ($template) { 548c2e8227SGreg Roach return Theme::theme()->formatBlock($id, $title, $class, $content); 558c2e8227SGreg Roach } else { 568c2e8227SGreg Roach return $content; 578c2e8227SGreg Roach } 588c2e8227SGreg Roach } 598c2e8227SGreg Roach 608c2e8227SGreg Roach /** {@inheritdoc} */ 618c2e8227SGreg Roach public function loadAjax() { 628c2e8227SGreg Roach return false; 638c2e8227SGreg Roach } 648c2e8227SGreg Roach 658c2e8227SGreg Roach /** {@inheritdoc} */ 668c2e8227SGreg Roach public function isUserBlock() { 678c2e8227SGreg Roach return true; 688c2e8227SGreg Roach } 698c2e8227SGreg Roach 708c2e8227SGreg Roach /** {@inheritdoc} */ 718c2e8227SGreg Roach public function isGedcomBlock() { 728c2e8227SGreg Roach return false; 738c2e8227SGreg Roach } 748c2e8227SGreg Roach 758c2e8227SGreg Roach /** {@inheritdoc} */ 768c2e8227SGreg Roach public function configureBlock($block_id) { 778c2e8227SGreg Roach } 788c2e8227SGreg Roach} 79