<?php
$debug = $sf_request->hasParameter('debug');

include_partial('catalyz/flash');

function displayLevel($nodes, $visibleOnly, $debug = false) {
    if (0 < count($nodes)) {
        printf("\n" . '<ul>' . "\n");
        foreach($nodes as $node) {
            if (!$visibleOnly || $node->isVisibleInMenu()) {
                printf('<li><a href="%s">%s</a>', $node->getUrl(), $node->getTitle());
                if ($debug) {
                    $nodeClass = $node->getNodeClass();
                    printf('<span style="color: #999999"> <small>%d:[%s]</small></span>', $node->getId(), $nodeClass);
                }

                displayLevel($node->children, $visibleOnly, $debug);
                printf('</li>' . "\n");
                if ('Network' == $node->getNodeClass()) { ?>
	<?php foreach(KataoProductPeer::getAllProductsTree() as $katao_product_category_url => $katao_product_category_data): ?>
		<li>
			<a href="<?php echo url_for('@katao_boutique_rayon?category=' . $katao_product_category_url) ?>"><?php echo $katao_product_category_data['name'] ?></a>
			<ul>
			<?php foreach($katao_product_category_data['families'] as $katao_product_family_url => $katao_product_family_data): ?>
				<li>
					<a href="<?php echo url_for('@katao_boutique_famille?category=' . $katao_product_category_url . '&family=' . $katao_product_family_url) ?>"><?php echo $katao_product_family_data['name'] ?></a>
					<!--ul>
					<?php foreach($katao_product_family_data['products'] as $katao_product_url => $katao_product_name): ?>
						<li><a href="<?php echo url_for('@katao_boutique_produit?category=' . $katao_product_category_url . '&family=' . $katao_product_family_url . '&product=' . $katao_product_url) ?>"><?php echo $katao_product_name ?></a></li>
					<?php endforeach ?>
					</ul-->
				</li>
			<?php endforeach ?>
			</ul>
		</li>
	<?php endforeach ?>
		<li>
			<a href="<?php echo url_for('@katao_fournisseurs') ?>">Les partenaires</a>
			<ul>
			<?php foreach (KataoSupplierPeer::getAllVisible() as $katao_supplier): ?>
            	<li><a href="<?php echo url_for('@katao_fournisseurs_details?supplier=' . $katao_supplier['url']) ?>"><?php echo $katao_supplier['name'] ?></a></li>
            <?php endforeach ?>
			</ul>
		</li>
			<?php
                }
            }
        }
        printf('</ul>' . "\n");
    }
}

?>

<div class="content-add01">
	<?php displayLevel($ContentTree->getRoot()->children, false, $sf_request->hasParameter('debug')); ?>
</div>