<?php
/* ==========================================================================================	*/
/* \SentraDesigner\modules\cat.hor.navi\css3hornavi\css3.tpl 	                                */
/* ==========================================================================================	*/
/* Function:  Professional pure CSS drop-down menu                         										*/
/*                                                              															*/
/* This menu is copyright protected!                            															*/
/*                                                              															*/
/* You may use it only in templates and designs which are       															*/
/* delivered for use in the SENTRA CMS software package.     															    */
/*                                                              															*/
/* For any other usage you need the permission of SENTRA-CMS.de.															*/
/* ==========================================================================================	*/
$menulevels = 3;
$Pro6navi_homeicon = TRUE;
$has_sep = False;
$HOME = get_home_page();
$temp = explode('::',$HOME['caption']);
If (count($temp) == 2 && $temp[1] == 'right') {
	$HOME['caption'] = $temp[0];
}
$PageWrapperActive = false;
$OuterPageWrapperActive = true;
echo '';
$MAIN_TOPIC = get_main_topic(); // Get all main topic info
If ($PageWrapperActive && !$OuterPageWrapperActive) {
	echo '<nav id="c279f6caef3" class="">'.PHP_EOL.
			 '	<div class="PageWrapper">'.PHP_EOL;
} else if (!$PageWrapperActive && $OuterPageWrapperActive) {
echo '<nav id="c279f6caef3" class="PageWrapper">'.PHP_EOL;
} Else {
	echo '<nav id="c279f6caef3" class="">'.PHP_EOL;
}
echo '		<ul class="sf-menu" id="c279f6caef3-i">';
$HOME_Link 		= generate_link($HOME);
$HOME_caption = print_caption($HOME);
if ($IS_HOME || $IS_COMMON) { // Abfrage ob Homepage oder eine Common Page Hightlight Link aktiv
echo '
		<li class="mt">
			<a class="xFont-Topnavi mta act" '.generate_link($HOME).'>
				<i class="fa fa-home awehome">
				</i>
			</a>
		</li>
';
} Else {
echo '
		<li class="mt">
			<a class="xFont-Topnavi mta" '.generate_link($HOME).'><i class="fa fa-home awehome"></i></a>
		</li>
	';
}
$sep = '';
IF ($has_sep)
$sep = '<li class="mt sep"><b></b></li>'.PHP_EOL;
echo $sep;
If ($MAIN_TOPIC['count'] > 0) {
	$temp = explode('::',$MAIN_TOPIC[$MAIN_TOPIC['count']-1]['caption']);
	If (count($temp) == 2 && $temp[1] == 'right') {
		$MAIN_TOPIC[$MAIN_TOPIC['count']-1]['caption'] = $temp[0];
	}
} Else {
	/* Here: $MAIN_TOPIC['count'] == 0 */
		$temp = $MAIN_TOPIC;
}
If (count($temp) == 2 && $temp[1] == 'right') {
	$LastMTrightaligned = TRUE;
	$LastMTrightindex   = $MAIN_TOPIC['count']-1;
	$MTCount = $MAIN_TOPIC['count'] - 1;
	$MAIN_TOPIC[$LastMTrightindex]['caption'] = $temp[0];
} else {
	$LastMTrightaligned = FALSE;
	$LastMTrightindex   = $MAIN_TOPIC['count']-1;
	$MTCount = $MAIN_TOPIC['count'];
}
for ($x=0;$x < $MTCount ; $x++ ) { // Starte Main Topic Schleife. letzter Eintrag geht extra, da rechtsbündig
	$TOPIC = get_topic($MAIN_TOPIC[$x]['id']); // Hole alle Topicseiten der Maintopicseite Loopcounter = $x
	if ($MAIN_TOPIC[$x]['GroupPage'] == "True") {
			$iconfilename = $MAIN_TOPIC[$x]['icon'];
			If ($iconfilename != "") { // use the icon as separator
				$MyImages = $wb->SYS_PROJECT."/image_pool/";
				list($wb -> dd6iconwidth,$wb -> dd6iconheight) = getimagesize($MyImages.$iconfilename);
				$iconfilename = RegPluginImage($MyImages.$iconfilename);
				$iconfilepath = "<?php echo SENTRA_HOME;?>assets/images/".$iconfilename;
				echo '<li class="mt group"><b class="mt_icon"><img src="'.$iconfilepath.'" alt="'.$iconfilename.'" /></b></li>'.PHP_EOL;
} Else {// otherwise use the caption'
				$Content = trim(print_caption($MAIN_TOPIC[$x]));
				if ($Content == '-') {
					echo '<li class="mtdivider"></li>'.PHP_EOL;
				} else {
					echo '<li class="mtgroup">'.htmlspecialchars(print_caption($MAIN_TOPIC[$x])).'</li>'.PHP_EOL;
				}
			}
} Else {
		if ($MAIN_TOPIC[$x]['id']==$MAIN_TOPIC_ACTIVE) { // test if Main Topic is active  and highlight and generate link
			echo '<li data-pageid="'.$MAIN_TOPIC[$x]['id'].'" class="mt"><a class="xFont-Topnavi mta act" '.generate_link($MAIN_TOPIC[$x]).'>'.PHP_EOL;
		} else {
			echo '<li data-pageid="'.$MAIN_TOPIC[$x]['id'].'" class="mt"><a class="xFont-Topnavi mta" '.generate_link($MAIN_TOPIC[$x]).'>';
		}
if ($TOPIC['count']==0) { // Test if current maintopic has topics? in that case take another class for maintopic
			echo '<span>'.print_caption($MAIN_TOPIC[$x]).'</span></a></li>'.PHP_EOL;
		} else {
			If ($menulevels > 1) {
			  echo '<span class="down">'.print_caption($MAIN_TOPIC[$x]).'</span></a>'.PHP_EOL;
			} Else {
			  echo '<span>'.print_caption($MAIN_TOPIC[$x]).'</span></a></li>'.PHP_EOL;
			}
		}
		If ($menulevels > 1) {
			if ($TOPIC['count'] != 0) {// If we have a topic
		    echo '<ul class="sub css3navi toLeft">';
		    for ($x1=0;$x1<$TOPIC['count'];$x1++) {
					$SUB_TOPIC = get_sub_topic($TOPIC[$x1]['id']); // Get all subtopics under current topic
					if ($TOPIC[$x1]['GroupPage'] == "True") {
						$Content = trim(print_caption($TOPIC[$x1]));
						If ($Content == '-') {
							/* Draw a simple separator line */
							echo '<li role="separator" class="divider"></li>'.PHP_EOL;
						} Else {
							echo '<li class="group">'.htmlspecialchars($Content).'</li>'.PHP_EOL;
						}
						continue;
					}
if ($menulevels > 2 && $SUB_TOPIC['count'] != 0) { // If we have a subtopic
						if ($TOPIC[$x1]['id']==$TOPIC_ACTIVE) {
							echo '<li><a class="fly act"  '.generate_link($TOPIC[$x1]).'>';
echo print_caption($TOPIC[$x1]).'</a>'.PHP_EOL;
						} else {
							echo '<li><a class="fly" '.generate_link($TOPIC[$x1]).'>';
echo print_caption($TOPIC[$x1]).'</a>'.PHP_EOL;
						}
If ($menulevels > 2) {
							If ($SUB_TOPIC[0]['GroupPage'] == "True") {
						  	echo '<ul class="group">';
							} else {
						  	echo '<ul>';
							}
						  for ($x2=0; $x2 < $SUB_TOPIC['count']; $x2++) {
								if ($SUB_TOPIC[$x2]['GroupPage'] == "True"){
									$Content = trim(print_caption($SUB_TOPIC[$x2]));
									If ($Content == '-') {
										/* Draw a simple separator line */
										echo '<li role="separator" class="divider"></li>'.PHP_EOL;
									} Else {
										echo '<li class="group">'.htmlspecialchars($Content).'</li>'.PHP_EOL;
									}
									continue;
						    }
								if ($SUB_TOPIC[$x2]['id']==$SUB_TOPIC_ACTIVE) {
									echo '<li><a class="act" '.generate_link($SUB_TOPIC[$x2]).'>';
echo print_caption($SUB_TOPIC[$x2]).'</a></li>'.PHP_EOL;
								} else {
									echo '<li><a '.generate_link($SUB_TOPIC[$x2]).'>';
echo print_caption($SUB_TOPIC[$x2]).'</a></li>'.PHP_EOL;
								}
						  }
						  echo '</ul>	<!-- close subtopics item list -->'.PHP_EOL.'</li>';
						}
					} else {
						if ($TOPIC[$x1]['id']==$TOPIC_ACTIVE) {
						    echo '<li><a class="act"  '.generate_link($TOPIC[$x1]).'>';
echo print_caption($TOPIC[$x1]).'</a></li>'.PHP_EOL;
						} else {
						    echo '<li><a '.generate_link($TOPIC[$x1]).'>';
echo print_caption($TOPIC[$x1]).'</a></li>'.PHP_EOL;
						}
					}
				}
		    echo '</ul>	<!-- close class="sub" -->'.PHP_EOL.'</li>';
			}
		}
	}
	echo $sep; /* grafical separator */
}
$searchType = 'link';
if ($wb->SEARCH_SETTINGS['ModalSearch'] == "True") {
$searchType = 'modal';
$rightClass = '';
}
echo '		</ul>	<!-- close maintopic list items -->'.PHP_EOL;
If ($LastMTrightaligned) {
	echo '		<ul class="lastMT">	<!-- Open list for right hand aligned main topics -->'.PHP_EOL;
	if ($MAIN_TOPIC[$LastMTrightindex]['id'] == $MAIN_TOPIC_ACTIVE) { // test if Main Topic is active  and highlight and generate link
		echo '<li class="mt"><a class="xFont-Topnavi mta act" '.generate_link($MAIN_TOPIC[$LastMTrightindex]).'>'.PHP_EOL;
	} else {
		echo '<li class="mt"><a class="xFont-Topnavi mta" '.generate_link($MAIN_TOPIC[$LastMTrightindex]).'>';
	}
	echo '<span>'.print_caption($MAIN_TOPIC[$LastMTrightindex]).'</span></a></li>'.PHP_EOL;
	echo '		</ul>	<!-- Open list for right hand aligned main topics -->'.PHP_EOL;
}
If ($PageWrapperActive && !$OuterPageWrapperActive) {
	echo '	</div>		<!-- Close class="PageWrapper" -->'.PHP_EOL.
			 '</nav>	<!-- Close role="navigation" id="c279f6caef3" -->'.PHP_EOL;
}
else if (!$PageWrapperActive && $OuterPageWrapperActive) {
	echo '</nav>	<!-- Close role="navigation" id="c279f6caef3" class="PageWrapper"-->'.PHP_EOL;
}
 Else {
	echo '</nav>	<!-- Close role="navigation" id="c279f6caef3" -->'.PHP_EOL;
}
echo '';
?>
<div class="clearer"></div>
<script>$('#c279f6caef3-sln').slicknav({prependTo:'#c279f6caef3-slnc',label:'<?= GetResource("menu");?>',searchText:'<?= quote2entities($wb->SEARCH_SETTINGS["TXT"]["TXT-SearchText"])?>',autoCollapse:true,searchLink:<?= strtolower($wb->SEARCH_SETTINGS["SearchOnPage"]) ?>,searchType:'<?= $searchType ?>',fixed:true,closedSymbol:'<i class="fa fa-angle-down"></i>',openedSymbol:'<i class="fa fa-angle-up"></i>'});</script>
