4 * @file src/Content/Widget/CalendarExport.php
7 namespace Friendica\Content\Widget;
9 use Friendica\Content\Feature;
10 use Friendica\Core\L10n;
12 require_once 'boot.php';
13 require_once 'include/text.php';
23 * @brief Get the events widget.
25 * @return string Formated HTML of the calendar widget.
27 public static function getHTML() {
30 $owner_uid = $a->data['user']['uid'];
32 // The permission testing is a little bit tricky because we have to respect many cases.
34 // It's not the private events page (we don't get the $owner_uid for /events).
35 if (!local_user() && !$owner_uid) {
40 * If it's a kind of profile page (intval($owner_uid)) return if the user not logged in and
41 * export feature isn't enabled.
43 if (!local_user() && $owner_uid && !Feature::isEnabled($owner_uid, 'export_calendar')) {
47 // $a->data is only available if the profile page is visited. If the visited page is not part
48 // of the profile page it should be the personal /events page. So we can use $a->user.
49 $user = defaults($a->data['user'], 'nickname', $a->user['nickname']);
51 $tpl = get_markup_template("events_aside.tpl");
52 $return = replace_macros($tpl, [
53 '$etitle' => L10n::t("Export"),
54 '$export_ical' => L10n::t("Export calendar as ical"),
55 '$export_csv' => L10n::t("Export calendar as csv"),