1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
9	header("location: index.php");
10	exit;
11}
12
13
14/**
15 * @return array
16 */
17function module_map_layer_selector_info()
18{
19	return [
20		'name' => tra('Layer Selector'),
21		'description' => tra("Replace the map's built-in layer controls."),
22		'prefs' => [],
23		'params' => [
24			'baselayer' => [
25				'required' => false,
26				'name' => tr('Include base layer'),
27				'description' => tr('Include the drop list for the base layers.'),
28				'default' => 'y',
29			],
30			'optionallayers' => [
31				'required' => false,
32				'name' => tr('Include optional layers'),
33				'description' => tr('Include the checkboxes for the optional layers.'),
34				'default' => 'y',
35			],
36		],
37	];
38}
39
40/**
41 * @param $mod_reference
42 * @param $module_params
43 */
44function module_map_layer_selector($mod_reference, $module_params)
45{
46	$smarty = TikiLib::lib('smarty');
47
48	$smarty->assign(
49		'controls',
50		[
51			'baselayer' => isset($module_params['baselayer']) ? $module_params['baselayer'] != 'n' : true,
52			'optionallayers' => isset($module_params['optionallayers']) ? $module_params['optionallayers'] != 'n' : true,
53		]
54	);
55}
56