<?php
define('RENDER_MODE', 'catalyz');
ob_start();

$page = $node->getPage();

$properties = array();
$properties['page'] = $page;
$properties['node'] = $node;
//$properties['culture'] = $culture;
$properties['ContentTree'] = $ContentTree;
include_partial('catalyz/header');

?>

<div id="catalyz-content">
<div id="catalyz-content-internal">

<h1 class="section_current"><?php
$parentPage = $parentNode->getPage();
if($parentPage instanceof ICatalyzToolbarActionStringManager){
	echo $parentPage->getCatalyzToolbarAddCaption();
}else{
echo __('Add a page', null, 'catalyz');
}

?></h1>

<p><?php echo __('Please choose from the list below the kind of page you would like to create.', null, 'catalyz'); ?></p>

<?php

use_helper('Form', 'I18N');
echo form_tag('catalyz/nodeEdit', array('method' => 'GET'));
echo input_hidden_tag('parent_id', $node->getId());
$isFirst = true;
foreach($options as $optionClass => $details){
	?>
	<div>
	<?php
	echo radiobutton_tag('page_type', $optionClass, $isFirst);
	printf('<b>%s</b>', $details['caption']);
	printf('<div style="margin-left: 25px;">%s</div>', $details['description']);
	?>

	</div><?php
	$isFirst=false;
}
echo '<br />';
echo submit_tag(__('Add', null, 'catalyz'), array('name'=> 'Submit'));
echo '&nbsp;';
echo submit_tag(__('Cancel', null, 'catalyz'), array('name'=> 'Cancel'));

?>
</form>
</div>
</div>
<?php

$content = ob_get_contents();

ob_end_clean();

use_helper('Catalyz');
$layout = LayoutManager::instance()->getCatalyzTemplate($ContentTree->getCurrentNode()->getCurrentLayoutNameForAction());
$properties['layout_family'] = $layout[0];
$properties['layout_name'] = $layout[1];

embed_with_layout($content, $layout, $properties);

?>