ILIAS  release_8 Revision v8.24
ilDidacticTemplateSettingsTableFilter Class Reference
+ Collaboration diagram for ilDidacticTemplateSettingsTableFilter:

Public Member Functions

 __construct (string $target_url)
 
 init ()
 Init Filter. More...
 
 render ()
 
 filter (array $settings)
 

Protected Member Functions

 isFiltered (ilDidacticTemplateSetting $setting)
 
 getFilterValue (string $name)
 
 loadFilterValues ()
 

Protected Attributes

const FILTER_ID = 'otpl_templates_table'
 
const FILTER_NAME_ICON = 'icon'
 
const FILTER_NAME_TITLE = 'title'
 
const FILTER_NAME_TYPE = 'type'
 
const FILTER_NAME_SCOPE = 'scope'
 
const FILTER_NAME_ACTIVE = 'active'
 
const FILTER_ON = 1
 
const FILTER_OFF = 2
 
const FILTER_GLOBAL = 1
 
const FILTER_LOCAL = 2
 

Private Attributes

array $input_activation_config
 
ilLanguage $lng
 
Factory $ui_factory
 
Renderer $ui_renderer
 
ilUIService $ui_service
 
string $target_url
 
ILIAS UI Component Input Container Filter Filter $filter = null
 
array $filter_values = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsTableFilter::__construct ( string  $target_url)

Definition at line 43 of file class.ilDidacticTemplateSettingsTableFilter.php.

44 {
45 global $DIC;
46
47 $this->lng = $DIC->language();
48 $this->ui_factory = $DIC->ui()->factory();
49 $this->ui_renderer = $DIC->ui()->renderer();
50 $this->ui_service = $DIC->uiService();
51
52 $this->target_url = $target_url;
53 }
global $DIC
Definition: feed.php:28

References $DIC, $target_url, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ filter()

ilDidacticTemplateSettingsTableFilter::filter ( array  $settings)
Parameters
ilDidacticTemplateSetting[]$settings
Returns
ilDidacticTemplateSetting[]

Definition at line 121 of file class.ilDidacticTemplateSettingsTableFilter.php.

121 : array
122 {
123 $this->loadFilterValues();
124
125 $filtered = [];
126 foreach ($settings as $setting) {
127 if ($this->isFiltered($setting)) {
128 continue;
129 }
130 $filtered[] = $setting;
131 }
132
133 return $filtered;
134 }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References ILIAS\LTI\ToolProvider\$settings, isFiltered(), and loadFilterValues().

Referenced by init(), isFiltered(), loadFilterValues(), ilDidacticTemplateSettingsTableGUI\parse(), and render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilterValue()

ilDidacticTemplateSettingsTableFilter::getFilterValue ( string  $name)
protected

Definition at line 195 of file class.ilDidacticTemplateSettingsTableFilter.php.

196 {
197 return $this->filter_values[$name] ?? null;
198 }
if($format !==null) $name
Definition: metadata.php:247

References $name.

Referenced by isFiltered().

+ Here is the caller graph for this function:

◆ init()

ilDidacticTemplateSettingsTableFilter::init ( )

Init Filter.

Definition at line 58 of file class.ilDidacticTemplateSettingsTableFilter.php.

