137 lines
3.8 KiB
PHP
137 lines
3.8 KiB
PHP
<?php
|
|
|
|
|
|
/**
|
|
*
|
|
* Ein Client für die Darstellung von Kalenderterminen und die Online-Buchung dieser Termine
|
|
* im Kontext von community.stattbuchung.de
|
|
*
|
|
* Jede Darstellung liest dabei die Daten vom community.stattbuchung.de Server ein und gibt diese Entsprechend aus
|
|
* Zur Authentifizierung wird Benutzername, Kennwort und der API-Key benötigt.
|
|
* Sollte im produktiven Einsatz immer SSL-gesichert verwendet werden.
|
|
*
|
|
* Autor: Thomas Mack
|
|
*/
|
|
|
|
|
|
include('client.php');
|
|
include('template.php');
|
|
$ini = parse_ini_file('config.ini');
|
|
|
|
$debug=false;
|
|
|
|
/**
|
|
* Für jede Aktion wird ein Opcode an den Server geschickt.
|
|
* Dieser wird mit weiteren Daten im JSON-Format parametrisiert.
|
|
* Die jeweils notwendigen Paramater variieren.
|
|
* In jedem Fall sollte der API-Key unter dem Attribut 'de_stattbuchung_Kanal'
|
|
* enthalten sein
|
|
*/
|
|
define("opcObjectlistProdukt", 256160);
|
|
define("opcObjectlistEventNachZeitraum", 255100);
|
|
define("opcQueryProdukt",256167);
|
|
define("opcLoadProduktContainer",256168);
|
|
define("opcFetchTreffpunkt",256141);
|
|
define("opcCalendarByChannel",257000);
|
|
define("opcFetchTermindetail",257001);
|
|
define("opcAddAnmeldung",257002);
|
|
define("opcStichwortlistByKanal",257003);
|
|
define("opcPaymentStepOne",257007);
|
|
|
|
/**
|
|
* Ende OPCODE Definition
|
|
*/
|
|
|
|
function sendAnmeldung($id, $sessionInfo, $apikey, $oidang, $verkaufstelle, $zahlungsart, $postdata) {
|
|
date_default_timezone_set('Europe/Berlin');
|
|
|
|
$gebdate = new DateTime( $postdata['geburtsdatum']);
|
|
$params=array(
|
|
"oid" => $postdata['de_stattbuchung_event_Modul'],
|
|
"anrede"=>$postdata['anrede'],
|
|
"vorname"=>$postdata['vorname'],
|
|
"nachname"=>$postdata['nachname'],
|
|
"strasse"=>$postdata['strasse'],
|
|
"plz"=>$postdata['plz'],
|
|
"ort"=>$postdata['ort'],
|
|
"email"=>$postdata['email'],
|
|
"telefon"=>$postdata['telefon'],
|
|
"institution"=>$postdata['institution'],
|
|
"geburtsdatum"=>$gebdate->format(DateTime::ATOM),
|
|
"de_bidat_av_Profiltyp_geburtsort"=>$postdata['geburtsort'],
|
|
"kommentar"=>$postdata['kommentar'],
|
|
"de_stattbuchung_event_Modul"=>$postdata['de_stattbuchung_event_Modul'],
|
|
"de_stattbuchung_Kanal"=>$apikey,
|
|
"de_stattbuchung_Verkaufsstelle"=>$verkaufstelle,
|
|
"systems_sdw_fi_Zahlungsart"=>$zahlungsart,
|
|
"systems_sdw_hr_Angestellter"=>$oidang
|
|
);
|
|
|
|
foreach ($postdata as $key => $value) {
|
|
if(strpos($key, "de_stattbuchung_Teilnehmerart_") === 0) {
|
|
$params[$key] = $value;
|
|
}
|
|
}
|
|
|
|
$resp=post($sessionInfo, opcPaymentStepOne, $params, "{}", $debug) ;
|
|
|
|
|
|
return $resp;
|
|
}
|
|
|
|
|
|
/**
|
|
* Main.
|
|
*
|
|
*/
|
|
|
|
try {
|
|
$sessionInfo=login($ini['host'], $ini['user'], $ini['psw'], $debug);
|
|
|
|
date_default_timezone_set('Europe/Berlin');
|
|
|
|
//$resp=get($sessionInfo, opcObjectlistProdukt, $params, $debug) ;
|
|
|
|
$treffpunktid = $_GET['treffpunkt'];
|
|
$registerid = $_GET['register'];
|
|
$modulid = $_GET['modul'];
|
|
$modultermine = $_GET['modultermine'];
|
|
|
|
$formid = $_GET['form'];
|
|
$stichwortkey = $_GET['stichwort'];
|
|
|
|
$monat = $_GET['monat'];
|
|
$jahr = $_GET['jahr'];
|
|
$maxResult = $_GET['maxResultLength'];
|
|
$teaser = $_GET['teaser'];
|
|
$viewStyle = $_GET['style'];
|
|
|
|
$verkaufstelle = $ini['de_stattbuchung_Verkaufsstelle'];
|
|
$zahlungsart = $ini['systems_sdw_fi_Zahlungsart'];
|
|
|
|
|
|
|
|
if($registerid == 872) {
|
|
|
|
$resp = sendAnmeldung($registerid, $sessionInfo, $ini['apikey'], $ini['oid_ang'], $verkaufstelle, $zahlungsart, $_POST);
|
|
|
|
if($ini['paypal'] == true) {
|
|
header('Content-type: application/json');
|
|
echo json_encode($resp);
|
|
}
|
|
|
|
//renderAnmeldeformular($resp, $sessionInfo, $ini['paypal'], 2);
|
|
|
|
|
|
|
|
}
|
|
// Ausloggen nicht vergessen!
|
|
logoff($sessionInfo, $debug);
|
|
|
|
} catch (Exception $e) {
|
|
echo 'Exception: '.$e->getMessage()." code: ".$e->getCode()."<br/>";
|
|
}
|
|
|
|
|
|
?>
|