ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLuceneAdvancedSearchFields Class Reference

Field definitions of advanced meta data search. More...

+ Collaboration diagram for ilLuceneAdvancedSearchFields:

Public Member Functions

 getActiveFields ()
 Get all active fields. More...
 
 getActiveSections ()
 
 getFormElement ($a_query, $a_field_name, ilPropertyFormGUI $a_form)
 
 parseFieldQuery ($a_field, $a_query)
 Called from ilLuceneAdvancedQueryParser Parse a field specific query. More...
 

Static Public Member Functions

static getInstance ()
 Get singleton instance. More...
 
static getFields ()
 Return an array of all meta data fields. More...
 

Data Fields

const ONLINE_QUERY = 1
 
const OFFLINE_QUERY = 2
 

Protected Member Functions

 __construct ()
 
 readFields ()
 Read active fields. More...
 
 readSections ()
 Read active sections. More...
 
 getRangeSelect ($txt_from, $select_from, $txt_until, $select_until)
 get a range selection More...
 

Protected Attributes

 $lng = null
 

Private Attributes

 $settings = null
 
 $active_fields = array()
 
 $active_sections = array()
 

Static Private Attributes

static $instance = null
 
static $fields = null
 
static $sections = null
 

Detailed Description

Field definitions of advanced meta data search.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 36 of file class.ilLuceneAdvancedSearchFields.php.

Constructor & Destructor Documentation

◆ __construct()

ilLuceneAdvancedSearchFields::__construct ( )
protected

Definition at line 53 of file class.ilLuceneAdvancedSearchFields.php.

References $DIC, $lng, ilLuceneAdvancedSearchSettings\getInstance(), readFields(), readSections(), and settings().

54  {
55  global $DIC;
56 
57  $lng = $DIC['lng'];
58 
60 
61  $this->lng = $lng;
62  $this->lng->loadLanguageModule('meta');
63 
64  $this->readFields();
65  $this->readSections();
66  }
settings()
Definition: settings.php:2
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveFields()

ilLuceneAdvancedSearchFields::getActiveFields ( )

Get all active fields.

Definition at line 134 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by readSections().

135  {
136  return $this->active_fields ? $this->active_fields : array();
137  }
+ Here is the caller graph for this function:

◆ getActiveSections()

ilLuceneAdvancedSearchFields::getActiveSections ( )

Definition at line 139 of file class.ilLuceneAdvancedSearchFields.php.

140  {
141  return $this->active_sections ? $this->active_sections : array();
142  }

◆ getFields()

static ilLuceneAdvancedSearchFields::getFields ( )
static

Return an array of all meta data fields.

Definition at line 82 of file class.ilLuceneAdvancedSearchFields.php.

References $DIC, $fields, $lng, ilAdvancedMDRecord\_getRecords(), ilSearchSettings\getInstance(), ilAdvancedMDFieldTranslations\getInstanceByRecordId(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by ilLuceneAdvancedSearchActivationTableGUI\parse(), ilLuceneAdvancedSearchSettings\read(), and ilObjSearchSettingsGUI\saveAdvancedLuceneSettingsObject().

83  {
84  global $DIC;
85 
86  $lng = $DIC->language();
87 
88  $lng->loadLanguageModule('meta');
89 
90  $fields['lom_content'] = $lng->txt('content');
91 
92  include_once './Services/Search/classes/class.ilSearchSettings.php';
93  if (ilSearchSettings::getInstance()->enabledLucene()) {
94  $fields['general_offline'] = $lng->txt('lucene_offline_filter');
95  }
96  //'lom_type' = $lng->txt('type');
97  $fields['lom_language'] = $lng->txt('language');
98  $fields['lom_keyword'] = $lng->txt('meta_keyword');
99  $fields['lom_coverage'] = $lng->txt('meta_coverage');
100  $fields['lom_structure'] = $lng->txt('meta_structure');
101  $fields['lom_status'] = $lng->txt('meta_status');
102  $fields['lom_version'] = $lng->txt('meta_version');
103  $fields['lom_contribute'] = $lng->txt('meta_contribute');
104  $fields['lom_format'] = $lng->txt('meta_format');
105  $fields['lom_operating_system'] = $lng->txt('meta_operating_system');
106  $fields['lom_browser'] = $lng->txt('meta_browser');
107  $fields['lom_interactivity'] = $lng->txt('meta_interactivity_type');
108  $fields['lom_resource'] = $lng->txt('meta_learning_resource_type');
109  $fields['lom_level'] = $lng->txt('meta_interactivity_level');
110  $fields['lom_density'] = $lng->txt('meta_semantic_density');
111  $fields['lom_user_role'] = $lng->txt('meta_intended_end_user_role');
112  $fields['lom_context'] = $lng->txt('meta_context');
113  $fields['lom_difficulty'] = $lng->txt('meta_difficulty');
114  $fields['lom_costs'] = $lng->txt('meta_cost');
115  $fields['lom_copyright'] = $lng->txt('meta_copyright_and_other_restrictions');
116  $fields['lom_purpose'] = $lng->txt('meta_purpose');
117  $fields['lom_taxon'] = $lng->txt('meta_taxon');
118 
119  // Append all advanced meta data fields
120  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
121  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
122  foreach (ilAdvancedMDRecord::_getRecords() as $record) {
123  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true) as $def) {
124  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record->getRecordId());
125  $fields['adv_' . $def->getFieldId()] = $field_translations->getTitleForLanguage($def->getFieldId(), $lng->getLangKey());
126  }
127  }
128  return $fields;
129  }
static _getRecords()
Get records.
global $DIC
Definition: goto.php:24
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormElement()

ilLuceneAdvancedSearchFields::getFormElement (   $a_query,
  $a_field_name,
ilPropertyFormGUI  $a_form 
)

Definition at line 144 of file class.ilLuceneAdvancedSearchFields.php.

References ilMDUtilSelect\_getBrowserSelect(), ilMDUtilSelect\_getContextSelect(), ilMDUtilSelect\_getCopyrightAndOtherRestrictionsSelect(), ilMDUtilSelect\_getCostsSelect(), ilMDUtilSelect\_getDifficultySelect(), ilMDUtilSelect\_getFormatSelect(), ilMDUtilSelect\_getIntendedEndUserRoleSelect(), ilMDUtilSelect\_getInteractivityLevelSelect(), ilMDUtilSelect\_getInteractivityTypeSelect(), ilMDUtilSelect\_getLanguageSelect(), ilMDUtilSelect\_getLearningResourceTypeSelect(), ilMDUtilSelect\_getOperatingSystemSelect(), ilMDUtilSelect\_getPurposeSelect(), ilMDUtilSelect\_getRoleSelect(), ilMDUtilSelect\_getSemanticDensitySelect(), ilMDUtilSelect\_getStatusSelect(), ilMDUtilSelect\_getStructureSelect(), ilADTFactory\getInstance(), ilAdvancedMDFieldDefinition\getInstance(), ilLoggerFactory\getLogger(), and getRangeSelect().

