<?php
/**
* weather_uk.php
*
* Copyright (c) 2005 David Newcomb <david.newcomb@bigsoft.co.uk>
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* @package plugins
* @subpackage ccontacts
*/

define('SM_PATH','../../');
define('SM_PATH_CCONTACTS', SM_PATH . 'plugins/ccontacts/');

include_once(SM_PATH . 'include/validate.php');
include_once(SM_PATH . 'functions/page_header.php');
include_once(SM_PATH . 'include/load_prefs.php');
include_once(SM_PATH . 'functions/addressbook.php');

global $color;
global $username, $data_dir;


$ccontacts_submit = "";
$ccontacts_list = array();

sqgetGlobalVar("ccontacts_submit", $ccontacts_submit, SQ_POST);
if ($ccontacts_submit != "")
{
	sqgetGlobalVar("ccontacts_list[]", $ccontacts_list, SQ_POST);
echo "<pre>";
var_dump($ccontacts_list);
echo "</pre>";
die;
	setPref($data_dir, $username, "ccontacts_list", $ccontacts_list);

}




function print_cell($ok, $where, $what, $when, $alt ="")
{
	if ($ok != 1)
	{
		return " <td></td>\n";
	}

	global $location;

	return " <td align=center>".
		"<img src='$location/".$where."_".$when."_".$what.".gif' alt='$alt'>".
		"</td>\n";
}

bindtextdomain('weather_uk', SM_PATH_CCONTACTS . 'locale');
textdomain('weather_uk');

displayPageHeader($color, "None");


	$abook = addressbook_init(true, true);
	if($abook->localbackend == 0)
	{
		echo "No address book";
		return;
	}
	$alist = $abook->list_addr();
	if(!is_array($alist))
	{
		echo "Address is not array";
		return;
	}
	if (count($alist) == 0)
	{
		echo "Address is empty";
		return;
	}

	usort($alist, 'ccontacts_sort');

	echo '<form action=' . SM_PATH_CCONTACTS . 'ccontacts-list.php method=post>'; 
	echo '<table>';
	while(list($undef,$row) = each($alist))
	{
		$name = htmlspecialchars($row['firstname']) . " " . htmlspecialchars($row['lastname']);
		$email = htmlspecialchars($row['email']);
		echo '<tr><td>'.
			'<input type=checkbox name=ccontacts_list[] value="' . $email . '"></td><td>' .
			$name . '</td><td>' .
			$email . '</td></tr>';
	}
	echo '</table>';
	echo '<input type=submit name=ccontacts_submit value=' . _("Update") . '>';
	echo '</form>';


