<?php
/**
 * unit_compare_view.php - Unit Compare Version.
 *
 * @author $Author: dtong $
 * @version $Id: unit_compare_view.php,v 1.9 2011/04/05 16:17:52 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
$url = base_url().'unit/compare/version/' ;
//fix don't use for dhtmlwindow
//$this->load->view('template/all_jscript_view');

$formname = "unit_compare_form";

if (isset($update_div)===FALSE)
	$update_div = 'unit_history';

if (isset($notwin_div)===FALSE)
	$notwin_div = 'compare_content';
if (isset($multi_scroll) && $multi_scroll)
	$multi_scroll = 'class="unit_compare_scroll"';
else
	$multi_scroll = '';

if ($use_combo === TRUE) {
?>
<form method="POST" name="<?php echo $formname; ?>" >
<input type="hidden" name="courseid" value="<?php echo $unit->courseid ?>" />
<input type="hidden" name="unitid" value="<?php echo $unit->id ?>" />
<div style="margin:15px;text-align:center;"><?php echo lang('unit_compare_head');?></div>
<table width="100%" border="1">
<tr>
	<td class="unit_title_textcompare"> <?php echo lang('unit_compare_textcompare'); ?>
	<?php
		//$jscript_sel = "onChange=\"compare_histoty('$url', '$formname', '$div');  return false; \"";
		$jscript_sel = "onChange=\"updateWindow('$url', '$formname','', '$update_div', '$notwin_div');  return false; \"";
		echo form_dropdown("unitid_left", $history, $history_left, "size=1  " . "  $jscript_sel");
	?>
	</td>
	<td class="unit_title_remotefile"><?php echo lang('unit_compare_remotefile'); ?>
	<?php
		//$jscript_sel = "onChange=\"compare_histoty('$url', '$formname', '$div');  return false; \"";
		$jscript_sel = "onChange=\"updateWindow('$url', '$formname','', '$update_div', '$notwin_div');  return false; \"";
		echo form_dropdown("unitid_right", $history, $history_right, "size=1  " . "  $jscript_sel");
	?>
	</td>
</tr>
<!-- <tr><td colspan="2" valign="top" >  -->
</table>
<div id="compare_content" style="border:solid 0px;">
<?php } ?>
<table width="100%" border="1"><tr>
<?php
	$units = array(CMS_UNIT_COMPARE_LEFT=>$unit_left , CMS_UNIT_COMPARE_RIGHT=>$unit_right);
	foreach ($units as $key => $unit) {
?>	<td valign="top"  width="50%" ><div <?php echo $multi_scroll; ?> >
	<table width="100%" border="0" class="unitbody">
		<tr><td>
			 <table border="0" cellpadding="3" cellspacing="0" width="98%"><tbody>
				<tr>
					<td class="<?php echo $css_title['coursename']; ?>"><span style="font-weight:bold;margin-bottom:15px;"><?php echo $coursename; ?></span></td>
				</tr>
				<tr>
					<td class="<?php echo $css_title['title']; ?>" valign="top" width="5%"><nobr><?php echo lang('unit_title'); ?>:</nobr></td>
					<td class="<?php echo $css_title['title']; ?>" valign="top" width="93%"><?php osa_echo($unit->title);   ?></td>
				</tr>
				<tr>
					<td class="<?php echo $css_title['description']; ?>" valign="top"><nobr><?php echo lang('unit_description'); ?>:</nobr></td>
					<td class="<?php echo $css_title['description']; ?>" valign="top"><?php osa_echo($unit->description); ?></td>
				</tr>
		        <tr>
					<td class="<?php echo $css_title['type']; ?>" valign="top"><nobr><?php echo lang('unit_type'); ?>:</nobr></td>
					<td class="<?php echo $css_title['type']; ?>" valign="top"><?php osa_echo($unit->typename); ?></td>
				</tr>
		        <tr>
					<td class="<?php echo $css_title['startdate']; ?>" valign="top"><nobr><?php echo lang('unit_startdate'); ?>:</nobr></td>
					<td class="<?php echo $css_title['startdate']; ?>" valign="top"><?php osa_echo(osa_date_format($unit->startdate)); ?></td>
				</tr>
		        <tr>
					<td class="<?php echo $css_title['enddate']; ?>" valign="top"><nobr><?php echo lang('unit_enddate'); ?>:</nobr></td>
					<td class="<?php echo $css_title['enddate']; ?>" valign="top"><?php osa_echo(osa_date_format($unit->enddate)); ?></td>
				</tr>
			</tbody></table>
		</td></tr>
		<tr><td valign="top" colspan="2" ><div class="unit_compare_unitbody">
			<?php
				//var_dump($html[$key]->unit->unitbody);
				if (isset($html[$key]) && isset($html[$key]->unitbody))
			 		 echo $html[$key]->unitbody;
			//$unit->unitbody;
			?>
		</div></td></tr>
	</table></div>
	</td>
<?php
	}
?>
</tr>
</table>
<?php
	if ($use_combo === TRUE) { ?>
		</div>
		</form>
<?php
	}
?>