<?if( isset($moderator) && $moderator):?>
<script type="text/javascript" src="/public/js/jquery_ui.js"></script>

<script type="text/javascript">

jQuery(document).ready(function($){
	// témakör szerkesztése dialóg
	$('#edit_temakor_dialog').dialog({
		autoOpen: false,
		modal: true,
		width: 560
	});
	
	
	// új témakör dialóg
	$('#new_temakor_dialog').dialog({
		autoOpen: false,
		modal: true,
		width: 560
	});
	
	
	//témakör szerkesztés
	$('.edit_anchor').click(function(){
		//populate the dialog
		var con = $('#modositas_form');
		var event = $(this).parents('.temakorcim');
		
		$('#ujnev', con).val(event.attr('temakorcime'));
		$('#tid', con).val(event.attr('tid'));
		
		//open the dialog
		$('#edit_temakor_dialog').dialog('open');
		$('div.ui-dialog-titlebar').css({'display': 'none'});
		$('div..ui-widget-content').css({'background': 'none'});
		$('div..ui-widget-content').css({'border': 'none'});
		$('div..ui-icon').css({'background': 'none'});
		
		return false;
	});
	
	// új témakör
	$('.new_anchor').click(function(){
		//open the dialog
		$('#new_temakor_dialog').dialog('open');
		$('div.ui-dialog-titlebar').css({'display': 'none'});
		$('div..ui-widget-content').css({'background': 'none'});
		$('div..ui-widget-content').css({'border': 'none'});
		$('div..ui-icon').css({'background': 'none'});
		return false;
	});
	
	$('.bezargomb').click(function(){
		$('#new_temakor_dialog').dialog('close');
		$('#edit_temakor_dialog').dialog('close');
		return false;
	});
	
});

</script>


<div class="forummodositas" style="display: none;" id="edit_temakor_dialog">
	<div class="forumpopuptop"></div>
	<div class="forumpopup">
		<h2><?=lang('forum_temakoratnev')?></h2>
		<form action="/forum/tkatnevez" method="post" id="modositas_form">
		<input type="hidden" name="atnevez" id="atnevez" value="true" />
		<input type="hidden" name="tid" id="tid" value="" />
		<input type="text" style="width: 475px; margin-bottom: 10px;" name="ujnev" id="ujnev" value=""/>
		<div style="text-align: right;">
		<input type="submit" value="OK" class="ngomb" style="width: 120px; background: url('/public/img/forum/stilus/button_normal.png');" />
		<button class="bezargomb megsem" style="width: 120px; background: url('/public/img/forum/stilus/button_grey.png');">
			<?=lang('forum_megsem')?>
		</button>
		</div>
		</form>
	</div>
	<div class="forumpopupbottom"></div>
</div>


<div class="forummodositas" style="display: none;" id="new_temakor_dialog">
	<div class="forumpopuptop"></div>
	<div class="forumpopup">
		<h2><?=lang('forum_ujtemakornyit')?></h2>
		<form action="/forum/ujtemakor" method="post" id="uj_form">
		<input type="hidden" name="nyit" id="nyit" value="true" />
		<input type="text" style="width: 475px; margin-bottom: 10px;" name="temacim" id="temacim" /><br />
		<div style="text-align: right;">
		<input type="submit" value="OK" class="ngomb" style="width: 120px; background: url('/public/img/forum/stilus/button_normal.png');" />
		<button class="bezargomb megsem" class="megsem" style="width: 120px; background: url('/public/img/forum/stilus/button_grey.png');">
			<?=lang('forum_megsem')?>
		</button>
		</div>
		</form>
	</div>
	<div class="forumpopupbottom"></div>
</div>

<?endif;?>


<?if( $this->uri->segment(2) != "temakorok" ):?>
<div class="fweltop"></div>
<div class="fwel">
	<?if(hun()):?>
	<?=$this->mpages->get_row(558)->page_body;?>
	<?else:?>
	<?=$this->mpages->get_row(557)->page_body;?>
	<?endif;?>
</div>
<div class="fwelbottom"></div>
<?endif;?>


<div class="temaktop"></div>
<div class="temak" style="background: url('/public/img/forum/stilus/box_main_forum_sprite.png') repeat-y scroll -1604px 0;">
<h2 class='forumh2'><?=lang('forum_topics')?></h2>
<?php
	$tomb = $this->phpsession->get('fuser');?>
	
	<?if( isset($moderator) && $moderator):?>
		<div class="gombst new_anchor" style="float: right; background: url('/public/img/forum/stilus/button_new.png'); width: 100px; padding-left: 15px; cursor: pointer;">
			<?=lang('forum_ujtemakor')?>
		</div>
	<?endif;?>
	<div class="clear"></div>
	
	<?if($temak):?>
	<?$this->load->view("forum/temakorlapozas")?>
	
	<div style="padding-left: 10px;">
	<table>
		<tr>
		<th style="padding-left: 8px;"><?=lang('forum_topic_title')?></th>
		<th width="70px" align="center"><?=lang('forum_temak')?></th>
		<th width="160px" align="center"><?=lang('forum_uthsz')?></th>
		<?if( isset($moderator) && $moderator):?>
		<th align="center" width="50px">&nbsp;</th>
		<?endif;?>
		</tr>
<?	
	
	// témakörök
	foreach($temak as $tema){
		?>
		<tr>
			<td style="border-left: 1px solid #5d5d5d;">
				<h2 style="margin-bottom: 0px; padding: 0px;"><a href="/forum/temak/<?=$tema->temakor_id?>" title="<?=$tema->cim?>" ><?=$tema->cim?></a></h2>
				<span class="tdalso"><?=lang('forum_letrehoz')?>: <?=$tema->megnyito?></span>
			</td>
			<td align="center">
				<span style="font-size: 1.3em;"><strong><?=$tema->szam?></strong></span>
			</td>
			<td>
				<?
				$ido = time() - strtotime($tema->datum);
				if($ido < 60){
					$ido = '0 '.lang('forum_perce1');
					
				}elseif($ido < 60*60){
					$x = round($ido/60);
					if($x == 1) $ido = $x.' '.lang('forum_perce1');
					else $ido = $x.' '.lang('forum_perce');
					
				}elseif($ido < 60*60*24){
					$x = round($ido/(60*60));
					if($x == 1) $ido = $x.' '.lang('forum_oraja1');
					else $ido = $x.' '.lang('forum_oraja');
					
				}elseif($ido < 60*60*24*7){
					$x = round($ido/(60*60*24));
					if($x == 1) $ido = $x.' '.lang('forum_napja1');
					else $ido = $x.' '.lang('forum_napja');
					
				}elseif($ido < 60*60*24*28){
					$x = round($ido/(60*60*24*7));
					if($x == 1) $ido = $x.' '.lang('forum_hete1');
					else $ido = $x.' '.lang('forum_hete');
					
				}elseif($ido < 60*60*24*365){
					$x = round($ido/(60*60*24*28));
					if($x == 1) $ido = $x.' '.lang('forum_honapja1');
					else $ido = $x.' '.lang('forum_honapja');
					
				}else{
					$x = round($ido/(60*60*24*365));
					if($x == 1) $ido = $x.' '.lang('forum_eve1');
					$ido = $x.' '.lang('forum_eve');
				}
				
				if($tema->datum=="2010-01-01 10:10:10")
					$ido = "-";
				?>
				
				<?=$ido?><br />
				<span class="tdalso"><?=$tema->utolsouser?></span>
			</td>
		<?if( isset($moderator) && $moderator):?>
		<td>
			<a style="cursor: pointer; margin-right: 15px;" onclick="if(confirm('<?=lang('forum_torlesmegerosites')?>')){window.location.href='http://<?=$_SERVER['SERVER_NAME']?>/forum/temakortorol/<?=$tema->temakor_id?>'} else{};"><img src="/public/img/forum/stilus/icon_delete.png" alt="<?=lang('forum_torles')?>" title="<?=lang('forum_torles')?>" /></a>
			<span class="temakorcim" temakorcime="<?=$tema->cim?>" tid="<?=$tema->temakor_id?>">
			<a href="/forum/tkatnevez/<?=$tema->temakor_id?>" class="edit_anchor" event_id="<?=$tema->temakor_id?>">
				<img src="/public/img/forum/stilus/icon_edit.png" alt="<?=lang('forum_atnevez')?>" title="<?=lang('forum_atnevez')?>">
			</a>
			</span>
		</td>
		<?endif;?>
		</tr>
		<? } ?>
	</table>
	</div>
	<?$this->load->view("forum/temakorlapozas")?>
	
	<?else:?>
		<b><?=lang('forum_nincstemakor')?></b>
	<?endif;?>
	
</div>
<div class="temakbottom"></div>
