<?php
/*
 * \Eigene Dateien\Sentra.Designs\BasicDesigner\modules\menues\verticaltopicnavi\render_topicnavi.tpl
 */
$MAIN_TOPIC = get_main_topic();
$print_topicmenu=FALSE;
/* First check if  there are topics under the current maintopic page */
for ( $mt=0; $mt < $MAIN_TOPIC['count'] ; $mt++ ) {  	// Loop over all Main Topics
  $TOPIC = get_topic($MAIN_TOPIC[$mt]['id']); 				// Get all topicpage-parameter belonging to this maintopic
	If ($MAIN_TOPIC[$mt]['id']==$MAIN_TOPIC_ACTIVE) {
		If ($TOPIC['count'] > 0) $print_topicmenu = TRUE;
	}
}
If ($print_topicmenu) {
	If (!$IS_HOME && !$IS_COMMON) {
		echo '	<ul class="topicnavi">'.PHP_EOL;
		for ( $mt=0; $mt < $MAIN_TOPIC['count'] ; $mt++ ) {  	// Start loop over maintopics
		  $TOPIC = get_topic($MAIN_TOPIC[$mt]['id']); 				// get all topics belonging to this main topic
			If ($MAIN_TOPIC[$mt]['id']==$MAIN_TOPIC_ACTIVE) {
				If ($TOPIC['count'] > 0) {
					echo '		<li class="mt"><a '.generate_link($MAIN_TOPIC[$mt]).">".print_caption($MAIN_TOPIC[$mt])."</a></li>\r\n";
					// Jetzt die Topics anzeigen:
				  for ($t = 0; $t < $TOPIC['count']; $t++) {
						$SUB_TOPIC = get_sub_topic($TOPIC[$t]['id']); // hole alle Subtopics der momentanen Topic
					  if ($TOPIC[$t]['id']==$TOPIC_ACTIVE) {
							echo '					<li class="current"><a '.generate_link($TOPIC[$t]).'>'.$TOPIC[$t]['caption']."</a>\r\n";
							if ($SUB_TOPIC['count'] != 0) { // wenn Subtopic vorhanden
								echo '			<ul>';
								for ($st = 0; $st < $SUB_TOPIC['count']; $st++) {
						  	  if ($SUB_TOPIC[$st]['id']==$SUB_TOPIC_ACTIVE) {
										If ($t == $TOPIC['count']-1 && $st == $SUB_TOPIC['count']-1) {
											echo '							<li class="current">'.PHP_EOL;
											echo '<a '.generate_link($SUB_TOPIC[$st]).'>'.$SUB_TOPIC[$st]['caption'].'</a></li>'.PHP_EOL;
										} Else {
											echo '							<li class="current"><a '.generate_link($SUB_TOPIC[$st]).'>'.$SUB_TOPIC[$st]['caption'].'</a></li>'.PHP_EOL;
										}
									} Else {
										If ($t == $TOPIC['count']-1 && $st == $SUB_TOPIC['count']-1) {
										echo '							<li>'.PHP_EOL;
										echo '<a '.generate_link($SUB_TOPIC[$st]).'>'.$SUB_TOPIC[$st]['caption'].'</a></li>'.PHP_EOL;
										} Else {
										echo '							<li><a '.generate_link($SUB_TOPIC[$st]).'>'.$SUB_TOPIC[$st]['caption'].'</a></li>'.PHP_EOL;
										}
									}
								}
								echo '			</ul></li>';
							}
						} Else {
							$aclass="";
							If ($SUB_TOPIC['count'] > 0) $aclass='class="fly" ';
							echo '					<li><a '.$aclass.generate_link($TOPIC[$t]).'>'.$TOPIC[$t]['caption']."</a></li>\r\n";
						}
					}
				}
			}
		}																											// End loop over maintopics
		echo '	</ul>	<!-- Close class="topicnavi" -->'.PHP_EOL;
	}
}

?>