/*
weather_uk_load();

$weather_uk_visible = getPref($data_dir, $username, 'weather_uk_visible');
$weather_uk_region = getPref($data_dir, $username, 'weather_uk_region');

$weather_uk_where_uk = getPref($data_dir, $username, 'weather_uk_where_uk');
$weather_uk_where_region = getPref($data_dir, $username, 'weather_uk_where_region');

$weather_uk_when_today = getPref($data_dir, $username, 'weather_uk_when_today');
$weather_uk_when_tomorrow = getPref($data_dir, $username, 'weather_uk_when_tomorrow');
$weather_uk_when_dayafter = getPref($data_dir, $username, 'weather_uk_when_dayafter');

$weather_uk_what_weather = getPref($data_dir, $username, 'weather_uk_what_weather');
$weather_uk_what_wind = getPref($data_dir, $username, 'weather_uk_what_wind');
$weather_uk_what_temperature = getPref($data_dir, $username, 'weather_uk_what_temperature');


echo '<br><center>';

echo '<TABLE WIDTH=95% COLS=1 ALIGN=CENTER>' .
"<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><b>" . _("Weather Forecast for the UK") . '</b></TD></TR>' .
'</TABLE>';

echo '<br><br><table width=400 cellspacing=0 cellpadding=0 border=0>';


echo "<tr>\n";
echo print_cell($weather_uk_where_uk && $weather_uk_when_today && $weather_uk_what_weather,
		'UK', 'weather', 'map0', _("UK weather today"));
echo print_cell($weather_uk_where_uk && $weather_uk_when_tomorrow && $weather_uk_what_weather,
		'UK', 'weather', 'map1', _("UK weather tomorrow"));
echo print_cell($weather_uk_where_uk && $weather_uk_when_dayafter && $weather_uk_what_weather,
		'UK', 'weather', 'map2', _("UK weather day after tomorrow"));
echo "</tr>\n";

echo "<tr>\n";
echo print_cell($weather_uk_where_uk && $weather_uk_when_today && $weather_uk_what_wind,
		"UK", "winds", "map0", _("UK wind direction today"));
echo print_cell($weather_uk_where_uk && $weather_uk_when_tomorrow && $weather_uk_what_wind,
		"UK", "winds", "map1", _("UK wind direction tomorrow"));
echo print_cell($weather_uk_where_uk && $weather_uk_when_dayafter && $weather_uk_what_wind,
		"UK", "winds", "map2", _("UK wind direction day after tomorrow"));
echo "</tr>\n";

echo "<tr>\n";
echo print_cell($weather_uk_where_uk && $weather_uk_when_today && $weather_uk_what_temperature,
		"UK", "temperature", "map0", _("UK temperature today"));
echo print_cell($weather_uk_where_uk && $weather_uk_when_tomorrow && $weather_uk_what_temperature,
		"UK", "temperature", "map1", _("UK temperature tomorrow"));
echo print_cell($weather_uk_where_uk && $weather_uk_when_dayafter && $weather_uk_what_temperature,
		"UK", "temperature", "map2", _("UK temperature day after tomorrow"));
echo "</tr>\n";



echo "<tr>\n";
echo print_cell($weather_uk_where_region && $weather_uk_when_today && $weather_uk_what_weather,
		$weather_uk_region, "weather", "map0", $weather_uk_region . ' ' . _("weather today"));
echo print_cell($weather_uk_where_region && $weather_uk_when_tomorrow && $weather_uk_what_weather,
		$weather_uk_region, "weather", "map1", $weather_uk_region . ' ' . _("weather tomorrow"));
echo print_cell($weather_uk_where_region && $weather_uk_when_dayafter && $weather_uk_what_weather,
		$weather_uk_region, "weather", "map2", $weather_uk_region . ' ' . _("weather day after tomorrow"));
echo "</tr>\n";

echo "<tr>\n";
echo print_cell($weather_uk_where_region && $weather_uk_when_today && $weather_uk_what_wind,
		$weather_uk_region, "winds", "map0", $weather_uk_region . ' ' . _("wind direction today"));
echo print_cell($weather_uk_where_region && $weather_uk_when_tomorrow && $weather_uk_what_wind,
		$weather_uk_region, "winds", "map1", $weather_uk_region . ' ' . _("wind direction tomorrow"));
echo print_cell($weather_uk_where_region && $weather_uk_when_dayafter && $weather_uk_what_wind,
		$weather_uk_region, "winds", "map2", $weather_uk_region . ' ' . _("wind direction day after tomorrow"));
echo "</tr>\n";

echo "<tr>\n";
echo print_cell($weather_uk_where_region && $weather_uk_when_today && $weather_uk_what_temperature,
		$weather_uk_region, "temperature", "map0", $weather_uk_region . ' ' . _("temperature today"));
echo print_cell($weather_uk_where_region && $weather_uk_when_tomorrow && $weather_uk_what_temperature,
		$weather_uk_region, "temperature", "map1", $weather_uk_region . ' ' . _("temperature tomorrow"));
echo print_cell($weather_uk_where_region && $weather_uk_when_dayafter && $weather_uk_what_temperature,
		$weather_uk_region, "temperature", "map2", $weather_uk_region . ' ' . _("temperature day after tomorrow"));
echo "</tr>\n";


echo '</table>';

die;
bindtextdomain('squirrelmail', SM_PATH . 'locale');
textdomain('squirrelmail');

define('SM_PATH','../../');
*/

?>
