diff options
| author | winter | 2025-03-15 18:53:29 +0000 |
|---|---|---|
| committer | winter | 2025-03-15 18:53:29 +0000 |
| commit | e0588a6113ff6b3c1000fa6c82629f81fb5e05b5 (patch) | |
| tree | ef6beb046a7dcc7542b88f0962d4e5e264895b7a /templates/actor/profile_page.php | |
| parent | 61b122e88cc6783b4d0cf5142a22002f8e558c60 (diff) | |
[refactor] move some templates to subdirs
Diffstat (limited to 'templates/actor/profile_page.php')
| -rw-r--r-- | templates/actor/profile_page.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/templates/actor/profile_page.php b/templates/actor/profile_page.php new file mode 100644 index 0000000..9c11dd6 --- /dev/null +++ b/templates/actor/profile_page.php @@ -0,0 +1,52 @@ +<?php + +use Digitigrade\Model\Note; +use Digitigrade\Model\UserAccount; +use Digitigrade\UserSettings; + +$lang = get_ui_language(); +$actorUser = UserAccount::findByLinkedActor($actor); + +call_template('skeleton', [ + 'pageTitle' => "$actor->displayName - @" . $actor->getFullHandle(), + 'renderTitleHeading' => false, + 'ogTitle' => $actor->displayName, + 'ogDesc' => $actor->bio, + 'ogImage' => $actor->avatar ?? path_to_uri('/static/default-avatar.png'), + 'ogType' => 'profile', + 'ogHandle' => '@' . $actor->getFullHandle(true), + 'headLinks' => ($actorUser != null && (new UserSettings($actorUser))->getBool('profile.rssEnabled')) ? [ + [ + 'rel' => 'alternate', + 'type' => 'application/rss+xml', + 'href' => "/actor/$actor->id/feed/$lang/feed.rss", + 'title' => __('user.profile.feed.rss') + ], + [ + 'rel' => 'alternate', + 'type' => 'application/atom+xml', + 'href' => "/actor/$actor->id/feed/$lang/feed.atom", + 'title' => __('user.profile.feed.atom') + ] + ] : [] +], function () use ($actor) { + $user = UserAccount::findByCurrentSession(); + + call_template('actor/profile', ['actor' => $actor]); + echo '<hr>'; + $notes = Note::findAllWithAuthor($actor, 20); + if (count($notes) == 0) { + call_template('placeholder_text', ['message' => __('user.notes.placeholder')]); + } elseif ($user != null && $user->actor->blocks($actor)) { + call_template('placeholder_text', ['message' => __('user.profile.notesHidden')]); + } else { + foreach ($notes as $n) { + if ($n->isViewableBy($user)) + call_template('note/note', ['note' => $n]); + } + $countNotShown = Note::countWithAuthor($actor) - count($notes); + if ($countNotShown >= 0) { + call_template('placeholder_text', ['count' => $countNotShown]); + } + } +});
\ No newline at end of file |