145  {
146  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
147 
148  $a_post_name = 'query[' . $a_field_name . ']';
149 
150  ilLoggerFactory::getLogger('sea')->debug('Query was: ' . print_r($a_query, true));
151  if (!is_array($a_query)) {
152  $a_query = array();
153  }
154 
155  switch ($a_field_name) {
156  case 'general_offline':
157  $offline_options = array(
158  '0' => $this->lng->txt('search_any'),
159  self::ONLINE_QUERY => $this->lng->txt('search_option_online'),
160  self::OFFLINE_QUERY => $this->lng->txt('search_option_offline')
161  );
162  $offline = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
163  $offline->setOptions($offline_options);
164  $offline->setValue($a_query['general_offline']);
165  return $offline;
166 
167  case 'lom_content':
168  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
169  $text->setSubmitFormOnEnter(true);
170  $text->setValue($a_query['lom_content']);
171  $text->setSize(30);
172  $text->setMaxLength(255);
173  return $text;
174 
175  // General
176  case 'lom_language':
177  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
178  $select->setValue($a_query['lom_language']);
179  $select->setOptions(ilMDUtilSelect::_getLanguageSelect(
180  '',
181  $a_field_name,
182  array(0 => $this->lng->txt('search_any')),
183  true
184  ));
185  return $select;
186 
187  case 'lom_keyword':
188  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
189  $text->setSubmitFormOnEnter(true);
190  $text->setValue($a_query['lom_keyword']);
191  $text->setSize(30);
192  $text->setMaxLength(255);
193  return $text;
194 
195  case 'lom_coverage':
196  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
197  $text->setSubmitFormOnEnter(true);
198  $text->setValue($a_query['lom_coverage']);
199  $text->setSize(30);
200  $text->setMaxLength(255);
201  return $text;
202 
203  case 'lom_structure':
204  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
205  $select->setValue($a_query['lom_structure']);
206  $select->setOptions(ilMDUtilSelect::_getStructureSelect(
207  '',
208  $a_field_name,
209  array(0 => $this->lng->txt('search_any')),
210  true
211  ));
212  return $select;
213 
214  // Lifecycle
215  case 'lom_status':
216  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
217  $select->setValue($a_query['lom_status']);
218  $select->setOptions(ilMDUtilSelect::_getStatusSelect(
219  '',
220  $a_field_name,
221  array(0 => $this->lng->txt('search_any')),
222  true
223  ));
224  return $select;
225 
226  case 'lom_version':
227  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
228  $text->setSubmitFormOnEnter(true);
229  $text->setValue($a_query['lom_version']);
230  $text->setSize(30);
231  $text->setMaxLength(255);
232  return $text;
233 
234  case 'lom_contribute':
235  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], 'query[' . 'lom_role' . ']');
236  $select->setValue($a_query['lom_role']);
237  $select->setOptions(ilMDUtilSelect::_getRoleSelect(
238  '',
239  $a_field_name,
240  array(0 => $this->lng->txt('search_any')),
241  true
242  ));
243 
244  $text = new ilTextInputGUI($this->lng->txt('meta_entry'), 'query[' . 'lom_role_entry' . ']');
245  $text->setValue($a_query['lom_role_entry']);
246  $text->setSize(30);
247  $text->setMaxLength(255);
248 
249  $select->addSubItem($text);
250  return $select;
251 
252  // Technical
253  case 'lom_format':
254  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
255  $select->setValue($a_query['lom_format']);
256  $select->setOptions(ilMDUtilSelect::_getFormatSelect(
257  '',
258  $a_field_name,
259  array(0 => $this->lng->txt('search_any')),
260  true
261  ));
262  return $select;
263 
264  case 'lom_operating_system':
265  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
266  $select->setValue($a_query['lom_operating_system']);
267  $select->setOptions(ilMDUtilSelect::_getOperatingSystemSelect(
268  '',
269  $a_field_name,
270  array(0 => $this->lng->txt('search_any')),
271  true
272  ));
273  return $select;
274 
275  case 'lom_browser':
276  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
277  $select->setValue($a_query['lom_browser']);
278  $select->setOptions(ilMDUtilSelect::_getBrowserSelect(
279  '',
280  $a_field_name,
281  array(0 => $this->lng->txt('search_any')),
282  true
283  ));
284  return $select;
285 
286  // Education
287  case 'lom_interactivity':
288  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
289  $select->setValue($a_query['lom_interactivity']);
291  '',
292  $a_field_name,
293  array(0 => $this->lng->txt('search_any')),
294  true
295  ));
296  return $select;
297 
298  case 'lom_resource':
299  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
300  $select->setValue($a_query['lom_resource']);
302  '',
303  $a_field_name,
304  array(0 => $this->lng->txt('search_any')),
305  true
306  ));
307  return $select;
308 
309  case 'lom_level':
310  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
311  $html = $this->getRangeSelect(
312  $this->lng->txt('from'),
314  $a_query['lom_level_start'],
315  'query[' . 'lom_level_start' . ']',
316  array(0 => $this->lng->txt('search_any'))
317  ),
318  $this->lng->txt('until'),
320  $a_query['lom_level_end'],
321  'query[' . 'lom_level_end' . ']',
322  array(0 => $this->lng->txt('search_any'))
323  )
324  );
325  $range->setHTML($html);
326  return $range;
327 
328  case 'lom_density':
329  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
330  $html = $this->getRangeSelect(
331  $this->lng->txt('from'),
333  $a_query['lom_density_start'],
334  'query[' . 'lom_density_start' . ']',
335  array(0 => $this->lng->txt('search_any'))
336  ),
337  $this->lng->txt('until'),
339  $a_query['lom_density_end'],
340  'query[' . 'lom_density_end' . ']',
341  array(0 => $this->lng->txt('search_any'))
342  )
343  );
344  $range->setHTML($html);
345  return $range;
346 
347 
348  case 'lom_user_role':
349  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
350  $select->setValue($a_query['lom_user_role']);
352  '',
353  $a_field_name,
354  array(0 => $this->lng->txt('search_any')),
355  true
356  ));
357  return $select;
358 
359  case 'lom_context':
360  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
361  $select->setValue($a_query['lom_context']);
362  $select->setOptions(ilMDUtilSelect::_getContextSelect(
363  '',
364  $a_field_name,
365  array(0 => $this->lng->txt('search_any')),
366  true
367  ));
368  return $select;
369 
370  case 'lom_difficulty':
371  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
372  $html = $this->getRangeSelect(
373  $this->lng->txt('from'),
375  $a_query['lom_difficulty_start'],
376  'query[' . 'lom_difficulty_start' . ']',
377  array(0 => $this->lng->txt('search_any'))
378  ),
379  $this->lng->txt('until'),
381  $a_query['lom_difficulty_end'],
382  'query[' . 'lom_difficulty_end' . ']',
383  array(0 => $this->lng->txt('search_any'))
384  )
385  );
386  $range->setHTML($html);
387  return $range;
388 
389  // Rights
390  case 'lom_costs':
391  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
392  $select->setValue($a_query['lom_costs']);
393  $select->setOptions(ilMDUtilSelect::_getCostsSelect(
394  '',
395  $a_field_name,
396  array(0 => $this->lng->txt('search_any')),
397  true
398  ));
399  return $select;
400 
401  case 'lom_copyright':
402  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
403  $select->setValue($a_query['lom_copyright']);
405  '',
406  $a_field_name,
407  array(0 => $this->lng->txt('search_any')),
408  true
409  ));
410  return $select;
411 
412 
413 
414  // Classification
415  case 'lom_purpose':
416  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
417  $select->setValue($a_query['lom_purpose']);
418  $select->setOptions(ilMDUtilSelect::_getPurposeSelect(
419  '',
420  $a_field_name,
421  array(0 => $this->lng->txt('search_any')),
422  true
423  ));
424  return $select;
425 
426  case 'lom_taxon':
427  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
428  $text->setSubmitFormOnEnter(true);
429  $text->setValue($a_query['lom_taxon']);
430  $text->setSize(30);
431  $text->setMaxLength(255);
432  return $text;
433 
434  default:
435  if (substr($a_field_name, 0, 3) != 'adv') {
436  break;
437  }
438 
439  // Advanced meta data
440  $field_id = substr($a_field_name, 4);
441  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
442  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
443 
444  $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
445  $field_form->setForm($a_form);
446  $field_form->setElementId($a_post_name);
447  $field_form->setTitle($this->active_fields[$a_field_name]);
448  $field_form->addToForm();
449 
450  // #17071 - reload search values
451  if (is_array($a_query) &&
452  array_key_exists($a_field_name, $a_query)) {
453  $field_form->importFromPost((array) $a_query);
454  $field_form->validate();
455  }
456 
457  return;
458  }
459  return null;
460  }
static _getCopyrightAndOtherRestrictionsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
static _getIntendedEndUserRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational intended end user role All possible entries in meta_format are shown...
static _getCostsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights costs All possible entries in meta_format are shown.
static _getSemanticDensitySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational semantic density All possible entries in meta_format are shown...
static _getLanguageSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta data language selector.
static _getInteractivityLevelSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational interactivity level All possible entries in meta_format are shown...
static getInstance()
Get singleton.
static _getLearningResourceTypeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational learning resource type All possible entries in meta_format are shown...
static _getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
static _getFormatSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical format selector All possible entries in meta_format are shown.
static _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
static _getDifficultySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
static _getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
static _getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
This class represents a custom property in a property form.
static _getContextSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta context.
getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
get a range selection
static _getPurposeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
static getInstance($a_field_id, $a_type=null, string $language='')
Get definition instance by type.
static getLogger($a_component_id)
Get component logger.
static _getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
static _getInteractivityTypeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational interactivity type All possible entries in meta_format are shown...
+ Here is the call graph for this function:

