friendica/src/Content/Widget/CalendarExport.php

65 lines
1.7 KiB
PHP
Raw Normal View History

<?php
/**
2023-01-01 14:36:24 +00:00
* @copyright Copyright (C) 2010-2023, 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 22:42:01 +00:00
use Friendica\DI;
2021-05-29 17:09:45 +00:00
use Friendica\Model\User;
/**
* TagCloud widget
*
* @author Rabuzarus
*/
class CalendarExport
{
/**
2020-01-19 06:05:23 +00:00
* Get the events widget.
*
2021-05-29 17:09:45 +00:00
* @param int $uid
*
* @return string Formated HTML of the calendar widget.
2019-01-06 21:06:53 +00:00
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function getHTML(int $uid = 0): string
{
2021-05-29 17:09:45 +00:00
if (empty($uid)) {
return '';
}
2021-05-29 17:09:45 +00: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 17:09:45 +00:00
'$user' => $user['nickname']
]);
return $return;
}
}