ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
25include_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 $lng;
56
58
59 $this->lng = $lng;
60 $this->lng->loadLanguageModule('meta');
61
62 $this->readFields();
63 $this->readSections();
64 }
65
69 public static function getInstance()
70 {
71 if(isset(self::$instance) and self::$instance)
72 {
73 return self::$instance;
74 }
75 return self::$instance = new ilLuceneAdvancedSearchFields();
76 }
77
81 public static function getFields()
82 {
83 global $lng;
84
85 $lng->loadLanguageModule('meta');
86
87 $fields['lom_content'] = $lng->txt('content');
88
89 include_once './Services/Search/classes/class.ilSearchSettings.php';
90 if(ilSearchSettings::getInstance()->enabledLucene())
91 {
92 $fields['general_offline'] = $lng->txt('lucene_offline_filter');
93 }
94 //'lom_type' = $lng->txt('type');
95 $fields['lom_language'] = $lng->txt('language');
96 $fields['lom_keyword'] = $lng->txt('meta_keyword');
97 $fields['lom_coverage'] = $lng->txt('meta_coverage');
98 $fields['lom_structure'] = $lng->txt('meta_structure');
99 $fields['lom_status'] = $lng->txt('meta_status');
100 $fields['lom_version'] = $lng->txt('meta_version');
101 $fields['lom_contribute'] = $lng->txt('meta_contribute');
102 $fields['lom_format'] = $lng->txt('meta_format');
103 $fields['lom_operating_system'] = $lng->txt('meta_operating_system');
104 $fields['lom_browser'] = $lng->txt('meta_browser');
105 $fields['lom_interactivity'] = $lng->txt('meta_interactivity_type');
106 $fields['lom_resource'] = $lng->txt('meta_learning_resource_type');
107 $fields['lom_level'] = $lng->txt('meta_interactivity_level');
108 $fields['lom_density'] = $lng->txt('meta_semantic_density');
109 $fields['lom_user_role'] = $lng->txt('meta_intended_end_user_role');
110 $fields['lom_context'] = $lng->txt('meta_context');
111 $fields['lom_difficulty'] = $lng->txt('meta_difficulty');
112 $fields['lom_costs'] = $lng->txt('meta_cost');
113 $fields['lom_copyright'] = $lng->txt('meta_copyright_and_other_restrictions');
114 $fields['lom_purpose'] = $lng->txt('meta_purpose');
115 $fields['lom_taxon'] = $lng->txt('meta_taxon');
116
117 // Append all advanced meta data fields
118 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
119 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
120 foreach(ilAdvancedMDRecord::_getRecords() as $record)
121 {
122 foreach(ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true) as $def)
123 {
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 {
152 $a_query = array();
153 }
154
155 switch($a_field_name)
156 {
157 case 'general_offline':
158 $offline_options = array(
159 '0' => $this->lng->txt('search_any'),
160 self::ONLINE_QUERY => $this->lng->txt('search_option_online'),
161 self::OFFLINE_QUERY => $this->lng->txt('search_option_offline')
162 );
163 $offline = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
164 $offline->setOptions($offline_options);
165 $offline->setValue($a_query['general_offline']);
166 return $offline;
167
168 case 'lom_content':
169 $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
170 $text->setSubmitFormOnEnter(true);
171 $text->setValue($a_query['lom_content']);
172 $text->setSize(30);
173 $text->setMaxLength(255);
174 return $text;
175
176 // General
177 case 'lom_language':
178 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
179 $select->setValue($a_query['lom_language']);
180 $select->setOptions(ilMDUtilSelect::_getLanguageSelect(
181 '',
182 $a_field_name,
183 array(0 => $this->lng->txt('search_any')),
184 true));
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 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 return $select;
223
224 case 'lom_version':
225 $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
226 $text->setSubmitFormOnEnter(true);
227 $text->setValue($a_query['lom_version']);
228 $text->setSize(30);
229 $text->setMaxLength(255);
230 return $text;
231
232 case 'lom_contribute':
233 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],'query['.'lom_role'.']');
234 $select->setValue($a_query['lom_role']);
235 $select->setOptions(ilMDUtilSelect::_getRoleSelect(
236 '',
237 $a_field_name,
238 array(0 => $this->lng->txt('search_any')),
239 true));
240
241 $text = new ilTextInputGUI($this->lng->txt('meta_entry'),'query['.'lom_role_entry'.']');
242 $text->setValue($a_query['lom_role_entry']);
243 $text->setSize(30);
244 $text->setMaxLength(255);
245
246 $select->addSubItem($text);
247 return $select;
248
249 // Technical
250 case 'lom_format':
251 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
252 $select->setValue($a_query['lom_format']);
253 $select->setOptions(ilMDUtilSelect::_getFormatSelect(
254 '',
255 $a_field_name,
256 array(0 => $this->lng->txt('search_any')),
257 true));
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']);
264 '',
265 $a_field_name,
266 array(0 => $this->lng->txt('search_any')),
267 true));
268 return $select;
269
270 case 'lom_browser':
271 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
272 $select->setValue($a_query['lom_browser']);
273 $select->setOptions(ilMDUtilSelect::_getBrowserSelect(
274 '',
275 $a_field_name,
276 array(0 => $this->lng->txt('search_any')),
277 true));
278 return $select;
279
280 // Education
281 case 'lom_interactivity':
282 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
283 $select->setValue($a_query['lom_interactivity']);
285 '',
286 $a_field_name,
287 array(0 => $this->lng->txt('search_any')),
288 true));
289 return $select;
290
291 case 'lom_resource':
292 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
293 $select->setValue($a_query['lom_resource']);
295 '',
296 $a_field_name,
297 array(0 => $this->lng->txt('search_any')),
298 true));
299 return $select;
300
301 case 'lom_level':
302 $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
303 $html = $this->getRangeSelect(
304 $this->lng->txt('from'),
306 $a_query['lom_level_start'],
307 'query['.'lom_level_start'.']',
308 array(0 => $this->lng->txt('search_any'))),
309 $this->lng->txt('until'),
311 $a_query['lom_level_end'],
312 'query['.'lom_level_end'.']',
313 array(0 => $this->lng->txt('search_any')))
314 );
315 $range->setHTML($html);
316 return $range;
317
318 case 'lom_density':
319 $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
320 $html = $this->getRangeSelect(
321 $this->lng->txt('from'),
323 $a_query['lom_density_start'],
324 'query['.'lom_density_start'.']',
325 array(0 => $this->lng->txt('search_any'))),
326 $this->lng->txt('until'),
328 $a_query['lom_density_end'],
329 'query['.'lom_density_end'.']',
330 array(0 => $this->lng->txt('search_any')))
331 );
332 $range->setHTML($html);
333 return $range;
334
335
336 case 'lom_user_role':
337 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
338 $select->setValue($a_query['lom_user_role']);
340 '',
341 $a_field_name,
342 array(0 => $this->lng->txt('search_any')),
343 true));
344 return $select;
345
346 case 'lom_context':
347 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
348 $select->setValue($a_query['lom_context']);
349 $select->setOptions(ilMDUtilSelect::_getContextSelect(
350 '',
351 $a_field_name,
352 array(0 => $this->lng->txt('search_any')),
353 true));
354 return $select;
355
356 case 'lom_difficulty':
357 $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
358 $html = $this->getRangeSelect(
359 $this->lng->txt('from'),
361 $a_query['lom_difficulty_start'],
362 'query['.'lom_difficulty_start'.']',
363 array(0 => $this->lng->txt('search_any'))),
364 $this->lng->txt('until'),
366 $a_query['lom_difficulty_end'],
367 'query['.'lom_difficulty_end'.']',
368 array(0 => $this->lng->txt('search_any')))
369 );
370 $range->setHTML($html);
371 return $range;
372
373 // Rights
374 case 'lom_costs':
375 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
376 $select->setValue($a_query['lom_costs']);
377 $select->setOptions(ilMDUtilSelect::_getCostsSelect(
378 '',
379 $a_field_name,
380 array(0 => $this->lng->txt('search_any')),
381 true));
382 return $select;
383
384 case 'lom_copyright':
385 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
386 $select->setValue($a_query['lom_copyright']);
388 '',
389 $a_field_name,
390 array(0 => $this->lng->txt('search_any')),
391 true));
392 return $select;
393
394
395
396 // Classification
397 case 'lom_purpose':
398 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
399 $select->setValue($a_query['lom_purpose']);
400 $select->setOptions(ilMDUtilSelect::_getPurposeSelect(
401 '',
402 $a_field_name,
403 array(0 => $this->lng->txt('search_any')),
404 true));
405 return $select;
406
407 case 'lom_taxon':
408 $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
409 $text->setSubmitFormOnEnter(true);
410 $text->setValue($a_query['lom_taxon']);
411 $text->setSize(30);
412 $text->setMaxLength(255);
413 return $text;
414
415 default:
416 if(substr($a_field_name,0,3) != 'adv')
417 break;
418
419 // Advanced meta data
420 $field_id = substr($a_field_name,4);
421 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
423
424 $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
425 $field_form->setForm($a_form);
426 $field_form->setElementId($a_post_name);
427 $field_form->setTitle($this->active_fields[$a_field_name]);
428 $field_form->addToForm();
429
430 // #17071 - reload search values
431 if(is_array($a_query) &&
432 array_key_exists($a_field_name, $a_query))
433 {
434 $field_form->importFromPost($a_query);
435 $field_form->validate();
436 }
437
438 return;
439 }
440 return null;
441 }
442
443
448 public function parseFieldQuery($a_field,$a_query)
449 {
450 switch($a_field)
451 {
452 case 'lom_content':
453 return $a_query;
454
455 case 'general_offline':
456
457 switch($a_query)
458 {
460 return 'offline:1';
461
462 default:
463 return '-offline:1';
464
465 }
466 return '';
467
468 // General
469 case 'lom_language':
470 return 'lomLanguage:'.$a_query;
471
472 case 'lom_keyword':
473 return 'lomKeyword:'.$a_query;
474
475 case 'lom_coverage':
476 return 'lomCoverage:'.$a_query;
477
478 case 'lom_structure':
479 return 'lomStructure:'.$a_query;
480
481 // Lifecycle
482 case 'lom_status':
483 return 'lomStatus:'.$a_query;
484
485 case 'lom_version':
486 return 'lomVersion:'.$a_query;
487
488 // Begin Contribute
489 case 'lom_role':
490 return 'lomRole:'.$a_query;
491
492 case 'lom_role_entry':
493 return 'lomRoleEntity:'.$a_query;
494 // End contribute
495
496 // Technical
497 case 'lom_format':
498 return 'lomFormat:'.$a_query;
499
500 case 'lom_operating_system':
501 return 'lomOS:'.$a_query;
502
503 case 'lom_browser':
504 return 'lomBrowser:'.$a_query;
505
506 // Educational
507 case 'lom_interactivity':
508 return 'lomInteractivity:'.$a_query;
509
510 case 'lom_resource':
511 return 'lomResource:'.$a_query;
512
513 case 'lom_level_start':
514 $q_string = '';
515 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
516 $options = ilMDUtilSelect::_getInteractivityLevelSelect(0,'lom_level',array(),true);
517 for($i = $a_query; $i <= count($options); $i++)
518 {
519 if(strlen($q_string))
520 {
521 $q_string .= 'OR ';
522 }
523 $q_string .= ('lomLevel:"'.$options[$i].'" ');
524 }
525 return $q_string;
526
527 case 'lom_level_end':
528 $q_string = '';
529 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
530 $options = ilMDUtilSelect::_getInteractivityLevelSelect(0,'lom_level',array(),true);
531 for($i = 1; $i <= $a_query; $i++)
532 {
533 if(strlen($q_string))
534 {
535 $q_string .= 'OR ';
536 }
537 $q_string .= ('lomLevel:"'.$options[$i].'" ');
538 }
539 return $q_string;
540
541 case 'lom_density_start':
542 $q_string = '';
543 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
544 $options = ilMDUtilSelect::_getSemanticDensitySelect(0,'lom_density',array(),true);
545 for($i = $a_query; $i <= count($options); $i++)
546 {
547 if(strlen($q_string))
548 {
549 $q_string .= 'OR ';
550 }
551 $q_string .= ('lomDensity:"'.$options[$i].'" ');
552 }
553 return $q_string;
554
555 case 'lom_density_end':
556 $q_string = '';
557 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
558 $options = ilMDUtilSelect::_getSemanticDensitySelect(0,'lom_density',array(),true);
559 for($i = 1; $i <= $a_query; $i++)
560 {
561 if(strlen($q_string))
562 {
563 $q_string .= 'OR ';
564 }
565 $q_string .= ('lomDensity:"'.$options[$i].'" ');
566 }
567 return $q_string;
568
569 case 'lom_user_role':
570 return 'lomUserRole:'.$a_query;
571
572 case 'lom_context':
573 return 'lomContext:'.$a_query;
574
575 case 'lom_difficulty_start':
576 $q_string = '';
577 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
578 $options = ilMDUtilSelect::_getDifficultySelect(0,'lom_difficulty',array(),true);
579 for($i = $a_query; $i <= count($options); $i++)
580 {
581 if(strlen($q_string))
582 {
583 $q_string .= 'OR ';
584 }
585 $q_string .= ('lomDifficulty:"'.$options[$i].'" ');
586 }
587 return $q_string;
588
589 case 'lom_difficulty_end':
590 $q_string = '';
591 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
592 $options = ilMDUtilSelect::_getDifficultySelect(0,'lom_difficulty',array(),true);
593 for($i = 1; $i <= $a_query; $i++)
594 {
595 if(strlen($q_string))
596 {
597 $q_string .= 'OR ';
598 }
599 $q_string .= ('lomDifficulty:"'.$options[$i].'" ');
600 }
601 return $q_string;
602
603 // Rights
604 case 'lom_costs':
605 return 'lomCosts:'.$a_query;
606
607 case 'lom_copyright':
608 return 'lomCopyright:'.$a_query;
609
610 // Classification
611 case 'lom_purpose':
612 return 'lomPurpose:'.$a_query;
613
614 case 'lom_taxon':
615 return 'lomTaxon:'.$a_query;
616
617 default:
618 if(substr($a_field,0,3) != 'adv')
619 break;
620
621 // Advanced meta data
622 $field_id = substr($a_field,4);
623 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
624 try
625 {
626 // field might be invalid (cached query)
628 }
629 catch (Exception $ex)
630 {
631 return '';
632 }
633
634 $adv_query = $field->getLuceneSearchString($a_query);
635 if($adv_query)
636 {
637 // #17558
638 if(!is_array($adv_query))
639 {
640 return 'advancedMetaData_'.$field_id.': '.$adv_query;
641 }
642 else
643 {
644 $res = array();
645 foreach($adv_query as $adv_query_item)
646 {
647 $res[] = 'advancedMetaData_'.$field_id.': '.$adv_query_item;
648 }
649 return '('.implode(' OR ', $res).')';
650 }
651 }
652 }
653 }
654
655
659 protected function readFields()
660 {
661 foreach(self::getFields() as $name => $translation)
662 {
663 if($this->settings->isActive($name))
664 {
665 $this->active_fields[$name] = $translation;
666 }
667 }
668 }
669
673 protected function readSections()
674 {
675 foreach($this->getActiveFields() as $field_name => $translation)
676 {
677 switch($field_name)
678 {
679 // Default section
680 case 'lom_content':
681 $this->active_sections['default']['fields'][] = 'lom_content';
682 $this->active_sections['default']['name'] = '';
683 break;
684
685 case 'general_offline':
686 $this->active_sections['default']['fields'][] = 'general_offline';
687 $this->active_sections['default']['name'] = '';
688 break;
689
690 case 'lom_type':
691 $this->active_sections['default']['fields'][] = 'lom_type';
692 $this->active_sections['default']['name'] = '';
693 break;
694
695 // General
696 case 'lom_language':
697 $this->active_sections['general']['fields'][] = 'lom_language';
698 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
699 break;
700 case 'lom_keyword':
701 $this->active_sections['general']['fields'][] = 'lom_keyword';
702 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
703 break;
704 case 'lom_coverage':
705 $this->active_sections['general']['fields'][] = 'lom_coverage';
706 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
707 break;
708 case 'lom_structure':
709 $this->active_sections['general']['fields'][] = 'lom_structure';
710 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
711 break;
712
713 // Lifecycle
714 case 'lom_status':
715 $this->active_sections['lifecycle']['fields'][] = 'lom_status';
716 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
717 break;
718 case 'lom_version':
719 $this->active_sections['lifecycle']['fields'][] = 'lom_version';
720 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
721 break;
722 case 'lom_contribute':
723 $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
724 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
725 break;
726
727 // Technical
728 case 'lom_format':
729 $this->active_sections['technical']['fields'][] = 'lom_format';
730 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
731 break;
732 case 'lom_operating_system':
733 $this->active_sections['technical']['fields'][] = 'lom_operating_system';
734 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
735 break;
736 case 'lom_browser':
737 $this->active_sections['technical']['fields'][] = 'lom_browser';
738 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
739 break;
740
741 // Education
742 case 'lom_interactivity':
743 $this->active_sections['education']['fields'][] = 'lom_interactivity';
744 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
745 break;
746 case 'lom_resource':
747 $this->active_sections['education']['fields'][] = 'lom_resource';
748 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
749 break;
750 case 'lom_level':
751 $this->active_sections['education']['fields'][] = 'lom_level';
752 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
753 break;
754 case 'lom_density':
755 $this->active_sections['education']['fields'][] = 'lom_density';
756 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
757 break;
758 case 'lom_user_role':
759 $this->active_sections['education']['fields'][] = 'lom_user_role';
760 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
761 break;
762 case 'lom_context':
763 $this->active_sections['education']['fields'][] = 'lom_context';
764 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
765 break;
766 case 'lom_difficulty':
767 $this->active_sections['education']['fields'][] = 'lom_difficulty';
768 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
769 break;
770
771 // Rights
772 case 'lom_costs':
773 $this->active_sections['rights']['fields'][] = 'lom_costs';
774 $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
775 break;
776 case 'lom_copyright':
777 $this->active_sections['rights']['fields'][] = 'lom_copyright';
778 $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
779 break;
780
781 // Classification
782 case 'lom_purpose':
783 $this->active_sections['classification']['fields'][] = 'lom_purpose';
784 $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
785 break;
786 case 'lom_taxon':
787 $this->active_sections['classification']['fields'][] = 'lom_taxon';
788 $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
789 break;
790
791 default:
792 if(substr($field_name,0,3) != 'adv')
793 break;
794
795 // Advanced meta data
796 $field_id = substr($field_name,4);
797 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
798 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
800 $record_id = $field->getRecordId();
801
802 $this->active_sections['adv_record_'.$record_id]['fields'][] = $field_name;
803 $this->active_sections['adv_record_'.$record_id]['name'] = ilAdvancedMDRecord::_lookupTitle($record_id);
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
822}
823?>
global $tpl
Definition: ilias.php:8
static getInstance()
Get singleton.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static _lookupTitle($a_record_id)
Lookup title.
static _getRecords()
Get records.
This class represents a custom property in a property form.
static getLogger($a_component_id)
Get component logger.
Field definitions of advanced meta data search.
getFormElement($a_query, $a_field_name, ilPropertyFormGUI $a_form)
static getInstance()
Get singleton instance.
static getFields()
Return an array of all meta data fields.
getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
get a range selection
parseFieldQuery($a_field, $a_query)
Called from ilLuceneAdvancedQueryParser Parse a field specific query.
_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.
_getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
_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.
_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.
_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.
_getLanguageSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta data language selector.
_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.
_getCostsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights costs All possible entries in meta_format are shown.
_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.
_getDifficultySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
_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.
_getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
_getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
_getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
_getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
_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.
_getContextSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta context.
This class represents a property form user interface.
This class represents a selection list property in a property form.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
$html
Definition: example_001.php:87
$text
if(!is_array($argv)) $options