◆ getInstance()

static ilLuceneAdvancedSearchFields::getInstance ( )
static

Get singleton instance.

Definition at line 71 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by ilLuceneAdvancedQueryParser\__construct(), ilLuceneSearchGUI\__construct(), ilLuceneAdvancedSearchGUI\__construct(), ilAdvancedSearchGUI\__construct(), and ilLuceneUserSearchGUI\getTabs().

72  {
73  if (isset(self::$instance) and self::$instance) {
74  return self::$instance;
75  }
76  return self::$instance = new ilLuceneAdvancedSearchFields();
77  }
Field definitions of advanced meta data search.
+ Here is the caller graph for this function:

◆ getRangeSelect()

ilLuceneAdvancedSearchFields::getRangeSelect (   $txt_from,
  $select_from,
  $txt_until,
  $select_until 
)
protected

get a range selection

Definition at line 812 of file class.ilLuceneAdvancedSearchFields.php.

References $tpl.

Referenced by getFormElement().

813  {
814  $tpl = new ilTemplate('tpl.range_search.html', true, true, 'Services/Search');
815  $tpl->setVariable('TXT_FROM', $txt_from);
816  $tpl->setVariable('FROM', $select_from);
817  $tpl->setVariable('TXT_UPTO', $txt_until);
818  $tpl->setVariable('UPTO', $select_until);
819  return $tpl->get();
820  }
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the caller graph for this function:

