1<?php 2 3use Fisharebest\Webtrees\Functions\FunctionsEdit; 4use Fisharebest\Webtrees\I18N; 5use Fisharebest\Webtrees\Individual; 6use Fisharebest\Webtrees\Module\ModuleThemeInterface; 7use Illuminate\Support\Collection; 8 9/** 10 * @var int $block_id 11 * @var bool $can_edit 12 * @var Collection $favorites 13 * @var string $module_name 14 */ 15?> 16 17<?php foreach ($favorites as $favorite) : ?> 18 <div class="person_box action_header<?= $favorite->record instanceof Individual ? $favorite->record->sex() : '' ?>"> 19 <?php if ($favorite->favorite_type === 'URL') : ?> 20 <a href="<?= e($favorite->url) ?>"><b><?= e($favorite->title) ?></b></a> 21 <?php elseif ($favorite->record instanceof Individual) : ?> 22 <?= app(ModuleThemeInterface::class)->individualBoxLarge($favorite->record) ?> 23 <?php elseif ($favorite->record !== null) : ?> 24 <?= $favorite->record->formatList() ?> 25 <?php endif ?> 26 27 <div class="wt-favorites-block-note"> 28 <?= e((string) $favorite->note) ?> 29 </div> 30 </div> 31 32 <?php if ($can_edit) : ?> 33 <form action="<?= e(route('module', ['module' => $module_name, 'action' => 'DeleteFavorite', 'ged' => $tree->name(), 'favorite_id' => $favorite->favorite_id])) ?>" method="post"> 34 <?= csrf_field() ?> 35 <button type="submit" class="btn btn-link btn-sm" data-confirm="<?= I18N::translate('Are you sure you want to remove this item from your list of favorites?') ?>" onclick="return confirm(this.dataset.confirm);"> 36 <?= I18N::translate('Remove') ?> 37 </button> 38 </form> 39 <?php endif ?> 40<?php endforeach ?> 41 42<?php if ($can_edit) : ?> 43 <button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#favorite-form-<?= e($block_id) ?>"> 44 <?= I18N::translate('Add a favorite') ?> 45 </button> 46 47 <div class="modal fade" id="favorite-form-<?= e($block_id) ?>" tabindex="-1" role="dialog" aria-labelledby="favorite-form-<?= e($block_id) ?>-label" aria-hidden="true"> 48 <div class="modal-dialog modal-xl" role="document"> 49 <div class="modal-content"> 50 <form action="<?= e(route('module', ['module' => $module_name, 'action' => 'AddFavorite', 'ged' => $tree->name()])) ?>" method="post"> 51 <?= csrf_field() ?> 52 <div class="modal-header"> 53 <h5 class="modal-title" id="favorite-form-<?= e($block_id) ?>-label"> 54 <?= I18N::translate('Add a favorite') ?> 55 </h5> 56 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 57 <span aria-hidden="true">×</span> 58 </button> 59 </div> 60 <div class="modal-body row"> 61 <div class="col-sm-4 col-md-3"> 62 <div class="form-check"> 63 <input class="form-check-input" type="radio" name="type" value="indi" id="fav-indi-<?= e($block_id) ?>" checked> 64 <label for="fav-indi-<?= e($block_id) ?>"> 65 <?= I18N::translate('Individual') ?> 66 </label> 67 </div> 68 </div> 69 <div class="col-sm-8 col-md-9"> 70 <?= FunctionsEdit::formControlIndividual($tree, null, ['id' => 'xref', 'name' => 'indi-xref']) ?> 71 </div> 72 73 <div class="col-sm-4 col-md-3"> 74 <div class="form-check"> 75 <input class="form-check-input" type="radio" name="type" value="fam" id="fav-fam-<?= e($block_id) ?>"> 76 <label for="fav-fam-<?= e($block_id) ?>"> 77 <?= I18N::translate('Family') ?> 78 </label> 79 </div> 80 </div> 81 <div class="col-sm-8 col-md-9"> 82 <?= FunctionsEdit::formControlFamily($tree, null, ['id' => 'xref', 'name' => 'fam-xref']) ?> 83 </div> 84 85 <div class="col-sm-4 col-md-3"> 86 <div class="form-check"> 87 <input class="form-check-input" type="radio" name="type" value="obje" id="fav-obje-<?= e($block_id) ?>"> 88 <label for="fav-obje-<?= e($block_id) ?>"> 89 <?= I18N::translate('Media object') ?> 90 </label> 91 </div> 92 </div> 93 <div class="col-sm-8 col-md-9"> 94 <?= FunctionsEdit::formControlMediaObject($tree, null, ['id' => 'xref', 'name' => 'obje-xref']) ?> 95 </div> 96 97 <div class="col-sm-4 col-md-3"> 98 <div class="form-check"> 99 <input class="form-check-input" type="radio" name="type" value="sour" id="fav-sour-<?= e($block_id) ?>"> 100 <label for="fav-sour-<?= e($block_id) ?>"> 101 <?= I18N::translate('Source') ?> 102 </label> 103 </div> 104 </div> 105 <div class="col-sm-8 col-md-9"> 106 <?= FunctionsEdit::formControlSource($tree, null, ['id' => 'xref', 'name' => 'sour-xref']) ?> 107 </div> 108 109 <div class="col-sm-4 col-md-3"> 110 <div class="form-check"> 111 <input class="form-check-input" type="radio" name="type" value="repo" id="fav-repo-<?= e($block_id) ?>"> 112 <label for="fav-repo-<?= e($block_id) ?>"> 113 <?= I18N::translate('Repository') ?> 114 </label> 115 </div> 116 </div> 117 <div class="col-sm-8 col-md-"> 118 <?= FunctionsEdit::formControlRepository($tree, null, ['id' => 'xref', 'name' => 'repo-xref']) ?> 119 </div> 120 121 <div class="col-sm-4 col-md-3"> 122 <div class="form-check"> 123 <input class="form-check-input" type="radio" name="type" value="url" id="fav-url-<?= e($block_id) ?>"> 124 <label for="fav-url-<?= e($block_id) ?>"> 125 <?= I18N::translate('URL') ?> 126 </label> 127 </div> 128 </div> 129 <div class="col-sm-8 col-md-"> 130 <input type="text" name="url" id="url" size="20" value="" placeholder="<?= I18N::translate('URL') ?>"> 131 <input type="text" name="title" id="title" size="20" value="" placeholder="<?= I18N::translate('Title') ?>"> 132 </div> 133 134 <div class="col-sm-4 col-md-3"> 135 <label for="fav-note-<?= e($block_id) ?>"> 136 <?= I18N::translate('Note') ?> 137 </label> 138 </div> 139 <div class="col-sm-8 col-md-"> 140 <textarea name="note" id="fav-repo-<?= e($block_id) ?>" rows="3" class="form-control" placeholder="<?= I18N::translate('Enter an optional note about this favorite') ?>"></textarea> 141 </div> 142 </div> 143 144 <div class="modal-footer"> 145 <button type="button" class="btn btn-secondary" data-dismiss="modal"> 146 <?= view('icons/cancel') ?> 147 <?= I18N::translate('cancel') ?> 148 </button> 149 <button type="submit" class="btn btn-primary"> 150 <?= view('icons/save') ?> 151 <?= I18N::translate('save') ?> 152 </button> 153 </div> 154 </form> 155 </div> 156 </div> 157 </div> 158<?php endif ?> 159