blob: 8d00f52fbe989471739b4b93fd124e2679f548ea (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
<?php
class Course_MessengerController extends AuthenticatedController
{
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
PageLayout::setBodyElementId('blubber-index');
PageLayout::setHelpKeyword('Basis/InteraktionBlubber');
PageLayout::setTitle(_('Blubber'));
}
public function course_action($thread_id = null)
{
$context = Context::get();
if (!$context) {
throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
}
if (Navigation::hasItem('/course/blubber')) {
Navigation::activateItem('/course/blubber');
}
PageLayout::setTitle($context->getFullName() . ' - ' . _('Blubber'));
$this->search = '';
$this->threads = BlubberThread::findByContext($context->id, true, Context::getType());
$this->thread = null;
$this->threads_more_down = 0;
if (!$thread_id) {
$thread_id = $GLOBALS['user']->cfg->BLUBBER_DEFAULT_THREAD;
}
if ($thread_id) {
foreach ($this->threads as $thread) {
if ($thread->getId() === $thread_id) {
$this->thread = $thread;
break;
}
}
}
if (!$this->thread || Request::get('thread') === 'new') {
$threads = array_reverse($this->threads);
$this->thread = array_pop($threads);
}
if ($this->thread) {
$this->thread->markAsRead();
}
if (!Avatar::getAvatar($GLOBALS['user']->id)->is_customized()) {
$_SESSION['already_asked_for_avatar'] = true;
PageLayout::postInfo(
sprintf(
_('Wollen Sie ein Avatar-Bild nutzen? %sLaden Sie jetzt ein Bild hoch%s.'),
'<a href="' .
URLHelper::getURL('dispatch.php/settings/avatar/') .
'" >',
'</a>'
)
);
}
$this->buildSidebar();
if (Request::isDialog()) {
PageLayout::setTitle($this->thread->getName());
$this->render_template('blubber/dialog');
} else {
$this->render_template('blubber/index', $this->layout);
}
}
protected function buildSidebar()
{
$sidebar = Sidebar::Get();
$sidebar->addWidget(new VueWidget('blubber-search-widget'));
$sidebar->addWidget(new VueWidget('blubber-threads-widget'));
}
}
|