<?php
if (isset($fields) && is_array($fields)){
	foreach ($fields AS $key => $value){
		if (defined('LABEL_ENCRYPT_'.strtoupper($key))) $title_str = constant('LABEL_ENCRYPT_'.strtoupper($key));
		else $title_str = ucwords(str_replace("_", " ", $key));
		
		print "
<div class='form-row'>
	<label for='fields[".$key."][c_hash]' class='form-label'>".$title_str."</label>
	<div class='form-cols'>
		<div class='form-col'>
			<div class='form-controls'>";
		if ($value['c_hash']){
			print "
				<input type='checkbox' class='field' id='fields[".$key."][c_hash]' name='fields[".$key."][c_hash]' value='1' checked='checked'>";
		} else {
			print "
				<input type='checkbox' class='field' id='fields[".$key."][c_hash]' name='fields[".$key."][c_hash]' value='1'>";
		}
		print "
				<label for='fields[".$key."][c_hash]' class='form-label-after'>".LABEL_ENCRYPT."</label>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col-->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->";

		if (isset($value['plain']) && $value['plain']){
			print "
<div class='form-row'>
	<label for='fields[".$key."][c_plain]' class='form-label'></label>
	<div class='form-cols'>
		<div class='form-col'>
			<div class='form-controls'>";
			if ($value['c_plain']){
				print "
				<input type='checkbox' class='field' id='fields[".$key."][c_plain]' name='fields[".$key."][c_plain]' value='1' checked='checked'>";
			} else {
				print "
				<input type='checkbox' class='field' id='fields[".$key."][c_plain]' name='fields[".$key."][c_plain]' value='1'>";
			}
			print "
				<label for='fields[".$key."][c_plain]' class='form-label-after'>".LABEL_PLAIN."</label>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col-->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->";
			}
			
			print "<hr />";

		}
		 
		$ini_path = "config/".$module_name."_encrypt.ini";
		
		if (file_exists($ini_path)){
			print "
<div class='form-row'>
	<label for='c_rotation' class='form-label'>".LABEL_ROTATION."</label>
	<div class='form-cols'>
		<div class='form-col'>
			<div class='form-controls'>
				<input type='checkbox' class='field' id='c_rotation' name='c_rotation' value='1'>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col-->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->

<div class='form-row'>
	<label for='c_decrypt' class='form-label'>".LABEL_DECRYPT."</label>
	<div class='form-cols'>
		<div class='form-col'>
			<div class='form-controls'>
				<input type='checkbox' class='field' id='c_decrypt' name='c_decrypt' value='1'>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col-->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->

<hr />";
		} else {
			print "
<div class='form-row'>
	<label for='c_encrypt' class='form-label'>".LABEL_ENCRYPT."</label>
	<div class='form-cols'>
		<div class='form-col'>
			<div class='form-controls'>
				<input type='checkbox' class='field' id='c_encrypt' name='c_encrypt' value='1' checked='checked'>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col-->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->

<hr />";
	}
}
