<?php
if (!isset($c_templates)) $c_templates = NULL;
if ($c_templates){
	if ($action == 'add'){
		if ((isset($_POST['submit']) && $_POST['submit'] != 'reload') OR !isset($_POST['submit'])){
			if (isset($_GET['id_template'])) $id_template = addslashes(trim(strip_tags(stripslashes($_GET['id_template']))));
		}
	}
	if (!isset($id_template)) $id_template = NULL;
	print "
<div class='form-row'>
	<label for='id_template' class='form-label'>".LABEL_TEMPLATE." ";
	if (!isset($multi_module)) print "*";
	print "</label>
	<div class='form-cols'>
		<div class='form-col form-medium'>
			<div class='form-controls'>
				<select class='select' name='id_template' id='id_template'>";
  $sql_tmp = "SELECT * FROM content_templates WHERE c_active = '1' ORDER BY sortorder";
	$result_tmp = $conn->prepare($sql_tmp);
	$result_tmp->execute();
	
  print "<option value=''>...</option>";
  while($arr_tmp = $result_tmp->fetch()){
    if($id_template == $arr_tmp['id']){
    	print "<option value='".$arr_tmp['id']."' selected='selected'>".id($arr_tmp['label'])."</option>";
    } else print "<option value='".$arr_tmp['id']."'>".id($arr_tmp['label'])."</option>";
  }
	print "
				</select>
			</div><!-- /.form-controls -->
		</div><!-- /.form-col -->
	</div><!-- /.form-cols -->
</div><!-- /.form-row -->

<hr/>";
}