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'),
72 'label' => DI::l10n()->t('Media'),
73 'url' => $baseProfileUrl . '/media',
74 'sel' => $current == 'media' ? 'active' : '',
75 'title' => DI::l10n()->t('Media'),
81 // the calendar link for the full featured events calendar
82 if ($is_owner && $a->getThemeInfoValue('events_in_profile')) {
84 'label' => DI::l10n()->t('Events'),
85 'url' => DI::baseUrl() . '/events',
86 'sel' => $current == 'events' ? 'active' : '',
87 'title' => DI::l10n()->t('Events and Calendar'),
91 // if the user is not the owner of the calendar we only show a calendar
92 // with the public events of the calendar owner
93 } elseif (!$is_owner) {
95 'label' => DI::l10n()->t('Events'),
96 'url' => DI::baseUrl() . '/cal/' . $nickname,
97 'sel' => $current == 'cal' ? 'active' : '',
98 'title' => DI::l10n()->t('Events and Calendar'),
106 'label' => DI::l10n()->t('Personal Notes'),
107 'url' => DI::baseUrl() . '/notes',
108 'sel' => $current == 'notes' ? 'active' : '',
109 'title' => DI::l10n()->t('Only You Can See This'),
114 'label' => DI::l10n()->t('Scheduled Posts'),
115 'url' => $baseProfileUrl . '/schedule',
116 'sel' => $current == 'schedule' ? 'active' : '',
117 'title' => DI::l10n()->t('Posts that are scheduled for publishing'),
118 'id' => 'schedule-tab',
123 if (!$hide_friends) {
125 'label' => DI::l10n()->t('Contacts'),
126 'url' => $baseProfileUrl . '/contacts',
127 'sel' => $current == 'contacts' ? 'active' : '',
128 'title' => DI::l10n()->t('Contacts'),
129 'id' => 'viewcontacts-tab',
134 if (DI::session()->get('new_member') && $is_owner) {
136 'label' => DI::l10n()->t('Tips for New Members'),
137 'url' => DI::baseUrl() . '/newmember',
139 'title' => DI::l10n()->t('Tips for New Members'),
140 'id' => 'newmember-tab',
144 $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $current, 'tabs' => $tabs];
146 Hook::callAll('profile_tabs', $arr);
148 $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
150 return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);