ILIAS  release_8 Revision v8.24
class.ViewManager.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
27{
28 private int $user_id;
30
31 public function __construct(
33 ?int $user_id = null
34 ) {
35 global $DIC; // fixes 41305, to do: move to constructor
36 if (is_null($user_id)) {
37 $this->user_id = $DIC->user()->getId();
38 } else {
39 $this->user_id = $user_id;
40 }
41
42 $this->view_repo = $view_repo;
43 }
44
45 public function setAdminView(): void
46 {
47 if (in_array($this->user_id, [ANONYMOUS_USER_ID, 0], true)) {
48 return;
49 }
50 $this->view_repo->setAdminView();
51 }
52
53 public function setContentView(): void
54 {
55 $this->view_repo->setContentView();
56 }
57
58 public function isAdminView(): bool
59 {
60 return $this->view_repo->isAdminView();
61 }
62
63 public function isContentView(): bool
64 {
65 return $this->view_repo->isContentView();
66 }
67}
__construct(ViewSessionRepository $view_repo, ?int $user_id=null)
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...