<?php
//////////////////////////////////////////////////////////////////////
//
// $Id: news_item.php,v 1.6 2002/02/08 19:14:18 carney Exp $
//
// Copyright (C) 2002 Michael Carney
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//////////////////////////////////////////////////////////////////////
include_once ("util/misc.php");
include_once ("util/manila.php");
function getDepartmentLink($id)
{
$result = db_query("select * from news_department where id='$id'");
$vars = mysql_fetch_assoc($result);
$image = imageRef($vars["icon"],
array("align"=>"right",
"link"=>"news.php?dept=$id"));
return $image;
}
function news_item_submit_handler(&$vars, &$errors)
{
if (checkdate($vars["news_item_date"]["month"],
$vars["news_item_date"]["day"],
$vars["news_item_date"]["year"]) == false )
{
$errors["news_item_date"] = "badDate";
}
$datestr = $vars["news_item_date"]["year"]
."-".$vars["news_item_date"]["month"]
."-".$vars["news_item_date"]["day"]
." ".$vars["news_item_date"]["hour"]
.":".$vars["news_item_date"]["minute"]
.":".$vars["news_item_date"]["second"];
$vars["news_item_date"] = $datestr;
}
function news_item_display_handler($id)
// Go off and munge the display content as needed
{
global $p;
include_once ("util/misc.php");
$result = db_query("select * from news_item where id='$id'");
$vars = mysql_fetch_assoc($result);
$url = $vars ["url"];
if ($url != "")
$vars["url"] = "<a href=\"$url\">Full Story</a>";
$vars["news_department"] = getDepartmentLink($vars["news_department"]);
return $vars;
}
?>