ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLuceneAdvancedSearchFields.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
25 include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
26 
37 {
38  const ONLINE_QUERY = 1;
39  const OFFLINE_QUERY = 2;
40 
41  private static $instance = null;
42  private $settings = null;
43 
44  protected $lng = null;
45 
46  private static $fields = null;
47  private $active_fields = array();
48 
49  private static $sections = null;
50  private $active_sections = array();
51 
52 
53  protected function __construct()
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  }
67 
71  public static function getInstance()
72  {
73  if (isset(self::$instance) and self::$instance) {
74  return self::$instance;
75  }
76  return self::$instance = new ilLuceneAdvancedSearchFields();
77  }
78 
82  public static function getFields()
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  }
130 
134  public function getActiveFields()
135  {
136  return $this->active_fields ? $this->active_fields : array();
137  }
138 
139  public function getActiveSections()
140  {
141  return $this->active_sections ? $this->active_sections : array();
142  }
143 
144  public function getFormElement($a_query, $a_field_name, ilPropertyFormGUI $a_form)
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  }
461 
462 
467  public function parseFieldQuery($a_field, $a_query)
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  }
652 
653 
657  protected function readFields()
658  {
659  foreach (self::getFields() as $name => $translation) {
660  if ($this->settings->isActive($name)) {
661  $this->active_fields[$name] = $translation;
662  }
663  }
664  }
665 
669  protected function readSections()
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  }
808 
812  protected function getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
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  }
821 }
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.
settings()
Definition: settings.php:2
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 _getRecords()
Get records.
This class represents a property form user interface.
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.
if($format !==null) $name
Definition: metadata.php:230
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.
foreach($_POST as $key=> $value) $res
static _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
global $DIC
Definition: goto.php:24
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.
getFormElement($a_query, $a_field_name, ilPropertyFormGUI $a_form)
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 getFields()
Return an array of all meta data fields.
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 getInstance()
Get singleton instance.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
parseFieldQuery($a_field, $a_query)
Called from ilLuceneAdvancedQueryParser Parse a field specific query.
Field definitions of advanced meta data search.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
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...
$i
Definition: metadata.php:24