<?php
/**
 * course_lt_link_view.php - Unit Copy
 *
 * @author $Author: dtong $
 * @version $Id: course_lt_link_view.php,v 1.8 2011/05/09 11:27:45 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
 */

$imgadd     = osa_imagepath() . 'forward.gif';
$imgdelete	= osa_imagepath() . 'deletes.gif';
$imgdis     = osa_imagepath() . 'dis_right.gif';
$img_del  	= "<img src='$imgdelete' title='" . lang('outcomes_course_lnk_deletecourse') . "'  border='0' />";
$img_dis  	= "<img src='$imgdis'    title='" . lang('unit_copy_selectreminder') . "' border='0' />";
$formname = 'course_lnk_form';
?>
<div id='dhtmlwin_lt'>
<form method="POST" name="<?php echo $formname; ?>">
<div class="course_lnk_input_title"><?php
	if ( osa_flag_use_lt() ) {
		echo lang('outcomes_course_lnk_title_lt');
	}
	else {
		echo lang('outcomes_course_lnk_title_os');
	}
?>
</div>
<div class="course_lnk_input_coursename"><?php echo $coursename;  ?></div>
<input type="hidden" value='<?php echo $course_select;?>'
	name='txt_courseids' />
<center>
<table width="96%" border="0">
	<tr>
		<td class="unitcopy_course_sourse" valign="top">
		<div class="unitcopy_sourse"><span class="user_course_title"><?php echo lang('outcomes_course_lnk_select_course'); ?></span>
		<?php
		if (isset($course_desc) && $course_desc!=FALSE && is_array($course_desc)) {
			$fieldname  = 'courseids[]';
			//$button  = "change_button('img_button', '$imgadd', '" . lang('outcomes_course_lnk_addcourse') . "','','resource_form'); ";
			$button  = "change_button('img_button', '$imgadd', '" . lang('outcomes_course_lnk_addcourse') . "','{$href_select}','$formname','dhtmlwin_lt');return false; ";
			$jscript = "onChange=\"$button \"";
			echo form_dropdown($fieldname, $course_desc,'',"size='20' style='width:300px' multiple='multiple'\" $jscript ");
		}
		?></div>
		</td>
		<td class="unitcopy_unit_sourse" valign="middle" align="center"><?php
		//$jscript_add = "onClick=\"course_lnk('img_button', '$imgadd', '" . lang('outcomes_course_lnk_addcourse') . "','$href_select','$formname');return false; \"";
		?>
		<div id="img_add" style="margin-top: 30px"><span id="img_button"><?php echo $img_dis ?></span>
		</div>
		</td>
		<td class="unitcopy_unit_result" valign="middle">
		<div class="user_course_title"><?php echo lang('outcomes_course_lnk_result_course') ;?></div>
		<table class="user_course_table" border=0>
			<tr>
				<th class="user_course_table_header"><?php echo '' ?></th>
				<th class="user_course_table_header"></th>
			</tr>
			<?php
			$swap='';
			if (isset($course_result) && is_array($course_result)) {
				foreach ($course_result as $row) {
					if ($swap  == '') {
						$tr_class = "table_body_row";
						$swap = '_none';
					}
					else {
						$tr_class = "table_body_row_none";
						$swap = '';
					}
					?>

			<tr class="<?php echo $tr_class; ?>">
				<td class="user_course_col_header_Name"><?php echo $row->coursename ; ?></td>
				<?php
				$href=$href_select.$row->courseid;
				$jscript_del = "onClick=\"if (confirm('" . lang('outcomes_course_lnk_message') .
									"')) {  ajaxPostform('dhtmlwin_lt','{$href}','$formname', false);return false;}\"";
				?>
				<td class="user_course_col_header_del"><a <?php echo $jscript_del ?>><?php echo $img_del ?></a>
				</td>
			</tr>
			<?php
				}
			}
			?>
		</table>
		<div style="margin-bottom: 15px;">&nbsp;</div>
		</td>

	</tr>
	<tr>
		<td>
		<div class="user_course_footer"><?php
			if ( osa_flag_use_lt() ) {
				echo lang('outcomes_course_lnk_footer_lt');
			}
			else {
				echo lang('outcomes_course_lnk_footer_os');
			}
		?></div>
		</td>
	</tr>
</table>
<input type="button"
	value="<?php echo lang('outcomes_button_cancel'); ?>" name="cancel"
	<?php osa_btn()?> onClick="cancelDhtml('course_input');return false;" />

<span style="margin-left: 30px">&nbsp;</span> <input type="button"
	value="<?php echo lang('outcomes_button_save'); ?>" name="save"
	<?php osa_btn()?>
	onClick="submitDhtml('<?php echo $href_save; ?>','<?php echo $formname; ?>',
               '<?php echo $href_refresh; ?>','page_content','course_input');return false;" />

</center>
</form>
</div>
