3 * @copyright Copyright (C) 2010-2022, the Friendica project
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Module;
25 use Friendica\BaseModule;
26 use Friendica\Core\Hook;
27 use Friendica\Core\Renderer;
30 class BaseProfile extends BaseModule
33 * Returns the HTML for the profile pages tabs
35 * @param string $current
36 * @param bool $is_owner
37 * @param string $nickname
39 * @throws \Friendica\Network\HTTPException\InternalServerErrorException
41 public static function getTabsHTML(string $current, bool $is_owner, string $nickname, bool $hide_friends)
43 $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
47 'label' => DI::l10n()->t('Profile'),
48 'url' => $baseProfileUrl . '/profile',
49 'sel' => $current == 'profile' ? 'active' : '',
50 'title' => DI::l10n()->t('Profile Details'),
51 'id' => 'profile-tab',
55 'label' => DI::l10n()->t('Status'),
56 'url' => $baseProfileUrl . '/status',
57 'sel' => $current == 'status' ? 'active' : '',
58 'title' => DI::l10n()->t('Status Messages and Posts'),
63 'label' => DI::l10n()->t('Photos'),
64 'url' => $baseProfileUrl . '/photos',
65 'sel' => $current == 'photos' ? 'active' : '',
66 'title' => DI::l10n()->t('Photo Albums'),
71 'label' => DI::l10n()->t('Media'),
72 'url' => $baseProfileUrl . '/media',
73 'sel' => $current == 'media' ? 'active' : '',
74 'title' => DI::l10n()->t('Media'),
80 // the calendar link for the full-featured events calendar
83 'label' => DI::l10n()->t('Calendar'),
84 'url' => DI::baseUrl() . '/calendar',
85 'sel' => $current == 'calendar' ? 'active' : '',
86 'title' => DI::l10n()->t('Calendar'),
87 'id' => 'calendar-tab',
90 // if the user is not the owner of the calendar we only show a calendar
91 // with the public events of the calendar owner
94 'label' => DI::l10n()->t('Calendar'),
95 'url' => DI::baseUrl() . '/calendar/show/' . $nickname,
96 'sel' => $current == 'calendar' ? 'active' : '',
97 'title' => DI::l10n()->t('Calendar'),
98 'id' => 'calendar-tab',
105 'label' => DI::l10n()->t('Personal Notes'),
106 'url' => DI::baseUrl() . '/notes',
107 'sel' => $current == 'notes' ? 'active' : '',
108 'title' => DI::l10n()->t('Only You Can See This'),
113 'label' => DI::l10n()->t('Scheduled Posts'),
114 'url' => $baseProfileUrl . '/schedule',
115 'sel' => $current == 'schedule' ? 'active' : '',
116 'title' => DI::l10n()->t('Posts that are scheduled for publishing'),
117 'id' => 'schedule-tab',
122 if (!$hide_friends) {
124 'label' => DI::l10n()->t('Contacts'),
125 'url' => $baseProfileUrl . '/contacts',
126 'sel' => $current == 'contacts' ? 'active' : '',
127 'title' => DI::l10n()->t('Contacts'),
128 'id' => 'viewcontacts-tab',
133 if (DI::session()->get('new_member') && $is_owner) {
135 'label' => DI::l10n()->t('Tips for New Members'),
136 'url' => DI::baseUrl() . '/newmember',
138 'title' => DI::l10n()->t('Tips for New Members'),
139 'id' => 'newmember-tab',
143 $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $current, 'tabs' => $tabs];
145 Hook::callAll('profile_tabs', $arr);
147 $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
149 return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);