149a243cbSGreg Roach<?php 249a243cbSGreg Roach/** 349a243cbSGreg Roach * webtrees: online genealogy 449a243cbSGreg Roach * Copyright (C) 2019 webtrees development team 549a243cbSGreg Roach * This program is free software: you can redistribute it and/or modify 649a243cbSGreg Roach * it under the terms of the GNU General Public License as published by 749a243cbSGreg Roach * the Free Software Foundation, either version 3 of the License, or 849a243cbSGreg Roach * (at your option) any later version. 949a243cbSGreg Roach * This program is distributed in the hope that it will be useful, 1049a243cbSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1149a243cbSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1249a243cbSGreg Roach * GNU General Public License for more details. 1349a243cbSGreg Roach * You should have received a copy of the GNU General Public License 1449a243cbSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 1549a243cbSGreg Roach */ 1649a243cbSGreg Roachdeclare(strict_types=1); 1749a243cbSGreg Roach 1849a243cbSGreg Roachnamespace Fisharebest\Webtrees\Module; 1949a243cbSGreg Roach 20*3caaa4d2SGreg Roachuse Fisharebest\Webtrees\Auth; 21*3caaa4d2SGreg Roachuse Fisharebest\Webtrees\Tree; 22*3caaa4d2SGreg Roachuse Psr\Http\Message\ServerRequestInterface; 23*3caaa4d2SGreg Roachuse function route; 24*3caaa4d2SGreg Roach 2549a243cbSGreg Roach/** 2649a243cbSGreg Roach * Trait ModuleBlockTrait - default implementation of ModuleBlockInterface 2749a243cbSGreg Roach */ 2849a243cbSGreg Roachtrait ModuleBlockTrait 2949a243cbSGreg Roach{ 30*3caaa4d2SGreg Roach /** 31*3caaa4d2SGreg Roach * @param Tree $tree 32*3caaa4d2SGreg Roach * @param string $context 33*3caaa4d2SGreg Roach * @param int $block_id 34*3caaa4d2SGreg Roach * 35*3caaa4d2SGreg Roach * @return string 36*3caaa4d2SGreg Roach */ 37*3caaa4d2SGreg Roach protected function configUrl(Tree $tree, string $context, int $block_id): string { 38*3caaa4d2SGreg Roach if ($context === self::CONTEXT_TREE_PAGE && Auth::isManager($tree)) { 39*3caaa4d2SGreg Roach return route('tree-page-block-edit', [ 40*3caaa4d2SGreg Roach 'block_id' => $block_id, 41*3caaa4d2SGreg Roach 'ged' => $tree->name(), 42*3caaa4d2SGreg Roach ]); 43*3caaa4d2SGreg Roach } 44*3caaa4d2SGreg Roach 45*3caaa4d2SGreg Roach if ($context === self::CONTEXT_USER_PAGE && Auth::check()) { 46*3caaa4d2SGreg Roach return route('user-page-block-edit', [ 47*3caaa4d2SGreg Roach 'block_id' => $block_id, 48*3caaa4d2SGreg Roach 'ged' => $tree->name(), 49*3caaa4d2SGreg Roach ]); 50*3caaa4d2SGreg Roach } 51*3caaa4d2SGreg Roach 52*3caaa4d2SGreg Roach return ''; 53*3caaa4d2SGreg Roach } 54*3caaa4d2SGreg Roach 55*3caaa4d2SGreg Roach /** 56*3caaa4d2SGreg Roach * Update the configuration for a block. 57*3caaa4d2SGreg Roach * 58*3caaa4d2SGreg Roach * @param ServerRequestInterface $request 59*3caaa4d2SGreg Roach * @param int $block_id 60*3caaa4d2SGreg Roach * 61*3caaa4d2SGreg Roach * @return void 62*3caaa4d2SGreg Roach */ 63*3caaa4d2SGreg Roach public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void 64*3caaa4d2SGreg Roach { 65*3caaa4d2SGreg Roach } 66*3caaa4d2SGreg Roach 67*3caaa4d2SGreg Roach /** 68*3caaa4d2SGreg Roach * An HTML form to edit block settings 69*3caaa4d2SGreg Roach * 70*3caaa4d2SGreg Roach * @param Tree $tree 71*3caaa4d2SGreg Roach * @param int $block_id 72*3caaa4d2SGreg Roach * 73*3caaa4d2SGreg Roach * @return string 74*3caaa4d2SGreg Roach */ 75*3caaa4d2SGreg Roach public function editBlockConfiguration(Tree $tree, int $block_id): string 76*3caaa4d2SGreg Roach { 77*3caaa4d2SGreg Roach return ''; 78*3caaa4d2SGreg Roach } 7949a243cbSGreg Roach} 80