--- new.php 2001/02/28 09:48:31 1.8 +++ new.php 2001/04/05 11:54:08 1.13 @@ -13,11 +13,17 @@ $section="new"; } +$sql_where="where visible is true"; + if ($section == "investor") { $title="INVESTOR'S PAGE"; $lpic="investor"; $lext=".jpg"; $mpic="investors.gif"; $back_url="investor.php"; + if (! isset($type)) { + $sql_where .= " and type='i'"; + } + $title.=" : Investors News"; } elseif ($section == "about") { $title="ABOUT US"; $lpic="about"; $lext=".gif"; @@ -31,7 +37,6 @@ $smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, ) ); -$sql_where="where visible is true"; function find_html_file($dir,$file) { $file="./$dir/$file"; @@ -53,7 +58,7 @@ if (isset($type)) { if ($type == "n") { - $sql_where .= " and type='n'"; + $sql_where .= " and (type='n' or type='i')"; $title.=" : News"; } elseif ($type == "e") { $sql_where .= " and type='e'"; @@ -71,6 +76,16 @@ } + if (isset($days)) { + if ($days != 0) { + $sql_where.=" and date(now())-date(date) > 0 and date(now())-date(date) < $days"; + $title.=" : News in last $days days"; + } + $smarty->assign("days",$days); + $smarty->assign("last_days",array(14,30,160,240,365)); + $smarty->assign("last_desc",array("two week","one month","four months","six months","one year")); + } + $num_selected=0; $sql="select id,upper(title) as title,town_date,body,more,pdf, @@ -106,10 +121,26 @@ $title.=" : Community : ".$data[0][title_lc]; } elseif ($data[0][type] == "r") { $title.=" : Result : ".$data[0][title_lc]; + } elseif ($data[0][type] == "i") { + $title.=" : Investors News : ".$data[0][title_lc]; + } elseif ($data[0][type] == "a") { + $title.=" : Annual Report : ".$data[0][title_lc]; } } - $smarty->assign("data",$data); + + if (isset($days) && $num_selected == 0) { + $warning = "There are no news for last $days days."; + } + + if ($main == "" && $num_selected == 0) { + $warning = "This news item is no longer available"; + } + + $smarty->assign(array( + data=>$data, + warning=>$warning + )); $main=$smarty->fetch("new.tpl"); @@ -117,9 +148,6 @@ $main=join('',file(find_html_file("news",$data[0][more]))); } - if ($main == "") { - $main = "This news item is no longer available"; - } }