xref: /webtrees/app/Module/SlideShowModule.php (revision 3d7a8a4ca809135634f38216b734b15acff479f7)
18c2e8227SGreg Roach<?php
20e62c4b8SGreg Roachnamespace Fisharebest\Webtrees\Module;
38c2e8227SGreg Roach
48c2e8227SGreg Roach/**
58c2e8227SGreg Roach * webtrees: online genealogy
68c2e8227SGreg Roach * Copyright (C) 2015 webtrees development team
78c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
88c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
98c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
108c2e8227SGreg Roach * (at your option) any later version.
118c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
128c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
138c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148c2e8227SGreg Roach * GNU General Public License for more details.
158c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
168c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
178c2e8227SGreg Roach */
180e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth;
190e62c4b8SGreg Roachuse Fisharebest\Webtrees\Database;
200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Filter;
21*3d7a8a4cSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsEdit;
22*3d7a8a4cSGreg 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
428c2e8227SGreg Roach	/** {@inheritdoc} */
438c2e8227SGreg Roach	public function getBlock($block_id, $template = true, $cfg = null) {
444b9ff166SGreg Roach		global $ctype, $WT_TREE;
458c2e8227SGreg Roach
46e2a378d3SGreg Roach		$filter   = $this->getBlockSetting($block_id, 'filter', 'all');
47e2a378d3SGreg Roach		$controls = $this->getBlockSetting($block_id, 'controls', '1');
48e2a378d3SGreg Roach		$start    = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
498c2e8227SGreg Roach
508c2e8227SGreg Roach		// We can apply the filters using SQL
518c2e8227SGreg Roach		// Do not use "ORDER BY RAND()" - it is very slow on large tables.  Use PHP::array_rand() instead.
528c2e8227SGreg Roach		$all_media = Database::prepare(
538c2e8227SGreg Roach			"SELECT m_id FROM `##media`" .
548c2e8227SGreg Roach			" WHERE m_file = ?" .
558c2e8227SGreg Roach			" AND m_ext  IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" .
568c2e8227SGreg Roach			" AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')"
578c2e8227SGreg Roach		)->execute(array(
5824ec66ceSGreg Roach			$WT_TREE->getTreeId(),
59e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null,
60e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null,
61e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null,
62e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null,
63e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null,
64e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null,
65e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null,
66e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null,
67e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null,
68e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null,
69e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null,
70e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null,
71e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null,
72e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null,
73e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null,
74e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null,
75e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null,
76e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null,
77e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null,
78e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null,
79e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null,
80e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null,
81e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null,
82e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null,
83e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null,
84e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null,
85e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null,
86e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null,
87e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null,
88e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null,
898c2e8227SGreg Roach		))->fetchOneColumn();
908c2e8227SGreg Roach
918c2e8227SGreg Roach		// Keep looking through the media until a suitable one is found.
928c2e8227SGreg Roach		$random_media = null;
938c2e8227SGreg Roach		while ($all_media) {
948c2e8227SGreg Roach			$n     = array_rand($all_media);
9524ec66ceSGreg Roach			$media = Media::getInstance($all_media[$n], $WT_TREE);
968c2e8227SGreg Roach			if ($media->canShow() && !$media->isExternal()) {
978c2e8227SGreg Roach				// Check if it is linked to a suitable individual
988c2e8227SGreg Roach				foreach ($media->linkedIndividuals('OBJE') as $indi) {
998c2e8227SGreg Roach					if (
1008c2e8227SGreg Roach						$filter === 'all' ||
1018c2e8227SGreg Roach						$filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false ||
1028c2e8227SGreg Roach						$filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false
1038c2e8227SGreg Roach					) {
1048c2e8227SGreg Roach						// Found one :-)
1058c2e8227SGreg Roach						$random_media = $media;
1068c2e8227SGreg Roach						break 2;
1078c2e8227SGreg Roach					}
1088c2e8227SGreg Roach				}
1098c2e8227SGreg Roach			}
1108c2e8227SGreg Roach			unset($all_media[$n]);
1118c2e8227SGreg Roach		};
1128c2e8227SGreg Roach
1138c2e8227SGreg Roach		$id    = $this->getName() . $block_id;
1148c2e8227SGreg Roach		$class = $this->getName() . '_block';
1154b9ff166SGreg Roach		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
1169353052eSGreg Roach			$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
1178c2e8227SGreg Roach		} else {
1188c2e8227SGreg Roach			$title = '';
1198c2e8227SGreg Roach		}
1208c2e8227SGreg Roach		$title .= $this->getTitle();
1218c2e8227SGreg Roach
1228c2e8227SGreg Roach		if ($random_media) {
1238c2e8227SGreg Roach			$content = "<div id=\"random_picture_container$block_id\">";
1248c2e8227SGreg Roach			if ($controls) {
1258c2e8227SGreg Roach				if ($start) {
1268c2e8227SGreg Roach					$icon_class = 'icon-media-stop';
1278c2e8227SGreg Roach				} else {
1288c2e8227SGreg Roach					$icon_class = 'icon-media-play';
1298c2e8227SGreg Roach				}
1308c2e8227SGreg Roach				$content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>';
1318c2e8227SGreg Roach				$content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . I18N::translate('Play') . "/" . I18N::translate('Stop') . '"></a>';
1328c2e8227SGreg Roach				$content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&amp;action=ajax&amp;block_id=' . $block_id . '\');return false;" title="' . I18N::translate('Next image') . '" class="icon-media-next"></a>';
1338c2e8227SGreg Roach				$content .= '</div><script>
1348c2e8227SGreg Roach					var play = false;
1358c2e8227SGreg Roach						function togglePlay() {
1368c2e8227SGreg Roach							if (play) {
1378c2e8227SGreg Roach								play = false;
1388c2e8227SGreg Roach								jQuery("#play_stop").removeClass("icon-media-stop").addClass("icon-media-play");
1398c2e8227SGreg Roach							}
1408c2e8227SGreg Roach							else {
1418c2e8227SGreg Roach								play = true;
1428c2e8227SGreg Roach								playSlideShow();
1438c2e8227SGreg Roach								jQuery("#play_stop").removeClass("icon-media-play").addClass("icon-media-stop");
1448c2e8227SGreg Roach							}
1458c2e8227SGreg Roach						}
1468c2e8227SGreg Roach
1478c2e8227SGreg Roach						function playSlideShow() {
1488c2e8227SGreg Roach							if (play) {
1498c2e8227SGreg Roach								window.setTimeout("reload_image()", 6000);
1508c2e8227SGreg Roach							}
1518c2e8227SGreg Roach						}
1528c2e8227SGreg Roach						function reload_image() {
1538c2e8227SGreg Roach							if (play) {
1548c2e8227SGreg Roach								jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1");
1558c2e8227SGreg Roach							}
1568c2e8227SGreg Roach						}
1578c2e8227SGreg Roach					</script>';
1588c2e8227SGreg Roach			}
1598c2e8227SGreg Roach			if ($start) {
1608c2e8227SGreg Roach				$content .= '<script>togglePlay();</script>';
1618c2e8227SGreg Roach			}
1628c2e8227SGreg Roach			$content .= '<div class="center" id="random_picture_content' . $block_id . '">';
1638c2e8227SGreg Roach			$content .= '<table id="random_picture_box"><tr><td class="details1">';
1648c2e8227SGreg Roach			$content .= $random_media->displayImage();
1658c2e8227SGreg Roach
1668c2e8227SGreg Roach			$content .= '<br>';
1678c2e8227SGreg Roach			$content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>';
1688c2e8227SGreg Roach			foreach ($random_media->linkedIndividuals('OBJE') as $individual) {
1698c2e8227SGreg Roach				$content .= '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View individual') . ' — ' . $individual->getFullname() . '</a><br>';
1708c2e8227SGreg Roach			}
1718c2e8227SGreg Roach			foreach ($random_media->linkedFamilies('OBJE') as $family) {
1728c2e8227SGreg Roach				$content .= '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View family') . ' — ' . $family->getFullname() . '</a><br>';
1738c2e8227SGreg Roach			}
1748c2e8227SGreg Roach			foreach ($random_media->linkedSources('OBJE') as $source) {
1758c2e8227SGreg Roach				$content .= '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View source') . ' — ' . $source->getFullname() . '</a><br>';
1768c2e8227SGreg Roach			}
1778c2e8227SGreg Roach			$content .= '<br><div class="indent">';
178*3d7a8a4cSGreg Roach			$content .= FunctionsPrint::printFactNotes($random_media->getGedcom(), "1", false);
1798c2e8227SGreg Roach			$content .= '</div>';
1808c2e8227SGreg Roach			$content .= '</td></tr></table>';
1818c2e8227SGreg Roach			$content .= '</div>'; // random_picture_content
1828c2e8227SGreg Roach			$content .= '</div>'; // random_picture_container
1838c2e8227SGreg Roach		} else {
1848c2e8227SGreg Roach			$content = I18N::translate('This family tree has no images to display.');
1858c2e8227SGreg Roach		}
1868c2e8227SGreg Roach		if ($template) {
1874f8ecee1SGreg Roach			return Theme::theme()->formatBlock($id, $title, $class, $content);
1888c2e8227SGreg Roach		} else {
1898c2e8227SGreg Roach			return $content;
1908c2e8227SGreg Roach		}
1918c2e8227SGreg Roach	}
1928c2e8227SGreg Roach
1938c2e8227SGreg Roach	/** {@inheritdoc} */
1948c2e8227SGreg Roach	public function loadAjax() {
1958c2e8227SGreg Roach		return true;
1968c2e8227SGreg Roach	}
1978c2e8227SGreg Roach
1988c2e8227SGreg Roach	/** {@inheritdoc} */
1998c2e8227SGreg Roach	public function isUserBlock() {
2008c2e8227SGreg Roach		return true;
2018c2e8227SGreg Roach	}
2028c2e8227SGreg Roach
2038c2e8227SGreg Roach	/** {@inheritdoc} */
2048c2e8227SGreg Roach	public function isGedcomBlock() {
2058c2e8227SGreg Roach		return true;
2068c2e8227SGreg Roach	}
2078c2e8227SGreg Roach
2088c2e8227SGreg Roach	/** {@inheritdoc} */
2098c2e8227SGreg Roach	public function configureBlock($block_id) {
2108c2e8227SGreg Roach		if (Filter::postBool('save') && Filter::checkCsrf()) {
211e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all'));
212e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'controls', Filter::postBool('controls'));
213e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'start', Filter::postBool('start'));
214e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi'));
215e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp'));
216e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif'));
217e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg'));
218e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3'));
219e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole'));
220e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx'));
221e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf'));
222e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png'));
223e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff'));
224e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav'));
225e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio'));
226e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book'));
227e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card'));
228e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate'));
229e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat'));
230e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document'));
231e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic'));
232e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche'));
233e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film'));
234e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine'));
235e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript'));
236e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map'));
237e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper'));
238e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other'));
239e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting'));
240e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo'));
241e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone'));
242e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video'));
2438c2e8227SGreg Roach		}
2448c2e8227SGreg Roach
245e2a378d3SGreg Roach		$filter   = $this->getBlockSetting($block_id, 'filter', 'all');
246e2a378d3SGreg Roach		$controls = $this->getBlockSetting($block_id, 'controls', '1');
247e2a378d3SGreg Roach		$start    = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
2488c2e8227SGreg Roach
2498c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
2508c2e8227SGreg Roach		echo I18N::translate('Show only individuals, events, or all?');
2518c2e8227SGreg Roach		echo '</td><td class="optionbox">';
252*3d7a8a4cSGreg Roach		echo FunctionsEdit::selectEditControl('filter', array('indi' => I18N::translate('Individuals'), 'event' => I18N::translate('Facts and events'), 'all' => I18N::translate('All')), null, $filter, '');
2538c2e8227SGreg Roach		echo '</td></tr>';
2548c2e8227SGreg Roach
2558c2e8227SGreg Roach		$filters = array(
256e2a378d3SGreg Roach			'avi'         => $this->getBlockSetting($block_id, 'filter_avi', '0'),
257e2a378d3SGreg Roach			'bmp'         => $this->getBlockSetting($block_id, 'filter_bmp', '1'),
258e2a378d3SGreg Roach			'gif'         => $this->getBlockSetting($block_id, 'filter_gif', '1'),
259e2a378d3SGreg Roach			'jpeg'        => $this->getBlockSetting($block_id, 'filter_jpeg', '1'),
260e2a378d3SGreg Roach			'mp3'         => $this->getBlockSetting($block_id, 'filter_mp3', '0'),
261e2a378d3SGreg Roach			'ole'         => $this->getBlockSetting($block_id, 'filter_ole', '1'),
262e2a378d3SGreg Roach			'pcx'         => $this->getBlockSetting($block_id, 'filter_pcx', '1'),
263e2a378d3SGreg Roach			'pdf'         => $this->getBlockSetting($block_id, 'filter_pdf', '0'),
264e2a378d3SGreg Roach			'png'         => $this->getBlockSetting($block_id, 'filter_png', '1'),
265e2a378d3SGreg Roach			'tiff'        => $this->getBlockSetting($block_id, 'filter_tiff', '1'),
266e2a378d3SGreg Roach			'wav'         => $this->getBlockSetting($block_id, 'filter_wav', '0'),
267e2a378d3SGreg Roach			'audio'       => $this->getBlockSetting($block_id, 'filter_audio', '0'),
268e2a378d3SGreg Roach			'book'        => $this->getBlockSetting($block_id, 'filter_book', '1'),
269e2a378d3SGreg Roach			'card'        => $this->getBlockSetting($block_id, 'filter_card', '1'),
270e2a378d3SGreg Roach			'certificate' => $this->getBlockSetting($block_id, 'filter_certificate', '1'),
271e2a378d3SGreg Roach			'coat'        => $this->getBlockSetting($block_id, 'filter_coat', '1'),
272e2a378d3SGreg Roach			'document'    => $this->getBlockSetting($block_id, 'filter_document', '1'),
273e2a378d3SGreg Roach			'electronic'  => $this->getBlockSetting($block_id, 'filter_electronic', '1'),
274e2a378d3SGreg Roach			'fiche'       => $this->getBlockSetting($block_id, 'filter_fiche', '1'),
275e2a378d3SGreg Roach			'film'        => $this->getBlockSetting($block_id, 'filter_film', '1'),
276e2a378d3SGreg Roach			'magazine'    => $this->getBlockSetting($block_id, 'filter_magazine', '1'),
277e2a378d3SGreg Roach			'manuscript'  => $this->getBlockSetting($block_id, 'filter_manuscript', '1'),
278e2a378d3SGreg Roach			'map'         => $this->getBlockSetting($block_id, 'filter_map', '1'),
279e2a378d3SGreg Roach			'newspaper'   => $this->getBlockSetting($block_id, 'filter_newspaper', '1'),
280e2a378d3SGreg Roach			'other'       => $this->getBlockSetting($block_id, 'filter_other', '1'),
281e2a378d3SGreg Roach			'painting'    => $this->getBlockSetting($block_id, 'filter_painting', '1'),
282e2a378d3SGreg Roach			'photo'       => $this->getBlockSetting($block_id, 'filter_photo', '1'),
283e2a378d3SGreg Roach			'tombstone'   => $this->getBlockSetting($block_id, 'filter_tombstone', '1'),
284e2a378d3SGreg Roach			'video'       => $this->getBlockSetting($block_id, 'filter_video', '0'),
2858c2e8227SGreg Roach		);
2868c2e8227SGreg Roach
2878c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
2888c2e8227SGreg Roach		echo I18N::translate('Filter');
2898c2e8227SGreg Roach		?>
2908c2e8227SGreg Roach	</td>
2918c2e8227SGreg Roach	<td class="optionbox">
292764a01d9SGreg Roach		<center><b><?php echo GedcomTag::getLabel('FORM'); ?></b></center>
2938c2e8227SGreg Roach		<table class="width100">
2948c2e8227SGreg Roach			<tr>
2958c2e8227SGreg Roach				<td class="width33">
2968c2e8227SGreg Roach					<label>
2978c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_avi" <?php echo $filters['avi'] ? 'checked' : ''; ?>>
2988c2e8227SGreg Roach						avi
2998c2e8227SGreg Roach				</td>
3008c2e8227SGreg Roach				<td class="width33">
3018c2e8227SGreg Roach					<label>
3028c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_bmp" <?php echo $filters['bmp'] ? 'checked' : ''; ?>>
3038c2e8227SGreg Roach						bmp
3048c2e8227SGreg Roach					</label>
3058c2e8227SGreg Roach				</td>
3068c2e8227SGreg Roach				<td class="width33">
3078c2e8227SGreg Roach					<label>
3088c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_gif" <?php echo $filters['gif'] ? 'checked' : ''; ?>>
3098c2e8227SGreg Roach						gif
3108c2e8227SGreg Roach					</label>
3118c2e8227SGreg Roach				</td>
3128c2e8227SGreg Roach			</tr>
3138c2e8227SGreg Roach			<tr>
3148c2e8227SGreg Roach				<td class="width33">
3158c2e8227SGreg Roach					<label>
3168c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_jpeg" <?php echo $filters['jpeg'] ? 'checked' : ''; ?>>
3178c2e8227SGreg Roach						jpeg
3188c2e8227SGreg Roach					</label>
3198c2e8227SGreg Roach				</td>
3208c2e8227SGreg Roach				<td class="width33">
3218c2e8227SGreg Roach					<label>
3228c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_mp3" <?php echo $filters['mp3'] ? 'checked' : ''; ?>>
3238c2e8227SGreg Roach						mp3
3248c2e8227SGreg Roach					</label>
3258c2e8227SGreg Roach				</td>
3268c2e8227SGreg Roach					<td class="width33">
3278c2e8227SGreg Roach					<label>
3288c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_ole" <?php echo $filters['ole'] ? 'checked' : ''; ?>>
3298c2e8227SGreg Roach						ole
3308c2e8227SGreg Roach					</label>
3318c2e8227SGreg Roach				</td>
3328c2e8227SGreg Roach			</tr>
3338c2e8227SGreg Roach			<tr>
3348c2e8227SGreg Roach				<td class="width33">
3358c2e8227SGreg Roach					<label>
3368c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_pcx" <?php echo $filters['pcx'] ? 'checked' : ''; ?>>
3378c2e8227SGreg Roach						pcx
3388c2e8227SGreg Roach					</label>
3398c2e8227SGreg Roach				</td>
3408c2e8227SGreg Roach				<td class="width33">
3418c2e8227SGreg Roach					<label>
3428c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_pdf" <?php echo $filters['pdf'] ? 'checked' : ''; ?>>
3438c2e8227SGreg Roach						pdf
3448c2e8227SGreg Roach					</label>
3458c2e8227SGreg Roach				</td>
3468c2e8227SGreg Roach				<td class="width33">
3478c2e8227SGreg Roach					<label>
3488c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_png" <?php echo $filters['png'] ? 'checked' : ''; ?>>
3498c2e8227SGreg Roach						png
3508c2e8227SGreg Roach					</label>
3518c2e8227SGreg Roach				</td>
3528c2e8227SGreg Roach			</tr>
3538c2e8227SGreg Roach			<tr>
3548c2e8227SGreg Roach				<td class="width33">
3558c2e8227SGreg Roach					<label>
3568c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_tiff" <?php echo $filters['tiff'] ? 'checked' : ''; ?>>
3578c2e8227SGreg Roach						tiff
3588c2e8227SGreg Roach					</label>
3598c2e8227SGreg Roach				</td>
3608c2e8227SGreg Roach				<td class="width33">
3618c2e8227SGreg Roach					<label>
3628c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_wav" <?php echo $filters['wav'] ? 'checked' : ''; ?>>
3638c2e8227SGreg Roach						wav
3648c2e8227SGreg Roach					</label>
3658c2e8227SGreg Roach				</td>
3668c2e8227SGreg Roach				<td class="width33"></td>
3678c2e8227SGreg Roach				<td class="width33"></td>
3688c2e8227SGreg Roach			</tr>
3698c2e8227SGreg Roach		</table>
3708c2e8227SGreg Roach			<br>
371764a01d9SGreg Roach			<center><b><?php echo GedcomTag::getLabel('TYPE'); ?></b></center>
3728c2e8227SGreg Roach				<table class="width100">
3738c2e8227SGreg Roach					<tr>
3748c2e8227SGreg Roach					<?php
3758c2e8227SGreg Roach					//-- Build the list of checkboxes
3768c2e8227SGreg Roach					$i = 0;
377764a01d9SGreg Roach					foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) {
3788c2e8227SGreg Roach						$i++;
3798c2e8227SGreg Roach						if ($i > 3) {
3808c2e8227SGreg Roach							$i = 1;
3818c2e8227SGreg Roach							echo '</tr><tr>';
3828c2e8227SGreg Roach						}
3838c2e8227SGreg Roach						echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" ';
384ffd703eaSGreg Roach						echo $filters[$typeName] ? 'checked' : '';
3858c2e8227SGreg Roach						echo '> ' . $typeValue . '</label></td>';
3868c2e8227SGreg Roach					}
3878c2e8227SGreg Roach					?>
3888c2e8227SGreg Roach				</tr>
3898c2e8227SGreg Roach			</table>
3908c2e8227SGreg Roach		</td>
3918c2e8227SGreg Roach	</tr>
3928c2e8227SGreg Roach
3938c2e8227SGreg Roach	<?php
3948c2e8227SGreg Roach
3958c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
3968c2e8227SGreg Roach		echo I18N::translate('Show slide show controls?');
3978c2e8227SGreg Roach		echo '</td><td class="optionbox">';
398*3d7a8a4cSGreg Roach		echo FunctionsEdit::editFieldYesNo('controls', $controls);
3998c2e8227SGreg Roach		echo '</td></tr>';
4008c2e8227SGreg Roach
4018c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
4028c2e8227SGreg Roach		echo I18N::translate('Start slide show on page load?');
4038c2e8227SGreg Roach		echo '</td><td class="optionbox">';
404*3d7a8a4cSGreg Roach		echo FunctionsEdit::editFieldYesNo('start', $start);
4058c2e8227SGreg Roach		echo '</td></tr>';
4068c2e8227SGreg Roach	}
4078c2e8227SGreg Roach}
408