ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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['lng'];
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  $fields['adv_' . $def->getFieldId()] = $def->getTitle();
125  }
126  }
127  return $fields;
128  }
129 
133  public function getActiveFields()
134  {
135  return $this->active_fields ? $this->active_fields : array();
136  }
137 
138  public function getActiveSections()
139  {
140  return $this->active_sections ? $this->active_sections : array();
141  }
142 
143  public function getFormElement($a_query, $a_field_name, ilPropertyFormGUI $a_form)
144  {
145  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
146 
147  $a_post_name = 'query[' . $a_field_name . ']';
148 
149  ilLoggerFactory::getLogger('sea')->debug('Query was: ' . print_r($a_query, true));
150  if (!is_array($a_query)) {
151  $a_query = array();
152  }
153 
154  switch ($a_field_name) {
155  case 'general_offline':
156  $offline_options = array(
157  '0' => $this->lng->txt('search_any'),
158  self::ONLINE_QUERY => $this->lng->txt('search_option_online'),
159  self::OFFLINE_QUERY => $this->lng->txt('search_option_offline')
160  );
161  $offline = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
162  $offline->setOptions($offline_options);
163  $offline->setValue($a_query['general_offline']);
164  return $offline;
165 
166  case 'lom_content':
167  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
168  $text->setSubmitFormOnEnter(true);
169  $text->setValue($a_query['lom_content']);
170  $text->setSize(30);
171  $text->setMaxLength(255);
172  return $text;
173 
174  // General
175  case 'lom_language':
176  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
177  $select->setValue($a_query['lom_language']);
178  $select->setOptions(ilMDUtilSelect::_getLanguageSelect(
179  '',
180  $a_field_name,
181  array(0 => $this->lng->txt('search_any')),
182  true
183  ));
184  return $select;
185 
186  case 'lom_keyword':
187  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
188  $text->setSubmitFormOnEnter(true);
189  $text->setValue($a_query['lom_keyword']);
190  $text->setSize(30);
191  $text->setMaxLength(255);
192  return $text;
193 
194  case 'lom_coverage':
195  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
196  $text->setSubmitFormOnEnter(true);
197  $text->setValue($a_query['lom_coverage']);
198  $text->setSize(30);
199  $text->setMaxLength(255);
200  return $text;
201 
202  case 'lom_structure':
203  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
204  $select->setValue($a_query['lom_structure']);
205  $select->setOptions(ilMDUtilSelect::_getStructureSelect(
206  '',
207  $a_field_name,
208  array(0 => $this->lng->txt('search_any')),
209  true
210  ));
211  return $select;
212 
213  // Lifecycle
214  case 'lom_status':
215  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
216  $select->setValue($a_query['lom_status']);
217  $select->setOptions(ilMDUtilSelect::_getStatusSelect(
218  '',
219  $a_field_name,
220  array(0 => $this->lng->txt('search_any')),
221  true
222  ));
223  return $select;
224 
225  case 'lom_version':
226  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
227  $text->setSubmitFormOnEnter(true);
228  $text->setValue($a_query['lom_version']);
229  $text->setSize(30);
230  $text->setMaxLength(255);
231  return $text;
232 
233  case 'lom_contribute':
234  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], 'query[' . 'lom_role' . ']');
235  $select->setValue($a_query['lom_role']);
236  $select->setOptions(ilMDUtilSelect::_getRoleSelect(
237  '',
238  $a_field_name,
239  array(0 => $this->lng->txt('search_any')),
240  true
241  ));
242 
243  $text = new ilTextInputGUI($this->lng->txt('meta_entry'), 'query[' . 'lom_role_entry' . ']');
244  $text->setValue($a_query['lom_role_entry']);
245  $text->setSize(30);
246  $text->setMaxLength(255);
247 
248  $select->addSubItem($text);
249  return $select;
250 
251  // Technical
252  case 'lom_format':
253  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
254  $select->setValue($a_query['lom_format']);
255  $select->setOptions(ilMDUtilSelect::_getFormatSelect(
256  '',
257  $a_field_name,
258  array(0 => $this->lng->txt('search_any')),
259  true
260  ));
261  return $select;
262 
263  case 'lom_operating_system':
264  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
265  $select->setValue($a_query['lom_operating_system']);
266  $select->setOptions(ilMDUtilSelect::_getOperatingSystemSelect(
267  '',
268  $a_field_name,
269  array(0 => $this->lng->txt('search_any')),
270  true
271  ));
272  return $select;
273 
274  case 'lom_browser':
275  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
276  $select->setValue($a_query['lom_browser']);
277  $select->setOptions(ilMDUtilSelect::_getBrowserSelect(
278  '',
279  $a_field_name,
280  array(0 => $this->lng->txt('search_any')),
281  true
282  ));
283  return $select;
284 
285  // Education
286  case 'lom_interactivity':
287  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
288  $select->setValue($a_query['lom_interactivity']);
290  '',
291  $a_field_name,
292  array(0 => $this->lng->txt('search_any')),
293  true
294  ));
295  return $select;
296 
297  case 'lom_resource':
298  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
299  $select->setValue($a_query['lom_resource']);
301  '',
302  $a_field_name,
303  array(0 => $this->lng->txt('search_any')),
304  true
305  ));
306  return $select;
307 
308  case 'lom_level':
309  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
310  $html = $this->getRangeSelect(
311  $this->lng->txt('from'),
313  $a_query['lom_level_start'],
314  'query[' . 'lom_level_start' . ']',
315  array(0 => $this->lng->txt('search_any'))
316  ),
317  $this->lng->txt('until'),
319  $a_query['lom_level_end'],
320  'query[' . 'lom_level_end' . ']',
321  array(0 => $this->lng->txt('search_any'))
322  )
323  );
324  $range->setHTML($html);
325  return $range;
326 
327  case 'lom_density':
328  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
329  $html = $this->getRangeSelect(
330  $this->lng->txt('from'),
332  $a_query['lom_density_start'],
333  'query[' . 'lom_density_start' . ']',
334  array(0 => $this->lng->txt('search_any'))
335  ),
336  $this->lng->txt('until'),
338  $a_query['lom_density_end'],
339  'query[' . 'lom_density_end' . ']',
340  array(0 => $this->lng->txt('search_any'))
341  )
342  );
343  $range->setHTML($html);
344  return $range;
345 
346 
347  case 'lom_user_role':
348  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
349  $select->setValue($a_query['lom_user_role']);
351  '',
352  $a_field_name,
353  array(0 => $this->lng->txt('search_any')),
354  true
355  ));
356  return $select;
357 
358  case 'lom_context':
359  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
360  $select->setValue($a_query['lom_context']);
361  $select->setOptions(ilMDUtilSelect::_getContextSelect(
362  '',
363  $a_field_name,
364  array(0 => $this->lng->txt('search_any')),
365  true
366  ));
367  return $select;
368 
369  case 'lom_difficulty':
370  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
371  $html = $this->getRangeSelect(
372  $this->lng->txt('from'),
374  $a_query['lom_difficulty_start'],
375  'query[' . 'lom_difficulty_start' . ']',
376  array(0 => $this->lng->txt('search_any'))
377  ),
378  $this->lng->txt('until'),
380  $a_query['lom_difficulty_end'],
381  'query[' . 'lom_difficulty_end' . ']',
382  array(0 => $this->lng->txt('search_any'))
383  )
384  );
385  $range->setHTML($html);
386  return $range;
387 
388  // Rights
389  case 'lom_costs':
390  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
391  $select->setValue($a_query['lom_costs']);
392  $select->setOptions(ilMDUtilSelect::_getCostsSelect(
393  '',
394  $a_field_name,
395  array(0 => $this->lng->txt('search_any')),
396  true
397  ));
398  return $select;
399 
400  case 'lom_copyright':
401  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
402  $select->setValue($a_query['lom_copyright']);
404  '',
405  $a_field_name,
406  array(0 => $this->lng->txt('search_any')),
407  true
408  ));
409  return $select;
410 
411 
412 
413  // Classification
414  case 'lom_purpose':
415  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
416  $select->setValue($a_query['lom_purpose']);
417  $select->setOptions(ilMDUtilSelect::_getPurposeSelect(
418  '',
419  $a_field_name,
420  array(0 => $this->lng->txt('search_any')),
421  true
422  ));
423  return $select;
424 
425  case 'lom_taxon':
426  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
427  $text->setSubmitFormOnEnter(true);
428  $text->setValue($a_query['lom_taxon']);
429  $text->setSize(30);
430  $text->setMaxLength(255);
431  return $text;
432 
433  default:
434  if (substr($a_field_name, 0, 3) != 'adv') {
435  break;
436  }
437 
438  // Advanced meta data
439  $field_id = substr($a_field_name, 4);
440  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
441  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
442 
443  $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
444  $field_form->setForm($a_form);
445  $field_form->setElementId($a_post_name);
446  $field_form->setTitle($this->active_fields[$a_field_name]);
447  $field_form->addToForm();
448 
449  // #17071 - reload search values
450  if (is_array($a_query) &&
451  array_key_exists($a_field_name, $a_query)) {
452  $field_form->importFromPost($a_query);
453  $field_form->validate();
454  }
455 
456  return;
457  }
458  return null;
459  }
460 
461 
466  public function parseFieldQuery($a_field, $a_query)
467  {
468  switch ($a_field) {
469  case 'lom_content':
470  return $a_query;
471 
472  case 'general_offline':
473 
474  switch ($a_query) {
475  case self::OFFLINE_QUERY:
476  return 'offline:1';
477 
478  default:
479  return '-offline:1';
480 
481  }
482  return '';
483 
484  // General
485  case 'lom_language':
486  return 'lomLanguage:' . $a_query;
487 
488  case 'lom_keyword':
489  return 'lomKeyword:' . $a_query;
490 
491  case 'lom_coverage':
492  return 'lomCoverage:' . $a_query;
493 
494  case 'lom_structure':
495  return 'lomStructure:' . $a_query;
496 
497  // Lifecycle
498  case 'lom_status':
499  return 'lomStatus:' . $a_query;
500 
501  case 'lom_version':
502  return 'lomVersion:' . $a_query;
503 
504  // Begin Contribute
505  case 'lom_role':
506  return 'lomRole:' . $a_query;
507 
508  case 'lom_role_entry':
509  return 'lomRoleEntity:' . $a_query;
510  // End contribute
511 
512  // Technical
513  case 'lom_format':
514  return 'lomFormat:' . $a_query;
515 
516  case 'lom_operating_system':
517  return 'lomOS:' . $a_query;
518 
519  case 'lom_browser':
520  return 'lomBrowser:' . $a_query;
521 
522  // Educational
523  case 'lom_interactivity':
524  return 'lomInteractivity:' . $a_query;
525 
526  case 'lom_resource':
527  return 'lomResource:' . $a_query;
528 
529  case 'lom_level_start':
530  $q_string = '';
531  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
532  $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
533  for ($i = $a_query; $i <= count($options); $i++) {
534  if (strlen($q_string)) {
535  $q_string .= 'OR ';
536  }
537  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
538  }
539  return $q_string;
540 
541  case 'lom_level_end':
542  $q_string = '';
543  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
544  $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
545  for ($i = 1; $i <= $a_query; $i++) {
546  if (strlen($q_string)) {
547  $q_string .= 'OR ';
548  }
549  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
550  }
551  return $q_string;
552 
553  case 'lom_density_start':
554  $q_string = '';
555  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
556  $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
557  for ($i = $a_query; $i <= count($options); $i++) {
558  if (strlen($q_string)) {
559  $q_string .= 'OR ';
560  }
561  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
562  }
563  return $q_string;
564 
565  case 'lom_density_end':
566  $q_string = '';
567  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
568  $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
569  for ($i = 1; $i <= $a_query; $i++) {
570  if (strlen($q_string)) {
571  $q_string .= 'OR ';
572  }
573  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
574  }
575  return $q_string;
576 
577  case 'lom_user_role':
578  return 'lomUserRole:' . $a_query;
579 
580  case 'lom_context':
581  return 'lomContext:' . $a_query;
582 
583  case 'lom_difficulty_start':
584  $q_string = '';
585  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
586  $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
587  for ($i = $a_query; $i <= count($options); $i++) {
588  if (strlen($q_string)) {
589  $q_string .= 'OR ';
590  }
591  $q_string .= ('lomDifficulty:"' . $options[$i] . '" ');
592  }
593  return $q_string;
594 
595  case 'lom_difficulty_end':
596  $q_string = '';
597  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
598  $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
599  for ($i = 1; $i <= $a_query; $i++) {
600  if (strlen($q_string)) {
601  $q_string .= 'OR ';
602  }
603  $q_string .= ('lomDifficulty:"' . $options[$i] . '" ');
604  }
605  return $q_string;
606 
607  // Rights
608  case 'lom_costs':
609  return 'lomCosts:' . $a_query;
610 
611  case 'lom_copyright':
612  return 'lomCopyright:' . $a_query;
613 
614  // Classification
615  case 'lom_purpose':
616  return 'lomPurpose:' . $a_query;
617 
618  case 'lom_taxon':
619  return 'lomTaxon:' . $a_query;
620 
621  default:
622  if (substr($a_field, 0, 3) != 'adv') {
623  break;
624  }
625 
626  // Advanced meta data
627  $field_id = substr($a_field, 4);
628  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
629  try {
630  // field might be invalid (cached query)
631  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
632  } catch (Exception $ex) {
633  return '';
634  }
635 
636  $adv_query = $field->getLuceneSearchString($a_query);
637  if ($adv_query) {
638  // #17558
639  if (!is_array($adv_query)) {
640  return 'advancedMetaData_' . $field_id . ': ' . $adv_query;
641  } else {
642  $res = array();
643  foreach ($adv_query as $adv_query_item) {
644  $res[] = 'advancedMetaData_' . $field_id . ': ' . $adv_query_item;
645  }
646  return '(' . implode(' OR ', $res) . ')';
647  }
648  }
649  }
650  }
651 
652 
656  protected function readFields()
657  {
658  foreach (self::getFields() as $name => $translation) {
659  if ($this->settings->isActive($name)) {
660  $this->active_fields[$name] = $translation;
661  }
662  }
663  }
664 
668  protected function readSections()
669  {
670  foreach ($this->getActiveFields() as $field_name => $translation) {
671  switch ($field_name) {
672  // Default section
673  case 'lom_content':
674  $this->active_sections['default']['fields'][] = 'lom_content';
675  $this->active_sections['default']['name'] = '';
676  break;
677 
678  case 'general_offline':
679  $this->active_sections['default']['fields'][] = 'general_offline';
680  $this->active_sections['default']['name'] = '';
681  break;
682 
683  case 'lom_type':
684  $this->active_sections['default']['fields'][] = 'lom_type';
685  $this->active_sections['default']['name'] = '';
686  break;
687 
688  // General
689  case 'lom_language':
690  $this->active_sections['general']['fields'][] = 'lom_language';
691  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
692  break;
693  case 'lom_keyword':
694  $this->active_sections['general']['fields'][] = 'lom_keyword';
695  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
696  break;
697  case 'lom_coverage':
698  $this->active_sections['general']['fields'][] = 'lom_coverage';
699  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
700  break;
701  case 'lom_structure':
702  $this->active_sections['general']['fields'][] = 'lom_structure';
703  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
704  break;
705 
706  // Lifecycle
707  case 'lom_status':
708  $this->active_sections['lifecycle']['fields'][] = 'lom_status';
709  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
710  break;
711  case 'lom_version':
712  $this->active_sections['lifecycle']['fields'][] = 'lom_version';
713  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
714  break;
715  case 'lom_contribute':
716  $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
717  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
718  break;
719 
720  // Technical
721  case 'lom_format':
722  $this->active_sections['technical']['fields'][] = 'lom_format';
723  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
724  break;
725  case 'lom_operating_system':
726  $this->active_sections['technical']['fields'][] = 'lom_operating_system';
727  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
728  break;
729  case 'lom_browser':
730  $this->active_sections['technical']['fields'][] = 'lom_browser';
731  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
732  break;
733 
734  // Education
735  case 'lom_interactivity':
736  $this->active_sections['education']['fields'][] = 'lom_interactivity';
737  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
738  break;
739  case 'lom_resource':
740  $this->active_sections['education']['fields'][] = 'lom_resource';
741  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
742  break;
743  case 'lom_level':
744  $this->active_sections['education']['fields'][] = 'lom_level';
745  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
746  break;
747  case 'lom_density':
748  $this->active_sections['education']['fields'][] = 'lom_density';
749  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
750  break;
751  case 'lom_user_role':
752  $this->active_sections['education']['fields'][] = 'lom_user_role';
753  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
754  break;
755  case 'lom_context':
756  $this->active_sections['education']['fields'][] = 'lom_context';
757  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
758  break;
759  case 'lom_difficulty':
760  $this->active_sections['education']['fields'][] = 'lom_difficulty';
761  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
762  break;
763 
764  // Rights
765  case 'lom_costs':
766  $this->active_sections['rights']['fields'][] = 'lom_costs';
767  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
768  break;
769  case 'lom_copyright':
770  $this->active_sections['rights']['fields'][] = 'lom_copyright';
771  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
772  break;
773 
774  // Classification
775  case 'lom_purpose':
776  $this->active_sections['classification']['fields'][] = 'lom_purpose';
777  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
778  break;
779  case 'lom_taxon':
780  $this->active_sections['classification']['fields'][] = 'lom_taxon';
781  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
782  break;
783 
784  default:
785  if (substr($field_name, 0, 3) != 'adv') {
786  break;
787  }
788 
789  // Advanced meta data
790  $field_id = substr($field_name, 4);
791  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
792  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
793  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
794  $record_id = $field->getRecordId();
795 
796  $this->active_sections['adv_record_' . $record_id]['fields'][] = $field_name;
797  $this->active_sections['adv_record_' . $record_id]['name'] = ilAdvancedMDRecord::_lookupTitle($record_id);
798  break;
799  }
800  }
801  }
802 
806  protected function getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
807  {
808  $tpl = new ilTemplate('tpl.range_search.html', true, true, 'Services/Search');
809  $tpl->setVariable('TXT_FROM', $txt_from);
810  $tpl->setVariable('FROM', $select_from);
811  $tpl->setVariable('TXT_UPTO', $txt_until);
812  $tpl->setVariable('UPTO', $select_until);
813  return $tpl->get();
814  }
815 }
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.
This class represents a selection list property in a property form.
static _getRecords()
Get records.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
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...
$tpl
Definition: ilias.php:10
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 getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
foreach($_POST as $key=> $value) $res
static _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
special template class to simplify handling of ITX/PEAR
$text
Definition: errorreport.php:18
This class represents a text property in a property form.
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 _lookupTitle($a_record_id)
Lookup title.
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 getFields()
Return an array of all meta data fields.
$i
Definition: disco.tpl.php:19
$def
Definition: croninfo.php:21
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.
parseFieldQuery($a_field, $a_query)
Called from ilLuceneAdvancedQueryParser Parse a field specific query.
Field definitions of advanced meta data search.
$html
Definition: example_001.php:87
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...