xref: /webtrees/app/Module/ShareUrlModule.php (revision 853f2b8ab920254b02a6cbbe9d6bf1f5c4486e2f)
1*853f2b8aSGreg Roach<?php
2*853f2b8aSGreg Roach
3*853f2b8aSGreg Roach/**
4*853f2b8aSGreg Roach * webtrees: online genealogy
5*853f2b8aSGreg Roach * Copyright (C) 2021 webtrees development team
6*853f2b8aSGreg Roach * This program is free software: you can redistribute it and/or modify
7*853f2b8aSGreg Roach * it under the terms of the GNU General Public License as published by
8*853f2b8aSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*853f2b8aSGreg Roach * (at your option) any later version.
10*853f2b8aSGreg Roach * This program is distributed in the hope that it will be useful,
11*853f2b8aSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*853f2b8aSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*853f2b8aSGreg Roach * GNU General Public License for more details.
14*853f2b8aSGreg Roach * You should have received a copy of the GNU General Public License
15*853f2b8aSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16*853f2b8aSGreg Roach */
17*853f2b8aSGreg Roach
18*853f2b8aSGreg Roachdeclare(strict_types=1);
19*853f2b8aSGreg Roach
20*853f2b8aSGreg Roachnamespace Fisharebest\Webtrees\Module;
21*853f2b8aSGreg Roach
22*853f2b8aSGreg Roachuse Aura\Router\Route;
23*853f2b8aSGreg Roachuse Aura\Router\RouterContainer;
24*853f2b8aSGreg Roachuse Fig\Http\Message\StatusCodeInterface;
25*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Auth;
26*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Exceptions\HttpNotFoundException;
27*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Registry;
28*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Family;
29*853f2b8aSGreg Roachuse Fisharebest\Webtrees\FlashMessages;
30*853f2b8aSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
31*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Html;
32*853f2b8aSGreg Roachuse Fisharebest\Webtrees\I18N;
33*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Individual;
34*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Media;
35*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Note;
36*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Repository;
37*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Services\TreeService;
38*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Source;
39*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Submitter;
40*853f2b8aSGreg Roachuse Fisharebest\Webtrees\Tree;
41*853f2b8aSGreg Roachuse Illuminate\Database\Capsule\Manager as DB;
42*853f2b8aSGreg Roachuse Illuminate\Database\Query\Expression;
43*853f2b8aSGreg Roachuse Illuminate\Support\Collection;
44*853f2b8aSGreg Roachuse Psr\Http\Message\ResponseInterface;
45*853f2b8aSGreg Roachuse Psr\Http\Message\ServerRequestInterface;
46*853f2b8aSGreg Roachuse Psr\Http\Server\RequestHandlerInterface;
47*853f2b8aSGreg Roach
48*853f2b8aSGreg Roachuse function app;
49*853f2b8aSGreg Roachuse function assert;
50*853f2b8aSGreg Roachuse function date;
51*853f2b8aSGreg Roachuse function redirect;
52*853f2b8aSGreg Roachuse function response;
53*853f2b8aSGreg Roachuse function route;
54*853f2b8aSGreg Roachuse function view;
55*853f2b8aSGreg Roach
56*853f2b8aSGreg Roach/**
57*853f2b8aSGreg Roach * Class ShareUrlModule
58*853f2b8aSGreg Roach */
59*853f2b8aSGreg Roachclass ShareUrlModule extends AbstractModule implements ModuleShareInterface
60*853f2b8aSGreg Roach{
61*853f2b8aSGreg Roach    use ModuleShareTrait;
62*853f2b8aSGreg Roach
63*853f2b8aSGreg Roach    /**
64*853f2b8aSGreg Roach     * How should this module be identified in the control panel, etc.?
65*853f2b8aSGreg Roach     *
66*853f2b8aSGreg Roach     * @return string
67*853f2b8aSGreg Roach     */
68*853f2b8aSGreg Roach    public function title(): string
69*853f2b8aSGreg Roach    {
70*853f2b8aSGreg Roach        return I18N::translate('Share the URL');
71*853f2b8aSGreg Roach    }
72*853f2b8aSGreg Roach
73*853f2b8aSGreg Roach    /**
74*853f2b8aSGreg Roach     * A sentence describing what this module does.
75*853f2b8aSGreg Roach     *
76*853f2b8aSGreg Roach     * @return string
77*853f2b8aSGreg Roach     */
78*853f2b8aSGreg Roach    public function description(): string
79*853f2b8aSGreg Roach    {
80*853f2b8aSGreg Roach        return I18N::translate('Copy the URL of the record to the clipboard');
81*853f2b8aSGreg Roach    }
82*853f2b8aSGreg Roach
83*853f2b8aSGreg Roach    /**
84*853f2b8aSGreg Roach     * HTML to include in the share links page.
85*853f2b8aSGreg Roach     *
86*853f2b8aSGreg Roach     * @param GedcomRecord $record
87*853f2b8aSGreg Roach     *
88*853f2b8aSGreg Roach     * @return string
89*853f2b8aSGreg Roach     */
90*853f2b8aSGreg Roach    public function share(GedcomRecord $record): string
91*853f2b8aSGreg Roach    {
92*853f2b8aSGreg Roach        return view('modules/share-url/share', ['record' => $record]);
93*853f2b8aSGreg Roach    }
94*853f2b8aSGreg Roach}
95