function churchcal_getMyServices()
{
    global $user;
    include_once CHURCHSERVICE . '/churchservice_db.php';
    $res = churchservice_getUserCurrentServices($user->id);
    return $res;
}
/**
 * echo ical for services to do from user id (read from request)
 */
function churchservice_ical()
{
    global $base_url, $config;
    if (!($id = readVar("id"))) {
        echo t("please.specify.id");
    }
    drupal_add_http_header('Content-Type', 'text/calendar;charset=utf-8', false);
    drupal_add_http_header('Content-Disposition', 'inline;filename="ChurchTools.ics"', false);
    drupal_add_http_header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', false);
    drupal_add_http_header('Cache-Control', 'private', false);
    $content = drupal_get_header();
    include_once './' . CHURCHSERVICE . '/churchservice_db.php';
    $arr = churchservice_getUserCurrentServices($id);
    // TODO: use txt Template
    $txt = "";
    foreach ($arr as $res) {
        $txt .= "BEGIN:VEVENT\r\n";
        $txt .= "ORGANIZER:MAILTO:" . readConf('site_mail', '') . "\r\n";
        if ($res->zugesagt_yn == 1) {
            $txt .= "SUMMARY:" . $res->dienst . " (" . $res->servicegroup . ")\r\n";
        } else {
            $txt .= "SUMMARY:Anfrage: " . $res->dienst . " (" . $res->servicegroup . ")?\r\n";
        }
        $txt .= "X-MICROSOFT-CDO-BUSYSTATUS:BUSY\r\n";
        $txt .= "URL:" . $base_url . "/?q=churchservice/entrylist\r\n";
        if ($res->ort != "") {
            $txt .= "LOCATION:" . $res->ort . "\r\n";
        }
        $txt .= "DESCRIPTION:" . $res->dienst . " (" . $res->servicegroup . ") bei " . $res->event . ".";
        if ($res->zugesagt_yn == 1) {
            $txt .= "\r\n";
        } else {
            $txt .= " " . t("request.from") . " {$res->vorname} {$res->name} [{$res->modified_pid}]\r\n";
        }
        $txt .= "DTSTAMP:" . $res->modified_date . "\r\n";
        $txt .= "UID:" . $res->eventservice_id . "\r\n";
        $txt .= "DTSTART;TZID=" . $config["timezone"] . ":" . $res->datum_start . "\r\n";
        $txt .= "DTEND;TZID=" . $config["timezone"] . ":" . $res->datum_end . "\r\n";
        $txt .= "END:VEVENT\r\n";
    }
    echo surroundWithVCALENDER($txt);
}