ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups 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 $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::_getDefinitionsByRecordId($record->getRecordId()) as $def)
123  {
124  if($def->isSearchable())
125  {
126  $fields['adv_'.$def->getFieldId()] = $def->getTitle();
127  }
128  }
129  }
130  return $fields;
131  }
132 
136  public function getActiveFields()
137  {
138  return $this->active_fields ? $this->active_fields : array();
139  }
140 
141  public function getActiveSections()
142  {
143  return $this->active_sections ? $this->active_sections : array();
144  }
145 
146  public function getFormElement($a_query,$a_field_name)
147  {
148  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
149 
150  $a_post_name = 'query['.$a_field_name.']';
151 
152  switch($a_field_name)
153  {
154  case 'general_offline':
155  $offline_options = array(
156  '0' => $this->lng->txt('search_any'),
157  self::ONLINE_QUERY => $this->lng->txt('search_option_online'),
158  self::OFFLINE_QUERY => $this->lng->txt('search_option_offline')
159  );
160  $offline = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
161  $offline->setOptions($offline_options);
162  $offline->setValue($a_query['general_offline']);
163  return $offline;
164 
165  case 'lom_content':
166  $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
167  $text->setSubmitFormOnEnter(true);
168  $text->setValue($a_query['lom_content']);
169  $text->setSize(30);
170  $text->setMaxLength(255);
171  return $text;
172 
173  // General
174  case 'lom_language':
175  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
176  $select->setValue($a_query['lom_language']);
177  $select->setOptions(ilMDUtilSelect::_getLanguageSelect(
178  '',
179  $a_field_name,
180  array(0 => $this->lng->txt('search_any')),
181  true));
182  return $select;
183 
184  case 'lom_keyword':
185  $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
186  $text->setSubmitFormOnEnter(true);
187  $text->setValue($a_query['lom_keyword']);
188  $text->setSize(30);
189  $text->setMaxLength(255);
190  return $text;
191 
192  case 'lom_coverage':
193  $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
194  $text->setSubmitFormOnEnter(true);
195  $text->setValue($a_query['lom_coverage']);
196  $text->setSize(30);
197  $text->setMaxLength(255);
198  return $text;
199 
200  case 'lom_structure':
201  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
202  $select->setValue($a_query['lom_structure']);
203  $select->setOptions(ilMDUtilSelect::_getStructureSelect(
204  '',
205  $a_field_name,
206  array(0 => $this->lng->txt('search_any')),
207  true));
208  return $select;
209 
210  // Lifecycle
211  case 'lom_status':
212  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
213  $select->setValue($a_query['lom_status']);
214  $select->setOptions(ilMDUtilSelect::_getStatusSelect(
215  '',
216  $a_field_name,
217  array(0 => $this->lng->txt('search_any')),
218  true));
219  return $select;
220 
221  case 'lom_version':
222  $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
223  $text->setSubmitFormOnEnter(true);
224  $text->setValue($a_query['lom_version']);
225  $text->setSize(30);
226  $text->setMaxLength(255);
227  return $text;
228 
229  case 'lom_contribute':
230  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],'query['.'lom_role'.']');
231  $select->setValue($a_query['lom_role']);
232  $select->setOptions(ilMDUtilSelect::_getRoleSelect(
233  '',
234  $a_field_name,
235  array(0 => $this->lng->txt('search_any')),
236  true));
237 
238  $text = new ilTextInputGUI($this->lng->txt('meta_entry'),'query['.'lom_role_entry'.']');
239  $text->setValue($a_query['lom_role_entry']);
240  $text->setSize(30);
241  $text->setMaxLength(255);
242 
243  $select->addSubItem($text);
244  return $select;
245 
246  // Technical
247  case 'lom_format':
248  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
249  $select->setValue($a_query['lom_format']);
250  $select->setOptions(ilMDUtilSelect::_getFormatSelect(
251  '',
252  $a_field_name,
253  array(0 => $this->lng->txt('search_any')),
254  true));
255  return $select;
256 
257  case 'lom_operating_system':
258  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
259  $select->setValue($a_query['lom_operating_system']);
260  $select->setOptions(ilMDUtilSelect::_getOperatingSystemSelect(
261  '',
262  $a_field_name,
263  array(0 => $this->lng->txt('search_any')),
264  true));
265  return $select;
266 
267  case 'lom_browser':
268  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
269  $select->setValue($a_query['lom_browser']);
270  $select->setOptions(ilMDUtilSelect::_getBrowserSelect(
271  '',
272  $a_field_name,
273  array(0 => $this->lng->txt('search_any')),
274  true));
275  return $select;
276 
277  // Education
278  case 'lom_interactivity':
279  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
280  $select->setValue($a_query['lom_interactivity']);
282  '',
283  $a_field_name,
284  array(0 => $this->lng->txt('search_any')),
285  true));
286  return $select;
287 
288  case 'lom_resource':
289  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
290  $select->setValue($a_query['lom_resource']);
292  '',
293  $a_field_name,
294  array(0 => $this->lng->txt('search_any')),
295  true));
296  return $select;
297 
298  case 'lom_level':
299  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
300  $html = $this->getRangeSelect(
301  $this->lng->txt('from'),
303  $a_query['lom_level_start'],
304  'query['.'lom_level_start'.']',
305  array(0 => $this->lng->txt('search_any'))),
306  $this->lng->txt('until'),
308  $a_query['lom_level_end'],
309  'query['.'lom_level_end'.']',
310  array(0 => $this->lng->txt('search_any')))
311  );
312  $range->setHTML($html);
313  return $range;
314 
315  case 'lom_density':
316  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
317  $html = $this->getRangeSelect(
318  $this->lng->txt('from'),
320  $a_query['lom_density_start'],
321  'query['.'lom_density_start'.']',
322  array(0 => $this->lng->txt('search_any'))),
323  $this->lng->txt('until'),
325  $a_query['lom_density_end'],
326  'query['.'lom_density_end'.']',
327  array(0 => $this->lng->txt('search_any')))
328  );
329  $range->setHTML($html);
330  return $range;
331 
332 
333  case 'lom_user_role':
334  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
335  $select->setValue($a_query['lom_user_role']);
337  '',
338  $a_field_name,
339  array(0 => $this->lng->txt('search_any')),
340  true));
341  return $select;
342 
343  case 'lom_context':
344  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
345  $select->setValue($a_query['lom_context']);
346  $select->setOptions(ilMDUtilSelect::_getContextSelect(
347  '',
348  $a_field_name,
349  array(0 => $this->lng->txt('search_any')),
350  true));
351  return $select;
352 
353  case 'lom_difficulty':
354  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
355  $html = $this->getRangeSelect(
356  $this->lng->txt('from'),
358  $a_query['lom_difficulty_start'],
359  'query['.'lom_difficulty_start'.']',
360  array(0 => $this->lng->txt('search_any'))),
361  $this->lng->txt('until'),
363  $a_query['lom_difficulty_end'],
364  'query['.'lom_difficulty_end'.']',
365  array(0 => $this->lng->txt('search_any')))
366  );
367  $range->setHTML($html);
368  return $range;
369 
370  // Rights
371  case 'lom_costs':
372  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
373  $select->setValue($a_query['lom_costs']);
374  $select->setOptions(ilMDUtilSelect::_getCostsSelect(
375  '',
376  $a_field_name,
377  array(0 => $this->lng->txt('search_any')),
378  true));
379  return $select;
380 
381  case 'lom_copyright':
382  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
383  $select->setValue($a_query['lom_copyright']);
385  '',
386  $a_field_name,
387  array(0 => $this->lng->txt('search_any')),
388  true));
389  return $select;
390 
391 
392 
393  // Classification
394  case 'lom_purpose':
395  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
396  $select->setValue($a_query['lom_purpose']);
397  $select->setOptions(ilMDUtilSelect::_getPurposeSelect(
398  '',
399  $a_field_name,
400  array(0 => $this->lng->txt('search_any')),
401  true));
402  return $select;
403 
404  case 'lom_taxon':
405  $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
406  $text->setSubmitFormOnEnter(true);
407  $text->setValue($a_query['lom_taxon']);
408  $text->setSize(30);
409  $text->setMaxLength(255);
410  return $text;
411 
412  default:
413  if(substr($a_field_name,0,3) != 'adv')
414  break;
415 
416  // Advanced meta data
417  $field_id = substr($a_field_name,4);
418  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
420 
421  switch($field->getFieldType())
422  {
424  $text = new ilTextInputGUI($this->active_fields[$a_field_name],$a_post_name);
425  $text->setSubmitFormOnEnter(true);
426  $text->setValue($a_query[$a_field_name]);
427  $text->setSize(30);
428  $text->setMaxLength(255);
429  return $text;
430 
432  $select = new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
433  $select->setValue($a_query[$a_field_name]);
434  $select->setOptions($field->getFieldValuesForSearch());
435  return $select;
436 
439 
440  $check = new ilCheckboxInputGUI($this->active_fields[$a_field_name],$a_post_name);
441  $check->setValue(1);
442  $check->setChecked($a_query[$a_field_name]);
443 
444  $time = new ilDateTimeInputGUI($this->lng->txt('from'),$a_field_name.'_start');
445  $time->setShowTime($field->getFieldType() != ilAdvancedMDFieldDefinition::TYPE_DATE);
446  $time->setDate(new ilDateTime(mktime(8,0,0,date('m'),date('d'),date('Y')),IL_CAL_UNIX));
447  $check->addSubItem($time);
448 
449  $time = new ilDateTimeInputGUI($this->lng->txt('until'),$a_field_name.'_end');
450  $time->setShowTime($field->getFieldType() != ilAdvancedMDFieldDefinition::TYPE_DATE);
451  $time->setDate(new ilDateTime(mktime(16,0,0,date('m'),date('d'),date('Y')),IL_CAL_UNIX));
452  $check->addSubItem($time);
453  return $check;
454  }
455  }
456  return null;
457  }
458 
459 
464  public function parseFieldQuery($a_field,$a_query)
465  {
466  switch($a_field)
467  {
468  case 'lom_content':
469  return $a_query;
470 
471  case 'general_offline':
472 
473  switch($a_query)
474  {
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  {
535  if(strlen($q_string))
536  {
537  $q_string .= 'OR ';
538  }
539  $q_string .= ('lomLevel:"'.$options[$i].'" ');
540  }
541  return $q_string;
542 
543  case 'lom_level_end':
544  $q_string = '';
545  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
546  $options = ilMDUtilSelect::_getInteractivityLevelSelect(0,'lom_level',array(),true);
547  for($i = 1; $i <= $a_query; $i++)
548  {
549  if(strlen($q_string))
550  {
551  $q_string .= 'OR ';
552  }
553  $q_string .= ('lomLevel:"'.$options[$i].'" ');
554  }
555  return $q_string;
556 
557  case 'lom_density_start':
558  $q_string = '';
559  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
560  $options = ilMDUtilSelect::_getSemanticDensitySelect(0,'lom_density',array(),true);
561  for($i = $a_query; $i <= count($options); $i++)
562  {
563  if(strlen($q_string))
564  {
565  $q_string .= 'OR ';
566  }
567  $q_string .= ('lomDensity:"'.$options[$i].'" ');
568  }
569  return $q_string;
570 
571  case 'lom_density_end':
572  $q_string = '';
573  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
574  $options = ilMDUtilSelect::_getSemanticDensitySelect(0,'lom_density',array(),true);
575  for($i = 1; $i <= $a_query; $i++)
576  {
577  if(strlen($q_string))
578  {
579  $q_string .= 'OR ';
580  }
581  $q_string .= ('lomDensity:"'.$options[$i].'" ');
582  }
583  return $q_string;
584 
585  case 'lom_user_role':
586  return 'lomUserRole:'.$a_query;
587 
588  case 'lom_context':
589  return 'lomContext:'.$a_query;
590 
591  case 'lom_difficulty_start':
592  $q_string = '';
593  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
594  $options = ilMDUtilSelect::_getDifficultySelect(0,'lom_difficulty',array(),true);
595  for($i = $a_query; $i <= count($options); $i++)
596  {
597  if(strlen($q_string))
598  {
599  $q_string .= 'OR ';
600  }
601  $q_string .= ('lomDifficulty:"'.$options[$i].'" ');
602  }
603  return $q_string;
604 
605  case 'lom_difficulty_end':
606  $q_string = '';
607  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
608  $options = ilMDUtilSelect::_getDifficultySelect(0,'lom_difficulty',array(),true);
609  for($i = 1; $i <= $a_query; $i++)
610  {
611  if(strlen($q_string))
612  {
613  $q_string .= 'OR ';
614  }
615  $q_string .= ('lomDifficulty:"'.$options[$i].'" ');
616  }
617  return $q_string;
618 
619  // Rights
620  case 'lom_costs':
621  return 'lomCosts:'.$a_query;
622 
623  case 'lom_copyright':
624  return 'lomCopyright:'.$a_query;
625 
626  // Classification
627  case 'lom_purpose':
628  return 'lomPurpose:'.$a_query;
629 
630  case 'lom_taxon':
631  return 'lomTaxon:'.$a_query;
632 
633  default:
634  if(substr($a_field,0,3) != 'adv')
635  break;
636 
637  // Advanced meta data
638  $field_id = substr($a_field,4);
639  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
641 
642  switch($field->getFieldType())
643  {
646  return 'advancedMetaData_'.$field_id.':'.$a_query;
647 
649 
650  $value = $_POST['adv_'.$field_id.'_start'];
651  $dt['year'] = (int) $value['date']['y'];
652  $dt['mon'] = (int) $value['date']['m'];
653  $dt['mday'] = (int) $value['date']['d'];
654  $dt['hours'] = (int) 0;
655  $dt['minutes'] = (int) 0;
656  $dt['seconds'] = (int) 0;
657  $date = new ilDate($dt,IL_CAL_FKT_GETDATE);
658  $ustart = $date->get(IL_CAL_UNIX);
659 
660  $value = $_POST['adv_'.$field_id.'_end'];
661  $dt['year'] = (int) $value['date']['y'];
662  $dt['mon'] = (int) $value['date']['m'];
663  $dt['mday'] = (int) $value['date']['d'];
664  $dt['hours'] = (int) 0;
665  $dt['minutes'] = (int) 0;
666  $dt['seconds'] = (int) 0;
667  $date = new ilDate($dt,IL_CAL_FKT_GETDATE);
668  $uend = $date->get(IL_CAL_UNIX);
669 
670  return 'advancedMetaData_'.$field_id.':{'.$ustart.' TO '.$uend.'}';
671 
673 
674  $value = $_POST['adv_'.$field_id.'_start'];
675  $dt['year'] = (int) $value['date']['y'];
676  $dt['mon'] = (int) $value['date']['m'];
677  $dt['mday'] = (int) $value['date']['d'];
678  $dt['hours'] = (int) $value['time']['h'];
679  $dt['minutes'] = (int) $value['time']['m'];
680  $dt['seconds'] = (int) 0;
681  $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE);
682  $ustart = $date->get(IL_CAL_UNIX);
683 
684  $value = $_POST['adv_'.$field_id.'_end'];
685  $dt['year'] = (int) $value['date']['y'];
686  $dt['mon'] = (int) $value['date']['m'];
687  $dt['mday'] = (int) $value['date']['d'];
688  $dt['hours'] = (int) $value['time']['h'];
689  $dt['minutes'] = (int) $value['time']['m'];
690  $dt['seconds'] = (int) 0;
691  $date = new ilDateTime($dt,IL_CAL_FKT_GETDATE);
692  $uend = $date->get(IL_CAL_UNIX);
693 
694  return 'advancedMetaData_'.$field_id.':{'.$ustart.' TO '.$uend.'}';
695 
696 
697  }
698  break;
699  }
700  }
701 
702 
706  protected function readFields()
707  {
708  foreach(self::getFields() as $name => $translation)
709  {
710  if($this->settings->isActive($name))
711  {
712  $this->active_fields[$name] = $translation;
713  }
714  }
715  }
716 
720  protected function readSections()
721  {
722  foreach($this->getActiveFields() as $field_name => $translation)
723  {
724  switch($field_name)
725  {
726  // Default section
727  case 'lom_content':
728  $this->active_sections['default']['fields'][] = 'lom_content';
729  $this->active_sections['default']['name'] = '';
730  break;
731 
732  case 'general_offline':
733  $this->active_sections['default']['fields'][] = 'general_offline';
734  $this->active_sections['default']['name'] = '';
735  break;
736 
737  case 'lom_type':
738  $this->active_sections['default']['fields'][] = 'lom_type';
739  $this->active_sections['default']['name'] = '';
740  break;
741 
742  // General
743  case 'lom_language':
744  $this->active_sections['general']['fields'][] = 'lom_language';
745  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
746  break;
747  case 'lom_keyword':
748  $this->active_sections['general']['fields'][] = 'lom_keyword';
749  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
750  break;
751  case 'lom_coverage':
752  $this->active_sections['general']['fields'][] = 'lom_coverage';
753  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
754  break;
755  case 'lom_structure':
756  $this->active_sections['general']['fields'][] = 'lom_structure';
757  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
758  break;
759 
760  // Lifecycle
761  case 'lom_status':
762  $this->active_sections['lifecycle']['fields'][] = 'lom_status';
763  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
764  break;
765  case 'lom_version':
766  $this->active_sections['lifecycle']['fields'][] = 'lom_version';
767  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
768  break;
769  case 'lom_contribute':
770  $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
771  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
772  break;
773 
774  // Technical
775  case 'lom_format':
776  $this->active_sections['technical']['fields'][] = 'lom_format';
777  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
778  break;
779  case 'lom_operating_system':
780  $this->active_sections['technical']['fields'][] = 'lom_operating_system';
781  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
782  break;
783  case 'lom_browser':
784  $this->active_sections['technical']['fields'][] = 'lom_browser';
785  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
786  break;
787 
788  // Education
789  case 'lom_interactivity':
790  $this->active_sections['education']['fields'][] = 'lom_interactivity';
791  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
792  break;
793  case 'lom_resource':
794  $this->active_sections['education']['fields'][] = 'lom_resource';
795  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
796  break;
797  case 'lom_level':
798  $this->active_sections['education']['fields'][] = 'lom_level';
799  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
800  break;
801  case 'lom_density':
802  $this->active_sections['education']['fields'][] = 'lom_density';
803  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
804  break;
805  case 'lom_user_role':
806  $this->active_sections['education']['fields'][] = 'lom_user_role';
807  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
808  break;
809  case 'lom_context':
810  $this->active_sections['education']['fields'][] = 'lom_context';
811  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
812  break;
813  case 'lom_difficulty':
814  $this->active_sections['education']['fields'][] = 'lom_difficulty';
815  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
816  break;
817 
818  // Rights
819  case 'lom_costs':
820  $this->active_sections['rights']['fields'][] = 'lom_costs';
821  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
822  break;
823  case 'lom_copyright':
824  $this->active_sections['rights']['fields'][] = 'lom_copyright';
825  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
826  break;
827 
828  // Classification
829  case 'lom_purpose':
830  $this->active_sections['classification']['fields'][] = 'lom_purpose';
831  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
832  break;
833  case 'lom_taxon':
834  $this->active_sections['classification']['fields'][] = 'lom_taxon';
835  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
836  break;
837 
838  default:
839  if(substr($field_name,0,3) != 'adv')
840  break;
841 
842  // Advanced meta data
843  $field_id = substr($field_name,4);
844  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
845  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
847  $record_id = $field->getRecordId();
848 
849  $this->active_sections['adv_record_'.$record_id]['fields'][] = $field_name;
850  $this->active_sections['adv_record_'.$record_id]['name'] = ilAdvancedMDRecord::_lookupTitle($record_id);
851  break;
852  }
853  }
854  }
855 
859  protected function getRangeSelect($txt_from,$select_from,$txt_until,$select_until)
860  {
861  $tpl = new ilTemplate('tpl.range_search.html',true,true,'Services/Search');
862  $tpl->setVariable('TXT_FROM',$txt_from);
863  $tpl->setVariable('FROM',$select_from);
864  $tpl->setVariable('TXT_UPTO',$txt_until);
865  $tpl->setVariable('UPTO',$select_until);
866  return $tpl->get();
867  }
868 
869 }
870 ?>