◆ parseFieldQuery()

ilLuceneAdvancedSearchFields::parseFieldQuery (   $a_field,
  $a_query 
)

Called from ilLuceneAdvancedQueryParser Parse a field specific query.

Definition at line 467 of file class.ilLuceneAdvancedSearchFields.php.

References $i, $res, ilMDUtilSelect\_getDifficultySelect(), ilMDUtilSelect\_getInteractivityLevelSelect(), ilMDUtilSelect\_getSemanticDensitySelect(), and ilAdvancedMDFieldDefinition\getInstance().

468  {
469  switch ($a_field) {
470  case 'lom_content':
471  return $a_query;
472 
473  case 'general_offline':
474 
475  switch ($a_query) {
476  case self::OFFLINE_QUERY:
477  return 'offline:1';
478 
479  default:
480  return '-offline:1';
481 
482  }
483  return '';
484 
485  // General
486  case 'lom_language':
487  return 'lomLanguage:' . $a_query;
488 
489  case 'lom_keyword':
490  return 'lomKeyword:' . $a_query;
491 
492  case 'lom_coverage':
493  return 'lomCoverage:' . $a_query;
494 
495  case 'lom_structure':
496  return 'lomStructure:' . $a_query;
497 
498  // Lifecycle
499  case 'lom_status':
500  return 'lomStatus:' . $a_query;
501 
502  case 'lom_version':
503  return 'lomVersion:' . $a_query;
504 
505  // Begin Contribute
506  case 'lom_role':
507  return 'lomRole:' . $a_query;
508 
509  case 'lom_role_entry':
510  return 'lomRoleEntity:' . $a_query;
511  // End contribute
512 
513  // Technical
514  case 'lom_format':
515  return 'lomFormat:' . $a_query;
516 
517  case 'lom_operating_system':
518  return 'lomOS:' . $a_query;
519 
520  case 'lom_browser':
521  return 'lomBrowser:' . $a_query;
522 
523  // Educational
524  case 'lom_interactivity':
525  return 'lomInteractivity:' . $a_query;
526 
527  case 'lom_resource':
528  return 'lomResource:' . $a_query;
529 
530  case 'lom_level_start':
531  $q_string = '';
532  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
533  $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
534  for ($i = $a_query; $i <= count($options); $i++) {
535  if (strlen($q_string)) {
536  $q_string .= 'OR ';
537  }
538  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
539  }
540  return $q_string;
541 
542  case 'lom_level_end':
543  $q_string = '';
544  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
545  $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
546  for ($i = 1; $i <= $a_query; $i++) {
547  if (strlen($q_string)) {
548  $q_string .= 'OR ';
549  }
550  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
551  }
552  return $q_string;
553 
554  case 'lom_density_start':
555  $q_string = '';
556  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
557  $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
558  for ($i = $a_query; $i <= count($options); $i++) {
559  if (strlen($q_string)) {
560  $q_string .= 'OR ';
561  }
562  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
563  }
564  return $q_string;
565 
566  case 'lom_density_end':
567  $q_string = '';
568  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
569  $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
570  for ($i = 1; $i <= $a_query; $i++) {
571  if (strlen($q_string)) {
572  $q_string .= 'OR ';
573  }
574  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
575  }
576  return $q_string;
577 
578  case 'lom_user_role':
579  return 'lomUserRole:' . $a_query;
580 
581  case 'lom_context':
582  return 'lomContext:' . $a_query;
583 
584  case 'lom_difficulty_start':
585  $q_string = '';
586  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
587  $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
588  for ($i = $a_query; $i <= count($options); $i++) {
589  if (strlen($q_string)) {
590  $q_string .= 'OR ';
591  }
592  $q_string .= ('lomDifficulty:"' . $options[$i] . '" ');
593  }
594  return $q_string;
595 
596  case 'lom_difficulty_end':
597  $q_string = '';
598  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
599  $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
600  for ($i = 1; $i <= $a_query; $i++) {
601  if (strlen($q_string)) {
602  $q_string .= 'OR ';
603  }
604  $q_string .= ('lomDifficulty:"' . $options[$i] . '" ');
605  }
606  return $q_string;
607 
608  // Rights
609  case 'lom_costs':
610  return 'lomCosts:' . $a_query;
611 
612  case 'lom_copyright':
613  return 'lomCopyright:' . $a_query;
614 
615  // Classification
616  case 'lom_purpose':
617  return 'lomPurpose:' . $a_query;
618 
619  case 'lom_taxon':
620  return 'lomTaxon:' . $a_query;
621 
622  default:
623  if (substr($a_field, 0, 3) != 'adv') {
624  break;
625  }
626 
627  // Advanced meta data
628  $field_id = substr($a_field, 4);
629  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
630  try {
631  // field might be invalid (cached query)
632  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
633  } catch (Exception $ex) {
634  return '';
635  }
636 
637  $adv_query = $field->getLuceneSearchString($a_query);
638  if ($adv_query) {
639  // #17558
640  if (!is_array($adv_query)) {
641  return 'advancedMetaData_' . $field_id . ': ' . $adv_query;
642  } else {
643  $res = array();
644  foreach ($adv_query as $adv_query_item) {
645  $res[] = 'advancedMetaData_' . $field_id . ': ' . $adv_query_item;
646  }
647  return '(' . implode(' OR ', $res) . ')';
648  }
649  }
650  }
651  }
static _getSemanticDensitySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational semantic density All possible entries in meta_format are shown...
static _getInteractivityLevelSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational interactivity level All possible entries in meta_format are shown...
foreach($_POST as $key=> $value) $res
static _getDifficultySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
static getInstance($a_field_id, $a_type=null, string $language='')
Get definition instance by type.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ readFields()

