<?php
 	/**
 * strand_input_view.php - strand Edit file
 *
 * @author $Author: dtong $
 * @version $Id: strand_input_view.php,v 1.17 2011/05/09 12:33:17 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/

	$href   = base_url();
	$refresh= base_url().$page.'/refresh/'.$selectlistitem.'/'.$type.'/'.'0'.'/'.$dep_schid.'/'.$filter;
	$page   = base_url().$page;
	$imgreq	    = 'req.gif';
	$img_req  	= "<img src=". osa_imagepath() . "$imgreq    title='Required field'   alt='Required field'    border='0' >";

	$mode = CMS_ADMIN_UPDATE;
	if ( $action == CMS_ACTION_ADD ) {
	 	$row->id = '';
	 	$row->importid = '';
	 	$row->data = '';
	 	$row->enabled = '1';
	 	$row->importid = '';
	 	$mode = CMS_ADMIN_INSERT;
	}
	elseif ( $action == CMS_ACTION_EDIT ) {
	 	if ( isset($data)==FALSE || count($data) == 0 )  {
			echo lang('admin_strand_error_nodata');
			return;
		}
		$row = $data[0];
	}
	else {
	 	return;
	}
	$mode = $page.'/'.$mode;

?>


<form method="POST" action= "<?php echo $href; ?>admin/strand/update" name="strand_form" >
<input type="hidden" id="id" name="id" size="30" value="<?php   echo $row->id; ?>" />
<input type="hidden" id="type" name="type" size="30" value="<?php   echo $type; ?>" />
<center>
<div class="user_title"><?php echo $selected_display; ?></div>
<div id="div_strnd" class="strand_table">

<?php
if (isset($schoolflag) && $schoolflag != FALSE){
?>
<div id="div_school" >
	<table class="strand_table_edit"  >
		<tr >
		<td class="field_req" ><?php echo lang('admin_strand_col_school'); ?><?php echo $img_req; ?></td>
		<td class="strand_text_left" >
 		<?php
 			echo form_dropdown("schoolid", $school, $selected_school, "size=1");
		?>
		</td>
		</tr>
	</table>
</div>
<?php
}
?>

<?php
if ($type==CMS_LEARNING_TARGETS_TYPE){
	?>
<div id="div_department" >
	<table class="strand_table_edit"  >
		<tr>
		<td class="field_req" ><?php echo lang('admin_strand_col_department'); ?><?php echo $img_req; ?></td>
		<td class="strand_text_left" >
	 	<?php
	    	echo form_dropdown("departmentid", $department, $selected_dep, "size=1");
		?>
		</td>
		</tr>
	</table>
</div>
<?php
}
?>

<div id="div_data" >
	<table class="strand_table_edit"  >
		<tr >
		<td class="field_req" ><?php echo lang('admin_strand_col_data'); ?><?php echo $img_req; ?></td>
		<td class="strand_text_left" >
			<TEXTAREA id="strand_col_data"  NAME="data" COLS="60" ROWS="10" ><?php   echo $row->data; ?></TEXTAREA>
		</td>
		</tr>
		<?php if ( isset($show_importid) && $show_importid ) { ?>
		<tr>
		<td>
			<?php echo lang('admin_strand_sort_number');?>
		</td>
		<td>
			<input type="text" name="importid" size="18" maxlength="20" value="<?php echo $row->importid;?>" />
			<?php
				echo lang('admin_strand_sort_number_eg');
				echo '<div style="font-style:italic;font-size:10px">' . lang('admin_strand_sort_number_desc') . '</div>';
			?>
		</td>
		</tr>
		<?php } ?>
	</table>
</div>

<div id="div_enabled" >
	<table class="strand_table_edit"  >
		<tr >
		<td class="strand_edit_left" ><?php echo lang('admin_strand_col_enabled'); ?></td>
		<td class="strand_text_left" >
		<?php
		$checked="";
		if ($row->enabled =='1')
		$checked='checked';
		?>
		<input type="checkbox"  name="enabled" <?php  echo $checked; ?>  />
		</tr>
	</table>
</div>

</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 class="reswin_buttons">
		<input type="button" value="<?php echo lang('admin_btn_cancel'); ?>" name="cancel" <?php osa_btn()?>
		onClick="cancelDhtml('strand_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; ?>','strand_form','<?php echo $refresh; ?>','page_content','strand_input');return false;" />
</div>
<br />
</form>