<?php
 	/**
 * unit_history_view.php - Unit History. TODO: FILE IS OBSOLETE
 *
 * @author $Author: dtong $
 * @version $Id: unit_history_view.php,v 1.15 2011/04/05 16:17:52 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
return;
?>
<?php

$href = base_url();

$sortup_url   = osa_imagepath() . 'arrow_up.gif';
$sortdown_url = osa_imagepath() . 'arrow_down.gif';
$update_url   = base_url().'search/sort/get_history/sort/';

$imgreq	    = 'search.gif';
$img_req  	= "<img src=". osa_imagepath() . "$imgreq    title='Required field'   alt='Required field'    border='0' >";

$url = base_url().'unit/compare/version/' ;
//$div = 'unit_history';
//$formname = 'unit_history_form';
$formname = $display->formname;
$newdiv = 'unit_compare';
$title = lang('unit_compare_title');
//$click_compare = "onClick=\"ajaxPostIframe('$url','$title','900','700','$div','unit_history_form');  return false; \"";
$click_compare = "onClick=\" ajaxPostIframe('$url','$title','1000','800','$newdiv','$formname'); return false; \"";

$alt_sort = lang('unit_history_sort_title');

if (isset($display))
	$display->reset();
?>
<form method="POST" name="<?php echo $formname; ?>" >
<center>
<?php
	if (isset($display->unit)) {
?>
<div style='margin-top:10px;margin-bottom:10px;'>
<div class='unit_history_coursename'><?php echo $display->unit->coursename; ?></div>
<div class='unit_history_unittitle'><?php echo $display->unit->title; ?></div>
</div>
<?php
	}
?>
<div >
<input type="button" value="<?php echo lang('unit_history_btncancel'); ?>" name="cancel" <?php osa_btn()?>
	   onClick="closeDhtmlWindow('<?php echo $formname; ?>');" />
<span style="margin-left:30px">&nbsp;</span>
<input type="button" value="<?php echo lang('unit_history_btncompare'); ?>" name="compare" <?php osa_btn()?>
       <?php echo $click_compare ; ?>/>
</div>
<div id='unit_history'>
<table class="unit_history_table" border="0">
<tr >
<?php
	$tdwidths = array();
	foreach ($display->titles as $key => $title) {
		$width = $display->widths[$key];
		if ( $width != '' )
			$width = "width=\"$width%\"";
		else
			$width='';
		$tdwidths[$key] = $width;

		$url   = $update_url . $display->searchid .'/'.$key.'/'.$display->image_sort.'/'.$display->paging.'/'.$display->current_page;

		$click = "onClick=\"updateWindow('$url','unit_history_form','', 'unit_history_form'); return false;\"";

		$imgsrc  = $sortdown_url;
		if ($display->image_sort == 0)
			$imgsrc  = $sortup_url;
		$colspan = '';
		$img     = '';
		if ($display->default_col==$key){
			$img = "<img src='$imgsrc' class='searchsort_button_image' title='$alt_sort' />";
		}
		if (is_array($title)==FALSE)
		    $sort = "<a title='sort' href='$url' $click ><nobr>$title $img</nobr></a>";
		else {
			$sort = "<a title='sort' href='$url' $click ><nobr>$title[0] $img</nobr></a>";
			$colspan = "colspan='".$title['_colspan']."'";
		}

		echo "<td $colspan {$width} class=\"unit_history_head\">$sort</td>";

	}
	echo "</tr>";

	$colortrack=FALSE;
	$trclass = $trclass1 = 'table_body_row';
	$trclass2 = 'table_body_row_none';
	while ( ($node = $display->next()) !== FALSE)  {
		if ( $display->colortrack ) {
			if (!$colortrack)
				$trclass = $trclass1;
			else
				$trclass = $trclass2;
			$colortrack = !$colortrack;
		}
		echo "<tr class='$trclass'>";
		foreach ($node as $key => $value) {
			echo '<td  class="unit_history_td">'.$value.'</td>';
		}
		echo '</tr>';
	} //while
?>
</tr>
</table>
<table width="96%">
<tr>
<td>
<div class=""><?php echo lang('unit_history_footer'); ?></div>
</td>
</tr>
</table>
</div>
<div >


<input type="button" value="<?php echo lang('unit_history_btncancel'); ?>" name="cancel" <?php osa_btn()?>
	   onClick="closeDhtmlWindow('<?php echo $formname; ?>');" />
<span style="margin-left:30px">&nbsp;</span>
<input type="button" value="<?php echo lang('unit_history_btncompare'); ?>" name="compare" <?php osa_btn()?>
       <?php echo $click_compare ; ?>/>
</div>
</center>
</form>
