ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 if(!$a_query)
150 {
151 $a_query = array();
152 }
153
154 switch($a_field_name)
155 {
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 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 return $select;
211
212 // Lifecycle
213 case 'lom_status':
214 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
215 $select->setValue($a_query['lom_status']);
216 $select->setOptions(ilMDUtilSelect::_getStatusSelect(
217 '',
218 $a_field_name,
219 array(0 => $this->lng->txt('search_any')),
220 true));
221 return $select;
222
223 case 'lom_version':
224 $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
225 $text->setSubmitFormOnEnter(true);
226 $text->setValue($a_query['lom_version']);
227 $text->setSize(30);
228 $text->setMaxLength(255);
229 return $text;
230
231 case 'lom_contribute':
232 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],'query['.'lom_role'.']');
233 $select->setValue($a_query['lom_role']);
234 $select->setOptions(ilMDUtilSelect::_getRoleSelect(
235 '',
236 $a_field_name,
237 array(0 => $this->lng->txt('search_any')),
238 true));
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(ilMDUtilSelect::_getFormatSelect(
253 '',
254 $a_field_name,
255 array(0 => $this->lng->txt('search_any')),
256 true));
257 return $select;
258
259 case 'lom_operating_system':
260 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
261 $select->setValue($a_query['lom_operating_system']);
263 '',
264 $a_field_name,
265 array(0 => $this->lng->txt('search_any')),
266 true));
267 return $select;
268
269 case 'lom_browser':
270 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
271 $select->setValue($a_query['lom_browser']);
272 $select->setOptions(ilMDUtilSelect::_getBrowserSelect(
273 '',
274 $a_field_name,
275 array(0 => $this->lng->txt('search_any')),
276 true));
277 return $select;
278
279 // Education
280 case 'lom_interactivity':
281 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
282 $select->setValue($a_query['lom_interactivity']);
284 '',
285 $a_field_name,
286 array(0 => $this->lng->txt('search_any')),
287 true));
288 return $select;
289
290 case 'lom_resource':
291 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
292 $select->setValue($a_query['lom_resource']);
294 '',
295 $a_field_name,
296 array(0 => $this->lng->txt('search_any')),
297 true));
298 return $select;
299
300 case 'lom_level':
301 $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
302 $html = $this->getRangeSelect(
303 $this->lng->txt('from'),
305 $a_query['lom_level_start'],
306 'query['.'lom_level_start'.']',
307 array(0 => $this->lng->txt('search_any'))),
308 $this->lng->txt('until'),
310 $a_query['lom_level_end'],
311 'query['.'lom_level_end'.']',
312 array(0 => $this->lng->txt('search_any')))
313 );
314 $range->setHTML($html);
315 return $range;
316
317 case 'lom_density':
318 $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
319 $html = $this->getRangeSelect(
320 $this->lng->txt('from'),
322 $a_query['lom_density_start'],
323 'query['.'lom_density_start'.']',
324 array(0 => $this->lng->txt('search_any'))),
325 $this->lng->txt('until'),
327 $a_query['lom_density_end'],
328 'query['.'lom_density_end'.']',
329 array(0 => $this->lng->txt('search_any')))
330 );
331 $range->setHTML($html);
332 return $range;
333
334
335 case 'lom_user_role':
336 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
337 $select->setValue($a_query['lom_user_role']);
339 '',
340 $a_field_name,
341 array(0 => $this->lng->txt('search_any')),
342 true));
343 return $select;
344
345 case 'lom_context':
346 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
347 $select->setValue($a_query['lom_context']);
348 $select->setOptions(ilMDUtilSelect::_getContextSelect(
349 '',
350 $a_field_name,
351 array(0 => $this->lng->txt('search_any')),
352 true));
353 return $select;
354
355 case 'lom_difficulty':
356 $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
357 $html = $this->getRangeSelect(
358 $this->lng->txt('from'),
360 $a_query['lom_difficulty_start'],
361 'query['.'lom_difficulty_start'.']',
362 array(0 => $this->lng->txt('search_any'))),
363 $this->lng->txt('until'),
365 $a_query['lom_difficulty_end'],
366 'query['.'lom_difficulty_end'.']',
367 array(0 => $this->lng->txt('search_any')))
368 );
369 $range->setHTML($html);
370 return $range;
371
372 // Rights
373 case 'lom_costs':
374 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
375 $select->setValue($a_query['lom_costs']);
376 $select->setOptions(ilMDUtilSelect::_getCostsSelect(
377 '',
378 $a_field_name,
379 array(0 => $this->lng->txt('search_any')),
380 true));
381 return $select;
382
383 case 'lom_copyright':
384 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
385 $select->setValue($a_query['lom_copyright']);
387 '',
388 $a_field_name,
389 array(0 => $this->lng->txt('search_any')),
390 true));
391 return $select;
392
393
394
395 // Classification
396 case 'lom_purpose':
397 $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
398 $select->setValue($a_query['lom_purpose']);
399 $select->setOptions(ilMDUtilSelect::_getPurposeSelect(
400 '',
401 $a_field_name,
402 array(0 => $this->lng->txt('search_any')),
403 true));
404 return $select;
405
406 case 'lom_taxon':
407 $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
408 $text->setSubmitFormOnEnter(true);
409 $text->setValue($a_query['lom_taxon']);
410 $text->setSize(30);
411 $text->setMaxLength(255);
412 return $text;
413
414 default:
415 if(substr($a_field_name,0,3) != 'adv')
416 break;
417
418 // Advanced meta data
419 $field_id = substr($a_field_name,4);
420 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
422
423 $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
424 $field_form->setForm($a_form);
425 $field_form->setElementId($a_post_name);
426 $field_form->setTitle($this->active_fields[$a_field_name]);
427 $field_form->addToForm();
428
429 // #17071 - reload search values
430 if(is_array($a_query) &&
431 array_key_exists($a_field_name, $a_query))
432 {
433 $field_form->importFromPost($a_query);
434 $field_form->validate();
435 }
436
437 return;
438 }
439 return null;
440 }
441
442
447 public function parseFieldQuery($a_field,$a_query)
448 {
449 switch($a_field)
450 {
451 case 'lom_content':
452 return $a_query;
453
454 case 'general_offline':
455
456 switch($a_query)
457 {
459 return 'offline:1';
460
461 default:
462 return '-offline:1';
463
464 }
465 return '';
466
467 // General
468 case 'lom_language':
469 return 'lomLanguage:'.$a_query;
470
471 case 'lom_keyword':
472 return 'lomKeyword:'.$a_query;
473
474 case 'lom_coverage':
475 return 'lomCoverage:'.$a_query;
476
477 case 'lom_structure':
478 return 'lomStructure:'.$a_query;
479
480 // Lifecycle
481 case 'lom_status':
482 return 'lomStatus:'.$a_query;
483
484 case 'lom_version':
485 return 'lomVersion:'.$a_query;
486
487 // Begin Contribute
488 case 'lom_role':
489 return 'lomRole:'.$a_query;
490
491 case 'lom_role_entry':
492 return 'lomRoleEntity:'.$a_query;
493 // End contribute
494
495 // Technical
496 case 'lom_format':
497 return 'lomFormat:'.$a_query;
498
499 case 'lom_operating_system':
500 return 'lomOS:'.$a_query;
501
502 case 'lom_browser':
503 return 'lomBrowser:'.$a_query;
504
505 // Educational
506 case 'lom_interactivity':
507 return 'lomInteractivity:'.$a_query;
508
509 case 'lom_resource':
510 return 'lomResource:'.$a_query;
511
512 case 'lom_level_start':
513 $q_string = '';
514 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
515 $options = ilMDUtilSelect::_getInteractivityLevelSelect(0,'lom_level',array(),true);
516 for($i = $a_query; $i <= count($options); $i++)
517 {
518 if(strlen($q_string))
519 {
520 $q_string .= 'OR ';
521 }
522 $q_string .= ('lomLevel:"'.$options[$i].'" ');
523 }
524 return $q_string;
525
526 case 'lom_level_end':
527 $q_string = '';
528 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
529 $options = ilMDUtilSelect::_getInteractivityLevelSelect(0,'lom_level',array(),true);
530 for($i = 1; $i <= $a_query; $i++)
531 {
532 if(strlen($q_string))
533 {
534 $q_string .= 'OR ';
535 }
536 $q_string .= ('lomLevel:"'.$options[$i].'" ');
537 }
538 return $q_string;
539
540 case 'lom_density_start':
541 $q_string = '';
542 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
543 $options = ilMDUtilSelect::_getSemanticDensitySelect(0,'lom_density',array(),true);
544 for($i = $a_query; $i <= count($options); $i++)
545 {
546 if(strlen($q_string))
547 {
548 $q_string .= 'OR ';
549 }
550 $q_string .= ('lomDensity:"'.$options[$i].'" ');
551 }
552 return $q_string;
553
554 case 'lom_density_end':
555 $q_string = '';
556 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
557 $options = ilMDUtilSelect::_getSemanticDensitySelect(0,'lom_density',array(),true);
558 for($i = 1; $i <= $a_query; $i++)
559 {
560 if(strlen($q_string))
561 {
562 $q_string .= 'OR ';
563 }
564 $q_string .= ('lomDensity:"'.$options[$i].'" ');
565 }
566 return $q_string;
567
568 case 'lom_user_role':
569 return 'lomUserRole:'.$a_query;
570
571 case 'lom_context':
572 return 'lomContext:'.$a_query;
573
574 case 'lom_difficulty_start':
575 $q_string = '';
576 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
577 $options = ilMDUtilSelect::_getDifficultySelect(0,'lom_difficulty',array(),true);
578 for($i = $a_query; $i <= count($options); $i++)
579 {
580 if(strlen($q_string))
581 {
582 $q_string .= 'OR ';
583 }
584 $q_string .= ('lomDifficulty:"'.$options[$i].'" ');
585 }
586 return $q_string;
587
588 case 'lom_difficulty_end':
589 $q_string = '';
590 include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
591 $options = ilMDUtilSelect::_getDifficultySelect(0,'lom_difficulty',array(),true);
592 for($i = 1; $i <= $a_query; $i++)
593 {
594 if(strlen($q_string))
595 {
596 $q_string .= 'OR ';
597 }
598 $q_string .= ('lomDifficulty:"'.$options[$i].'" ');
599 }
600 return $q_string;
601
602 // Rights
603 case 'lom_costs':
604 return 'lomCosts:'.$a_query;
605
606 case 'lom_copyright':
607 return 'lomCopyright:'.$a_query;
608
609 // Classification
610 case 'lom_purpose':
611 return 'lomPurpose:'.$a_query;
612
613 case 'lom_taxon':
614 return 'lomTaxon:'.$a_query;
615
616 default:
617 if(substr($a_field,0,3) != 'adv')
618 break;
619
620 // Advanced meta data
621 $field_id = substr($a_field,4);
622 include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
623 try
624 {
625 // field might be invalid (cached query)
627 }
628 catch (Exception $ex)
629 {
630 return '';
631 }
632
633 $adv_query = $field->getLuceneSearchString($a_query);
634 if($adv_query)
635 {
636 // #17558
637 if(!is_array($adv_query))
638 {
639 return 'advancedMetaData_'.$field_id.': '.$adv_query;
640 }
641 else
642 {
643 $res = array();
644 foreach($adv_query as $adv_query_item)
645 {
646 $res[] = 'advancedMetaData_'.$field_id.': '.$adv_query_item;
647 }
648 return '('.implode(' OR ', $res).')';
649 }
650 }
651 }
652 }
653
654
658 protected function readFields()
659 {
660 foreach(self::getFields() as $name => $translation)
661 {
662 if($this->settings->isActive($name))
663 {
664 $this->active_fields[$name] = $translation;
665 }
666 }
667 }
668
672 protected function readSections()
673 {
674 foreach($this->getActiveFields() as $field_name => $translation)
675 {
676 switch($field_name)
677 {
678 // Default section
679 case 'lom_content':
680 $this->active_sections['default']['fields'][] = 'lom_content';
681 $this->active_sections['default']['name'] = '';
682 break;
683
684 case 'general_offline':
685 $this->active_sections['default']['fields'][] = 'general_offline';
686 $this->active_sections['default']['name'] = '';
687 break;
688
689 case 'lom_type':
690 $this->active_sections['default']['fields'][] = 'lom_type';
691 $this->active_sections['default']['name'] = '';
692 break;
693
694 // General
695 case 'lom_language':
696 $this->active_sections['general']['fields'][] = 'lom_language';
697 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
698 break;
699 case 'lom_keyword':
700 $this->active_sections['general']['fields'][] = 'lom_keyword';
701 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
702 break;
703 case 'lom_coverage':
704 $this->active_sections['general']['fields'][] = 'lom_coverage';
705 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
706 break;
707 case 'lom_structure':
708 $this->active_sections['general']['fields'][] = 'lom_structure';
709 $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
710 break;
711
712 // Lifecycle
713 case 'lom_status':
714 $this->active_sections['lifecycle']['fields'][] = 'lom_status';
715 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
716 break;
717 case 'lom_version':
718 $this->active_sections['lifecycle']['fields'][] = 'lom_version';
719 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
720 break;
721 case 'lom_contribute':
722 $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
723 $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
724 break;
725
726 // Technical
727 case 'lom_format':
728 $this->active_sections['technical']['fields'][] = 'lom_format';
729 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
730 break;
731 case 'lom_operating_system':
732 $this->active_sections['technical']['fields'][] = 'lom_operating_system';
733 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
734 break;
735 case 'lom_browser':
736 $this->active_sections['technical']['fields'][] = 'lom_browser';
737 $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
738 break;
739
740 // Education
741 case 'lom_interactivity':
742 $this->active_sections['education']['fields'][] = 'lom_interactivity';
743 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
744 break;
745 case 'lom_resource':
746 $this->active_sections['education']['fields'][] = 'lom_resource';
747 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
748 break;
749 case 'lom_level':
750 $this->active_sections['education']['fields'][] = 'lom_level';
751 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
752 break;
753 case 'lom_density':
754 $this->active_sections['education']['fields'][] = 'lom_density';
755 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
756 break;
757 case 'lom_user_role':
758 $this->active_sections['education']['fields'][] = 'lom_user_role';
759 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
760 break;
761 case 'lom_context':
762 $this->active_sections['education']['fields'][] = 'lom_context';
763 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
764 break;
765 case 'lom_difficulty':
766 $this->active_sections['education']['fields'][] = 'lom_difficulty';
767 $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
768 break;
769
770 // Rights
771 case 'lom_costs':
772 $this->active_sections['rights']['fields'][] = 'lom_costs';
773 $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
774 break;
775 case 'lom_copyright':
776 $this->active_sections['rights']['fields'][] = 'lom_copyright';
777 $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
778 break;
779
780 // Classification
781 case 'lom_purpose':
782 $this->active_sections['classification']['fields'][] = 'lom_purpose';
783 $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
784 break;
785 case 'lom_taxon':
786 $this->active_sections['classification']['fields'][] = 'lom_taxon';
787 $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
788 break;
789
790 default:
791 if(substr($field_name,0,3) != 'adv')
792 break;
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';
799 $record_id = $field->getRecordId();
800
801 $this->active_sections['adv_record_'.$record_id]['fields'][] = $field_name;
802 $this->active_sections['adv_record_'.$record_id]['name'] = ilAdvancedMDRecord::_lookupTitle($record_id);
803 break;
804 }
805 }
806 }
807
811 protected function getRangeSelect($txt_from,$select_from,$txt_until,$select_until)
812 {
813 $tpl = new ilTemplate('tpl.range_search.html',true,true,'Services/Search');
814 $tpl->setVariable('TXT_FROM',$txt_from);
815 $tpl->setVariable('FROM',$select_from);
816 $tpl->setVariable('TXT_UPTO',$txt_until);
817 $tpl->setVariable('UPTO',$select_until);
818 return $tpl->get();
819 }
820
821}
822?>
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.
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.
if(!is_array($argv)) $options