aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/actor_profile_page.php
blob: eba9d042eb627b2c499a7d0ac73808b525dd9e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

use Digitigrade\Model\Note;
use Digitigrade\Model\UserAccount;

call_template('skeleton', [
    'pageTitle' => "$actor->displayName - @" . $actor->getFullHandle(),
    'renderTitleHeading' => false
], function () {
    global $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')]);
    } else {
        foreach ($notes as $n) {
            if ($n->isViewableBy($user))
                call_template('note', ['note' => $n]);
        }
        $countNotShown = Note::countWithAuthor($actor) - count($notes);
        if ($countNotShown >= 0) {
            call_template('placeholder_text', ['count' => $countNotShown]);
        }
    }
});