<?PHP

#############################################################################
#                              FAgenda
# FAgenda is a website agenda designed for Site@School
# (http://siteatschool.sourceforge.net)
#
# About FAgenda:
# Original idea: Dirk Schouten and Fred Stuurman
# Coding: Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# FILENAME search_dialog.php last changed 07/09/2006, S@S version: 2.4.10                                        
#                            by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: search_dialog.php,v 1.2 2006/10/15 19:08:53 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
# Copyright (C) 2004 Fred Stuurman (fc.stuurman@hccnet.nl)
#
# FAgenda is an integrated part of the Site@School Content Management System.
# FAgenda may not be modified, taken out of Site@School and/or distributed 
# without the written permission of the author.
# 
# FAgenda is free to use for Educational use and may be used free-of-charge 
# by members of eucational institutions, but must be purchased by all others.
# Contact the author, F. Stuurman (fc.stuurman@hccnet.nl), for 
# non-educational use or adapting FAgenda to your requirements.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# FITNESS FOR A PARTICULAR PURPOSE.
#
#                   DO NOT REMOVE THIS COPYRIGHT NOTICE
##############################################################################
define('IN_SAS', true);

include ("config.inc.php"); //connect to mysql database
?>
<html>
<head>
<script type="text/javascript">
function popupform(f) {
	var url = ""
	var width = 300; 
	var height = 200;
	var screenX = (screen.width/2 - width/2);
	var screenY = (screen.height/2 - height/2);
	var features= "width=" + width + ",height=" + height;
	features += ",screenX=" + screenX + ",left=" + screenX;
	features += ",screenY=" + screenY  +",top=" + screenY;
	var mywin=window.open(url, "popup", features);
	mywin.focus();
	f.submit();
}
</script>
</head>
<body BGCOLOR="#B29D78">
<?PHP

$language = "";
$query = "SELECT config_value FROM $table_configuration WHERE config_key='language'"; //get language
$result = mysql_query($query);
$language = mysql_result($result, 0);

if (file_exists("../$cmsdir/languages/" . $language . "/sn_agenda/" . $language . ".php"))
{
	include ("../$cmsdir/languages/" . $language . "/sn_agenda/" . $language . ".php");
}
else
{
	include ("../$cmsdir/languages/EN/sn_agenda/EN.php");
}

$query = "SELECT id, name FROM $table_agenda_name ORDER BY sort";
$result = mysql_query($query);
$i = 0;
while ($row = mysql_fetch_array($result))
{
	$agenda[$i] = $row[1];
	$agenda_id[$i] = $row[0];
	$i++;
}
?>

<form method="post" action="search.php" target="popup">
<table><tr><td colspan="3"><b><?PHP echo $sas_lang['agenda_search_arg'] ?>:</b></td></tr>
<td><input type="text" size="50" name="searchstring"></td><td>&nbsp;</td>
<td><input type="button" value="<?PHP echo $sas_lang['agenda_search'] ?>" onclick="popupform(this.form)" ></td></tr>
<?PHP

for ($k = 0; $k < count($agenda); $k++)
{ //loop through the agenda's

	if ($k == 0)
	{
		$checked = "checked";
	}
	else
	{
		$checked = "";
	}
	print "<tr><td>$agenda[$k]</td>
	<td colspan=\"3\"><input TYPE=CHECKBOX NAME=\"a[$k]\" $checked value=\"$agenda_id[$k]\"></td></tr>";
}
?>
</table></form>
</body>
</html>