ilLuceneAdvancedSearchFields::readFields ( )
protected

Read active fields.

Definition at line 657 of file class.ilLuceneAdvancedSearchFields.php.

References $name, and settings().

Referenced by __construct().

658  {
659  foreach (self::getFields() as $name => $translation) {
660  if ($this->settings->isActive($name)) {
661  $this->active_fields[$name] = $translation;
662  }
663  }
664  }
settings()
Definition: settings.php:2
if($format !==null) $name
Definition: metadata.php:230
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSections()

ilLuceneAdvancedSearchFields::readSections ( )
protected

Read active sections.

Definition at line 669 of file class.ilLuceneAdvancedSearchFields.php.

References $DIC, getActiveFields(), ilAdvancedMDFieldDefinition\getInstance(), and ilAdvancedMDRecordTranslations\getInstanceByRecordId().

Referenced by __construct().

670  {
671  global $DIC;
672 
673  $user = $DIC->user();
674 
675  foreach ($this->getActiveFields() as $field_name => $translation) {
676  switch ($field_name) {
677  // Default section
678  case 'lom_content':
679  $this->active_sections['default']['fields'][] = 'lom_content';
680  $this->active_sections['default']['name'] = '';
681  break;
682 
683  case 'general_offline':
684  $this->active_sections['default']['fields'][] = 'general_offline';
685  $this->active_sections['default']['name'] = '';
686  break;
687 
688  case 'lom_type':
689  $this->active_sections['default']['fields'][] = 'lom_type';
690  $this->active_sections['default']['name'] = '';
691  break;
692 
693  // General
694  case 'lom_language':
695  $this->active_sections['general']['fields'][] = 'lom_language';
696  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
697  break;
698  case 'lom_keyword':
699  $this->active_sections['general']['fields'][] = 'lom_keyword';
700  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
701  break;
702  case 'lom_coverage':
703  $this->active_sections['general']['fields'][] = 'lom_coverage';
704  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
705  break;
706  case 'lom_structure':
707  $this->active_sections['general']['fields'][] = 'lom_structure';
708  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
709  break;
710 
711  // Lifecycle
712  case 'lom_status':
713  $this->active_sections['lifecycle']['fields'][] = 'lom_status';
714  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
715  break;
716  case 'lom_version':
717  $this->active_sections['lifecycle']['fields'][] = 'lom_version';
718  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
719  break;
720  case 'lom_contribute':
721  $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
722  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
723  break;
724 
725  // Technical
726  case 'lom_format':
727  $this->active_sections['technical']['fields'][] = 'lom_format';
728  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
729  break;
730  case 'lom_operating_system':
731  $this->active_sections['technical']['fields'][] = 'lom_operating_system';
732  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
733  break;
734  case 'lom_browser':
735  $this->active_sections['technical']['fields'][] = 'lom_browser';
736  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
737  break;
738 
739  // Education
740  case 'lom_interactivity':
741  $this->active_sections['education']['fields'][] = 'lom_interactivity';
742  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
743  break;
744  case 'lom_resource':
745  $this->active_sections['education']['fields'][] = 'lom_resource';
746  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
747  break;
748  case 'lom_level':
749  $this->active_sections['education']['fields'][] = 'lom_level';
750  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
751  break;
752  case 'lom_density':
753  $this->active_sections['education']['fields'][] = 'lom_density';
754  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
755  break;
756  case 'lom_user_role':
757  $this->active_sections['education']['fields'][] = 'lom_user_role';
758  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
759  break;
760  case 'lom_context':
761  $this->active_sections['education']['fields'][] = 'lom_context';
762  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
763  break;
764  case 'lom_difficulty':
765  $this->active_sections['education']['fields'][] = 'lom_difficulty';
766  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
767  break;
768 
769  // Rights
770  case 'lom_costs':
771  $this->active_sections['rights']['fields'][] = 'lom_costs';
772  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
773  break;
774  case 'lom_copyright':
775  $this->active_sections['rights']['fields'][] = 'lom_copyright';
776  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
777  break;
778 
779  // Classification
780  case 'lom_purpose':
781  $this->active_sections['classification']['fields'][] = 'lom_purpose';
782  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
783  break;
784  case 'lom_taxon':
785  $this->active_sections['classification']['fields'][] = 'lom_taxon';
786  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
787  break;
788 
789  default:
790  if (substr($field_name, 0, 3) != 'adv') {
791  break;
792  }
793 
794  // Advanced meta data
795  $field_id = substr($field_name, 4);
796  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
797  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
798  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
799  $record_id = $field->getRecordId();
800 
801  $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record_id);
802  $this->active_sections['adv_record_' . $record_id]['fields'][] = $field_name;
803  $this->active_sections['adv_record_' . $record_id]['name'] = $translations->getTitleForLanguage($user->getLanguage());
804  break;
805  }
806  }
807  }
global $DIC
Definition: goto.php:24
static getInstance($a_field_id, $a_type=null, string $language='')
Get definition instance by type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active_fields

