3 * @copyright Copyright (C) 2010-2021, 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
36 * @param string $current
37 * @param bool $is_owner
38 * @param string $nickname
40 * @throws \Friendica\Network\HTTPException\InternalServerErrorException
42 public static function getTabsHTML(App $a, string $current, bool $is_owner, string $nickname, bool $hide_friends)
44 $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
48 'label' => DI::l10n()->t('Profile'),
49 'url' => $baseProfileUrl . '/profile',
50 'sel' => $current == 'profile' ? 'active' : '',
51 'title' => DI::l10n()->t('Profile Details'),
52 'id' => 'profile-tab',
56 'label' => DI::l10n()->t('Status'),
57 'url' => $baseProfileUrl . '/status',
58 'sel' => $current == 'status' ? 'active' : '',
59 'title' => DI::l10n()->t('Status Messages and Posts'),
64 'label' => DI::l10n()->t('Photos'),
65 'url' => DI::baseUrl() . '/photos/' . $nickname,
66 'sel' => $current == 'photos' ? 'active' : '',
67 'title' => DI::l10n()->t('Photo Albums'),
71 // @todo Currently deactivated since it doesn't really work
73 // 'label' => DI::l10n()->t('Videos'),
74 // 'url' => DI::baseUrl() . '/videos/' . $nickname,
75 // 'sel' => $current == 'videos' ? 'active' : '',
76 // 'title' => DI::l10n()->t('Videos'),
77 // 'id' => 'video-tab',
78 // 'accesskey' => 'v',
82 // the calendar link for the full featured events calendar
83 if ($is_owner && $a->getThemeInfoValue('events_in_profile')) {
85 'label' => DI::l10n()->t('Events'),
86 'url' => DI::baseUrl() . '/events',
87 'sel' => $current == 'events' ? 'active' : '',
88 'title' => DI::l10n()->t('Events and Calendar'),
92 // if the user is not the owner of the calendar we only show a calendar
93 // with the public events of the calendar owner
94 } elseif (!$is_owner) {
96 'label' => DI::l10n()->t('Events'),
97 'url' => DI::baseUrl() . '/cal/' . $nickname,
98 'sel' => $current == 'cal' ? 'active' : '',
99 'title' => DI::l10n()->t('Events and Calendar'),
100 'id' => 'events-tab',
107 'label' => DI::l10n()->t('Personal Notes'),
108 'url' => DI::baseUrl() . '/notes',
109 'sel' => $current == 'notes' ? 'active' : '',
110 'title' => DI::l10n()->t('Only You Can See This'),
115 'label' => DI::l10n()->t('Scheduled Posts'),
116 'url' => $baseProfileUrl . '/schedule',
117 'sel' => $current == 'schedule' ? 'active' : '',
118 'title' => DI::l10n()->t('Posts that are scheduled for publishing'),
119 'id' => 'schedule-tab',
124 if (!$hide_friends) {
126 'label' => DI::l10n()->t('Contacts'),
127 'url' => $baseProfileUrl . '/contacts',
128 'sel' => $current == 'contacts' ? 'active' : '',
129 'title' => DI::l10n()->t('Contacts'),
130 'id' => 'viewcontacts-tab',
135 if (DI::session()->get('new_member') && $is_owner) {
137 'label' => DI::l10n()->t('Tips for New Members'),
138 'url' => DI::baseUrl() . '/newmember',
140 'title' => DI::l10n()->t('Tips for New Members'),
141 'id' => 'newmember-tab',
145 $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $current, 'tabs' => $tabs];
147 Hook::callAll('profile_tabs', $arr);
149 $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
151 return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);