aboutsummaryrefslogtreecommitdiff
path: root/lib/activities/ForumProvider.php
blob: 49260c3a7bcd2755447f4cd0ff5436c23493386f (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

/**
 * @author      Till Glöggler <tgloeggl@uos.de>
 * @author      André Klaßen <klassen@elan-ev.de>
 * @license     GPL 2 or later3
 */


namespace Studip\Activity;

require_once 'public/plugins_packages/core/Forum/models/ForumEntry.php';

class ForumProvider implements ActivityProvider
{
    /**
     * get the details for the passed activity
     *
     * @param object $activity the activity to fill with details, passed by reference
     */
    public function getActivityDetails($activity)
    {
        $post = \ForumEntry::getEntry($activity->object_id);

        if (!$post) {
            return false;
        }

        $activity->content = formatReady($post['content']);

        $url = \PluginEngine::getURL('CoreForum', [], 'index/index/' . $post['topic_id']
                    .'?cid='. $post['seminar_id'] .'&highlight_topic='. $post['topic_id']
                    .'#'. $post['topic_id']);

        $route = \URLHelper::getURL('api.php/forum_entry/' . $post['topic_id'], NULL, true);

        $activity->object_url = [
            $url => _('Zum Forum der Veranstaltung')
        ];

        $activity->object_route = $route;

        return true;
    }

    /**
     *  {@inheritdoc}
     */
    public static function getLexicalField()
    {
        return _('einen Forenbeitrag');
    }

}