<?php
if (!isset($sortorder)) $sortorder = NULL;
if (!isset($c_active)) $c_active = NULL;
if ($action == 'add' && !$c_active) $c_active = 1;
print "
<div class='container popup'>";
include('includes/form/alert.php');
print "
	<form action='".$_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING']."' method='post' enctype='multipart/form-data'>
		<input type='hidden' name='csrf_token' value='".htmlspecialchars(csrf_token())."'>
		<input type='hidden' name='update' value='1' />";

if (isset($update_parent) && $update_parent === true) print "<input type='hidden' id='update_parent' name='update_parent' value='1' />";

if (isset($category_data) && is_array($category_data)){
	foreach ($category_data AS $key => $value){
		print "
<input type='hidden' name='category_data[".$key."][language]' value='".$value['language']."' />
<input type='hidden' name='category_data[".$key."][title]' value='".$value['title']."' />";
	}
}
print "
		<ul class='tabs toggle'>
			<li class='current'>
				<a href='#' title='".LABEL_DATA."' data-id='data'><i class='material-icons md-24'>edit</i>".LABEL_DATA."</a>
			</li>
		</ul>
		
		<div class='quick-action'>";
if (isset($id) && $id) print "<span class='id'>#".$id."</span>";
print "
		</div><!-- /.quick-action -->
		
		<div class='form' data-id='data'>
			<div class='form-content'>";

include('includes/form/sortorder.php');

include('form/category_title.php');

include('form/category.php');

include('includes/form/error.php');
include('includes/form/c_active.php');

print "
				<div class='form-action'>
					<button type='submit' class='btn save' name='submit' title='".LABEL_SAVE."'><i class='material-icons md-24'>save_alt</i>".LABEL_SAVE."</button>
				</div><!-- /.form-action -->
				
			</div><!-- /.form-content -->
		</div><!-- /.form -->	
	</form>
	
</div><!-- /.container -->";