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