<?php
/**
 * target_edit_view.php - Edit targets for a benchmark
 *
 * @author $Author: dtong $
 * @version $Id: target_edit_view.php,v 1.10 2011/04/27 05:46:26 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
	$bigk = '<font style="color:red;font-size:14px;font-weight:bold">' . lang('target_knowledge') . '</font>';
	$bigs = '<font style="color:blue;font-size:14px;font-weight:bold">' . lang('target_skill') . '</font>';
?>
<div class="tedit_body">
	<div class="tedit_title"><?php
		echo lang('target_course') . ": {$course->name}";
	?></div>
	<div class="tedit_strand"><?php
		echo lang('target_strand') . ': ' . $benchmark->strand;
	?></div>
	<div class="tedit_standard"><?php
		echo lang('target_standard') . ': ' . $benchmark->standard;
	?></div>
<?php
	if (!$this->config->item('cms_hide_benchmarks')){
		?><div class="tedit_benchmark"><?php
			echo lang('target_benchmark') . ': ' . $benchmark->data;
		?></div>
		<?php
	}
?>
	<center style="margin:0px;padding:0px">
	<div class="tedit_target_title"><?php
		echo lang('target_title') . ':';
	?></div>
	<form name="target_edit_form" style="padding:0px;margin:0px;">
	<input type="hidden" name="courseid" value="<?php echo $course->id?>" />
	<table cellspacing="0" cellpadding="0" style="margin:0px;padding:0px">
	<tr><td align="right"><?php echo lang('target_kslegends')?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
		 <td align="center"><?php echo $bigk?></td><td align="center"><?php echo $bigs?></td></tr>
	<?php
		$text_row_count = 3;
		$CI = & get_instance();
		$CI->load->library('user_agent');
		if ( strtolower($CI->agent->browser()) == 'firefox' ) {
			$text_row_count -= 1;
		}
		$empty_row_count=11;
		if ( $targets ) {
			$empty_row_count=3;
			if ( ($empty_row_count + count($targets)) < 11 ) {
				$empty_row_count = 11 - count($targets);
			}
			foreach ($targets as $target) {
				$kselect = ''; $sselect='';
				if ($target->select1 == 1) {
					$kselect = 'checked="checked"';
				}
				elseif ($target->select1 == 2) {
					$sselect = 'checked="checked"';
				}
				echo '<tr style="margin:0px;padding:0px"><td>';
				echo "<div style='margin-bottom:3px;margin-top:0px'>" .
					  "<textarea type=\"text\" name=\"curlt_{$target->id}\" cols=\"130\" rows=\"{$text_row_count}\">$target->data</textarea></div>";
				echo "</td><td><input type=\"radio\" class=\"radio\" name=\"cursel_{$target->id}\" value=\"1\" $kselect /></td>" .
					  "<td><input type=\"radio\" class=\"radio\" name=\"cursel_{$target->id}\" value=\"2\" $sselect /></td></tr>";
			}
		}
		for ($i=1; $i<=$empty_row_count; $i++) {
			echo '<tr style="margin:0px;padding:0px"><td>';
			echo "<div style='margin-bottom:3px;margin-top:0px'>" .
				  "<textarea type=\"text\" name=\"newlt_$i\" cols=\"130\" rows=\"{$text_row_count}\"></textarea></div>";
			echo "</td><td><input type=\"radio\" class=\"radio\" name=\"newsel_{$i}\" value=\"1\" /></td>" .
				  "<td><input type=\"radio\" class=\"radio\" name=\"newsel_{$i}\" value=\"2\" /></td></tr>";
		}
		$updateurl = base_url() . "course/target/update/{$course->id}/{$benchmark->id}/$type";
	?>
	</table>
	<div style="padding:5px"></div>
	<input type="button" value="<?php echo lang('target_cancel');?>"
		name="close" <?php osa_btn()?> onClick="cancelDhtml('edit_lt');" />
	<span style="padding:20px">&nbsp;</span>
	<input type="button" value="<?php echo lang('target_save');?>"
		name="save" <?php osa_btn()?>
		onClick="updateTarget('<?php echo $updateurl?>', 'target_edit_form', 'page_content', 'edit_lt')" />
	</form>
	</center>
</div>