<?php
/**
 * result_list_view.php - View file for the mapping search result list using the display_list data object
 *
 * @author $Author: dtong $
 * @version $Id: result_list_view.php,v 1.40 2011/04/15 07:45:53 dtong Exp $
 * @copyright Copyright (c) 2009, Tiller Software Co., Ltd.
*/
osa_load_lang('mapping');

if ( !isset($add_js) ) {
	$add_js = '';
	if ( !empty($display->closebutton_jstext) ) {
		$add_js = $display->closebutton_jstext;
	}
}
$display->view_file = 'mapping/result_list_view';;
$display->print_page_links();
if ( !empty($display->pagetitle) ) {
?>
<div class="map_respagetitle" ><?php echo rawurldecode($display->pagetitle);?></div>
<?php } ?>
<div class="map_resspace">
	<div class="map_restotal" >
	<?php
		$total = $display->total;
		if ( $display->display_total !== FALSE )
			$total = $display->display_total;
		echo "{$total} "; echo lang('map_itemsfound');

	?>
	</div>
	<div class="map_resclosebtn">
			<?php
			if ($display->divid=='map_standbench') {
				$button = $display->button;
			?>
				<input type="button" <?php echo $button['disable'][CMS_MAPPING_NORMAL]; ?> value="<?php echo lang('map_normal_button'); ?>"
				<?php osa_btn();
					$pagetitle = str_replace("'",'',$display->pagetitle);
					$grade_url = base_url().'map/search/normal/standbench/'.$display->searchid ;
					$grade_click = "onclick=\"updateWindow('$grade_url', 'calendar_form','$pagetitle', '$display->divid');return false;\"";
					echo $grade_click;
				?>  />

				<input type="button" <?php echo $button['disable'][CMS_MAPPING_COURSE]; ?> value="<?php echo lang('map_course_button'); ?>"
				<?php osa_btn();
					$pagetitle = str_replace("'",'',$display->pagetitle);
					$grade_url = base_url().'map/search/course/standbench/'.$display->searchid ;
					$grade_click = "onclick=\"updateWindow('$grade_url', 'calendar_form','$pagetitle', '$display->divid');return false;\"";
					echo $grade_click;
				?>  />

				<input type="button" <?php echo $button['disable'][CMS_MAPPING_GRADE]; ?> value="<?php echo lang('map_grade_button'); ?>"
				<?php osa_btn();
					$pagetitle = str_replace("'",'',$display->pagetitle);
					$grade_url = base_url().'map/search/grade/standbench/'.$display->searchid ;
					$grade_click = "onclick=\"updateWindow('$grade_url', 'calendar_form','$pagetitle', '$display->divid');return false;\"";
					echo $grade_click;
				?>  />
			<?php
			}
			if ( $display->divid != '' ) {
				//$session_id = session_id();
				$divid = $display->divid;
				$url_pdf = base_url() . 'pdf/pdfgen/index/';
				//$url_pdf .= 'pdf_render_'.'mapping_'.str_replace('_','-',$divid).'_'.$session_id.'/MappingResult';
				$url_pdf .= 'pdf_render_'.'mapping_'.str_replace('_','-',$divid).'_PHPSESSIONID/MappingResult';
				$jscript_pdf="onClick=\"return openBrowserWindow('$url_pdf')\"";
			?>
			<?php if ( $display->pdfbutton ) {?>
				<input type="button" value="<?php echo lang('map_btn_pdf'); ?>" name="pdf" <?php osa_btn()?>
				<?php echo $jscript_pdf;?>  />
			<?php } ?>
			<?php if (  $display->divid != '' && $display->closebutton ) { ?>
				<input type="button" value="<?php echo lang('map_close');?>"
					onclick="closeDhtmlWindow('<?php echo $display->divid;?>');<?php echo $add_js;?>" <?php echo osa_btn();?> />
			<?php }
			} ?>
	</div>
	&nbsp;
</div>
<center>
<?php
	// (issue: ) Don't know why it only happens with one search for one customer but
	// have to echo the view here.
	echo $this->load->view('mapping/display_list_view', '', TRUE);
?>
</center>
<?php
if ( $display->total <= 0)
		echo '<center><div style="margin-top:15px;"></div><font color="red">' . lang('map_noresultmsg') .
			  '</font><div style="margin-top:15px;"></div></center>';
	if (  $display->divid != '' && $display->closebutton ) { ?>
		<div class="map_resspace">
			<div class="map_restotal" >&nbsp;</div>
			<div class="map_resclosebtn">
			<input type="button" value="<?php echo lang('map_close');?>"
				onclick="closeDhtmlWindow('<?php echo $display->divid;?>');
				<?php echo $add_js;?>" <?php echo osa_btn();?> />
			</div>
		</div>
<?php
	}
	$display->print_page_links();
?>
<br /><br />