ILIAS  release_7 Revision v7.30-3-g800a261c036
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

 $input_activation_config
 
 $lng
 
 $ui_factory
 
 $ui_renderer
 
 $ui_service
 
 $target_url
 
 $filter
 
 $filter_values = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsTableFilter::__construct ( string  $target_url)

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

65 {
66 global $DIC;
67
68 $this->lng = $DIC->language();
69 $this->ui_factory = $DIC->ui()->factory();
70 $this->ui_renderer = $DIC->ui()->renderer();
71 $this->ui_service = $DIC->uiService();
72
73 $this->target_url = $target_url;
74 }
global $DIC
Definition: goto.php:24

References $DIC, and $target_url.

Member Function Documentation

◆ filter()

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

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

145 : array
146 {
147 $this->loadFilterValues();
148
149 $filtered = [];
150 foreach ($settings as $setting) {
151 if ($this->isFiltered($setting)) {
152 continue;
153 }
154 $filtered[] = $setting;
155 }
156 return $filtered;
157 }

References 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
Parameters
string$name
Returns
mixed

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

226 {
227 if (isset($this->filter_values[$name])) {
228 return $this->filter_values[$name];
229 }
230 }
if($format !==null) $name
Definition: metadata.php:230

References $name.

Referenced by isFiltered().

+ Here is the caller graph for this function:

◆ init()

ilDidacticTemplateSettingsTableFilter::init ( )

Init Filter.

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

80 {
81 $inputs[self::FILTER_NAME_ICON] = $this->ui_factory->input()->field()->select(
82 $this->lng->txt('icon'),
83 [
84 self::FILTER_ON => $this->lng->txt('didactic_filter_with_icon'),
85 self::FILTER_OFF => $this->lng->txt('didactic_filter_without_icon')
86 ]
87 );
88
89 $inputs[self::FILTER_NAME_TITLE] = $this->ui_factory->input()->field()->text(
90 $this->lng->txt('title')
91 );
92
93 $options = [];
95 $options[$type] = $this->lng->txt('objs_' . $type);
96 }
97 asort($options);
98 $inputs[self::FILTER_NAME_TYPE] = $this->ui_factory->input()->field()->select(
99 $this->lng->txt('type'),
100 $options
101 );
102
103 $inputs[self::FILTER_NAME_SCOPE] = $this->ui_factory->input()->field()->select(
104 $this->lng->txt('didactic_scope'),
105 [
106 self::FILTER_GLOBAL => $this->lng->txt('didactic_global'),
107 self::FILTER_LOCAL => $this->lng->txt('didactic_local')
108 ]
109 );
110
111 $inputs[self::FILTER_NAME_ACTIVE] = $this->ui_factory->input()->field()->select(
112 $this->lng->txt('status'),
113 [
114 self::FILTER_ON => $this->lng->txt('active'),
115 self::FILTER_OFF => $this->lng->txt('inactive')
116 ]
117 );
118
119 $this->filter = $this->ui_service->filter()->standard(
120 self::FILTER_ID,
121 $this->target_url,
122 $inputs,
123 $this->input_activation_config,
124 true,
125 true
126 );
127 }
$type

References $type, filter(), FILTER_NAME_ACTIVE, FILTER_NAME_ICON, FILTER_NAME_SCOPE, FILTER_NAME_TITLE, FILTER_NAME_TYPE, and ilDidacticTemplateSettings\lookupAssignedObjectTypes().

+ Here is the call graph for this function:

◆ isFiltered()

ilDidacticTemplateSettingsTableFilter::isFiltered ( ilDidacticTemplateSetting  $setting)
protected
Parameters
ilDidacticTemplateSetting$setting
Returns
bool

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

163 : bool
164 {
165 if (!$this->filter->isActivated()) {
166 return false;
167 }
168
169 $value = $this->getFilterValue(self::FILTER_NAME_ICON);
170 if ($value) {
171 if ($value == self::FILTER_ON && !strlen($setting->getIconHandler()->getAbsolutePath())) {
172 return true;
173 }
174 if ($value == self::FILTER_OFF && strlen($setting->getIconHandler()->getAbsolutePath())) {
175 return true;
176 }
177 }
178
179 $value = $this->getFilterValue(self::FILTER_NAME_TITLE);
180 if (strlen($value)) {
181 $title_string = ($setting->getPresentationTitle() . ' ' . $setting->getPresentationDescription());
182 $title_string .= (' ' . $setting->getInfo());
183 if (ilStr::strIPos($title_string, $value) === false) {
184 return true;
185 }
186 }
187
188 $value = $this->getFilterValue(self::FILTER_NAME_TYPE);
189 if (strlen($value)) {
190 $assigned = $setting->getAssignments();
191 if (!in_array($value, $assigned)) {
192 return true;
193 }
194 }
195
196 $value = $this->getFilterValue(self::FILTER_NAME_SCOPE);
197 if ($value) {
198 $is_local = (bool) count($setting->getEffectiveFrom());
199
200 print_r($setting->getEffectiveFrom());
201 if ($value == self::FILTER_GLOBAL && $is_local) {
202 return true;
203 }
204 if ($value == self::FILTER_LOCAL && !$is_local) {
205 return true;
206 }
207 }
208
209 $value = $this->getFilterValue(self::FILTER_NAME_ACTIVE);
210 if ($value) {
211 if ($value == self::FILTER_ON && !$setting->isEnabled()) {
212 return true;
213 }
214 if ($value == self::FILTER_OFF && $setting->isEnabled()) {
215 return true;
216 }
217 }
218 return false;
219 }
getInfo()
Get installation info text.
isEnabled()
Check if template is enabled.
static strIPos($a_haystack, $a_needle, $a_offset=null)
Definition: class.ilStr.php:48

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 232 of file class.ilDidacticTemplateSettingsTableFilter.php.

233 {
234
235 foreach ($this->filter->getInputs() as $name => $input) {
236 $this->filter_values[$name] = $input->getValue();
237 }
238 }

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 ( )
Returns
string

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

132 : string
133 {
134 return $this->ui_renderer->render(
135 [
136 $this->filter
137 ]
138 );
139 }

References filter().

+ Here is the call graph for this function:

Field Documentation

◆ $filter

ilDidacticTemplateSettingsTableFilter::$filter
private

◆ $filter_values

ilDidacticTemplateSettingsTableFilter::$filter_values = []
private

◆ $input_activation_config

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
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.

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

◆ $lng

ilDidacticTemplateSettingsTableFilter::$lng
private

◆ $target_url

ilDidacticTemplateSettingsTableFilter::$target_url
private

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

Referenced by __construct().

◆ $ui_factory

ilDidacticTemplateSettingsTableFilter::$ui_factory
private

◆ $ui_renderer

ilDidacticTemplateSettingsTableFilter::$ui_renderer
private

◆ $ui_service

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 14 of file class.ilDidacticTemplateSettingsTableFilter.php.

Referenced by init().

◆ FILTER_NAME_ICON

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_ICON = 'icon'
protected

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

Referenced by init().

◆ FILTER_NAME_SCOPE

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_SCOPE = 'scope'
protected

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

Referenced by init().

◆ FILTER_NAME_TITLE

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_TITLE = 'title'
protected

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

Referenced by init().

◆ FILTER_NAME_TYPE

const ilDidacticTemplateSettingsTableFilter::FILTER_NAME_TYPE = 'type'
protected

Definition at line 12 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: