<?php
 	/**
 * course_editer_view.php - course_editer file
 *
 * @author $Author: dtong $
 * @version $Id: course_editer_view.php,v 1.13 2011/04/27 05:46:26 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/

$href 			= osa_imagepath();
$imgdis     	= 'dis_right.gif';
$imgsave		= $href.'forward.gif';
$imgdelete		= 'deletes.gif';
$img_save   	= "<img src=". $href. "$imgdis  title='".lang('desc_course_editer_disable')."' border='0' >";
$img_del  		= "<img src=". $href. "$imgdelete    title='Delete'    border='0' >";
$href_save 		= base_url().'course/desc/add_course_editor/'.$courseid;
if ($single_editor!== FALSE)
$href_save 		= base_url().'course/desc/add_course_editor/'.$courseid.'/'.TRUE;
$href_del 		= base_url().'course/desc/del_course_editor/'.$courseid.'/';
$href_refresh   = base_url().'course/desc/course_editor/'.$courseid.'/'.$descid;

$href_descid 	= base_url().'/course/desc/index/'.$courseid;
if ($descid!='')
$href_descid 	= base_url().'/course/desc/edit/'.$descid;

$user_course_col_name ='';
$user_course_name	  ='';
$seleteuser           =lang('desc_course_editer_seleteuser');
$resultuser           =lang('desc_course_editer_resultuser');

$href = base_url();
$cource_editor_deletemsg = lang('desc_course_editor_deletemsg');
$form_name = 'resource_form';
?>


<form method="POST" name="<?php echo $form_name; ?>" >
<center>

<input type="hidden" id="type" name="type" size="30" value="<?php   echo $descid; ?>" />
<div id='dhtmlwin_resource'>
<div class="user_course_head"><?php echo lang('desc_course_editer_head'); ?></div>
<br />
<div class="user_course_coursename"><?php echo $user_course_name; ?> <?php echo $coursename; ?></div>

<br/>

<table class="user_course_table" border=0>
<tr >
<td class="user_course_dropdownlist" valign=top> <div class="user_course_title"><?php echo $seleteuser; ?></div>

<?php
	if (isset($user) && is_array($user)) {
		$fieldname  = 'data[][userid]';
		$button  = "change_button('img_button', '$imgsave', '" . lang('desc_course_editer_assign') . "','','$form_name');return false;";
		$jscript = "onChange=\"$button\"";

		$multiple = "multiple='multiple'";
		if ($single_editor!== FALSE) {
			$multiple ="";
		}
		echo form_dropdown($fieldname, $user,'',"size='23' $multiple $jscript");
	}
?>
</td>

<?php
$jscript_add = "onClick=\"course_editor('$href_save','$href_refresh','$href_descid', '$form_name','$descid');return false;\"";
?>

<td class="user_course_image" valign=top>
<div id="img_add" >
<a id="add" name="add" <?php echo $jscript_add ?> ><span id="img_button" ><?php echo $img_save ?></span></a>
</div>
</td>

<td class="user_course_data"  valign=top><div class="user_course_title"><?php echo $resultuser; ?></div>
<table class="user_course_table" border=0 >
<tr>
<th class="user_course_table_header">
<?php echo $user_course_col_name ?>
</th>
<th class="user_course_table_header">
</th>
</tr>
<?php
$swap='';
  if (isset($usercourse) && is_array($usercourse)) {
	foreach ($usercourse 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 osa_user_getname($row);?></td>
<?php
$href=$href_del.$row->id;
$jscript_del = "onClick=\"if(confirm('$cource_editor_deletemsg')==true) {course_editor('$href','$href_refresh','$href_descid', '$form_name','$descid');return false;}\"";
?>
	<td class="user_course_col_header_del" >
	<a <?php echo $jscript_del ?> ><?php echo $img_del ?></a>
</td>
</tr>
<?php
	} //foreach
		} //if
?>
</table>
<div align="left">
<input type="button" value="<?php echo lang('desc_course_editer_btn_done'); ?>" name="Done" <?php osa_btn()?>
onClick="closeDhtmlWindow('course_input'); return false;" />
</div>
</td>
</tr>
</table>
<table width="96%">
<tr>
<td>
<div class="user_course_footer"><?php echo lang('desc_course_editer_footer'); ?></div>
</td>
</tr>
</table>
</div>
</center>
</form>