<?php
/**
 * goal_list_view.php - View Search file. TODO: FILE IS OBSOLETE.
 *
 * @author $Author: dtong $
 * @version $Id: goal_list_view.php,v 1.3 2011/04/05 15:18:45 dtong Exp $
 * @copyright Copyright (c) 2010, Tiller Software Co., Ltd.
*/

return;

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

$page     = $display->page;
$listitem = $display->listitem;
$selectlistitem = $display->selectlistitem;
$selectentry = $display->selectentry;
$entry = $display->entry;

$href			= base_url();
$refresh	    = base_url().$page.'/refresh/';
$search	        = base_url().$page.'/search/';
$filter	        = base_url().$page.'/filter/';
$imgreq	    = 'search.gif';
$img_req  	= "<img src=". osa_imagepath() . "$imgreq    title='Required field'   alt='Required field'    border='0' >";

$display->reset();
$count = $display->total;
if ( isset($count)==FALSE )  {
	 echo lang('user_error_nodata');
  	 return;
}

if (isset($display->selectid))
	$selectid = $display->selectid;
else
	$selectid = 0;

if(is_array($display->strand)==FALSE){
$display->strand=array();
}
if(is_array($display->standard)==FALSE){
$display->standard=array();
}

if(is_array($display->data_dep_sch)==FALSE){
$display->data_dep_sch=array();
}
//echo 'filters : ' . $data->enableflag;
$formname = 'admin_search_form_'.$display->divid.'_'.$display->type;

//echo '<pre>'; print_r($display->entry); echo '</pre>';
?>

<form method="POST"  name="<?php echo $formname;?>" >
<center>
<div class="goal_title"><?php echo $display->pagetitle;?></div>

<table cellspacing="0" cellpadding="0" class="admin_list_table"  border="0">

<?php
if ($listitem!=FALSE){
?>
<tr>
<td style='width:15%'><nobr><?php echo lang('goal_list_selectfilter'); ?></nobr></td>
<td class="goal_filer_space">
<?php
	$jscript_sel = "onChange=\"find_filter('$refresh', '$formname', '$display->refresh','$display->type');\" onkeyup=\"this.blur();this.focus();\" return false;";
	echo form_dropdown("filters", $listitem, $selectlistitem, "size=1  " . "  $jscript_sel");
?>
</td>
</tr>
<?php
}
?>
<?php if (isset($display->hide_entrypoint) && $display->hide_entrypoint === FALSE ){?>
<tr>
<td style='width:15%'><nobr><?php echo lang('goal_list_selectentry'); ?></nobr></td>
<td class="goal_filer_space">
<?php
	$jscript_sel = "onChange=\"find_filter('$refresh', '$formname', '$display->refresh','$display->type');\" onkeyup=\"this.blur();this.focus();\" return false; ";
	echo form_dropdown("selected", $entry, $selectentry, "size= 1 " . "  $jscript_sel");
?>
</td>
</tr>
<?php }?>
<tr>
<td style='width:15%'><nobr><?php echo $display->search; ?></nobr></td>
<td valign="middle" >
<table cellspacing="0" cellpadding="0">
<tr>
<td >
<input type=text name=filter value="<?php echo $display->filter;?>" size=40
	onkeydown="if (event.keyCode == 13) { document.getElementById('button_search').focus();  }" />
	<?php
		$jscript_search = "onClick=\"find_filter('$refresh', '$formname', '$display->refresh','$display->type');  return false; \"";
	?>
</td>
<td>
	<input id="button_search" type="button"
					value="<?php echo lang('admin_list_button_search'); ?>"
					name="button_search" <?php osa_btn(); echo $jscript_search; ?> />
</td>
</tr>

</table>

</td></tr>
<tr><td colspan='2' class="goal_filer_space"><nobr>
 <?php echo $count; ?> <?php echo lang('admin_list_count'); ?>
</nobr>
</td></tr>
</table>

<table class="admin_list_table"  border="1">
<tr class="table_head_col">
<?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;//$display->image_sort;
		//page_content
		if ($display->refresh=='page_content')
		$click = "onClick=\"ajaxGetpage('page_content','$url',false); return false;\"";
		else
		$click = "onClick=\"updateWindow('$url','$display->refresh','', '$display->refresh'); 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='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=\"map_restitle\">$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=\"map_resitem\">$value</td>";
		}
		echo '</tr>';
	} //while
?>
</tr>
</table>
</center>
</form>
