<?php if(!defined('master_script')) die();

/**
 * Default data
 *
 * @category   Module (list-pages)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2010-06-08
 */
	
	$modules['list-pages']['version'] = '1.2';
	$modules['list-pages']['author'] = 'Nico Wenig';
	$modules['list-pages']['support'] = 'mailto:nico.wenig@yellowgreen.de';
	$modules['list-pages']['pagemap version'] = '0.4';
	$modules['list-pages']['for'] = 'all';
	$modules['list-pages']['key'] = 'list-pages';
	$modules['list-pages']['path'] = $system_data['folder']['modules'] . $modules['list-pages']['key'] . '/';
	$modules['list-pages']['languages'] = $system_data['folder']['modules'] . $modules['list-pages']['key'] . '/languages/';
	$modules['list-pages']['protected'] = 1;
	$modules['list-pages']['preview'] = 1;

	include_txt($modules['list-pages']['key'], $modules['list-pages']['languages']);

/**
 * Save module to page
 *
 * @category   Module (list-pages)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2010-07-25
 */
	
	if(isset($_POST['save_list_pages'])) {
		// Parse data
		$_POST['show_sort_headlines'] = isset($_POST['show_sort_headlines']) ? 1 : 0;
		$_POST['show_info_pages'] = isset($_POST['show_info_pages']) ? 1 : 0;
		$_POST['sort_ascending'] = isset($_POST['sort_ascending']) ? 1 : 0;
		$_POST['categories'] = empty($_POST['categories']) ? '' : intval($_POST['categories']);
		
		// Create module section
		$module_content_to_save = '
			<!-- MODULE: list-pages -->
			
			<?php
				$module_settings["list-pages"] = array(
					"language" => "' . clean_string($_POST['language'], true) . '",
					"margin top" => ' . intval($_POST['margin_top']) . ',
					"margin left" => ' . intval($_POST['margin_left']) . ',
					"css class" => "' . clean_string($_POST['css_class'], true) . '",
					"css id" => "' . clean_string($_POST['css_id'], true) . '",
					
					"show sort headlines" => ' . $_POST['show_sort_headlines'] . ',
					"show info pages" => ' . $_POST['show_info_pages'] . ',
					"sort by" => "' . $_POST['sort_by'] . '",
					"categories" => array(' . (strlen($_POST['categories']) != 10 ? '' : $_POST['categories']) . '),
					"sort ascending" => ' . $_POST['sort_ascending'] . '
				);

				' . connector('list-pages backend save') . '
				include_module("list-pages");
			?>
		';
	}

?>