149a243cbSGreg Roach<?php 23976b470SGreg Roach 349a243cbSGreg Roach/** 449a243cbSGreg Roach * webtrees: online genealogy 549a243cbSGreg Roach * Copyright (C) 2019 webtrees development team 649a243cbSGreg Roach * This program is free software: you can redistribute it and/or modify 749a243cbSGreg Roach * it under the terms of the GNU General Public License as published by 849a243cbSGreg Roach * the Free Software Foundation, either version 3 of the License, or 949a243cbSGreg Roach * (at your option) any later version. 1049a243cbSGreg Roach * This program is distributed in the hope that it will be useful, 1149a243cbSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1249a243cbSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1349a243cbSGreg Roach * GNU General Public License for more details. 1449a243cbSGreg Roach * You should have received a copy of the GNU General Public License 1549a243cbSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 1649a243cbSGreg Roach */ 1749a243cbSGreg Roachdeclare(strict_types=1); 1849a243cbSGreg Roach 1949a243cbSGreg Roachnamespace Fisharebest\Webtrees\Module; 2049a243cbSGreg Roach 213caaa4d2SGreg Roachuse Fisharebest\Webtrees\Auth; 223caaa4d2SGreg Roachuse Fisharebest\Webtrees\Tree; 233caaa4d2SGreg Roachuse Psr\Http\Message\ServerRequestInterface; 243976b470SGreg Roach 253caaa4d2SGreg Roachuse function route; 263caaa4d2SGreg Roach 2749a243cbSGreg Roach/** 2849a243cbSGreg Roach * Trait ModuleBlockTrait - default implementation of ModuleBlockInterface 2949a243cbSGreg Roach */ 3049a243cbSGreg Roachtrait ModuleBlockTrait 3149a243cbSGreg Roach{ 323caaa4d2SGreg Roach /** 333caaa4d2SGreg Roach * @param Tree $tree 343caaa4d2SGreg Roach * @param string $context 353caaa4d2SGreg Roach * @param int $block_id 363caaa4d2SGreg Roach * 373caaa4d2SGreg Roach * @return string 383caaa4d2SGreg Roach */ 398b02deb4SGreg Roach protected function configUrl(Tree $tree, string $context, int $block_id): string 408b02deb4SGreg Roach { 413caaa4d2SGreg Roach if ($context === self::CONTEXT_TREE_PAGE && Auth::isManager($tree)) { 423caaa4d2SGreg Roach return route('tree-page-block-edit', [ 433caaa4d2SGreg Roach 'block_id' => $block_id, 44*d72b284aSGreg Roach 'tree' => $tree->name(), 453caaa4d2SGreg Roach ]); 463caaa4d2SGreg Roach } 473caaa4d2SGreg Roach 483caaa4d2SGreg Roach if ($context === self::CONTEXT_USER_PAGE && Auth::check()) { 493caaa4d2SGreg Roach return route('user-page-block-edit', [ 503caaa4d2SGreg Roach 'block_id' => $block_id, 513caaa4d2SGreg Roach 'ged' => $tree->name(), 523caaa4d2SGreg Roach ]); 533caaa4d2SGreg Roach } 543caaa4d2SGreg Roach 553caaa4d2SGreg Roach return ''; 563caaa4d2SGreg Roach } 573caaa4d2SGreg Roach 583caaa4d2SGreg Roach /** 593caaa4d2SGreg Roach * Update the configuration for a block. 603caaa4d2SGreg Roach * 613caaa4d2SGreg Roach * @param ServerRequestInterface $request 623caaa4d2SGreg Roach * @param int $block_id 633caaa4d2SGreg Roach * 643caaa4d2SGreg Roach * @return void 653caaa4d2SGreg Roach */ 663caaa4d2SGreg Roach public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void 673caaa4d2SGreg Roach { 683caaa4d2SGreg Roach } 693caaa4d2SGreg Roach 703caaa4d2SGreg Roach /** 713caaa4d2SGreg Roach * An HTML form to edit block settings 723caaa4d2SGreg Roach * 733caaa4d2SGreg Roach * @param Tree $tree 743caaa4d2SGreg Roach * @param int $block_id 753caaa4d2SGreg Roach * 763caaa4d2SGreg Roach * @return string 773caaa4d2SGreg Roach */ 783caaa4d2SGreg Roach public function editBlockConfiguration(Tree $tree, int $block_id): string 793caaa4d2SGreg Roach { 803caaa4d2SGreg Roach return ''; 813caaa4d2SGreg Roach } 8249a243cbSGreg Roach} 83