2018-03-17 01:22:19 +00:00
|
|
|
<?php
|
2020-02-09 15:34:23 +00:00
|
|
|
/**
|
2022-01-02 07:27:47 +00:00
|
|
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
2020-02-09 15:34:23 +00:00
|
|
|
*
|
|
|
|
* @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/>.
|
|
|
|
*
|
2018-03-17 01:22:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Friendica\Content\Widget;
|
|
|
|
|
2018-10-31 14:35:50 +00:00
|
|
|
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;
|
2018-03-17 01:22:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TagCloud widget
|
|
|
|
*
|
|
|
|
* @author Rabuzarus
|
|
|
|
*/
|
|
|
|
class CalendarExport
|
|
|
|
{
|
|
|
|
/**
|
2020-01-19 06:05:23 +00:00
|
|
|
* Get the events widget.
|
2022-09-11 05:04:13 +00:00
|
|
|
*
|
2021-05-29 17:09:45 +00:00
|
|
|
* @param int $uid
|
2018-03-17 01:22:19 +00:00
|
|
|
*
|
|
|
|
* @return string Formated HTML of the calendar widget.
|
2019-01-06 21:06:53 +00:00
|
|
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
2018-03-17 01:22:19 +00:00
|
|
|
*/
|
2022-09-11 05:04:13 +00:00
|
|
|
public static function getHTML(int $uid = 0): string
|
|
|
|
{
|
2021-05-29 17:09:45 +00:00
|
|
|
if (empty($uid)) {
|
|
|
|
return '';
|
2018-08-11 21:05:42 +00:00
|
|
|
}
|
|
|
|
|
2021-05-29 17:09:45 +00:00
|
|
|
$user = User::getById($uid, ['nickname']);
|
|
|
|
if (empty($user['nickname'])) {
|
|
|
|
return '';
|
2018-03-17 20:42:28 +00:00
|
|
|
}
|
|
|
|
|
2022-09-11 05:04:13 +00:00
|
|
|
$tpl = Renderer::getMarkupTemplate('widget/events.tpl');
|
2018-10-31 14:35:50 +00:00
|
|
|
$return = Renderer::replaceMacros($tpl, [
|
2022-09-11 05:04:13 +00:00
|
|
|
'$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']
|
2018-03-17 01:22:19 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
}
|