58 : void
59 {
60 $inputs[self::FILTER_NAME_ICON] = $this->ui_factory->input()->field()->select(
61 $this->lng->txt('icon'),
62 [
63 self::FILTER_ON => $this->lng->txt('didactic_filter_with_icon'),
64 self::FILTER_OFF => $this->lng->txt('didactic_filter_without_icon')
65 ]
66 );
67
68 $inputs[self::FILTER_NAME_TITLE] = $this->ui_factory->input()->field()->text(
69 $this->lng->txt('title')
70 );
71
72 $options = [];
74 $options[$type] = $this->lng->txt('objs_' . $type);
75 }
76 asort($options);
77 $inputs[self::FILTER_NAME_TYPE] = $this->ui_factory->input()->field()->select(
78 $this->lng->txt('type'),
79 $options
80 );
81
82 $inputs[self::FILTER_NAME_SCOPE] = $this->ui_factory->input()->field()->select(
83 $this->lng->txt('didactic_scope'),
84 [
85 self::FILTER_GLOBAL => $this->lng->txt('didactic_global'),
86 self::FILTER_LOCAL => $this->lng->txt('didactic_local')
87 ]
88 );
89
90 $inputs[self::FILTER_NAME_ACTIVE] = $this->ui_factory->input()->field()->select(
91 $this->lng->txt('status'),
92 [
93 self::FILTER_ON => $this->lng->txt('active'),
94 self::FILTER_OFF => $this->lng->txt('inactive')
95 ]
96 );
97
98 $this->filter = $this->ui_service->filter()->standard(
99 self::FILTER_ID,
100 $this->target_url,
101 $inputs,
102 $this->input_activation_config,
103 true,
104 true
105 );
106 }
$type

References ILIAS\UI\Implementation\Component\Input\$inputs, $type, filter(), FILTER_NAME_ACTIVE, FILTER_NAME_ICON, FILTER_NAME_SCOPE, FILTER_NAME_TITLE, FILTER_NAME_TYPE, ILIAS\Repository\lng(), and ilDidacticTemplateSettings\lookupAssignedObjectTypes().

+ Here is the call graph for this function:

◆ isFiltered()

ilDidacticTemplateSettingsTableFilter::isFiltered ( ilDidacticTemplateSetting  $setting)
protected

Definition at line 136 of file class.ilDidacticTemplateSettingsTableFilter.php.

136 : bool
137 {
138 if (!$this->filter->isActivated()) {
139 return false;
140 }
141
142 $value = (string) $this->getFilterValue(self::FILTER_NAME_ICON);
143 if ($value) {
144 if ($value === (string) self::FILTER_ON && $setting->getIconHandler()->getAbsolutePath() === '') {
145 return true;
146 }
147 if ($value === (string) self::FILTER_OFF && $setting->getIconHandler()->getAbsolutePath() !== '') {
148 return true;
149 }
150 }
151
152 $value = (string) $this->getFilterValue(self::FILTER_NAME_TITLE);
153 if ($value !== '') {
154 $title_string = ($setting->getPresentationTitle() . ' ' . $setting->getPresentationDescription());
155 $title_string .= (' ' . $setting->getInfo());
156 if (ilStr::strIPos($title_string, $value) === false) {
157 return true;
158 }
159 }
160
161 $value = (string) $this->getFilterValue(self::FILTER_NAME_TYPE);
162 if ($value !== '') {
163 $assigned = $setting->getAssignments();
164 if (!in_array($value, $assigned)) {
165 return true;
166 }
167 }
168
169 $value = (string) $this->getFilterValue(self::FILTER_NAME_SCOPE);
170 if ($value) {
171 $is_local = (bool) count($setting->getEffectiveFrom());
172
173 print_r($setting->getEffectiveFrom());
174 if ($value === (string) self::FILTER_GLOBAL && $is_local) {
175 return true;
176 }
177 if ($value === (string) self::FILTER_LOCAL && !$is_local) {
178 return true;
179 }
180 }
181
182 $value = (string) $this->getFilterValue(self::FILTER_NAME_ACTIVE);
183 if ($value) {
184 if ($value === (string) self::FILTER_ON && !$setting->isEnabled()) {
185 return true;
186 }
187 if ($value === (string) self::FILTER_OFF && $setting->isEnabled()) {
188 return true;
189 }
190 }
191
192 return false;
193 }
getInfo()
Get installation info text.
static strIPos(string $a_haystack, string $a_needle, ?int $a_offset=null)
Definition: class.ilStr.php:54

