<h1><?= ucfirst($this->site['galerie']);?></h1>
<table><tr><td>
	
<?php
	$printedgalleries = array();
	$i = 0;
	foreach($galleries as $gallery){
		$allowprint = 1;
		foreach($printedgalleries as $printedgallery){
			if($printedgallery==$gallery['idgalleries']){
				$allowprint = 0;
				break;
			}
		}
		if($allowprint){
			$printedgalleries[$i] = $gallery['idgalleries'];
			$i++;
			echo '<table><tr>';
			echo '<td>'.ucfirst($this->site['galeria']).': <b>['.$gallery['idgalleries'].']</b></td><td>'.form_open('admin/show_gallery/'.$gallery['idgalleries'].'/'.$gallery['idlanguages']).form_submit('submit', ucfirst($this->site['pokaz_zdjecia'])).form_close().'</td><td>'.form_open('admin/add_gallery_language/'.$gallery['idgalleries']).form_submit('submit', ucfirst($this->site['dodaj_wersje_jezykowa'])).form_close().'</td><td>'.form_open('admin/change_gallery_priority/'.$gallery['idgalleries']).form_input(array('name'=>'priority', 'size'=>'3', 'value'=>$gallery['showorder'])).form_submit('submit', ucfirst($this->site['ustaw'].' '.$this->site['kolejnosc'])).form_close().'</td></tr></table>';
			$have_versions = 0;
			foreach($gallery_languages as $gallery_language){	
				if($gallery_language['idgalleries']==$gallery['idgalleries']){
					$have_versions = 1;
					break;
				}
			}
			if($have_versions){
				echo '<table class="data_table"><tr class="admin_table_header"><td>';
				echo ucfirst($this->site['wyswietlana_nazwa']);
				echo '</td><td>';	
				echo ucfirst($this->site['jezyk']);
				echo '</td></tr>';
				foreach($gallery_languages as $gallery_language){	
					if($gallery_language['idgalleries']==$gallery['idgalleries']){
						echo '<tr class="data_row"><td><b>';
							echo $gallery_language['title'];
						echo '</b></td><td>';	
							echo $gallery_language['fullname'];
						echo '</td><td>';	
							echo form_open('admin/edit_gallery_language/'.$gallery_language['idgalleries_languages'].'/'.$gallery_language['idgalleries'].'/'.$gallery_language['idlanguages']).form_submit('submit', ucfirst($this->site['edytuj'])).form_close();
						echo '</td><td>';	
							echo '<input type="button" value="'.ucfirst($this->site['usun']).'" onClick="if(window.confirm(\''.ucfirst($this->site['czy_napewno_usunac']).'\')){window.location=\'/admin/delete_gallery_language/'.$gallery_language['idgalleries'].'/'.$gallery_language['idgalleries_languages'].'\';}">';			
						echo '</td></tr>';	
					}
				}
					echo '<tr><td><br/><br/></td></tr></table>';
				}	
			}
	}	
?>
</td></tr></table>