page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; switch (get_config("system", "language")) { case "de": $a->page['htmlhead'] .= '' . "\r\n"; break; default: $a->page['htmlhead'] .= '' . "\r\n"; } $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; } /** * */ function wdcal_addRequiredHeadersEdit() { $a = get_app(); $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; } /** * @param array|DBClass_friendica_calendars[] $calendars * @param array $calendar_preselected * @param string $data_feed_url * @param string $view * @param int $theme * @param int $height_diff * @param bool $readonly * @param string $curr_day * @param array $add_params * @param bool $show_nav * @return string */ function wdcal_printCalendar($calendars, $calendar_preselected, $data_feed_url, $view = "week", $theme = 0, $height_diff = 175, $readonly = false, $curr_day = "", $add_params = array(), $show_nav = true) { $a = get_app(); $localization = wdcal_local::getInstanceByUser($a->user["uid"]); $cals_avail = array(); foreach ($calendars as $c) $cals_avail[] = array("ns" => $c->namespace, "id" => $c->namespace_id, "displayname" => $c->displayname); $opts = array( "view" => $view, "theme" => $theme, "readonly" => $readonly, "height_diff" => $height_diff, "weekstartday" => $localization->getFirstDayOfWeek(), "data_feed_url" => $data_feed_url, "date_format_dm1" => $localization->dateformat_js_dm1(), "date_format_dm2" => $localization->dateformat_js_dm2(), "date_format_dm3" => $localization->dateformat_js_dm3(), "date_format_full" => $localization->dateformat_datepicker_js(), "baseurl" => $a->get_baseurl() . "/dav/wdcal/", ); $x = '
Available Calendars:'; foreach ($cals_avail as $cal) { $x .= '
'; if ($show_nav) { $x .= '
' . t("Today") . '
' . t("Reload") . '
' . t("Date") . '
'; } $x .= '
'; return $x; } /** * @param string $uri * @param string $recurr_uri * @return string */ function wdcal_getDetailPage($uri, $recurr_uri) { $a = get_app(); $details = null; $cals = dav_getMyCals($a->user["uid"]); foreach ($cals as $c) { $cs = wdcal_calendar_factory($a->user["uid"], $c->namespace, $c->namespace_id); $p = $cs->getPermissionsItem($a->user["uid"], $uri, $recurr_uri); if ($p["read"]) try { $redirect = $cs->getItemDetailRedirect($uri); if ($redirect !== null) goaway($redirect); $details = $cs->getItemByUri($uri); } catch (Exception $e) { notification(t("Error") . ": " . $e); goaway($a->get_baseurl() . "/dav/wdcal/"); } } return $uri . " / " . $recurr_uri . "
" . print_r($details, true); } /** * @param string $uri * @param string $recurr_uri * @return string */ function wdcal_getEditPage($uri, $recurr_uri = "") { $a = get_app(); $localization = wdcal_local::getInstanceByUser($a->user["uid"]); if ($uri != "" && $uri != "new") { $o = q("SELECT * FROM %s%sjqcalendar WHERE `uid` = %d AND `ical_uri` = '%s' AND `ical_recurr_uri` = '%s'", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $a->user["uid"], dbesc($uri), dbesc($recurr_uri) ); if (count($o) != 1) return t('Not found'); $event = $o[0]; $calendarSource = wdcal_calendar_factory($a->user["uid"], $event["namespace"], $event["namespace_id"]); $permissions = $calendarSource->getPermissionsItem($a->user["uid"], $uri, $recurr_uri, $event); if (!$permissions["write"]) return t('No access'); $n = q("SELECT * FROM %s%snotifications WHERE `uid` = %d AND `ical_uri` = '%s' AND `ical_recurr_uri` = '%s'", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $a->user["uid"], dbesc($uri), dbesc($recurr_uri) ); if (count($n) > 0) { $notification_type = $n[0]["rel_type"]; $notification_value = -1 * $n[0]["rel_value"]; $notification = true; } else { if ($event["IsAllDayEvent"]) { $notification_type = "hour"; $notification_value = 24; } else { $notification_type = "minute"; $notification_value = 60; } $notification = false; } } elseif (isset($_REQUEST["start"]) && $_REQUEST["start"] > 0) { $event = array( "id" => 0, "Subject" => $_REQUEST["title"], "Location" => "", "Description" => "", "StartTime" => wdcal_php2MySqlTime($_REQUEST["start"]), "EndTime" => wdcal_php2MySqlTime($_REQUEST["end"]), "IsAllDayEvent" => $_REQUEST["isallday"], "Color" => null, "RecurringRule" => null, ); if ($_REQUEST["isallday"]) { $notification_type = "hour"; $notification_value = 24; } else { $notification_type = "hour"; $notification_value = 1; } $notification = true; } else { $event = array( "id" => 0, "Subject" => "", "Location" => "", "Description" => "", "StartTime" => date("Y-m-d H:i:s"), "EndTime" => date("Y-m-d H:i:s", time() + 3600), "IsAllDayEvent" => "0", "Color" => "#5858ff", "RecurringRule" => null, ); $notification_type = "hour"; $notification_value = 1; $notification = true; } $postto = $a->get_baseurl() . "/dav/wdcal/" . ($uri == "new" ? "new/" : $uri . "/edit/"); $out = "" . t("Go back to the calendar") . "

"; $out .= "
\n"; $out .= "
\n"; $out .= "
\n"; $out .= ""; $out .= ""; $out .= ""; $out .= "
\n"; $out .= ""; $out .= ""; $out .= ""; $out .= "
\n"; $out .= "
\n"; $out .= " "; $out .= "
"; $out .= ""; $out .= ' ' . t('before') . '

'; $out .= ""; $out .= "
"; return $out; } /** * @param App $a * @return string */ function wdcal_getSettingsPage(&$a) { if (!local_user()) { notice(t('Permission denied.') . EOL); return ''; } if (isset($_REQUEST["save"])) { check_form_security_token_redirectOnErr($a->get_baseurl() . '/dav/settings/', 'calprop'); set_pconfig($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]); info(t('The new values have been saved.')); } $o = ""; $o .= "" . t("Go back to the calendar") . "

"; $o .= '

' . t('Calendar Settings') . '

'; $current_format = wdcal_local::getInstanceByUser($a->user["uid"]); $o .= '
'; $o .= "\n"; $o .= '
'; $o .= '
'; $o .= ''; $o .= '
'; $o .= "

" . t("Limitations") . "

"; $o .= "- The native friendica events are embedded as read-only, half-transparent in the calendar.
"; $o .= "

" . t("Warning") . "

"; $o .= "This plugin still is in a very early stage of development. Expect major bugs!
"; $o .= "

" . t("Synchronization (iPhone, Thunderbird Lightning, Android, ...)") . "

"; $o .= 'This plugin enables synchronization of your dates and contacts with CalDAV- and CardDAV-enabled programs or devices.
As an example, the instructions how to set up two-way synchronization with an iPhone/iPodTouch are provided below.
Unfortunately, Android does not have native support for CalDAV or CardDAV, so an app has to be installed.
On desktops, the Lightning-extension to Mozilla Thunderbird should be able to use this plugin as a backend.

'; $o .= '

' . t('Synchronizing this calendar with the iPhone') . '

'; $o .= ""; $o .= '

' . t('Synchronizing your Friendica-Contacts with the iPhone') . '

'; $o .= ""; return $o; }