<?php
/**
 * category_input_view.php - add/edit category
 *
 * @author $Author: wichai $
 * @version $Id: category_input_view.php,v 1.2 2011/03/09 12:01:00 wichai Exp $
 * @copyright Copyright (c) 2011, Tiller Software Co., Ltd.
*/
?>
<div style="text-align: center;">
<form method="POST" name="category_form" action="<?php echo $mode; ?>" >
<?php
	echo form_hidden('id', $category_id);
	if ( $action == CMS_ADMIN_ADD ) {
		echo form_hidden('enabled', $checked);
	}
?>
<div class="category_title"><?php echo $title ?></div>
<div class="category_table">
	<div id="category_name">
		<table class="category_table_edit" >
				<tr >
					<td class="category_field field_required" ><?php echo lang('admin_category_column_name'); ?></td>
					<td class="category_text_left" >
					<?php
						$categoryname_array = array('id' => 'name', 'name' => 'name' , 'size' => '30', 'value' => $category_name);
						echo form_input($categoryname_array);
					?>
					</td>
				</tr>
			</table>
	</div>
	<div id="category_mingrade">
			<table class="category_table_edit" >
				<tr >
					<td class="category_field field_required" ><?php echo lang('admin_category_column_mingrade'); ?></td>
					<td class="category_text_left" >
					<?php
						echo form_dropdown('mingradeid', $all_grades, $selected_gmin_dropdown);
					?>
					</td>
				</tr>
			</table>
	</div>
	<div id="category_maxgrade">
			<table class="category_table_edit" >
				<tr >
					<td class="category_field field_required" ><?php echo lang('admin_category_column_maxgrade'); ?></td>
					<td class="category_text_left" >
					<?php
						echo form_dropdown('maxgradeid', $all_grades, $selected_gmax_dropdown);
					?>
					</td>
				</tr>
			</table>
	</div>
	<div id="category_sort">
			<table class="category_table_edit" >
				<tr >
					<td class="category_field field_required" ><?php echo lang('admin_category_column_sort'); ?></td>
					<td class="category_text_left" >
					<?php
						$categorysort_array = array('id' => 'sort', 'name' => 'sort' , 'size' => '3', 'value' => $sort );
						echo form_input($categorysort_array);
					?>
					</td>
				</tr>
			</table>
	</div>
	<div id="category_department">
			<table class="category_table_edit" >
				<tr >
					<td class="category_field"><?php echo lang('admin_category_column_department'); ?></td>
					<td class="category_text_left" >
					<?php
						// multi select: the name of the field will need to use POST array syntax.
						echo form_multiselect('dapartmentid[]', $all_dapartments, $selected_department, "size='18' style='width:300px'");
					?>
					</td>
				</tr>
			</table>
	</div>
	<?php if ($action == CMS_ADMIN_EDIT) { ?>
	<div id="category_enabled">
			<table class="category_table_edit" >
				<tr >
					<td class="category_field" ><?php echo lang('admin_category_column_enabled'); ?></td>
					<td class="category_text_left" >
						<?php echo form_checkbox('enabled', 'accept', $checked); ?>
					</td>
				</tr>
			</table>
	</div>
	<?php }?>
</div>
<span class="admin_req" style="color:red"><?php echo lang('admin_red'); ?></span>
<span class="admin_req"><?php echo lang('admin_req'); ?></span>
<center><div style="width:85%; font-size:10px;"><?php echo lang('admin_category_note_no_department')?></div></center>
<div class="reswin_buttons">
	<input type="button" value="<?php echo lang('admin_btn_cancel'); ?>" name="cancel" <?php osa_btn()?> onClick="cancelDhtml('category_input'); return false;" />
	<span style="margin-left:30px">&nbsp;</span>
	<input type="button" value="<?php echo lang('admin_btn_save'); ?>" name="save" <?php osa_btn()?> onClick="submitDhtml('<?php echo $mode; ?>','category_form','<?php echo $refresh_link; ?>','page_content','category_input'); return false;" />
</div>
</form>
</div>