<?php
/**
 * admin_select_view.php -  Select view file
 *
 * @author $Author: Samarth
 * @version $Id: admin_select_view.php
 * @copyright Copyright (c) 2010, Tiller Software Co., Ltd.
*/

if (!isset($type))
	$type = '';
if (!isset($title_lang))
	$title_lang = '';
if (!isset($header_left_lang))
	$header_left_lang = '';
if (!isset($header_right_lang))
	$header_right_lang = '';
if (!isset($href_insert))
	$href_insert = '';
if (!isset($href_delete))
	$href_delete = '';
if (!isset($button_done_lang))
	$button_done_lang = '';
if (!isset($button_disable_lang))
	$button_disable_lang = '';
if (!isset($button_assign_lang))
	$button_assign_lang = '';
if (!isset($msg_delete_lang))
	$msg_delete_lang = '';
if (!isset($footer_lang))
	$footer_lang = '';

$href = osa_imagepath();
$imgdis = 'dis_right.gif';
$imgsave	= $href.'forward.gif';
$imgclose = 'close.gif';
$imgdelete = 'deletes.gif';
$img_save = "<img src=". $href. "$imgdis  title='".$button_disable_lang."' border='0' >";
$img_close = "<img src=". $href. "$imgclose  title='Close'        border='0' >";
$img_del = "<img src=". $href. "$imgdelete    title='Delete'    border='0' >";
?>
<div id='dhtmlwin_select'>
<form method="POST" name="select_form" >
<input id='type' type='hidden' value='<?php echo $type; ?>' />
<input id='departmentid' type='hidden' value='<?php echo $departmentid; ?>' />
<input id='schoolid' type='hidden' value='<?php echo $schoolid; ?>' />
<input id='group' type='hidden' value='<?php echo $group; ?>' />
<input id='title' type='hidden' value='<?php echo $title_lang; ?>' />
<center>
<div class="select_form_title"><?php echo $title_lang; ?></div>
<br />
<table class="select_form_table" border='0'>
	<tr>
		<td class="select_form_left" valign=top>
			<div class="select_form_head"><?php echo $header_left_lang; ?></div>
			<?php if (isset($left) && is_array($left)) {
				$fieldname  = 'userid[]';
				$button  = "change_button('img_button', '$imgsave', '" . $button_assign_lang . "','{$href_insert}','select_form','dhtmlwin_select');return false; ";
				$jscript = "onChange=\"$button \"";
				echo form_dropdown($fieldname, $left,'',"size='24'  multiple='multiple'\" $jscript ");
			}?>
		</td>
		<td class="select_form_center" valign="middle">
			<div id="img_add" >
				<span id="img_button" ><?php echo $img_save ?></span>
			</div>
		</td>
		<td class="select_form_right"  valign=top>
			<div class="select_form_head"><?php echo $header_right_lang; ?></div>
			<table class="select_form_table" border='0' >
				<tr>
					<td class="user_course_table_header"></td>
				</tr>
				<?php
				// create row
				$swap='';
				if (isset($right) && is_array($right)) {
					foreach ($right as $row) {
						if ($swap  == '') {
							$tr_class = "table_body_row";
							$swap = '_none';
						}
						else {
							$tr_class = "table_body_row_none";
							$swap = '';
						}
						// make link delete
						$href=$href_delete.$row->roleid;
						$jscript_del =  "onClick=\"if(confirm('$msg_delete_lang')==true) { ajaxPostform('dhtmlwin_select', '{$href}', 'select_form', false); } return false;\"";
				?>
				<tr class="<?php echo $tr_class; ?>">
					<td class="select_form_col_header_Name" ><?php echo osa_user_getname($row); ?></td>
					<td class="select_form_col_header_del" ><a href='<?php echo $href ?>' <?php echo $jscript_del ?> ><?php echo $img_del ?></a></td>
				</tr>
				<?php
					} // foreach
				} // if
				?>
			</table>
			<div align="left" style="margin-top:10px">
				<input type="button" value="<?php echo $button_done_lang; ?>" name="Done" <?php osa_btn()?>
				onClick="closeDhtmlWindow('select_form');  return false;" />
			</div>
		</td>
	</tr>
</table>

<table width="96%">
	<tr>
		<td>
			<div class="select_form_footer"><?php echo $footer_lang; ?></div>
		</td>
	</tr>
</table>

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

