X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FBaseProfile.php;h=3573542c05ef7b79009e2e33f0f35d0499c5ab0b;hb=8894b482dc9487c3e5dd6372f3d27b0775596e73;hp=3937fa07d2ee2b2da5b801882caeec47b3c708d0;hpb=e56a53647bd5469551bf4f9ef2df50a5dd16b943;p=friendica.git diff --git a/src/Module/BaseProfile.php b/src/Module/BaseProfile.php index 3937fa07d2..3573542c05 100644 --- a/src/Module/BaseProfile.php +++ b/src/Module/BaseProfile.php @@ -23,23 +23,24 @@ namespace Friendica\Module; use Friendica\App; use Friendica\BaseModule; +use Friendica\Content\Feature; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; +use Friendica\Model\User; class BaseProfile extends BaseModule { /** * Returns the HTML for the profile pages tabs * - * @param App $a * @param string $current * @param bool $is_owner * @param string $nickname * @return string * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function getTabsHTML(App $a, string $current, bool $is_owner, string $nickname, bool $hide_friends) + public static function getTabsHTML(string $current, bool $is_owner, string $nickname, bool $hide_friends) { $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname; @@ -62,7 +63,7 @@ class BaseProfile extends BaseModule ], [ 'label' => DI::l10n()->t('Photos'), - 'url' => DI::baseUrl() . '/photos/' . $nickname, + 'url' => $baseProfileUrl . '/photos', 'sel' => $current == 'photos' ? 'active' : '', 'title' => DI::l10n()->t('Photo Albums'), 'id' => 'photo-tab', @@ -78,27 +79,28 @@ class BaseProfile extends BaseModule ], ]; - // the calendar link for the full featured events calendar - if ($is_owner && $a->getThemeInfoValue('events_in_profile')) { - $tabs[] = [ - 'label' => DI::l10n()->t('Events'), - 'url' => DI::baseUrl() . '/events', - 'sel' => $current == 'events' ? 'active' : '', - 'title' => DI::l10n()->t('Events and Calendar'), - 'id' => 'events-tab', - 'accesskey' => 'e', - ]; - // if the user is not the owner of the calendar we only show a calendar - // with the public events of the calendar owner - } elseif (!$is_owner) { + // the calendar link for the full-featured events calendar + if ($is_owner) { $tabs[] = [ - 'label' => DI::l10n()->t('Events'), - 'url' => DI::baseUrl() . '/cal/' . $nickname, - 'sel' => $current == 'cal' ? 'active' : '', - 'title' => DI::l10n()->t('Events and Calendar'), - 'id' => 'events-tab', - 'accesskey' => 'e', + 'label' => DI::l10n()->t('Calendar'), + 'url' => DI::baseUrl() . '/calendar', + 'sel' => $current == 'calendar' ? 'active' : '', + 'title' => DI::l10n()->t('Calendar'), + 'id' => 'calendar-tab', + 'accesskey' => 'c', ]; + } else { + $owner = User::getByNickname($nickname, ['uid']); + if(DI::userSession()->isAuthenticated() || $owner && Feature::isEnabled($owner['uid'], 'public_calendar')) { + $tabs[] = [ + 'label' => DI::l10n()->t('Calendar'), + 'url' => DI::baseUrl() . '/calendar/show/' . $nickname, + 'sel' => $current == 'calendar' ? 'active' : '', + 'title' => DI::l10n()->t('Calendar'), + 'id' => 'calendar-tab', + 'accesskey' => 'c', + ]; + } } if ($is_owner) {