- public static function getAdvanced(App $a)
- {
- $uid = intval($a->profile['uid']);
-
- if ($a->profile['name']) {
- $profile = [];
-
- $profile['fullname'] = [DI::l10n()->t('Full Name:'), $a->profile['name']];
-
- if (Feature::isEnabled($uid, 'profile_membersince')) {
- $profile['membersince'] = [DI::l10n()->t('Member since:'), DateTimeFormat::local($a->profile['register_date'])];
- }
-
- if ($a->profile['gender']) {
- $profile['gender'] = [DI::l10n()->t('Gender:'), DI::l10n()->t($a->profile['gender'])];
- }
-
- if (!empty($a->profile['dob']) && $a->profile['dob'] > DBA::NULL_DATE) {
- $year_bd_format = DI::l10n()->t('j F, Y');
- $short_bd_format = DI::l10n()->t('j F');
-
- $val = DI::l10n()->getDay(
- intval($a->profile['dob']) ?
- DateTimeFormat::utc($a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)
- : DateTimeFormat::utc('2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format)
- );
-
- $profile['birthday'] = [DI::l10n()->t('Birthday:'), $val];
- }
-
- if (!empty($a->profile['dob'])
- && $a->profile['dob'] > DBA::NULL_DATE
- && $age = Temporal::getAgeByTimezone($a->profile['dob'], $a->profile['timezone'])
- ) {
- $profile['age'] = [DI::l10n()->t('Age: ') , DI::l10n()->tt('%d year old', '%d years old', $age)];
- }
-
- if ($a->profile['marital']) {
- $profile['marital'] = [DI::l10n()->t('Status:'), DI::l10n()->t($a->profile['marital'])];
- }
-
- /// @TODO Maybe use x() here, plus below?
- if ($a->profile['with']) {
- $profile['marital']['with'] = $a->profile['with'];
- }
-
- if (strlen($a->profile['howlong']) && $a->profile['howlong'] > DBA::NULL_DATETIME) {
- $profile['howlong'] = Temporal::getRelativeDate($a->profile['howlong'], DI::l10n()->t('for %1$d %2$s'));
- }
-
- if ($a->profile['sexual']) {
- $profile['sexual'] = [DI::l10n()->t('Sexual Preference:'), DI::l10n()->t($a->profile['sexual'])];
- }
-
- if ($a->profile['homepage']) {
- $profile['homepage'] = [DI::l10n()->t('Homepage:'), HTML::toLink($a->profile['homepage'])];
- }
-
- if ($a->profile['hometown']) {
- $profile['hometown'] = [DI::l10n()->t('Hometown:'), HTML::toLink($a->profile['hometown'])];
- }
-
- if ($a->profile['pub_keywords']) {
- $profile['pub_keywords'] = [DI::l10n()->t('Tags:'), $a->profile['pub_keywords']];
- }
-
- if ($a->profile['politic']) {
- $profile['politic'] = [DI::l10n()->t('Political Views:'), $a->profile['politic']];
- }
-
- if ($a->profile['religion']) {
- $profile['religion'] = [DI::l10n()->t('Religion:'), $a->profile['religion']];
- }
-
- if ($txt = BBCode::convert($a->profile['about'])) {
- $profile['about'] = [DI::l10n()->t('About:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['interest'])) {
- $profile['interest'] = [DI::l10n()->t('Hobbies/Interests:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['likes'])) {
- $profile['likes'] = [DI::l10n()->t('Likes:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['dislikes'])) {
- $profile['dislikes'] = [DI::l10n()->t('Dislikes:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['contact'])) {
- $profile['contact'] = [DI::l10n()->t('Contact information and Social Networks:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['music'])) {
- $profile['music'] = [DI::l10n()->t('Musical interests:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['book'])) {
- $profile['book'] = [DI::l10n()->t('Books, literature:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['tv'])) {
- $profile['tv'] = [DI::l10n()->t('Television:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['film'])) {
- $profile['film'] = [DI::l10n()->t('Film/dance/culture/entertainment:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['romance'])) {
- $profile['romance'] = [DI::l10n()->t('Love/Romance:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['work'])) {
- $profile['work'] = [DI::l10n()->t('Work/employment:'), $txt];
- }
-
- if ($txt = BBCode::convert($a->profile['education'])) {
- $profile['education'] = [DI::l10n()->t('School/education:'), $txt];
- }
-
- //show subcribed forum if it is enabled in the usersettings
- if (Feature::isEnabled($uid, 'forumlist_profile')) {
- $profile['forumlist'] = [DI::l10n()->t('Forums:'), ForumManager::profileAdvanced($uid)];
- }
-
- if ($a->profile['uid'] == local_user()) {
- $profile['edit'] = [DI::baseUrl() . '/settings/profile', DI::l10n()->t('Edit profile'), '', DI::l10n()->t('Edit profile')];
- }
-
- $tpl = Renderer::getMarkupTemplate('profile/advanced.tpl');
- return Renderer::replaceMacros($tpl, [
- '$title' => DI::l10n()->t('Profile'),
- '$basic' => DI::l10n()->t('Basic'),
- '$advanced' => DI::l10n()->t('Advanced'),
- '$profile' => $profile
- ]);
- }
-
- return '';
- }
-
- /**
- * @param App $a
- * @param string $current
- * @param bool $is_owner
- * @param string $nickname
- * @return string
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- */
- public static function getTabs(App $a, string $current, bool $is_owner, string $nickname = null)
- {
- if (is_null($nickname)) {
- $nickname = $a->user['nickname'];
- }
-
- $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
-
- $tabs = [
- [
- 'label' => DI::l10n()->t('Profile'),
- 'url' => $baseProfileUrl,
- 'sel' => $current == 'profile' ? 'active' : '',
- 'title' => DI::l10n()->t('Profile Details'),
- 'id' => 'profile-tab',
- 'accesskey' => 'r',
- ],
- [
- 'label' => DI::l10n()->t('Status'),
- 'url' => $baseProfileUrl . '/status',
- 'sel' => $current == 'status' ? 'active' : '',
- 'title' => DI::l10n()->t('Status Messages and Posts'),
- 'id' => 'status-tab',
- 'accesskey' => 'm',
- ],
- [
- 'label' => DI::l10n()->t('Photos'),
- 'url' => DI::baseUrl() . '/photos/' . $nickname,
- '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',
- ],
- ];
-
- // 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) {
- $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',
- ];
- }
-
- if ($is_owner) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Personal Notes'),
- 'url' => DI::baseUrl() . '/notes',
- 'sel' => $current == 'notes' ? 'active' : '',
- 'title' => DI::l10n()->t('Only You Can See This'),
- 'id' => 'notes-tab',
- 'accesskey' => 't',
- ];
- }
-
- if (empty($a->profile['hide-friends'])) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Contacts'),
- 'url' => $baseProfileUrl . '/contacts',
- 'sel' => $current == 'contacts' ? 'active' : '',
- 'title' => DI::l10n()->t('Contacts'),
- 'id' => 'viewcontacts-tab',
- 'accesskey' => 'k',
- ];
- }
-
- if (!empty($_SESSION['new_member']) && $is_owner) {
- $tabs[] = [
- 'label' => DI::l10n()->t('Tips for New Members'),
- 'url' => DI::baseUrl() . '/newmember',
- 'sel' => false,
- 'title' => DI::l10n()->t('Tips for New Members'),
- 'id' => 'newmember-tab',
- ];
- }
-
- $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $current, 'tabs' => $tabs];
-
- Hook::callAll('profile_tabs', $arr);
-
- $tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
-
- return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
- }
-