blob: 24b840059e3166ce4ae25c19b0d7bf96d5b9245b (
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
|
<?php
class Institute_AvatarController extends AuthenticatedController
{
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
// Ensure only admins gain access to this page
if (!$GLOBALS['perm']->have_perm("admin")) {
throw new AccessDeniedException();
}
}
public function index_action($i_id = false)
{
//get ID from an open Institut
$i_view = $i_id ?: Request::option('i_view', Context::getId());
if (!$i_view) {
Navigation::activateItem('/admin/institute/avatar');
require_once 'lib/admin_search.inc.php';
// This search just died a little inside, so it should be safe to
// continue here but we nevertheless return just to be sure
return;
} elseif ($i_view === 'new') {
closeObject();
Navigation::activateItem('/admin/institute/create');
} else {
Navigation::activateItem('/admin/institute/avatar');
}
// allow only inst-admin and root to view / edit
if ($i_view && !$GLOBALS['perm']->have_studip_perm('admin', $i_view) && $i_view !== 'new') {
throw new AccessDeniedException();
}
PageLayout::setTitle(Context::getHeaderLine() . ' - ' . _('Einrichtungsbild ändern'));
$this->institute_id = Context::getId();
$avatar = InstituteAvatar::getAvatar($this->institute_id);
$this->avatar_url = $avatar->getURL(Avatar::NORMAL);
}
}
|