<?php
/**
 * outcomes_skills_add_view.php - outcomes and skills
 *
 * @author $Author: samarth $
 * @version $Id: outcomes_skills_add_view.php,v 1.6 2010/06/09 09:13:20 samarth Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
 * /*

<input type="text" name="descid" value="<?php @osa_echo($descobj->id);?>">
<input type="text" name="editorid" value="<?php @osa_echo($editorids);?>">

*/
?>

<?php
	$lang_outcomes      = lang('outcomes_column_outcomes');
	$lang_skills        = lang('outcomes_column_skills');
	$lang_save_button   = lang('outcomes_button_save');
	$lang_cancel_button = lang('outcomes_button_cancel');
	$lang_remove_button = lang('outcomes_button_remove');
	$lang_confirm_remove= lang('outcomes_confirm_remove');

	$onClick = "onClick='alert(\" $lang_save_button \"); return FALSE;'";

	$last_outcomes= '';

	if (isset($textarea_cols))
		$textarea_cols = "style='width:$input_width'";//"cols='$textarea_cols'";
	if (isset($textarea_rows))
		$textarea_rows = "rows='$textarea_rows'";
	if (isset($input_height))
		$input_height  = "height:$input_height;";
	else
		$input_height  = '';
	if (isset($input_width))
		$input_width   = "style='$input_height width:$input_width'";

?>

<div class="outcomes_skills_title" ><?php echo lang('outcomes_title'); ?></div>
<form name='form_outcomes_skills' method="post">
<input type="hidden" name="courseid"   value="<?php @osa_echo($courseid);?>">
<input type="hidden" name="outcomesid" value="<?php @osa_echo($outcomesid);?>">
<?php
	//$inc_rows = 2;
	$skill_rows = $this->config->item('cms_outcomes_skills_input_rows');
	if ($outcomes !== FALSE) {
		$last_outcomes = $outcomes[0]->outcomes;
		//$skill_rows    = count($outcomes);
		foreach ($outcomes as $value){
			if($value->skillsid != FALSE){
				$count    = count($outcomes);
				$skill_rows = $this->config->item('cms_course_outcomes_inc_rows');
				$skill_rows +=  $count ;
				break;
			}
		}
	}

	


	echo "<table class='outcomes_skills_table_addedit'  >";
	echo "<tr><td ><div class='outcomes_skills_label'>$lang_outcomes</div></td></tr>";

	echo "<tr><td ><div class='outcomes_skills_input'>";
	echo "<textarea id='outcomes' name='outcomes' class='outcomes_skills_textarea' $textarea_cols $textarea_rows >$last_outcomes</textarea>";
	echo "</div></td></tr>";

	echo "<tr><td class='course_outcomes_sep'></td></tr>";
	echo "<tr><td ><div class='outcomes_skills_label'>$lang_skills</div></td></tr>";
	for ($i=0; $i < $skill_rows; $i++) {

		$value = '';
		if ($outcomes !== FALSE && $i < $skill_rows ) {
			$skills='';
			if (isset($outcomes[$i]->skills))
				$skills = $outcomes[$i]->skills;
			$value  = 'value="'.htmlspecialchars($skills).'"';
		}

		if (isset($outcomes[$i]->skillsid))
			$id = "skill_edit_".$outcomes[$i]->skillsid;
		else
			$id = "skill_add_".$i;

		echo "<tr><td><div class='outcomes_skills_input'>";

		echo "<input type='text' id='$id' name='$id' $input_width $value />";

		echo "</div></td></tr>";
	}

	echo "</table>";
?>

<div class="outcomes_skills_left" >
	<div class="outcomes_skills_button_padding" ></div>

    <input type="button" value="<?php echo $lang_cancel_button ?>" <?php osa_btn();?>
             	onClick="return cancelInput('page_content', '<?php echo base_url() . $cancel_link . $courseid ?>');" />

	<span class="outcomes_skills_button_span" ></span>

    <input type="button" value="<?php echo $lang_save_button; ?>" id="B1" <?php osa_btn();?>
           onClick="updateUnit('form_outcomes_skills','<?php echo base_url() . $save_link?>','<?php echo $courseid?>'); return false;" />

    <span class="outcomes_skills_button_span" ></span>

    <?php
    if ($outcomesid != FALSE) {
    	$remove_url    = $remove_link.$courseid.'/'.$outcomesid;
    	$remove_click  = "onClick=\"return delTarget('$remove_url','page_content','$lang_confirm_remove');\"";
    ?>
        <input type="button" value="<?php echo $lang_remove_button; ?>" id="B1" <?php osa_btn();?>
        <?php echo $remove_click; ?>" />
    <?php
    }
    ?>
</div>

</form>