18c2e8227SGreg Roach<?php 28c2e8227SGreg Roach/** 38c2e8227SGreg Roach * webtrees: online genealogy 4369c0ce6SGreg Roach * Copyright (C) 2016 webtrees development team 58c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 68c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 78c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 88c2e8227SGreg Roach * (at your option) any later version. 98c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 108c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 118c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 128c2e8227SGreg Roach * GNU General Public License for more details. 138c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 148c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 158c2e8227SGreg Roach */ 1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 1776692c8bSGreg Roach 180e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth; 190e62c4b8SGreg Roachuse Fisharebest\Webtrees\Database; 200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Filter; 213d7a8a4cSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsEdit; 223d7a8a4cSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint; 230e62c4b8SGreg Roachuse Fisharebest\Webtrees\GedcomTag; 240e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 250e62c4b8SGreg Roachuse Fisharebest\Webtrees\Media; 260e62c4b8SGreg Roachuse Fisharebest\Webtrees\Theme; 278c2e8227SGreg Roach 288c2e8227SGreg Roach/** 298c2e8227SGreg Roach * Class SlideShowModule 308c2e8227SGreg Roach */ 31e2a378d3SGreg Roachclass SlideShowModule extends AbstractModule implements ModuleBlockInterface { 328c2e8227SGreg Roach /** {@inheritdoc} */ 338c2e8227SGreg Roach public function getTitle() { 348c2e8227SGreg Roach return /* I18N: Name of a module */ I18N::translate('Slide show'); 358c2e8227SGreg Roach } 368c2e8227SGreg Roach 378c2e8227SGreg Roach /** {@inheritdoc} */ 388c2e8227SGreg Roach public function getDescription() { 398c2e8227SGreg Roach return /* I18N: Description of the “Slide show” module */ I18N::translate('Random images from the current family tree.'); 408c2e8227SGreg Roach } 418c2e8227SGreg Roach 4276692c8bSGreg Roach /** 4376692c8bSGreg Roach * Generate the HTML content of this block. 4476692c8bSGreg Roach * 4576692c8bSGreg Roach * @param int $block_id 4676692c8bSGreg Roach * @param bool $template 47727f238cSGreg Roach * @param string[] $cfg 4876692c8bSGreg Roach * 4976692c8bSGreg Roach * @return string 5076692c8bSGreg Roach */ 5113abd6f3SGreg Roach public function getBlock($block_id, $template = true, $cfg = []) { 524b9ff166SGreg Roach global $ctype, $WT_TREE; 538c2e8227SGreg Roach 54e2a378d3SGreg Roach $filter = $this->getBlockSetting($block_id, 'filter', 'all'); 55e2a378d3SGreg Roach $controls = $this->getBlockSetting($block_id, 'controls', '1'); 56e2a378d3SGreg Roach $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); 578c2e8227SGreg Roach 588c2e8227SGreg Roach // We can apply the filters using SQL 598c2e8227SGreg Roach // Do not use "ORDER BY RAND()" - it is very slow on large tables. Use PHP::array_rand() instead. 608c2e8227SGreg Roach $all_media = Database::prepare( 618c2e8227SGreg Roach "SELECT m_id FROM `##media`" . 628c2e8227SGreg Roach " WHERE m_file = ?" . 638c2e8227SGreg Roach " AND m_ext IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" . 648c2e8227SGreg Roach " AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" 6513abd6f3SGreg Roach )->execute([ 6624ec66ceSGreg Roach $WT_TREE->getTreeId(), 67e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null, 68e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null, 69e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null, 70e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null, 71e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null, 72e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null, 73e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null, 74e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null, 75e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null, 76e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null, 77e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null, 78e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null, 79e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null, 80e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null, 81e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null, 82e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null, 83e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null, 84e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null, 85e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null, 86e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null, 87e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null, 88e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null, 89e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null, 90e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null, 91e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null, 92e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null, 93e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null, 94e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null, 95e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null, 96e2a378d3SGreg Roach $this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null, 9713abd6f3SGreg Roach ])->fetchOneColumn(); 988c2e8227SGreg Roach 998c2e8227SGreg Roach // Keep looking through the media until a suitable one is found. 1008c2e8227SGreg Roach $random_media = null; 1018c2e8227SGreg Roach while ($all_media) { 1028c2e8227SGreg Roach $n = array_rand($all_media); 10324ec66ceSGreg Roach $media = Media::getInstance($all_media[$n], $WT_TREE); 1048c2e8227SGreg Roach if ($media->canShow() && !$media->isExternal()) { 1058c2e8227SGreg Roach // Check if it is linked to a suitable individual 1068c2e8227SGreg Roach foreach ($media->linkedIndividuals('OBJE') as $indi) { 1078c2e8227SGreg Roach if ( 1088c2e8227SGreg Roach $filter === 'all' || 1098c2e8227SGreg Roach $filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false || 1108c2e8227SGreg Roach $filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false 1118c2e8227SGreg Roach ) { 1128c2e8227SGreg Roach // Found one :-) 1138c2e8227SGreg Roach $random_media = $media; 1148c2e8227SGreg Roach break 2; 1158c2e8227SGreg Roach } 1168c2e8227SGreg Roach } 1178c2e8227SGreg Roach } 1188c2e8227SGreg Roach unset($all_media[$n]); 119*3c12f3e5SGreg Roach } 1208c2e8227SGreg Roach 1218c2e8227SGreg Roach $id = $this->getName() . $block_id; 1228c2e8227SGreg Roach $class = $this->getName() . '_block'; 1234b9ff166SGreg Roach if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { 1246d1c8039SGreg Roach $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; 1258c2e8227SGreg Roach } else { 1268c2e8227SGreg Roach $title = ''; 1278c2e8227SGreg Roach } 1288c2e8227SGreg Roach $title .= $this->getTitle(); 1298c2e8227SGreg Roach 1308c2e8227SGreg Roach if ($random_media) { 1318c2e8227SGreg Roach $content = "<div id=\"random_picture_container$block_id\">"; 1328c2e8227SGreg Roach if ($controls) { 1338c2e8227SGreg Roach if ($start) { 1348c2e8227SGreg Roach $icon_class = 'icon-media-stop'; 1358c2e8227SGreg Roach } else { 1368c2e8227SGreg Roach $icon_class = 'icon-media-play'; 1378c2e8227SGreg Roach } 1388c2e8227SGreg Roach $content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>'; 1398c2e8227SGreg Roach $content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . I18N::translate('Play') . "/" . I18N::translate('Stop') . '"></a>'; 1408c2e8227SGreg Roach $content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '\');return false;" title="' . I18N::translate('Next image') . '" class="icon-media-next"></a>'; 1418c2e8227SGreg Roach $content .= '</div><script> 1428c2e8227SGreg Roach var play = false; 1438c2e8227SGreg Roach function togglePlay() { 1448c2e8227SGreg Roach if (play) { 1458c2e8227SGreg Roach play = false; 1468c2e8227SGreg Roach jQuery("#play_stop").removeClass("icon-media-stop").addClass("icon-media-play"); 1478c2e8227SGreg Roach } 1488c2e8227SGreg Roach else { 1498c2e8227SGreg Roach play = true; 1508c2e8227SGreg Roach playSlideShow(); 1518c2e8227SGreg Roach jQuery("#play_stop").removeClass("icon-media-play").addClass("icon-media-stop"); 1528c2e8227SGreg Roach } 1538c2e8227SGreg Roach } 1548c2e8227SGreg Roach 1558c2e8227SGreg Roach function playSlideShow() { 1568c2e8227SGreg Roach if (play) { 1578c2e8227SGreg Roach window.setTimeout("reload_image()", 6000); 1588c2e8227SGreg Roach } 1598c2e8227SGreg Roach } 1608c2e8227SGreg Roach function reload_image() { 1618c2e8227SGreg Roach if (play) { 1628c2e8227SGreg Roach jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1"); 1638c2e8227SGreg Roach } 1648c2e8227SGreg Roach } 1658c2e8227SGreg Roach </script>'; 1668c2e8227SGreg Roach } 1678c2e8227SGreg Roach if ($start) { 1688c2e8227SGreg Roach $content .= '<script>togglePlay();</script>'; 1698c2e8227SGreg Roach } 1708c2e8227SGreg Roach $content .= '<div class="center" id="random_picture_content' . $block_id . '">'; 1718c2e8227SGreg Roach $content .= '<table id="random_picture_box"><tr><td class="details1">'; 1728c2e8227SGreg Roach $content .= $random_media->displayImage(); 1738c2e8227SGreg Roach 1748c2e8227SGreg Roach $content .= '<br>'; 1758c2e8227SGreg Roach $content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>'; 1768c2e8227SGreg Roach foreach ($random_media->linkedIndividuals('OBJE') as $individual) { 177a759c7d4SGreg Roach $content .= '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View this individual') . ' — ' . $individual->getFullName() . '</a><br>'; 1788c2e8227SGreg Roach } 1798c2e8227SGreg Roach foreach ($random_media->linkedFamilies('OBJE') as $family) { 180a759c7d4SGreg Roach $content .= '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View this family') . ' — ' . $family->getFullName() . '</a><br>'; 1818c2e8227SGreg Roach } 1828c2e8227SGreg Roach foreach ($random_media->linkedSources('OBJE') as $source) { 183a759c7d4SGreg Roach $content .= '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View this source') . ' — ' . $source->getFullName() . '</a><br>'; 1848c2e8227SGreg Roach } 1858c2e8227SGreg Roach $content .= '<br><div class="indent">'; 1863d7a8a4cSGreg Roach $content .= FunctionsPrint::printFactNotes($random_media->getGedcom(), "1", false); 1878c2e8227SGreg Roach $content .= '</div>'; 1888c2e8227SGreg Roach $content .= '</td></tr></table>'; 1898c2e8227SGreg Roach $content .= '</div>'; // random_picture_content 1908c2e8227SGreg Roach $content .= '</div>'; // random_picture_container 1918c2e8227SGreg Roach } else { 1928c2e8227SGreg Roach $content = I18N::translate('This family tree has no images to display.'); 1938c2e8227SGreg Roach } 1948c2e8227SGreg Roach if ($template) { 1954f8ecee1SGreg Roach return Theme::theme()->formatBlock($id, $title, $class, $content); 1968c2e8227SGreg Roach } else { 1978c2e8227SGreg Roach return $content; 1988c2e8227SGreg Roach } 1998c2e8227SGreg Roach } 2008c2e8227SGreg Roach 2018c2e8227SGreg Roach /** {@inheritdoc} */ 2028c2e8227SGreg Roach public function loadAjax() { 2038c2e8227SGreg Roach return true; 2048c2e8227SGreg Roach } 2058c2e8227SGreg Roach 2068c2e8227SGreg Roach /** {@inheritdoc} */ 2078c2e8227SGreg Roach public function isUserBlock() { 2088c2e8227SGreg Roach return true; 2098c2e8227SGreg Roach } 2108c2e8227SGreg Roach 2118c2e8227SGreg Roach /** {@inheritdoc} */ 2128c2e8227SGreg Roach public function isGedcomBlock() { 2138c2e8227SGreg Roach return true; 2148c2e8227SGreg Roach } 2158c2e8227SGreg Roach 21676692c8bSGreg Roach /** 21776692c8bSGreg Roach * An HTML form to edit block settings 21876692c8bSGreg Roach * 21976692c8bSGreg Roach * @param int $block_id 22076692c8bSGreg Roach */ 2218c2e8227SGreg Roach public function configureBlock($block_id) { 2228c2e8227SGreg Roach if (Filter::postBool('save') && Filter::checkCsrf()) { 223e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all')); 224e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'controls', Filter::postBool('controls')); 225e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'start', Filter::postBool('start')); 226e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi')); 227e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp')); 228e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif')); 229e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg')); 230e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3')); 231e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole')); 232e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx')); 233e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf')); 234e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png')); 235e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff')); 236e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav')); 237e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio')); 238e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book')); 239e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card')); 240e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate')); 241e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat')); 242e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document')); 243e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic')); 244e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche')); 245e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film')); 246e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine')); 247e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript')); 248e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map')); 249e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper')); 250e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other')); 251e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting')); 252e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo')); 253e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone')); 254e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video')); 2558c2e8227SGreg Roach } 2568c2e8227SGreg Roach 257e2a378d3SGreg Roach $filter = $this->getBlockSetting($block_id, 'filter', 'all'); 258e2a378d3SGreg Roach $controls = $this->getBlockSetting($block_id, 'controls', '1'); 259e2a378d3SGreg Roach $start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start'); 2608c2e8227SGreg Roach 2618c2e8227SGreg Roach echo '<tr><td class="descriptionbox wrap width33">'; 262a4d5a9c2SGreg Roach echo /* I18N: Label for a configuration option */ I18N::translate('Show only individuals, events, or all'); 2638c2e8227SGreg Roach echo '</td><td class="optionbox">'; 26413abd6f3SGreg Roach echo FunctionsEdit::selectEditControl('filter', ['indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')], null, $filter, ''); 2658c2e8227SGreg Roach echo '</td></tr>'; 2668c2e8227SGreg Roach 26713abd6f3SGreg Roach $filters = [ 268e2a378d3SGreg Roach 'avi' => $this->getBlockSetting($block_id, 'filter_avi', '0'), 269e2a378d3SGreg Roach 'bmp' => $this->getBlockSetting($block_id, 'filter_bmp', '1'), 270e2a378d3SGreg Roach 'gif' => $this->getBlockSetting($block_id, 'filter_gif', '1'), 271e2a378d3SGreg Roach 'jpeg' => $this->getBlockSetting($block_id, 'filter_jpeg', '1'), 272e2a378d3SGreg Roach 'mp3' => $this->getBlockSetting($block_id, 'filter_mp3', '0'), 273e2a378d3SGreg Roach 'ole' => $this->getBlockSetting($block_id, 'filter_ole', '1'), 274e2a378d3SGreg Roach 'pcx' => $this->getBlockSetting($block_id, 'filter_pcx', '1'), 275e2a378d3SGreg Roach 'pdf' => $this->getBlockSetting($block_id, 'filter_pdf', '0'), 276e2a378d3SGreg Roach 'png' => $this->getBlockSetting($block_id, 'filter_png', '1'), 277e2a378d3SGreg Roach 'tiff' => $this->getBlockSetting($block_id, 'filter_tiff', '1'), 278e2a378d3SGreg Roach 'wav' => $this->getBlockSetting($block_id, 'filter_wav', '0'), 279e2a378d3SGreg Roach 'audio' => $this->getBlockSetting($block_id, 'filter_audio', '0'), 280e2a378d3SGreg Roach 'book' => $this->getBlockSetting($block_id, 'filter_book', '1'), 281e2a378d3SGreg Roach 'card' => $this->getBlockSetting($block_id, 'filter_card', '1'), 282e2a378d3SGreg Roach 'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'), 283e2a378d3SGreg Roach 'coat' => $this->getBlockSetting($block_id, 'filter_coat', '1'), 284e2a378d3SGreg Roach 'document' => $this->getBlockSetting($block_id, 'filter_document', '1'), 285e2a378d3SGreg Roach 'electronic' => $this->getBlockSetting($block_id, 'filter_electronic', '1'), 286e2a378d3SGreg Roach 'fiche' => $this->getBlockSetting($block_id, 'filter_fiche', '1'), 287e2a378d3SGreg Roach 'film' => $this->getBlockSetting($block_id, 'filter_film', '1'), 288e2a378d3SGreg Roach 'magazine' => $this->getBlockSetting($block_id, 'filter_magazine', '1'), 289e2a378d3SGreg Roach 'manuscript' => $this->getBlockSetting($block_id, 'filter_manuscript', '1'), 290e2a378d3SGreg Roach 'map' => $this->getBlockSetting($block_id, 'filter_map', '1'), 291e2a378d3SGreg Roach 'newspaper' => $this->getBlockSetting($block_id, 'filter_newspaper', '1'), 292e2a378d3SGreg Roach 'other' => $this->getBlockSetting($block_id, 'filter_other', '1'), 293e2a378d3SGreg Roach 'painting' => $this->getBlockSetting($block_id, 'filter_painting', '1'), 294e2a378d3SGreg Roach 'photo' => $this->getBlockSetting($block_id, 'filter_photo', '1'), 295e2a378d3SGreg Roach 'tombstone' => $this->getBlockSetting($block_id, 'filter_tombstone', '1'), 296e2a378d3SGreg Roach 'video' => $this->getBlockSetting($block_id, 'filter_video', '0'), 29713abd6f3SGreg Roach ]; 2988c2e8227SGreg Roach 2998c2e8227SGreg Roach ?> 30091e873d9SGreg Roach <tr> 30191e873d9SGreg Roach <td class="descriptionbox wrap width33"> 30291e873d9SGreg Roach <?php echo I18N::translate('Filter'); ?> 3038c2e8227SGreg Roach </td> 3048c2e8227SGreg Roach <td class="optionbox"> 305764a01d9SGreg Roach <center><b><?php echo GedcomTag::getLabel('FORM'); ?></b></center> 3068c2e8227SGreg Roach <table class="width100"> 3078c2e8227SGreg Roach <tr> 3088c2e8227SGreg Roach <td class="width33"> 3098c2e8227SGreg Roach <label> 3108c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_avi" <?php echo $filters['avi'] ? 'checked' : ''; ?>> 3118c2e8227SGreg Roach avi 3128c2e8227SGreg Roach </td> 3138c2e8227SGreg Roach <td class="width33"> 3148c2e8227SGreg Roach <label> 3158c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_bmp" <?php echo $filters['bmp'] ? 'checked' : ''; ?>> 3168c2e8227SGreg Roach bmp 3178c2e8227SGreg Roach </label> 3188c2e8227SGreg Roach </td> 3198c2e8227SGreg Roach <td class="width33"> 3208c2e8227SGreg Roach <label> 3218c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_gif" <?php echo $filters['gif'] ? 'checked' : ''; ?>> 3228c2e8227SGreg Roach gif 3238c2e8227SGreg Roach </label> 3248c2e8227SGreg Roach </td> 3258c2e8227SGreg Roach </tr> 3268c2e8227SGreg Roach <tr> 3278c2e8227SGreg Roach <td class="width33"> 3288c2e8227SGreg Roach <label> 3298c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_jpeg" <?php echo $filters['jpeg'] ? 'checked' : ''; ?>> 3308c2e8227SGreg Roach jpeg 3318c2e8227SGreg Roach </label> 3328c2e8227SGreg Roach </td> 3338c2e8227SGreg Roach <td class="width33"> 3348c2e8227SGreg Roach <label> 3358c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_mp3" <?php echo $filters['mp3'] ? 'checked' : ''; ?>> 3368c2e8227SGreg Roach mp3 3378c2e8227SGreg Roach </label> 3388c2e8227SGreg Roach </td> 3398c2e8227SGreg Roach <td class="width33"> 3408c2e8227SGreg Roach <label> 3418c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_ole" <?php echo $filters['ole'] ? 'checked' : ''; ?>> 3428c2e8227SGreg Roach ole 3438c2e8227SGreg Roach </label> 3448c2e8227SGreg Roach </td> 3458c2e8227SGreg Roach </tr> 3468c2e8227SGreg Roach <tr> 3478c2e8227SGreg Roach <td class="width33"> 3488c2e8227SGreg Roach <label> 3498c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_pcx" <?php echo $filters['pcx'] ? 'checked' : ''; ?>> 3508c2e8227SGreg Roach pcx 3518c2e8227SGreg Roach </label> 3528c2e8227SGreg Roach </td> 3538c2e8227SGreg Roach <td class="width33"> 3548c2e8227SGreg Roach <label> 3558c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_pdf" <?php echo $filters['pdf'] ? 'checked' : ''; ?>> 3568c2e8227SGreg Roach pdf 3578c2e8227SGreg Roach </label> 3588c2e8227SGreg Roach </td> 3598c2e8227SGreg Roach <td class="width33"> 3608c2e8227SGreg Roach <label> 3618c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_png" <?php echo $filters['png'] ? 'checked' : ''; ?>> 3628c2e8227SGreg Roach png 3638c2e8227SGreg Roach </label> 3648c2e8227SGreg Roach </td> 3658c2e8227SGreg Roach </tr> 3668c2e8227SGreg Roach <tr> 3678c2e8227SGreg Roach <td class="width33"> 3688c2e8227SGreg Roach <label> 3698c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_tiff" <?php echo $filters['tiff'] ? 'checked' : ''; ?>> 3708c2e8227SGreg Roach tiff 3718c2e8227SGreg Roach </label> 3728c2e8227SGreg Roach </td> 3738c2e8227SGreg Roach <td class="width33"> 3748c2e8227SGreg Roach <label> 3758c2e8227SGreg Roach <input type="checkbox" value="yes" name="filter_wav" <?php echo $filters['wav'] ? 'checked' : ''; ?>> 3768c2e8227SGreg Roach wav 3778c2e8227SGreg Roach </label> 3788c2e8227SGreg Roach </td> 3798c2e8227SGreg Roach <td class="width33"></td> 3808c2e8227SGreg Roach <td class="width33"></td> 3818c2e8227SGreg Roach </tr> 3828c2e8227SGreg Roach </table> 3838c2e8227SGreg Roach <br> 384764a01d9SGreg Roach <center><b><?php echo GedcomTag::getLabel('TYPE'); ?></b></center> 3858c2e8227SGreg Roach <table class="width100"> 3868c2e8227SGreg Roach <tr> 3878c2e8227SGreg Roach <?php 3888c2e8227SGreg Roach //-- Build the list of checkboxes 3898c2e8227SGreg Roach $i = 0; 390764a01d9SGreg Roach foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) { 3918c2e8227SGreg Roach $i++; 3928c2e8227SGreg Roach if ($i > 3) { 3938c2e8227SGreg Roach $i = 1; 3948c2e8227SGreg Roach echo '</tr><tr>'; 3958c2e8227SGreg Roach } 3968c2e8227SGreg Roach echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" '; 397ffd703eaSGreg Roach echo $filters[$typeName] ? 'checked' : ''; 3988c2e8227SGreg Roach echo '> ' . $typeValue . '</label></td>'; 3998c2e8227SGreg Roach } 4008c2e8227SGreg Roach ?> 4018c2e8227SGreg Roach </tr> 4028c2e8227SGreg Roach </table> 4038c2e8227SGreg Roach </td> 4048c2e8227SGreg Roach </tr> 4058c2e8227SGreg Roach 4068c2e8227SGreg Roach <?php 4078c2e8227SGreg Roach 4088c2e8227SGreg Roach echo '<tr><td class="descriptionbox wrap width33">'; 409a4d5a9c2SGreg Roach echo /* I18N: Label for a configuration option */ I18N::translate('Show slide show controls'); 4108c2e8227SGreg Roach echo '</td><td class="optionbox">'; 4113d7a8a4cSGreg Roach echo FunctionsEdit::editFieldYesNo('controls', $controls); 4128c2e8227SGreg Roach echo '</td></tr>'; 4138c2e8227SGreg Roach 4148c2e8227SGreg Roach echo '<tr><td class="descriptionbox wrap width33">'; 415a4d5a9c2SGreg Roach echo /* I18N: Label for a configuration option */ I18N::translate('Start slide show on page load'); 4168c2e8227SGreg Roach echo '</td><td class="optionbox">'; 4173d7a8a4cSGreg Roach echo FunctionsEdit::editFieldYesNo('start', $start); 4188c2e8227SGreg Roach echo '</td></tr>'; 4198c2e8227SGreg Roach } 4208c2e8227SGreg Roach} 421