friendica_2021.01_tupambae_.../src/Content/Widget/CalendarExport.php

63 lines
1.7 KiB
PHP
Raw Normal View History

<?php
/**
2021-03-29 08:40:20 +02:00
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Content\Widget;
use Friendica\Core\Renderer;
2020-01-04 23:42:01 +01:00
use Friendica\DI;
2021-05-29 19:09:45 +02:00
use Friendica\Model\User;
/**
* TagCloud widget
*
* @author Rabuzarus
*/
class CalendarExport
{
/**
2020-01-19 07:05:23 +01:00
* Get the events widget.
2021-05-29 19:09:45 +02:00
* @param int $uid
*
* @return string Formated HTML of the calendar widget.
2019-01-06 22:06:53 +01:00
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
2021-05-29 19:09:45 +02:00
public static function getHTML(int $uid = 0) {
if (empty($uid)) {
return '';
}
2021-05-29 19:09:45 +02:00
$user = User::getById($uid, ['nickname']);
if (empty($user['nickname'])) {
return '';
}
$tpl = Renderer::getMarkupTemplate("widget/events.tpl");
$return = Renderer::replaceMacros($tpl, [
'$etitle' => DI::l10n()->t("Export"),
'$export_ical' => DI::l10n()->t("Export calendar as ical"),
'$export_csv' => DI::l10n()->t("Export calendar as csv"),
2021-05-29 19:09:45 +02:00
'$user' => $user['nickname']
]);
return $return;
}
}