ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLuceneAdvancedSearchFields.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
30 {
31  public const ONLINE_QUERY = 1;
32  public const OFFLINE_QUERY = 2;
33 
34  private static ?ilLuceneAdvancedSearchFields $instance = null;
36 
37  protected ilLanguage $lng;
38  protected ilObjUser $user;
39 
40  private static array $fields = [];
41  private array $active_fields = [];
42 
43  private static array $sections = [];
44  private array $active_sections = [];
45 
46 
47  protected function __construct()
48  {
49  global $DIC;
50 
51  $this->lng = $DIC->language();
52  $this->lng->loadLanguageModule('meta');
53  $this->user = $DIC->user();
54 
56 
57  $this->readFields();
58  $this->readSections();
59  }
60 
61  public static function getInstance(): ilLuceneAdvancedSearchFields
62  {
63  if (self::$instance instanceof ilLuceneAdvancedSearchFields) {
64  return self::$instance;
65  }
66  return self::$instance = new ilLuceneAdvancedSearchFields();
67  }
68 
73  public static function getFields(): array
74  {
75  global $DIC;
76 
77  $lng = $DIC->language();
78 
79  $lng->loadLanguageModule('meta');
80 
81  $fields['lom_content'] = $lng->txt('content');
82 
83  if (ilSearchSettings::getInstance()->enabledLucene()) {
84  $fields['general_offline'] = $lng->txt('lucene_offline_filter');
85  }
86  //'lom_type' = $lng->txt('type');
87  $fields['lom_language'] = $lng->txt('language');
88  $fields['lom_keyword'] = $lng->txt('meta_keyword');
89  $fields['lom_coverage'] = $lng->txt('meta_coverage');
90  $fields['lom_structure'] = $lng->txt('meta_structure');
91  $fields['lom_status'] = $lng->txt('meta_status');
92  $fields['lom_version'] = $lng->txt('meta_version');
93  $fields['lom_contribute'] = $lng->txt('meta_contribute');
94  $fields['lom_format'] = $lng->txt('meta_format');
95  $fields['lom_operating_system'] = $lng->txt('meta_operating_system');
96  $fields['lom_browser'] = $lng->txt('meta_browser');
97  $fields['lom_interactivity'] = $lng->txt('meta_interactivity_type');
98  $fields['lom_resource'] = $lng->txt('meta_learning_resource_type');
99  $fields['lom_level'] = $lng->txt('meta_interactivity_level');
100  $fields['lom_density'] = $lng->txt('meta_semantic_density');
101  $fields['lom_user_role'] = $lng->txt('meta_intended_end_user_role');
102  $fields['lom_context'] = $lng->txt('meta_context');
103  $fields['lom_difficulty'] = $lng->txt('meta_difficulty');
104  $fields['lom_costs'] = $lng->txt('meta_cost');
105  $fields['lom_copyright'] = $lng->txt('meta_copyright_and_other_restrictions');
106  $fields['lom_purpose'] = $lng->txt('meta_purpose');
107  $fields['lom_taxon'] = $lng->txt('meta_taxon');
108 
109  // Append all advanced meta data fields
110  foreach (ilAdvancedMDRecord::_getRecords() as $record) {
111  if ($record->getParentObject() > 0) {
112  if (!ilObject::_hasUntrashedReference($record->getParentObject())) {
113  continue;
114  }
115  }
116 
117  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true) as $def) {
118  $field_translations = ilAdvancedMDFieldTranslations::getInstanceByRecordId($record->getRecordId());
119  $fields['adv_' . $def->getFieldId()] = $field_translations->getTitleForLanguage($def->getFieldId(), $lng->getLangKey());
120  }
121  }
122 
123  return $fields;
124  }
125 
130  public function getActiveFields(): array
131  {
132  return $this->active_fields;
133  }
134 
135  public function getActiveSections(): array
136  {
137  return $this->active_sections;
138  }
139 
143  public function getFormElement($a_query, string $a_field_name, ilPropertyFormGUI $a_form): ?ilFormPropertyGUI
144  {
145  $a_post_name = 'query[' . $a_field_name . ']';
146 
147  if (!is_array($a_query)) {
148  $a_query = array();
149  }
150 
151  switch ($a_field_name) {
152  case 'general_offline':
153  $offline_options = array(
154  '0' => $this->lng->txt('search_any'),
155  self::ONLINE_QUERY => $this->lng->txt('search_option_online'),
156  self::OFFLINE_QUERY => $this->lng->txt('search_option_offline')
157  );
158  $offline = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
159  $offline->setOptions($offline_options);
160  $offline->setValue($a_query['general_offline'] ?? '');
161  return $offline;
162 
163  case 'lom_content':
164  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
165  $text->setSubmitFormOnEnter(true);
166  $text->setValue($a_query['lom_content'] ?? '');
167  $text->setSize(30);
168  $text->setMaxLength(255);
169  return $text;
170 
171  // General
172  case 'lom_language':
173  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
174  $select->setValue($a_query['lom_language'] ?? '');
175  $select->setOptions((array) ilMDUtilSelect::_getLanguageSelect(
176  '',
177  $a_field_name,
178  array(0 => $this->lng->txt('search_any')),
179  true
180  ));
181  return $select;
182 
183  case 'lom_keyword':
184  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
185  $text->setSubmitFormOnEnter(true);
186  $text->setValue($a_query['lom_keyword'] ?? '');
187  $text->setSize(30);
188  $text->setMaxLength(255);
189  return $text;
190 
191  case 'lom_coverage':
192  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
193  $text->setSubmitFormOnEnter(true);
194  $text->setValue($a_query['lom_coverage'] ?? '');
195  $text->setSize(30);
196  $text->setMaxLength(255);
197  return $text;
198 
199  case 'lom_structure':
200  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
201  $select->setValue($a_query['lom_structure'] ?? '');
202  $select->setOptions((array) ilMDUtilSelect::_getStructureSelect(
203  '',
204  $a_field_name,
205  array(0 => $this->lng->txt('search_any')),
206  true
207  ));
208  return $select;
209 
210  // Lifecycle
211  case 'lom_status':
212  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
213  $select->setValue($a_query['lom_status'] ?? '');
214  $select->setOptions((array) ilMDUtilSelect::_getStatusSelect(
215  '',
216  $a_field_name,
217  array(0 => $this->lng->txt('search_any')),
218  true
219  ));
220  return $select;
221 
222  case 'lom_version':
223  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
224  $text->setSubmitFormOnEnter(true);
225  $text->setValue($a_query['lom_version'] ?? '');
226  $text->setSize(30);
227  $text->setMaxLength(255);
228  return $text;
229 
230  case 'lom_contribute':
231  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], 'query[' . 'lom_role' . ']');
232  $select->setValue($a_query['lom_role'] ?? '');
233  $select->setOptions((array) ilMDUtilSelect::_getRoleSelect(
234  '',
235  $a_field_name,
236  array(0 => $this->lng->txt('search_any')),
237  true
238  ));
239 
240  $text = new ilTextInputGUI($this->lng->txt('meta_entry'), 'query[' . 'lom_role_entry' . ']');
241  $text->setValue($a_query['lom_role_entry'] ?? '');
242  $text->setSize(30);
243  $text->setMaxLength(255);
244 
245  $select->addSubItem($text);
246  return $select;
247 
248  // Technical
249  case 'lom_format':
250  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
251  $select->setValue($a_query['lom_format'] ?? '');
252  $select->setOptions((array) ilMDUtilSelect::_getFormatSelect(
253  '',
254  $a_field_name,
255  array(0 => $this->lng->txt('search_any')),
256  true
257  ));
258  return $select;
259 
260  case 'lom_operating_system':
261  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
262  $select->setValue($a_query['lom_operating_system'] ?? '');
263  $select->setOptions((array) ilMDUtilSelect::_getOperatingSystemSelect(
264  '',
265  $a_field_name,
266  array(0 => $this->lng->txt('search_any')),
267  true
268  ));
269  return $select;
270 
271  case 'lom_browser':
272  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
273  $select->setValue($a_query['lom_browser'] ?? '');
274  $select->setOptions((array) ilMDUtilSelect::_getBrowserSelect(
275  '',
276  $a_field_name,
277  array(0 => $this->lng->txt('search_any')),
278  true
279  ));
280  return $select;
281 
282  // Education
283  case 'lom_interactivity':
284  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
285  $select->setValue($a_query['lom_interactivity'] ?? '');
286  $select->setOptions((array) ilMDUtilSelect::_getInteractivityTypeSelect(
287  '',
288  $a_field_name,
289  array(0 => $this->lng->txt('search_any')),
290  true
291  ));
292  return $select;
293 
294  case 'lom_resource':
295  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
296  $select->setValue($a_query['lom_resource'] ?? '');
297  $select->setOptions((array) ilMDUtilSelect::_getLearningResourceTypeSelect(
298  '',
299  $a_field_name,
300  array(0 => $this->lng->txt('search_any')),
301  true
302  ));
303  return $select;
304 
305  case 'lom_level':
306  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
307  $html = $this->getRangeSelect(
308  $this->lng->txt('from'),
310  $a_query['lom_level_start'] ?? '',
311  'query[' . 'lom_level_start' . ']',
312  array(0 => $this->lng->txt('search_any'))
313  ),
314  $this->lng->txt('until'),
316  $a_query['lom_level_end'] ?? '',
317  'query[' . 'lom_level_end' . ']',
318  array(0 => $this->lng->txt('search_any'))
319  )
320  );
321  $range->setHtml($html);
322  return $range;
323 
324  case 'lom_density':
325  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
326  $html = $this->getRangeSelect(
327  $this->lng->txt('from'),
329  $a_query['lom_density_start'] ?? '',
330  'query[' . 'lom_density_start' . ']',
331  array(0 => $this->lng->txt('search_any'))
332  ),
333  $this->lng->txt('until'),
335  $a_query['lom_density_end'] ?? '',
336  'query[' . 'lom_density_end' . ']',
337  array(0 => $this->lng->txt('search_any'))
338  )
339  );
340  $range->setHtml($html);
341  return $range;
342 
343 
344  case 'lom_user_role':
345  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
346  $select->setValue($a_query['lom_user_role'] ?? '');
347  $select->setOptions((array) ilMDUtilSelect::_getIntendedEndUserRoleSelect(
348  '',
349  $a_field_name,
350  array(0 => $this->lng->txt('search_any')),
351  true
352  ));
353  return $select;
354 
355  case 'lom_context':
356  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
357  $select->setValue($a_query['lom_context'] ?? '');
358  $select->setOptions((array) ilMDUtilSelect::_getContextSelect(
359  '',
360  $a_field_name,
361  array(0 => $this->lng->txt('search_any')),
362  true
363  ));
364  return $select;
365 
366  case 'lom_difficulty':
367  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
368  $html = $this->getRangeSelect(
369  $this->lng->txt('from'),
371  $a_query['lom_difficulty_start'] ?? '',
372  'query[' . 'lom_difficulty_start' . ']',
373  array(0 => $this->lng->txt('search_any'))
374  ),
375  $this->lng->txt('until'),
377  $a_query['lom_difficulty_end'] ?? '',
378  'query[' . 'lom_difficulty_end' . ']',
379  array(0 => $this->lng->txt('search_any'))
380  )
381  );
382  $range->setHtml($html);
383  return $range;
384 
385  // Rights
386  case 'lom_costs':
387  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
388  $select->setValue($a_query['lom_costs'] ?? '');
389  $select->setOptions((array) ilMDUtilSelect::_getCostsSelect(
390  '',
391  $a_field_name,
392  array(0 => $this->lng->txt('search_any')),
393  true
394  ));
395  return $select;
396 
397  case 'lom_copyright':
398  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
399  $select->setValue($a_query['lom_copyright'] ?? '');
401  '',
402  $a_field_name,
403  array(0 => $this->lng->txt('search_any')),
404  true
405  ));
406  return $select;
407 
408 
409 
410  // Classification
411  case 'lom_purpose':
412  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
413  $select->setValue($a_query['lom_purpose'] ?? '');
414  $select->setOptions((array) ilMDUtilSelect::_getPurposeSelect(
415  '',
416  $a_field_name,
417  array(0 => $this->lng->txt('search_any')),
418  true
419  ));
420  return $select;
421 
422  case 'lom_taxon':
423  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
424  $text->setSubmitFormOnEnter(true);
425  $text->setValue($a_query['lom_taxon'] ?? '');
426  $text->setSize(30);
427  $text->setMaxLength(255);
428  return $text;
429 
430  default:
431  if (substr($a_field_name, 0, 3) != 'adv') {
432  break;
433  }
434 
435  // Advanced meta data
436  $field_id = substr($a_field_name, 4);
437  $field = ilAdvancedMDFieldDefinition::getInstance((int) $field_id);
438 
439  $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
440  $field_form->setForm($a_form);
441  $field_form->setElementId($a_post_name);
442  $field_form->setTitle($this->active_fields[$a_field_name]);
443  $field_form->addToForm();
444 
445  // #17071 - reload search values
446  if (is_array($a_query) &&
447  array_key_exists($a_field_name, $a_query)) {
448  $field_form->importFromPost((array) $a_query);
449  $field_form->validate();
450  }
451  return null;
452  }
453  return null;
454  }
455 
456 
463  public function parseFieldQuery(string $a_field, $a_query): string
464  {
465  switch ($a_field) {
466  case 'lom_content':
467  return $a_query;
468 
469  case 'general_offline':
470 
471  switch ($a_query) {
472  case self::OFFLINE_QUERY:
473  return 'offline:1';
474 
475  default:
476  return '-offline:1';
477 
478  }
479 
480  // General
481  // no break
482  case 'lom_language':
483  return 'lomLanguage:' . $a_query;
484 
485  case 'lom_keyword':
486  return 'lomKeyword:' . $a_query;
487 
488  case 'lom_coverage':
489  return 'lomCoverage:' . $a_query;
490 
491  case 'lom_structure':
492  return 'lomStructure:' . $a_query;
493 
494  // Lifecycle
495  case 'lom_status':
496  return 'lomStatus:' . $a_query;
497 
498  case 'lom_version':
499  return 'lomVersion:' . $a_query;
500 
501  // Begin Contribute
502  case 'lom_role':
503  return 'lomRole:' . $a_query;
504 
505  case 'lom_role_entry':
506  return 'lomRoleEntity:' . $a_query;
507  // End contribute
508 
509  // Technical
510  case 'lom_format':
511  return 'lomFormat:' . $a_query;
512 
513  case 'lom_operating_system':
514  return 'lomOS:' . $a_query;
515 
516  case 'lom_browser':
517  return 'lomBrowser:' . $a_query;
518 
519  // Educational
520  case 'lom_interactivity':
521  return 'lomInteractivity:' . $a_query;
522 
523  case 'lom_resource':
524  return 'lomResource:' . $a_query;
525 
526  case 'lom_level_start':
527  $q_string = '';
528  $options = (array) ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
529  for ($i = $a_query; $i <= count($options); $i++) {
530  if (strlen($q_string)) {
531  $q_string .= 'OR ';
532  }
533  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
534  }
535  return $q_string;
536 
537  case 'lom_level_end':
538  $q_string = '';
539  $options = (array) ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
540  for ($i = 1; $i <= $a_query; $i++) {
541  if (strlen($q_string)) {
542  $q_string .= 'OR ';
543  }
544  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
545  }
546  return $q_string;
547 
548  case 'lom_density_start':
549  $q_string = '';
550  $options = (array) ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
551  for ($i = $a_query; $i <= count($options); $i++) {
552  if (strlen($q_string)) {
553  $q_string .= 'OR ';
554  }
555  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
556  }
557  return $q_string;
558 
559  case 'lom_density_end':
560  $q_string = '';
561  $options = (array) ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
562  for ($i = 1; $i <= $a_query; $i++) {
563  if (strlen($q_string)) {
564  $q_string .= 'OR ';
565  }
566  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
567  }
568  return $q_string;
569 
570  case 'lom_user_role':
571  return 'lomUserRole:' . $a_query;
572 
573  case 'lom_context':
574  return 'lomContext:' . $a_query;
575 
576  case 'lom_difficulty_start':
577  $q_string = '';
578  $options = (array) ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
579  for ($i = $a_query; $i <= count($options); $i++) {
580  if (strlen($q_string)) {
581  $q_string .= 'OR ';
582  }
583  $q_string .= ('lomDifficulty:"' . $options[$i] . '" ');
584  }
585  return $q_string;
586 
587  case 'lom_difficulty_end':
588  $q_string = '';
589  $options = (array) ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
590  for ($i = 1; $i <= $a_query; $i++) {
591  if (strlen($q_string)) {
592  $q_string .= 'OR ';
593  }
594  $q_string .= ('lomDifficulty:"' . $options[$i] . '" ');
595  }
596  return $q_string;
597 
598  // Rights
599  case 'lom_costs':
600  return 'lomCosts:' . $a_query;
601 
602  case 'lom_copyright':
603  return 'lomCopyright:' . $a_query;
604 
605  // Classification
606  case 'lom_purpose':
607  return 'lomPurpose:' . $a_query;
608 
609  case 'lom_taxon':
610  return 'lomTaxon:' . $a_query;
611 
612  default:
613  if (substr($a_field, 0, 3) != 'adv') {
614  break;
615  }
616 
617  // Advanced meta data
618  $field_id = substr($a_field, 4);
619  try {
620  // field might be invalid (cached query)
621  $field = ilAdvancedMDFieldDefinition::getInstance((int) $field_id);
622  } catch (Exception $ex) {
623  return '';
624  }
625 
626  $adv_query = $field->getLuceneSearchString($a_query);
627  if ($adv_query) {
628  // #17558
629  if (!is_array($adv_query)) {
630  return 'advancedMetaData_' . $field_id . ': ' . $adv_query;
631  } else {
632  $res = array();
633  foreach ($adv_query as $adv_query_item) {
634  $res[] = 'advancedMetaData_' . $field_id . ': ' . $adv_query_item;
635  }
636  return '(' . implode(' OR ', $res) . ')';
637  }
638  }
639  }
640  return '';
641  }
642 
643 
647  protected function readFields(): void
648  {
649  foreach (self::getFields() as $name => $translation) {
650  if ($this->settings->isActive($name)) {
651  $this->active_fields[$name] = $translation;
652  }
653  }
654  }
655 
659  protected function readSections(): void
660  {
661  foreach ($this->getActiveFields() as $field_name => $translation) {
662  switch ($field_name) {
663  // Default section
664  case 'lom_content':
665  $this->active_sections['default']['fields'][] = 'lom_content';
666  $this->active_sections['default']['name'] = '';
667  break;
668 
669  case 'general_offline':
670  $this->active_sections['default']['fields'][] = 'general_offline';
671  $this->active_sections['default']['name'] = '';
672  break;
673 
674  case 'lom_type':
675  $this->active_sections['default']['fields'][] = 'lom_type';
676  $this->active_sections['default']['name'] = '';
677  break;
678 
679  // General
680  case 'lom_language':
681  $this->active_sections['general']['fields'][] = 'lom_language';
682  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
683  break;
684  case 'lom_keyword':
685  $this->active_sections['general']['fields'][] = 'lom_keyword';
686  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
687  break;
688  case 'lom_coverage':
689  $this->active_sections['general']['fields'][] = 'lom_coverage';
690  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
691  break;
692  case 'lom_structure':
693  $this->active_sections['general']['fields'][] = 'lom_structure';
694  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
695  break;
696 
697  // Lifecycle
698  case 'lom_status':
699  $this->active_sections['lifecycle']['fields'][] = 'lom_status';
700  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
701  break;
702  case 'lom_version':
703  $this->active_sections['lifecycle']['fields'][] = 'lom_version';
704  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
705  break;
706  case 'lom_contribute':
707  $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
708  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
709  break;
710 
711  // Technical
712  case 'lom_format':
713  $this->active_sections['technical']['fields'][] = 'lom_format';
714  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
715  break;
716  case 'lom_operating_system':
717  $this->active_sections['technical']['fields'][] = 'lom_operating_system';
718  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
719  break;
720  case 'lom_browser':
721  $this->active_sections['technical']['fields'][] = 'lom_browser';
722  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
723  break;
724 
725  // Education
726  case 'lom_interactivity':
727  $this->active_sections['education']['fields'][] = 'lom_interactivity';
728  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
729  break;
730  case 'lom_resource':
731  $this->active_sections['education']['fields'][] = 'lom_resource';
732  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
733  break;
734  case 'lom_level':
735  $this->active_sections['education']['fields'][] = 'lom_level';
736  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
737  break;
738  case 'lom_density':
739  $this->active_sections['education']['fields'][] = 'lom_density';
740  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
741  break;
742  case 'lom_user_role':
743  $this->active_sections['education']['fields'][] = 'lom_user_role';
744  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
745  break;
746  case 'lom_context':
747  $this->active_sections['education']['fields'][] = 'lom_context';
748  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
749  break;
750  case 'lom_difficulty':
751  $this->active_sections['education']['fields'][] = 'lom_difficulty';
752  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
753  break;
754 
755  // Rights
756  case 'lom_costs':
757  $this->active_sections['rights']['fields'][] = 'lom_costs';
758  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
759  break;
760  case 'lom_copyright':
761  $this->active_sections['rights']['fields'][] = 'lom_copyright';
762  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
763  break;
764 
765  // Classification
766  case 'lom_purpose':
767  $this->active_sections['classification']['fields'][] = 'lom_purpose';
768  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
769  break;
770  case 'lom_taxon':
771  $this->active_sections['classification']['fields'][] = 'lom_taxon';
772  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
773  break;
774 
775  default:
776  if (substr($field_name, 0, 3) != 'adv') {
777  break;
778  }
779 
780  // Advanced meta data
781  $field_id = substr($field_name, 4);
782  $field = ilAdvancedMDFieldDefinition::getInstance((int) $field_id);
783  $record_id = $field->getRecordId();
784 
785  $translations = ilAdvancedMDRecordTranslations::getInstanceByRecordId($record_id);
786  $this->active_sections['adv_record_' . $record_id]['fields'][] = $field_name;
787  $this->active_sections['adv_record_' . $record_id]['name'] = $translations->getTitleForLanguage($this->user->getLanguage());
788  break;
789  }
790  }
791  }
792 
796  protected function getRangeSelect(
797  string $txt_from,
798  string $select_from,
799  string $txt_until,
800  string $select_until
801  ): string {
802  $tpl = new ilTemplate('tpl.range_search.html', true, true, 'Services/Search');
803  $tpl->setVariable('TXT_FROM', $txt_from);
804  $tpl->setVariable('FROM', $select_from);
805  $tpl->setVariable('TXT_UPTO', $txt_until);
806  $tpl->setVariable('UPTO', $select_until);
807  return $tpl->get();
808  }
809 }
static _getOperatingSystemSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta technical os selector.
static _getCopyrightAndOtherRestrictionsSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
$res
Definition: ltiservices.php:69
static _getPurposeSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getRecords()
Get records public.
static _getBrowserSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta technical browser selector.
getFormElement($a_query, string $a_field_name, ilPropertyFormGUI $a_form)
static _getLearningResourceTypeSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational learning resource type All possible entries in meta_format are shown...
getRangeSelect(string $txt_from, string $select_from, string $txt_until, string $select_until)
get a range selection
parseFieldQuery(string $a_field, $a_query)
Called from ilLuceneAdvancedQueryParser Parse a field specific query.
getLangKey()
Return lang key.
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
loadLanguageModule(string $a_module)
Load language module.
static _getSemanticDensitySelect( $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational semantic density All possible entries in meta_format are shown...
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
static _getStatusSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta lifecycle status selector.
static getInstance(?int $a_field_id, ?int $a_type=null, string $language='')
static _getDifficultySelect( $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
En/disable single lom/advanced meta data fields.
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
static _getCostsSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta rights costs All possible entries in meta_format are shown.
static _getStructureSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta general structure selector.
static _getInteractivityLevelSelect( $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational interactivity level All possible entries in meta_format are shown...
static _getLanguageSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta data language selector.
static ilLuceneAdvancedSearchFields $instance
static _getIntendedEndUserRoleSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational intended end user role All possible entries in meta_format are shown...
static _getRoleSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta lifecycle status selector.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getContextSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta context.
This class represents a property in a property form.
static getFields()
Return an array of all meta data fields.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
static _getFormatSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta technical format selector All possible entries in meta_format are shown.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInteractivityTypeSelect(string $a_selected, string $a_name, array $prepend=array(), bool $a_options_only=false)
Prepare a meta educational interactivity type All possible entries in meta_format are shown...
$i
Definition: metadata.php:41