<?php
// $Id: modifevent.php,v 1.1 2004/07/11 10:27:51 Farsus Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Original Author: Nobse, Bama
// Author Website : http://www.e-xoops.de, http://service.bama-webdesign.de
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
include("header.php");
include(XOOPS_ROOT_PATH."/class/xoopsform/formselect.php");
include(XOOPS_ROOT_PATH."/header.php");

if ($xoopsUser) {
	$group = $xoopsUser->groups();
	$anno = explode("|", $anoevent);
	$is = array_intersect ($group, $anno);
	if (count($is) > 0){
	
$mytree = new XoopsTree($db->prefix('ecal_cat'), "cid", "pid");

global $xoopsUser, $db, $myts;

$id = !empty($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id'];

OpenTable();

if (!$id) {
	echo "<p>"._ERRORMSG1."";
break;
}

echo "<B>"._MSG3."</B>";

$query = $db->query("SELECT * FROM ".$db->prefix("ecal")." WHERE id = '$id' AND valid='yes'");
$row = $db->fetch_array($query);

$kat = $db->query("SELECT title, cid FROM ".$db->prefix("ecal_cat")." where cid=".$row['cid']);
list($title, $cid) = $db->fetch_row($kat);

$subject = $myts->makeTboxData4Edit($row['subject']);
$description = $myts->makeTboxData4Edit($row['description']);

$day = substr($row['stamp'],8,2);
$month = substr($row['stamp'],5,2);
$year = substr($row['stamp'],0,4);
$heure = substr($row['stamp'],11,2);
$minute = substr($row['stamp'],13,2);
$heureend = substr($row['eventend'],0,2);
$minuteend = substr($row['eventend'],3,2);


echo "<form method='post' action='action.php'><input type='hidden' name='id' value='".$row['id']."'><table><tr>";

echo "<td><b>"._USER."</td>";
echo "<td>".$row['username']." <input class='text' type='hidden' name='username' value='".$row['username']."'></td></tr>";

echo "<tr><td><b>"._CAL_KAT."</b></td><td>";
echo $mytree->makeMySelBox("title", "title", $cid, 1, "cid");
echo "</td></tr>";

if (intval($locat_yn) == 1){
	$query1 = $db->query("SELECT lid, location FROM ".$db->prefix("ecal_location")." ORDER BY location");
	echo "<tr><td><b>"._CAL_LOCATION."</b></td><td>";
	echo "<select class='select' name='locationid'>";
	 while ($location = $db->fetch_array($query1)){
		if ($location['lid'] == $row['locationid']) {
		     $sel = "selected";
		}else{
			$sel = "";
		}
			 echo "<option value='".$location['lid']."' $sel>".$location['location']."</option>";
	 }
	 echo "</select>";
	 if (intval($user_locyn) == 1){
          echo "&nbsp;&nbsp;";
          echo "<a href='addlocation.php'><img src='".XOOPS_URL."/modules/ecal/language/".$xoopsConfig['language']."/images/icon_new_loc.gif''></a>";
     }
	echo "</td></tr>";
}

echo "<tr><td><b>"._CAL_PRIVAT1."</b></td><td>";
$privat_select = new XoopsFormSelect(_CAL_PRIVAT, "privat", $row['privat']);
$privat_select->addOptionArray(array(0 =>_CAL_OFFEN,1 =>_CAL_PRIVAT));
echo $privat_select->render();
echo "</td></tr>";

echo "<tr><td><b>"._D."</td><td><select class='select' name='day' size='1'>";
buildDaySelect($day);
echo "</select><select class='select' size='1' name='month'>";
buildMonthSelect($month);
echo "</select><select class='select' size='1' name='year'>";
buildYearSelect($year);
echo "</select></tr>";

echo "<tr><td><b>"._CAL_BEGINN."</td><td><select class='select' name='heure' size='1'>";
buildHourSelect($heure);
echo "</select><select class='select' size='1' name='minute'>";
buildMinSelect($minute);
echo "</select></td></tr>";

echo "<tr><td><b>"._CAL_END."</td><td><select class='select' name='heureend' size='1'>";
buildHourSelect($heureend);
echo "</select><select class='select' size='1' name='minuteend'>";
buildMinSelect($minuteend);
echo "</select></td></tr>";

$chk1 = ''; $chk0 = '';
$row['high'] == 1 ? $chk1 = " checked='checked'" : $chk0 = " checked='checked'";
echo "<tr><td><b>"._CAL_HIGH."</td><td>";
echo "<input type='radio' class='radio' name='high' value='1' '$chk1' />"._YES."";
echo "<input type='radio' class='radio' name='high' value='0' '$chk0' />"._NO."</td></tr>";

echo "<tr><td><b>"._SUBSHOW."</td><td><input class='text' type='text' name='subject' value=\"$subject \" size='40'></td></tr>";

echo "<tr><td><b>"._DESC2."</b></td><td>";
		$desc = new XoopsFormDhtmlTextArea('', 'description1', $description, 10, 50);
		echo $desc->render();
		echo "</td></tr>";

echo "<tr><td><b>"._CAL_BILDURL."</b></td><td><input class='text' type='text' name='flayer' size='40' value='".$row['flayer']."'></td></tr>";
echo "</table>";

if ($moderat == '1') {
	echo "<input type='hidden' name='valid' value='no'>";
} else {
    echo "<input type='hidden' name='valid' value='yes'>";
}

echo "<input type='hidden' name='pa' value='ModifEvent'>
	<input class='button' type='submit' value='"._VALID."'></form>";

CloseTable();
}
}
else
redirect_header("index.php", 3, _NO_AUTHORIZ);
include(XOOPS_ROOT_PATH."/footer.php");
?>