<?php include 'en/admin/_adminheader.php'; ?>
<h2>Resources Page: Edit a Tools for Personal Category</h2>
<form action='/admin/resources.php' method='post' enctype="multipart/form-data">
	<fieldset id='cat_info'>
		<legend> Category Information</legend>
		<input type='hidden' name='what' value='toolsforpersonal' id='what' />
		<input type='hidden' name='do' value='doeditcat' id='do' />
		<input type='hidden' name='which' value='<?php echo $this->data['category']['id'] ?>' id='which' />
		<div class='field'>
			<label for='subcategoryof'>Sub-category of</label>
			<select id='subcategoryof' name='subcategoryof'>
					<option value='0'>None</option>
				<?php foreach($this->data['categories'] as $cat): ?>
					<?php if((string)$cat->name == (string)$this->data['category']->name): continue; endif; ?>
					<option value='<?php echo $cat['id'] ?>'
						<?php if((int)$cat['id'] == (int)$this->data['category']->subcategoryof): echo "selected='select'"; endif; ?>>
						<?php echo $cat->name ?>
					</option>
				<?php endforeach; ?>
			</select>
		</div>
		<div class='field'>
			<label for='name'>Name of category</label>
			<input type='text' name='name' id='name' value='<?php echo $this->data['category']->name ?>'/>
		</div>
		<div>
		<input type='button' value='Cancel' onClick='document.location="/admin/resources.php?what=toolsforpersonal"' />
				<input type='submit' value='Edit Category' />
		</div>
	</fieldset>
</form>
