<?php
if (!isset($c_languages)) $c_languages = NULL;

print "
<div class='form-row'>
	<label for='languages' class='form-label'>".LABEL_LANGUAGES."</label>
	<div class='form-cols'>
		<div class='form-col form-full'>
			<div class='form-controls'>";
if ($_SESSION['backend']['permissions']['admin']) print "<span class='form-label-link' for='languages'><a href='#' class='popup_filter' data-module='languages' data-backend-module='settings'><i class='material-icons md-24'>settings</i></a></span>";
print "
			</div><!-- /.form-controls -->
		</div><!-- /.form-col -->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->";

if ($c_languages){
	print "
<div class='form-row'>
	<label for='default_language' class='form-label'>".LABEL_DEFAULT_LANGUAGE."</label>
	<div class='form-cols'>
		<div class='form-col form-medium'>
			<div class='form-controls'>
				<select class='select' name='default_language' id='default_language'>";
	$sql_tmp = "SELECT * FROM languages ORDER BY label";
	$result_tmp = $conn->prepare($sql_tmp);
	$result_tmp->execute();
	
  print "<option value=''>...</option>";
	while ($arr_tmp = $result_tmp->fetch()){
		if ($default_language == $arr_tmp['iso']){
			print "<option value='".$arr_tmp['iso']."' selected='selected'>".id($arr_tmp['label'])."</option>";
		} else print "<option value='".$arr_tmp['iso']."'>".id($arr_tmp['label'])."</option>";
	}
	print "
				</select>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col -->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->

<hr/>";
}