<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
//-------------------------------------------------------------------------- //
// Author of the file: Marx Hans ( http://www.bama-webdesign.de)
// ------------------------------------------------------------------------- //
// Original Author: Nobse, bama
// Author Website : http://www.e-xoops.de, http://service.bama-webdesign.de
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //
    if (!defined("ECAL_LOCATION_INCLUDED")) {include_once(XOOPS_ROOT_PATH."/modules/ecal/class/location.php");}
    
    function bama_function($func, $parm_arr=array()){
        include_once(XOOPS_ROOT_PATH."/modules/ecal/include/func_".$func.".php");
        $ret = call_user_func_array($func, $parm_arr);
        return $ret;
    }
//    include_once(XOOPS_ROOT_PATH."/modules/ecal/include/func_makeCnameSelectArray.php"
    
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/themeform.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formtext.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formselect.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formdhtmltextarea.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formradioyn.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formelementtray.php");  
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formlabel.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formhidden.php");
    include_once(XOOPS_ROOT_PATH."/class/xoopsform/formbutton.php");
    
    $form = new XoopsThemeForm($form_titel, "loc_mod", $form_action);
    $loc_text = new XoopsFormText(_CAL_LOCATION, "location", 50, 255, $location);
    $form->addElement($loc_text);	
    $cat_select = new XoopsFormSelect(_CATEGORY.':', "cid", $cid);
    $cat_select->addOptionArray(bama_function("makeCnameSelectArray", array ("ecal_cat", "title", "title", "cid", "pid")));
    $form->addElement($cat_select);	
    $beschreibung_tarea = new XoopsFormDhtmlTextArea(_CAL_DESCRIPTION, "beschreibung", $beschreibung);
    $form->addElement($beschreibung_tarea);
    $ort_text = new XoopsFormText(_CAL_ORT, "ort", 50, 255, $ort);
    $form->addElement($ort_text);	
    $plz_text = new XoopsFormText(_CAL_PLZ, "plz", 5, 5, $plz);
    $form->addElement($plz_text);	
    $strasse_text = new XoopsFormText(_CAL_STRASSE, "strasse", 50, 255, $strasse);
    $form->addElement($strasse_text);
    $tel_text = new XoopsFormText(_CAL_TEL, "tel", 25, 25, $tel);
    $form->addElement($tel_text);
    $email_text = new XoopsFormText(_CAL_MAIL, "email", 50, 255, $email);
    $form->addElement($email_text);
    $url_text = new XoopsFormText(_URL, "url", 50, 255, $url);
    $form->addElement($url_text);
    if ($xoopsUser){
        if ($xoopsUser->isAdmin()){
            $valid_hidden = new XoopsFormHidden("valid", 1);
            $form->addElement($valid_hidden);
        }else{
            $valid_hidden = new XoopsFormHidden("valid", 0);
            $form->addElement($valid_hidden);
        }
    }else{
        $valid_hidden = new XoopsFormHidden("valid", 0);
        $form->addElement($valid_hidden);
    }
    if ($ret > 0){
        $ret_hidden = new XoopsFormHidden("ret", 1);
        $form->addElement($ret_hidden);
    }
    $op_hidden = new XoopsFormHidden("op", $ophidden);
    $form->addElement($op_hidden);
    $lid_hidden = new XoopsFormHidden("lid", $lid);
    $form->addElement($lid_hidden);
    $button_tray = new XoopsFormElementTray("", "");
    $submit_button = new XoopsFormButton("", "button", $sub_button_text, "submit");
    $button_tray->addElement($submit_button);	
    if ($xoopsUser){
        if ($xoopsUser->isAdmin() && $lid > 0){
            $delete_button = new XoopsFormLabel("", "<input type='button' class='button' value='"._DELETE."' onClick=\"self.location.href='addlocation.php?op=dellocation&lid=".$lid."'\">");
            $button_tray->addElement($delete_button);
        }
    }
    $form->addElement($button_tray);	
    $form->setRequired(array("location", "beschreibung"));
    $form->display();
        
?>
