<?php global $module_settings, $news_database, $page_info, $user_data; ?>

<?php if($module_settings['list-news']['mode'] == 'archive') { ?>
	<div class="container">
	    <ol class="news-pages-years">
	    <?php foreach($module_settings["list-news"]['news archive'] as $year => $month) { ?>
	    	<li class="year">
	    		<strong class="year <?php if(get_url_value('year') == $year) echo 'active'; ?>"><?php echo $year; ?></strong>
	    		
	    		<ol class="news-pages-months <?php if(get_url_value('year') == $year) echo 'active'; ?>">
	    		<?php foreach($month as $month_entry) { ?>
	    			<li class="month <?php if(get_url_value('year') == $year && get_url_value('month') == $month_entry->month) echo 'active'; ?>">
	    				<a href="<?php echo $module_settings["list-news"]["archive page"]; ?>/year/<?php echo $month_entry->year; ?>/month/<?php echo $month_entry->month; ?>/"><?php echo translate_keyword('month: ' . $month_entry->month); ?></a>
	    			</li>
	    		<?php } ?>
	    		</ol>
	    	</li>
	    <?php } ?>
	    </ol>
	</div>
<?php } ?>



<?php if($module_settings['list-news']['mode'] == 'latest') { ?>
	<div class="container">
		<h4><?php echo txt('list-news', 'Neuigkeiten'); ?></h4><br>
	
	    <ol class="news-pages-latest">
	    <?php foreach($module_settings['list-news']['latest pages'] as $page_entry) { ?>
	    	<li class="<?php if($page_info->alias == strval($page_entry->alias)) echo 'active'; ?>">
	    		<a href="<?php echo $system_data['frontend']['href attribute'] . $page_entry->alias; ?>"><?php echo $page_entry->title; ?></a>
	    	</li>
	    <?php } ?>
	    </ol>
	</div>
<?php } ?>



<?php if($module_settings['list-news']['mode'] == 'topics') { ?>
	<div class="container">
		<h4><?php echo txt('list-news', 'Themen'); ?></h4><br>
	
	    <ol class="news-pages-topics">
	    <?php foreach($module_settings['list-news']['topics'] as $topic_entry) if($topic_entry->pages != 0) { ?>
	    	<li class="<?php if(get_url_value('topic') == $topic_entry->id || strval($page_info->topic) == $topic_entry->title) echo 'active'; ?>">
	    		<a href="<?php echo $module_settings["list-news"]["archive page"]; ?>/topic/<?php echo $topic_entry->id; ?>/"><?php echo $topic_entry->title; ?></a> <span class="posts">(<?php echo $topic_entry->pages; ?>)</span>
	    	</li>
	    <?php } ?>
	    </ol>
	</div>
<?php } ?>



<?php if($module_settings['list-news']['mode'] == 'pages') { ?>
    <?php foreach($module_settings['list-news']['latest pages'] as $page_entry) { ?>
		<div class="list-news-page">
			<?php if($module_settings["list-news"]["show date"] == 1 || $module_settings["list-news"]["show author"] == 1) { ?>
				<p class="meta">
					<small>
						<?php echo txt('list-news', 'Geschrieben'); ?> 
						<?php if($module_settings["list-news"]["show date"] == 1) echo txt('list-news', 'am') . ' ' . date($user_data["date format print"], intval($page_entry->timestamp)); ?> 
						<?php if($module_settings["list-news"]["show author"] == 1) echo txt('list-news', 'von') . ' ' . $page_entry->author; ?>
					</small>
				</p>
			<?php } ?>

			<h2 class="headline"><a href="<?php echo $system_data['frontend']['href attribute'] . $page_entry->alias; ?>"><?php echo $page_entry->title; ?></a></h2>
			
			<div class="content">
				<?php echo $module_settings["list-news"]["show teaser"] == 0 || empty($page_entry->teaser) ? $page_entry->content : $page_entry->teaser; ?>
			</div>
			
			<p class="more"><a href="<?php echo $system_data['frontend']['href attribute'] . $page_entry->alias; ?>"><?php echo txt('list-news', 'Seite anzeigen'); ?></a></p>
		</div>
	<?php } ?>
<?php } ?>
