X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FBaseProfile.php;h=b7584d9db6098c7fde3caa3600bb3ef085ed46dc;hb=f0743e4e128dfcb5d6305f4ed09e969573ba6b15;hp=c6ef1c3541b014f43230d105756ec9d86ae1df9a;hpb=f2d917114f949b3f76c04f99247092a16b1e3e9e;p=friendica.git diff --git a/src/Module/BaseProfile.php b/src/Module/BaseProfile.php index c6ef1c3541..b7584d9db6 100644 --- a/src/Module/BaseProfile.php +++ b/src/Module/BaseProfile.php @@ -1,89 +1,106 @@ . + * + */ 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 = null) + public static function getTabsHTML(string $current, bool $is_owner, string $nickname, bool $hide_friends) { - if (is_null($nickname)) { - $nickname = $a->user['nickname']; - } - $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname; $tabs = [ [ 'label' => DI::l10n()->t('Profile'), - 'url' => $baseProfileUrl, + 'url' => $baseProfileUrl . '/profile', 'sel' => $current == 'profile' ? 'active' : '', 'title' => DI::l10n()->t('Profile Details'), 'id' => 'profile-tab', 'accesskey' => 'r', ], [ - 'label' => DI::l10n()->t('Status'), - 'url' => $baseProfileUrl . '/status', + 'label' => DI::l10n()->t('Conversations'), + 'url' => $baseProfileUrl . '/conversations', 'sel' => $current == 'status' ? 'active' : '', - 'title' => DI::l10n()->t('Status Messages and Posts'), + 'title' => DI::l10n()->t('Conversations started'), 'id' => 'status-tab', 'accesskey' => 'm', ], [ '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', 'accesskey' => 'h', ], [ - 'label' => DI::l10n()->t('Videos'), - 'url' => DI::baseUrl() . '/videos/' . $nickname, - 'sel' => $current == 'videos' ? 'active' : '', - 'title' => DI::l10n()->t('Videos'), - 'id' => 'video-tab', - 'accesskey' => 'v', + 'label' => DI::l10n()->t('Media'), + 'url' => $baseProfileUrl . '/media', + 'sel' => $current == 'media' ? 'active' : '', + 'title' => DI::l10n()->t('Media'), + 'id' => 'media-tab', + 'accesskey' => 'd', ], ]; - // the calendar link for the full featured events calendar - if ($is_owner && $a->theme_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) { @@ -95,9 +112,17 @@ class BaseProfile extends BaseModule 'id' => 'notes-tab', 'accesskey' => 't', ]; + $tabs[] = [ + 'label' => DI::l10n()->t('Scheduled Posts'), + 'url' => $baseProfileUrl . '/schedule', + 'sel' => $current == 'schedule' ? 'active' : '', + 'title' => DI::l10n()->t('Posts that are scheduled for publishing'), + 'id' => 'schedule-tab', + 'accesskey' => 'o', + ]; } - if (empty($a->profile['hide-friends'])) { + if (!$hide_friends) { $tabs[] = [ 'label' => DI::l10n()->t('Contacts'), 'url' => $baseProfileUrl . '/contacts',