xref: /webtrees/app/Module/OccupationReportModule.php (revision 571e6fcac743cc9b048486db27eb10ae509eb172)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2018 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16namespace Fisharebest\Webtrees\Module;
17
18use Fisharebest\Webtrees\Auth;
19use Fisharebest\Webtrees\I18N;
20use Fisharebest\Webtrees\Menu;
21use Fisharebest\Webtrees\Tree;
22
23/**
24 * Class OccupationReportModule
25 */
26class OccupationReportModule extends AbstractModule implements ModuleReportInterface {
27	/** {@inheritdoc} */
28	public function getTitle() {
29		// This text also appears in the .XML file - update both together
30		return /* I18N: Name of a report */ I18N::translate('Occupations');
31	}
32
33	/** {@inheritdoc} */
34	public function getDescription() {
35		// This text also appears in the .XML file - update both together
36		return /* I18N: Description of the “Occupations” module */ I18N::translate('A report of individuals who had a given occupation.');
37	}
38
39	/**
40	 * What is the default access level for this module?
41	 *
42	 * Some modules are aimed at admins or managers, and are not generally shown to users.
43	 *
44	 * @return int
45	 */
46	public function defaultAccessLevel() {
47		return Auth::PRIV_USER;
48	}
49
50	/**
51	 * Return a menu item for this report.
52	 *
53	 * @param Tree $tree
54	 *
55	 * @return Menu
56	 */
57	public function getReportMenu(Tree $tree): Menu {
58		return new Menu(
59			$this->getTitle(),
60			e(route('report-setup', ['ged' => $tree->getName(), 'report' => $this->getName()])),
61			'menu-report-' . $this->getName(),
62			['rel' => 'nofollow']
63		);
64	}
65}
66