ilLuceneAdvancedSearchFields::$active_fields = array()
private

Definition at line 47 of file class.ilLuceneAdvancedSearchFields.php.

◆ $active_sections

ilLuceneAdvancedSearchFields::$active_sections = array()
private

Definition at line 50 of file class.ilLuceneAdvancedSearchFields.php.

◆ $fields

ilLuceneAdvancedSearchFields::$fields = null
staticprivate

Definition at line 46 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by getFields().

◆ $instance

ilLuceneAdvancedSearchFields::$instance = null
staticprivate

Definition at line 41 of file class.ilLuceneAdvancedSearchFields.php.

◆ $lng

ilLuceneAdvancedSearchFields::$lng = null
protected

Definition at line 44 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by __construct(), and getFields().

◆ $sections

ilLuceneAdvancedSearchFields::$sections = null
staticprivate

Definition at line 49 of file class.ilLuceneAdvancedSearchFields.php.

◆ $settings

ilLuceneAdvancedSearchFields::$settings = null
private

Definition at line 42 of file class.ilLuceneAdvancedSearchFields.php.

◆ OFFLINE_QUERY

const ilLuceneAdvancedSearchFields::OFFLINE_QUERY = 2

Definition at line 39 of file class.ilLuceneAdvancedSearchFields.php.

◆ ONLINE_QUERY

const ilLuceneAdvancedSearchFields::ONLINE_QUERY = 1

Definition at line 38 of file class.ilLuceneAdvancedSearchFields.php.


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