ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DIC.php
Go to the documentation of this file.
1<?php
2
20
22
27trait DIC
28{
32 public function dic()
33 {
34 global $DIC;
35 return $DIC;
36 }
37
38 protected function ctrl(): \ilCtrl
39 {
40 return $this->dic()->ctrl();
41 }
42
43 public function txt(string $variable): string
44 {
45 return $this->lng()->txt($variable);
46 }
47
48
49 protected function tpl(): \ilGlobalTemplateInterface
50 {
51 return $this->dic()->ui()->mainTemplate();
52 }
53
54 protected function lng(): \ilLanguage
55 {
56 return $this->dic()->language();
57 }
58
59 protected function tabs(): \ilTabsGUI
60 {
61 return $this->dic()->tabs();
62 }
63
64 protected function ui(): \ILIAS\DI\UIServices
65 {
66 return $this->dic()->ui();
67 }
68
69 protected function user(): \ilObjUser
70 {
71 return $this->dic()->user();
72 }
73
74 protected function http(): \ILIAS\HTTP\Services
75 {
76 return $this->dic()->http();
77 }
78
79 protected function access(): \ilAccessHandler
80 {
81 return $this->dic()->access();
82 }
83
84 protected function toolbar(): \ilToolbarGUI
85 {
86 return $this->dic()->toolbar();
87 }
88
89 protected function database(): \ilDBInterface
90 {
91 return $this->dic()->database();
92 }
93
94 //
95 // Helper
96 //
97 public function checkPermissionAndFail($a_perm)
98 {
99 if (!$this->checkPermissionBoolAndReturn($a_perm)) {
100 throw new \ilObjectException($this->lng()->txt("permission_denied"));
101 }
102 }
103
108 public function checkPermissionBoolAndReturn($a_perm)
109 {
110 return (bool) $this->access()->checkAccess($a_perm, '', $this->http()->request()->getQueryParams()['ref_id']);
111 }
112}
Provides an interface to the ILIAS HTTP services.
Class ilCtrl provides processing control methods.
language handling
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
Interface ilDBInterface.
Class HTTPServicesTest.
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26