<?php
// www.bcoos.net 2006-09 1.0.2 GPL
// $Id: addlocation.php,v 1.3 2004/02/13 19:51:03 nobse 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_once("header.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopstree.php");
    $mytree = new XoopsTree($db->prefix('ecal_cat'), "cid", "pid");
    
    //bama
    include("cache/config.php");
    if (!defined("ECAL_LOCATION_INCLUDED")) {include_once(XOOPS_ROOT_PATH."/modules/ecal/class/location.php");}
//---------------------------------------------------------------------------------------//
    function addlocation() {
        global $mytree, $locat_yn, $xoopsUser;    
        include(XOOPS_ROOT_PATH."/header.php");
        OpenTable();
        $form_titel = _CAL_ADDLOCATION;
        $form_action = "addlocation.php";
        $ophidden = "addsave";
        $sub_button_text = _ADD;
        include_once(XOOPS_ROOT_PATH."/modules/ecal/include/form_location.php");
        CloseTable();
        include(XOOPS_ROOT_PATH."/footer.php");
    }
//---------------------------------------------------------------------------------------//
    function addsave() {
        global $_POST, $myts, $db;
        $loc_store = new CalLocation();
        $loc_store->setVar("cid", intval($_POST['cid']));
        $loc_store->setVar("location", $myts->makeTboxData4Save($_POST['location']));
        $loc_store->setVar("beschreibung", $myts->makeTboxData4Save($_POST['beschreibung']));
        $loc_store->setVar("ort", $myts->makeTboxData4Save($_POST['ort']));
        $loc_store->setVar("plz", $myts->makeTboxData4Save($_POST['plz']));
        $loc_store->setVar("strasse", $myts->makeTboxData4Save($_POST['strasse']));
        $loc_store->setVar("tel", $myts->makeTboxData4Save($_POST['tel']));
        $loc_store->setVar("email", $myts->makeTboxData4Save($_POST['email']));
        $loc_store->setVar("url", $myts->makeTboxData4Save($_POST['url']));
        $loc_store->setVar("valid", $myts->makeTboxData4Save($_POST['valid']));
        $result = $loc_store->store();
        if (!$result){
            xoops_cp_header();
            OpenTable();
            echo "konnte nicht in Location DB Schreiben";
            CloseTable();
            xoops_cp_footer();
            
        }else{
            redirect_header("addevent.php", 1, _CAL_NEWLOCADDED);
            exit();
        }
    }
    $op = $_POST['op'];
    if (intval($user_locyn) == 0){
        redirect_header("index.php", 3, _NO_AUTHORIZ);
        exit();
    }
    switch ($op) {
    
    case "addsave":
    	addsave();
    	break;
    
    default:
    	addlocation();
    	break;
    }
?>