<?php
/*
 * Copyright (c) 2013, webvariants GbR, http://www.webvariants.de
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

$mode = sly_get('extended', 'boolean', false) ? 'extended' : 'normal';
$num  = 0;

?>

<?php if ($mode === 'extended'): ?>
<p class="center"><a href="?page=devutilsdocs">Liste verkürzen</a></p>
<?php else: ?>
<p class="center"><a href="?page=devutilsdocs&amp;extended=1">Liste um Angabe der erlaubten Module erweitern</a></p>
<?php endif ?>

<div class="sly-area-col-2">
	<div class="sly-area col-a">
		<h2>Artikeltypen</h2>
		<div class="sly-area-content">
			<?php foreach ($articleTypes as $typeName => $type): ?>
			<div class="articletype num<?php print $num++ ?>">
				<h3><?php print sly_translate($type['title'], true) ?></h3>
				<?php if ($type['description']): ?>
				<p><?php print sly_translate($type['description'], true) ?></p>
				<?php endif ?>

				<?php if ($mode === 'extended' && !empty($type['slots'])): ?>
				<dl>
					<?php foreach ($type['slots'] as $slotName => $slot): ?>
					<dt><?php print sly_translate($slot['title'], true) ?>:</dt>
					<dd><?php
					$mod = array_values($slot['modules']);
					$mod = array_map('sly_translate', $mod);

					print sly_html(sly_Util_String::humanImplode($mod));
					?></dd>
					<?php endforeach ?>
				</dl>
				<?php endif ?>
			</div>
			<?php endforeach ?>
		</div>
	</div>

	<div class="sly-area col-b">
		<h2>Module</h2>

		<?php $num = 0; ?>

		<div class="sly-area-content">
			<?php foreach ($modules as $moduleName => $module): ?>
			<div class="module num<?php print $num++ ?>">
				<h3><?php print sly_translate($module['title'], true) ?></h3>
				<?php if ($module['description']): ?>
				<p><?php print sly_translate($module['description'], true) ?></p>
				<?php endif ?>
			</div>
			<?php endforeach ?>
		</div>
	</div>
</div>
