ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DIC.php
Go to the documentation of this file.
1<?php
2
4
10trait DIC
11{
12
16 public function dic()
17 {
18 return $GLOBALS['DIC'];
19 }
20
21
25 protected function ctrl()
26 {
27 return $this->dic()->ctrl();
28 }
29
30
36 public function txt($variable)
37 {
38 return $this->lng()->txt($variable);
39 }
40
41
45 protected function tpl()
46 {
47 return $this->dic()->ui()->mainTemplate();
48 }
49
50
54 protected function lng()
55 {
56 return $this->dic()->language();
57 }
58
59
63 protected function tabs()
64 {
65 return $this->dic()->tabs();
66 }
67
68
72 protected function ui()
73 {
74 return $this->dic()->ui();
75 }
76
77
81 protected function user()
82 {
83 return $this->dic()->user();
84 }
85
86
90 protected function http()
91 {
92 return $this->dic()->http();
93 }
94
95
99 protected function access()
100 {
101 return $this->dic()->access();
102 }
103
104
108 protected function toolbar()
109 {
110 return $this->dic()->toolbar();
111 }
112
113
117 protected function database()
118 {
119 return $this->dic()->database();
120 }
121
122 //
123 // Helper
124 //
125 public function checkPermissionAndFail($a_perm)
126 {
127 if (!$this->checkPermissionBoolAndReturn($a_perm)) {
128 throw new \ilObjectException($this->lng()->txt("permission_denied"));
129 }
130 }
131
132
138 public function checkPermissionBoolAndReturn($a_perm)
139 {
140 return (bool) $this->access()->checkAccess($a_perm, '', $this->http()->request()->getQueryParams()['ref_id']);
141 }
142}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static http()
Fetches the global http state from ILIAS.