xref: /webtrees/app/Module/SlideShowModule.php (revision 9353052e08ef3eb4cf05871a926f9ec2c45ba53b)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roachnamespace Fisharebest\Webtrees;
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 */
188c2e8227SGreg Roach
198c2e8227SGreg Roach/**
208c2e8227SGreg Roach * Class SlideShowModule
218c2e8227SGreg Roach */
22e2a378d3SGreg Roachclass SlideShowModule extends AbstractModule implements ModuleBlockInterface {
238c2e8227SGreg Roach	/** {@inheritdoc} */
248c2e8227SGreg Roach	public function getTitle() {
258c2e8227SGreg Roach		return /* I18N: Name of a module */ I18N::translate('Slide show');
268c2e8227SGreg Roach	}
278c2e8227SGreg Roach
288c2e8227SGreg Roach	/** {@inheritdoc} */
298c2e8227SGreg Roach	public function getDescription() {
308c2e8227SGreg Roach		return /* I18N: Description of the “Slide show” module */ I18N::translate('Random images from the current family tree.');
318c2e8227SGreg Roach	}
328c2e8227SGreg Roach
338c2e8227SGreg Roach	/** {@inheritdoc} */
348c2e8227SGreg Roach	public function getBlock($block_id, $template = true, $cfg = null) {
354b9ff166SGreg Roach		global $ctype, $WT_TREE;
368c2e8227SGreg Roach
37e2a378d3SGreg Roach		$filter   = $this->getBlockSetting($block_id, 'filter', 'all');
38e2a378d3SGreg Roach		$controls = $this->getBlockSetting($block_id, 'controls', '1');
39e2a378d3SGreg Roach		$start    = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
408c2e8227SGreg Roach
418c2e8227SGreg Roach		// We can apply the filters using SQL
428c2e8227SGreg Roach		// Do not use "ORDER BY RAND()" - it is very slow on large tables.  Use PHP::array_rand() instead.
438c2e8227SGreg Roach		$all_media = Database::prepare(
448c2e8227SGreg Roach			"SELECT m_id FROM `##media`" .
458c2e8227SGreg Roach			" WHERE m_file = ?" .
468c2e8227SGreg Roach			" AND m_ext  IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" .
478c2e8227SGreg Roach			" AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')"
488c2e8227SGreg Roach		)->execute(array(
4924ec66ceSGreg Roach			$WT_TREE->getTreeId(),
50e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null,
51e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null,
52e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null,
53e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null,
54e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null,
55e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null,
56e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null,
57e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null,
58e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null,
59e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null,
60e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null,
61e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null,
62e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null,
63e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null,
64e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null,
65e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null,
66e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null,
67e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null,
68e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null,
69e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null,
70e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null,
71e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null,
72e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null,
73e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null,
74e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null,
75e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null,
76e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null,
77e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null,
78e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null,
79e2a378d3SGreg Roach			$this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null,
808c2e8227SGreg Roach		))->fetchOneColumn();
818c2e8227SGreg Roach
828c2e8227SGreg Roach		// Keep looking through the media until a suitable one is found.
838c2e8227SGreg Roach		$random_media = null;
848c2e8227SGreg Roach		while ($all_media) {
858c2e8227SGreg Roach			$n = array_rand($all_media);
8624ec66ceSGreg Roach			$media = Media::getInstance($all_media[$n], $WT_TREE);
878c2e8227SGreg Roach			if ($media->canShow() && !$media->isExternal()) {
888c2e8227SGreg Roach				// Check if it is linked to a suitable individual
898c2e8227SGreg Roach				foreach ($media->linkedIndividuals('OBJE') as $indi) {
908c2e8227SGreg Roach					if (
918c2e8227SGreg Roach						$filter === 'all' ||
928c2e8227SGreg Roach						$filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false ||
938c2e8227SGreg Roach						$filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false
948c2e8227SGreg Roach					) {
958c2e8227SGreg Roach						// Found one :-)
968c2e8227SGreg Roach						$random_media = $media;
978c2e8227SGreg Roach						break 2;
988c2e8227SGreg Roach					}
998c2e8227SGreg Roach				}
1008c2e8227SGreg Roach			}
1018c2e8227SGreg Roach			unset($all_media[$n]);
1028c2e8227SGreg Roach		};
1038c2e8227SGreg Roach
1048c2e8227SGreg Roach		$id = $this->getName() . $block_id;
1058c2e8227SGreg Roach		$class = $this->getName() . '_block';
1064b9ff166SGreg Roach		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
107*9353052eSGreg 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>';
1088c2e8227SGreg Roach		} else {
1098c2e8227SGreg Roach			$title = '';
1108c2e8227SGreg Roach		}
1118c2e8227SGreg Roach		$title .= $this->getTitle();
1128c2e8227SGreg Roach
1138c2e8227SGreg Roach		if ($random_media) {
1148c2e8227SGreg Roach			$content = "<div id=\"random_picture_container$block_id\">";
1158c2e8227SGreg Roach			if ($controls) {
1168c2e8227SGreg Roach				if ($start) {
1178c2e8227SGreg Roach					$icon_class = 'icon-media-stop';
1188c2e8227SGreg Roach				} else {
1198c2e8227SGreg Roach					$icon_class = 'icon-media-play';
1208c2e8227SGreg Roach				}
1218c2e8227SGreg Roach				$content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>';
1228c2e8227SGreg Roach				$content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . I18N::translate('Play') . "/" . I18N::translate('Stop') . '"></a>';
1238c2e8227SGreg 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>';
1248c2e8227SGreg Roach				$content .= '</div><script>
1258c2e8227SGreg Roach					var play = false;
1268c2e8227SGreg Roach						function togglePlay() {
1278c2e8227SGreg Roach							if (play) {
1288c2e8227SGreg Roach								play = false;
1298c2e8227SGreg Roach								jQuery("#play_stop").removeClass("icon-media-stop").addClass("icon-media-play");
1308c2e8227SGreg Roach							}
1318c2e8227SGreg Roach							else {
1328c2e8227SGreg Roach								play = true;
1338c2e8227SGreg Roach								playSlideShow();
1348c2e8227SGreg Roach								jQuery("#play_stop").removeClass("icon-media-play").addClass("icon-media-stop");
1358c2e8227SGreg Roach							}
1368c2e8227SGreg Roach						}
1378c2e8227SGreg Roach
1388c2e8227SGreg Roach						function playSlideShow() {
1398c2e8227SGreg Roach							if (play) {
1408c2e8227SGreg Roach								window.setTimeout("reload_image()", 6000);
1418c2e8227SGreg Roach							}
1428c2e8227SGreg Roach						}
1438c2e8227SGreg Roach						function reload_image() {
1448c2e8227SGreg Roach							if (play) {
1458c2e8227SGreg Roach								jQuery("#block_'.$block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1");
1468c2e8227SGreg Roach							}
1478c2e8227SGreg Roach						}
1488c2e8227SGreg Roach					</script>';
1498c2e8227SGreg Roach			}
1508c2e8227SGreg Roach			if ($start) {
1518c2e8227SGreg Roach				$content .= '<script>togglePlay();</script>';
1528c2e8227SGreg Roach			}
1538c2e8227SGreg Roach			$content .= '<div class="center" id="random_picture_content' . $block_id . '">';
1548c2e8227SGreg Roach			$content .= '<table id="random_picture_box"><tr><td class="details1">';
1558c2e8227SGreg Roach			$content .= $random_media->displayImage();
1568c2e8227SGreg Roach
1578c2e8227SGreg Roach			$content .= '<br>';
1588c2e8227SGreg Roach			$content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>';
1598c2e8227SGreg Roach			foreach ($random_media->linkedIndividuals('OBJE') as $individual) {
1608c2e8227SGreg Roach				$content .= '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View individual') . ' — ' . $individual->getFullname() . '</a><br>';
1618c2e8227SGreg Roach			}
1628c2e8227SGreg Roach			foreach ($random_media->linkedFamilies('OBJE') as $family) {
1638c2e8227SGreg Roach				$content .= '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View family') . ' — ' . $family->getFullname() . '</a><br>';
1648c2e8227SGreg Roach			}
1658c2e8227SGreg Roach			foreach ($random_media->linkedSources('OBJE') as $source) {
1668c2e8227SGreg Roach				$content .= '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View source') . ' — ' . $source->getFullname() . '</a><br>';
1678c2e8227SGreg Roach			}
1688c2e8227SGreg Roach			$content .= '<br><div class="indent">';
1698c2e8227SGreg Roach			$content .= print_fact_notes($random_media->getGedcom(), "1", false);
1708c2e8227SGreg Roach			$content .= '</div>';
1718c2e8227SGreg Roach			$content .= '</td></tr></table>';
1728c2e8227SGreg Roach			$content .= '</div>'; // random_picture_content
1738c2e8227SGreg Roach			$content .= '</div>'; // random_picture_container
1748c2e8227SGreg Roach		} else {
1758c2e8227SGreg Roach			$content = I18N::translate('This family tree has no images to display.');
1768c2e8227SGreg Roach		}
1778c2e8227SGreg Roach		if ($template) {
1784f8ecee1SGreg Roach			return Theme::theme()->formatBlock($id, $title, $class, $content);
1798c2e8227SGreg Roach		} else {
1808c2e8227SGreg Roach			return $content;
1818c2e8227SGreg Roach		}
1828c2e8227SGreg Roach	}
1838c2e8227SGreg Roach
1848c2e8227SGreg Roach	/** {@inheritdoc} */
1858c2e8227SGreg Roach	public function loadAjax() {
1868c2e8227SGreg Roach		return true;
1878c2e8227SGreg Roach	}
1888c2e8227SGreg Roach
1898c2e8227SGreg Roach	/** {@inheritdoc} */
1908c2e8227SGreg Roach	public function isUserBlock() {
1918c2e8227SGreg Roach		return true;
1928c2e8227SGreg Roach	}
1938c2e8227SGreg Roach
1948c2e8227SGreg Roach	/** {@inheritdoc} */
1958c2e8227SGreg Roach	public function isGedcomBlock() {
1968c2e8227SGreg Roach		return true;
1978c2e8227SGreg Roach	}
1988c2e8227SGreg Roach
1998c2e8227SGreg Roach	/** {@inheritdoc} */
2008c2e8227SGreg Roach	public function configureBlock($block_id) {
2018c2e8227SGreg Roach		if (Filter::postBool('save') && Filter::checkCsrf()) {
202e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter', Filter::post('filter', 'indi|event|all', 'all'));
203e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'controls', Filter::postBool('controls'));
204e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'start', Filter::postBool('start'));
205e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_avi', Filter::postBool('filter_avi'));
206e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_bmp', Filter::postBool('filter_bmp'));
207e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_gif', Filter::postBool('filter_gif'));
208e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_jpeg', Filter::postBool('filter_jpeg'));
209e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_mp3', Filter::postBool('filter_mp3'));
210e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_ole', Filter::postBool('filter_ole'));
211e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_pcx', Filter::postBool('filter_pcx'));
212e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_pdf', Filter::postBool('filter_pdf'));
213e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_png', Filter::postBool('filter_png'));
214e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_tiff', Filter::postBool('filter_tiff'));
215e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_wav', Filter::postBool('filter_wav'));
216e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_audio', Filter::postBool('filter_audio'));
217e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_book', Filter::postBool('filter_book'));
218e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_card', Filter::postBool('filter_card'));
219e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_certificate', Filter::postBool('filter_certificate'));
220e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_coat', Filter::postBool('filter_coat'));
221e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_document', Filter::postBool('filter_document'));
222e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_electronic', Filter::postBool('filter_electronic'));
223e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_fiche', Filter::postBool('filter_fiche'));
224e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_film', Filter::postBool('filter_film'));
225e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_magazine', Filter::postBool('filter_magazine'));
226e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_manuscript', Filter::postBool('filter_manuscript'));
227e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_map', Filter::postBool('filter_map'));
228e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_newspaper', Filter::postBool('filter_newspaper'));
229e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_other', Filter::postBool('filter_other'));
230e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_painting', Filter::postBool('filter_painting'));
231e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_photo', Filter::postBool('filter_photo'));
232e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_tombstone', Filter::postBool('filter_tombstone'));
233e2a378d3SGreg Roach			$this->setBlockSetting($block_id, 'filter_video', Filter::postBool('filter_video'));
2348c2e8227SGreg Roach		}
2358c2e8227SGreg Roach
236e2a378d3SGreg Roach		$filter   = $this->getBlockSetting($block_id, 'filter', 'all');
237e2a378d3SGreg Roach		$controls = $this->getBlockSetting($block_id, 'controls', '1');
238e2a378d3SGreg Roach		$start    = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
2398c2e8227SGreg Roach
2408c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
2418c2e8227SGreg Roach		echo I18N::translate('Show only individuals, events, or all?');
2428c2e8227SGreg Roach		echo '</td><td class="optionbox">';
2438c2e8227SGreg Roach		echo select_edit_control('filter', array('indi'=> I18N::translate('Individuals'), 'event'=> I18N::translate('Facts and events'), 'all'=> I18N::translate('All')), null, $filter, '');
2448c2e8227SGreg Roach		echo '</td></tr>';
2458c2e8227SGreg Roach
2468c2e8227SGreg Roach		$filters = array(
247e2a378d3SGreg Roach			'avi'        =>$this->getBlockSetting($block_id, 'filter_avi', '0'),
248e2a378d3SGreg Roach			'bmp'        =>$this->getBlockSetting($block_id, 'filter_bmp', '1'),
249e2a378d3SGreg Roach			'gif'        =>$this->getBlockSetting($block_id, 'filter_gif', '1'),
250e2a378d3SGreg Roach			'jpeg'       =>$this->getBlockSetting($block_id, 'filter_jpeg', '1'),
251e2a378d3SGreg Roach			'mp3'        =>$this->getBlockSetting($block_id, 'filter_mp3', '0'),
252e2a378d3SGreg Roach			'ole'        =>$this->getBlockSetting($block_id, 'filter_ole', '1'),
253e2a378d3SGreg Roach			'pcx'        =>$this->getBlockSetting($block_id, 'filter_pcx', '1'),
254e2a378d3SGreg Roach			'pdf'        =>$this->getBlockSetting($block_id, 'filter_pdf', '0'),
255e2a378d3SGreg Roach			'png'        =>$this->getBlockSetting($block_id, 'filter_png', '1'),
256e2a378d3SGreg Roach			'tiff'       =>$this->getBlockSetting($block_id, 'filter_tiff', '1'),
257e2a378d3SGreg Roach			'wav'        =>$this->getBlockSetting($block_id, 'filter_wav', '0'),
258e2a378d3SGreg Roach			'audio'      =>$this->getBlockSetting($block_id, 'filter_audio', '0'),
259e2a378d3SGreg Roach			'book'       =>$this->getBlockSetting($block_id, 'filter_book', '1'),
260e2a378d3SGreg Roach			'card'       =>$this->getBlockSetting($block_id, 'filter_card', '1'),
261e2a378d3SGreg Roach			'certificate'=>$this->getBlockSetting($block_id, 'filter_certificate', '1'),
262e2a378d3SGreg Roach			'coat'       =>$this->getBlockSetting($block_id, 'filter_coat', '1'),
263e2a378d3SGreg Roach			'document'   =>$this->getBlockSetting($block_id, 'filter_document', '1'),
264e2a378d3SGreg Roach			'electronic' =>$this->getBlockSetting($block_id, 'filter_electronic', '1'),
265e2a378d3SGreg Roach			'fiche'      =>$this->getBlockSetting($block_id, 'filter_fiche', '1'),
266e2a378d3SGreg Roach			'film'       =>$this->getBlockSetting($block_id, 'filter_film', '1'),
267e2a378d3SGreg Roach			'magazine'   =>$this->getBlockSetting($block_id, 'filter_magazine', '1'),
268e2a378d3SGreg Roach			'manuscript' =>$this->getBlockSetting($block_id, 'filter_manuscript', '1'),
269e2a378d3SGreg Roach			'map'        =>$this->getBlockSetting($block_id, 'filter_map', '1'),
270e2a378d3SGreg Roach			'newspaper'  =>$this->getBlockSetting($block_id, 'filter_newspaper', '1'),
271e2a378d3SGreg Roach			'other'      =>$this->getBlockSetting($block_id, 'filter_other', '1'),
272e2a378d3SGreg Roach			'painting'   =>$this->getBlockSetting($block_id, 'filter_painting', '1'),
273e2a378d3SGreg Roach			'photo'      =>$this->getBlockSetting($block_id, 'filter_photo', '1'),
274e2a378d3SGreg Roach			'tombstone'  =>$this->getBlockSetting($block_id, 'filter_tombstone', '1'),
275e2a378d3SGreg Roach			'video'      =>$this->getBlockSetting($block_id, 'filter_video', '0'),
2768c2e8227SGreg Roach		);
2778c2e8227SGreg Roach
2788c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
2798c2e8227SGreg Roach		echo I18N::translate('Filter');
2808c2e8227SGreg Roach		?>
2818c2e8227SGreg Roach	</td>
2828c2e8227SGreg Roach	<td class="optionbox">
283764a01d9SGreg Roach		<center><b><?php echo GedcomTag::getLabel('FORM'); ?></b></center>
2848c2e8227SGreg Roach		<table class="width100">
2858c2e8227SGreg Roach			<tr>
2868c2e8227SGreg Roach				<td class="width33">
2878c2e8227SGreg Roach					<label>
2888c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_avi" <?php echo $filters['avi'] ? 'checked' : ''; ?>>
2898c2e8227SGreg Roach						avi
2908c2e8227SGreg Roach				</td>
2918c2e8227SGreg Roach				<td class="width33">
2928c2e8227SGreg Roach					<label>
2938c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_bmp" <?php echo $filters['bmp'] ? 'checked' : ''; ?>>
2948c2e8227SGreg Roach						bmp
2958c2e8227SGreg Roach					</label>
2968c2e8227SGreg Roach				</td>
2978c2e8227SGreg Roach				<td class="width33">
2988c2e8227SGreg Roach					<label>
2998c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_gif" <?php echo $filters['gif'] ? 'checked' : ''; ?>>
3008c2e8227SGreg Roach						gif
3018c2e8227SGreg Roach					</label>
3028c2e8227SGreg Roach				</td>
3038c2e8227SGreg Roach			</tr>
3048c2e8227SGreg Roach			<tr>
3058c2e8227SGreg Roach				<td class="width33">
3068c2e8227SGreg Roach					<label>
3078c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_jpeg" <?php echo $filters['jpeg'] ? 'checked' : ''; ?>>
3088c2e8227SGreg Roach						jpeg
3098c2e8227SGreg Roach					</label>
3108c2e8227SGreg Roach				</td>
3118c2e8227SGreg Roach				<td class="width33">
3128c2e8227SGreg Roach					<label>
3138c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_mp3" <?php echo $filters['mp3'] ? 'checked' : ''; ?>>
3148c2e8227SGreg Roach						mp3
3158c2e8227SGreg Roach					</label>
3168c2e8227SGreg Roach				</td>
3178c2e8227SGreg Roach					<td class="width33">
3188c2e8227SGreg Roach					<label>
3198c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_ole" <?php echo $filters['ole'] ? 'checked' : ''; ?>>
3208c2e8227SGreg Roach						ole
3218c2e8227SGreg Roach					</label>
3228c2e8227SGreg Roach				</td>
3238c2e8227SGreg Roach			</tr>
3248c2e8227SGreg Roach			<tr>
3258c2e8227SGreg Roach				<td class="width33">
3268c2e8227SGreg Roach					<label>
3278c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_pcx" <?php echo $filters['pcx'] ? 'checked' : ''; ?>>
3288c2e8227SGreg Roach						pcx
3298c2e8227SGreg Roach					</label>
3308c2e8227SGreg Roach				</td>
3318c2e8227SGreg Roach				<td class="width33">
3328c2e8227SGreg Roach					<label>
3338c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_pdf" <?php echo $filters['pdf'] ? 'checked' : ''; ?>>
3348c2e8227SGreg Roach						pdf
3358c2e8227SGreg Roach					</label>
3368c2e8227SGreg Roach				</td>
3378c2e8227SGreg Roach				<td class="width33">
3388c2e8227SGreg Roach					<label>
3398c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_png" <?php echo $filters['png'] ? 'checked' : ''; ?>>
3408c2e8227SGreg Roach						png
3418c2e8227SGreg Roach					</label>
3428c2e8227SGreg Roach				</td>
3438c2e8227SGreg Roach			</tr>
3448c2e8227SGreg Roach			<tr>
3458c2e8227SGreg Roach				<td class="width33">
3468c2e8227SGreg Roach					<label>
3478c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_tiff" <?php echo $filters['tiff'] ? 'checked' : ''; ?>>
3488c2e8227SGreg Roach						tiff
3498c2e8227SGreg Roach					</label>
3508c2e8227SGreg Roach				</td>
3518c2e8227SGreg Roach				<td class="width33">
3528c2e8227SGreg Roach					<label>
3538c2e8227SGreg Roach						<input type="checkbox" value="yes" name="filter_wav" <?php echo $filters['wav'] ? 'checked' : ''; ?>>
3548c2e8227SGreg Roach						wav
3558c2e8227SGreg Roach					</label>
3568c2e8227SGreg Roach				</td>
3578c2e8227SGreg Roach				<td class="width33"></td>
3588c2e8227SGreg Roach				<td class="width33"></td>
3598c2e8227SGreg Roach			</tr>
3608c2e8227SGreg Roach		</table>
3618c2e8227SGreg Roach			<br>
362764a01d9SGreg Roach			<center><b><?php echo GedcomTag::getLabel('TYPE'); ?></b></center>
3638c2e8227SGreg Roach				<table class="width100">
3648c2e8227SGreg Roach					<tr>
3658c2e8227SGreg Roach					<?php
3668c2e8227SGreg Roach					//-- Build the list of checkboxes
3678c2e8227SGreg Roach					$i = 0;
368764a01d9SGreg Roach					foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) {
3698c2e8227SGreg Roach						$i++;
3708c2e8227SGreg Roach						if ($i > 3) {
3718c2e8227SGreg Roach							$i = 1;
3728c2e8227SGreg Roach							echo '</tr><tr>';
3738c2e8227SGreg Roach						}
3748c2e8227SGreg Roach						echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" ';
3758c2e8227SGreg Roach						echo ($filters[$typeName]) ? 'checked' : '';
3768c2e8227SGreg Roach						echo '> ' . $typeValue . '</label></td>';
3778c2e8227SGreg Roach					}
3788c2e8227SGreg Roach					?>
3798c2e8227SGreg Roach				</tr>
3808c2e8227SGreg Roach			</table>
3818c2e8227SGreg Roach		</td>
3828c2e8227SGreg Roach	</tr>
3838c2e8227SGreg Roach
3848c2e8227SGreg Roach	<?php
3858c2e8227SGreg Roach
3868c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
3878c2e8227SGreg Roach		echo I18N::translate('Show slide show controls?');
3888c2e8227SGreg Roach		echo '</td><td class="optionbox">';
3898c2e8227SGreg Roach		echo edit_field_yes_no('controls', $controls);
3908c2e8227SGreg Roach		echo '</td></tr>';
3918c2e8227SGreg Roach
3928c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
3938c2e8227SGreg Roach		echo I18N::translate('Start slide show on page load?');
3948c2e8227SGreg Roach		echo '</td><td class="optionbox">';
3958c2e8227SGreg Roach		echo edit_field_yes_no('start', $start);
3968c2e8227SGreg Roach		echo '</td></tr>';
3978c2e8227SGreg Roach	}
3988c2e8227SGreg Roach}
399