friendica/src/Content/Widget/CalendarExport.php

63 lines
1.7 KiB
PHP
Raw Normal View History

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