3 namespace Friendica\Module;
6 use Friendica\BaseModule;
7 use Friendica\Core\Hook;
8 use Friendica\Core\Renderer;
11 class BaseProfile extends BaseModule
14 * Returns the HTML for the profile pages tabs
17 * @param string $current
18 * @param bool $is_owner
19 * @param string $nickname
21 * @throws \Friendica\Network\HTTPException\InternalServerErrorException
23 public static function getTabsHTML(App $a, string $current, bool $is_owner, string $nickname = null)
25 if (is_null($nickname)) {
26 $nickname = $a->user['nickname'];
29 $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
33 'label' => DI::l10n()->t('Profile'),
34 'url' => $baseProfileUrl . '/profile',
35 'sel' => $current == 'profile' ? 'active' : '',
36 'title' => DI::l10n()->t('Profile Details'),
37 'id' => 'profile-tab',
41 'label' => DI::l10n()->t('Status'),
42 'url' => $baseProfileUrl . '/status',
43 'sel' => $current == 'status' ? 'active' : '',
44 'title' => DI::l10n()->t('Status Messages and Posts'),
49 'label' => DI::l10n()->t('Photos'),
50 'url' => DI::baseUrl() . '/photos/' . $nickname,
51 'sel' => $current == 'photos' ? 'active' : '',
52 'title' => DI::l10n()->t('Photo Albums'),
57 'label' => DI::l10n()->t('Videos'),
58 'url' => DI::baseUrl() . '/videos/' . $nickname,
59 'sel' => $current == 'videos' ? 'active' : '',
60 'title' => DI::l10n()->t('Videos'),
66 // the calendar link for the full featured events calendar
67 if ($is_owner && $a->theme_events_in_profile) {
69 'label' => DI::l10n()->t('Events'),
70 'url' => DI::baseUrl() . '/events',
71 'sel' => $current == 'events' ? 'active' : '',
72 'title' => DI::l10n()->t('Events and Calendar'),
76 // if the user is not the owner of the calendar we only show a calendar
77 // with the public events of the calendar owner
78 } elseif (!$is_owner) {
80 'label' => DI::l10n()->t('Events'),
81 'url' => DI::baseUrl() . '/cal/' . $nickname,
82 'sel' => $current == 'cal' ? 'active' : '',
83 'title' => DI::l10n()->t('Events and Calendar'),
91 'label' => DI::l10n()->t('Personal Notes'),
92 'url' => DI::baseUrl() . '/notes',
93 'sel' => $current == 'notes' ? 'active' : '',
94 'title' => DI::l10n()->t('Only You Can See This'),
100 if (empty($a->profile['hide-friends'])) {
102 'label' => DI::l10n()->t('Contacts'),
103 'url' => $baseProfileUrl . '/contacts',
104 'sel' => $current == 'contacts' ? 'active' : '',
105 'title' => DI::l10n()->t('Contacts'),
106 'id' => 'viewcontacts-tab',
111 if (DI::session()->get('new_member') && $is_owner) {
113 'label' => DI::l10n()->t('Tips for New Members'),
114 'url' => DI::baseUrl() . '/newmember',
116 'title' => DI::l10n()->t('Tips for New Members'),
117 'id' => 'newmember-tab',
121 $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $current, 'tabs' => $tabs];
123 Hook::callAll('profile_tabs', $arr);
125 $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
127 return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);