References filter(), ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getEffectiveFrom(), getFilterValue(), ilDidacticTemplateSetting\getIconHandler(), ilDidacticTemplateSetting\getInfo(), ilDidacticTemplateSetting\getPresentationDescription(), ilDidacticTemplateSetting\getPresentationTitle(), ilDidacticTemplateSetting\isEnabled(), and ilStr\strIPos().

Referenced by filter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFilterValues()

ilDidacticTemplateSettingsTableFilter::loadFilterValues ( )
protected

Definition at line 200 of file class.ilDidacticTemplateSettingsTableFilter.php.

200 : void
201 {
202 foreach ($this->filter->getInputs() as $name => $input) {
203 $this->filter_values[$name] = $input->getValue();
204 }
205 }

References $name, and filter().

Referenced by filter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilDidacticTemplateSettingsTableFilter::render ( )

Definition at line 108 of file class.ilDidacticTemplateSettingsTableFilter.php.

108 : string
109 {
110 return $this->ui_renderer->render(
111 [
112 $this->filter
113 ]
114 );
115 }

References filter().

+ Here is the call graph for this function:

Field Documentation

◆ $filter

ILIAS UI Component Input Container Filter Filter ilDidacticTemplateSettingsTableFilter::$filter = null
private

◆ $filter_values

array ilDidacticTemplateSettingsTableFilter::$filter_values = []
private

◆ $input_activation_config

array ilDidacticTemplateSettingsTableFilter::$input_activation_config
private
Initial value:
= [
self::FILTER_NAME_ICON => false,
self::FILTER_NAME_TITLE => true,
self::FILTER_NAME_TYPE => true,
self::FILTER_NAME_SCOPE => false,
self::FILTER_NAME_ACTIVE => true
]
return true

Definition at line 23 of file class.ilDidacticTemplateSettingsTableFilter.php.

◆ $lng

ilLanguage ilDidacticTemplateSettingsTableFilter::$lng
private

◆ $target_url

string ilDidacticTemplateSettingsTableFilter::$target_url
private

Definition at line 35 of file class.ilDidacticTemplateSettingsTableFilter.php.

Referenced by __construct().

◆ $ui_factory

Factory ilDidacticTemplateSettingsTableFilter::$ui_factory
private

◆ $ui_renderer

Renderer ilDidacticTemplateSettingsTableFilter::$ui_renderer
private

◆ $ui_service

ilUIService ilDidacticTemplateSettingsTableFilter::$ui_service
private

◆ FILTER_GLOBAL

const ilDidacticTemplateSettingsTableFilter::FILTER_GLOBAL = 1
protected

◆ FILTER_ID

const ilDidacticTemplateSettingsTableFilter::FILTER_ID = 'otpl_templates_table'
protected

◆ FILTER_LOCAL

const ilDidacticTemplateSettingsTableFilter::FILTER_LOCAL = 2
protected

◆ FILTER_NAME_ACTIVE

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_ACTIVE = 'active'
protected

Definition at line 16 of file class.ilDidacticTemplateSettingsTableFilter.php.

Referenced by init().

◆ FILTER_NAME_ICON

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_ICON = 'icon'
protected

Definition at line 12 of file class.ilDidacticTemplateSettingsTableFilter.php.

Referenced by init().

◆ FILTER_NAME_SCOPE

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_SCOPE = 'scope'
protected

Definition at line 15 of file class.ilDidacticTemplateSettingsTableFilter.php.

Referenced by init().

◆ FILTER_NAME_TITLE

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_TITLE = 'title'
protected

Definition at line 13 of file class.ilDidacticTemplateSettingsTableFilter.php.

Referenced by init().

◆ FILTER_NAME_TYPE

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_TYPE = 'type'
protected

Definition at line 14 of file class.ilDidacticTemplateSettingsTableFilter.php.

Referenced by init().

◆ FILTER_OFF

const ilDidacticTemplateSettingsTableFilter::FILTER_OFF = 2
protected

◆ FILTER_ON

const ilDidacticTemplateSettingsTableFilter::FILTER_ON = 1
protected

The documentation for this class was generated from the following file: