ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  return self::$instance;
73  }
74  return self::$instance = new ilLuceneAdvancedSearchFields();
75  }
76 
80  public static function getFields()
81  {
82  global $lng;
83 
84  $lng->loadLanguageModule('meta');
85 
86  $fields['lom_content'] = $lng->txt('content');
87 
88  include_once './Services/Search/classes/class.ilSearchSettings.php';
89  if (ilSearchSettings::getInstance()->enabledLucene()) {
90  $fields['general_offline'] = $lng->txt('lucene_offline_filter');
91  }
92  //'lom_type' = $lng->txt('type');
93  $fields['lom_language'] = $lng->txt('language');
94  $fields['lom_keyword'] = $lng->txt('meta_keyword');
95  $fields['lom_coverage'] = $lng->txt('meta_coverage');
96  $fields['lom_structure'] = $lng->txt('meta_structure');
97  $fields['lom_status'] = $lng->txt('meta_status');
98  $fields['lom_version'] = $lng->txt('meta_version');
99  $fields['lom_contribute'] = $lng->txt('meta_contribute');
100  $fields['lom_format'] = $lng->txt('meta_format');
101  $fields['lom_operating_system'] = $lng->txt('meta_operating_system');
102  $fields['lom_browser'] = $lng->txt('meta_browser');
103  $fields['lom_interactivity'] = $lng->txt('meta_interactivity_type');
104  $fields['lom_resource'] = $lng->txt('meta_learning_resource_type');
105  $fields['lom_level'] = $lng->txt('meta_interactivity_level');
106  $fields['lom_density'] = $lng->txt('meta_semantic_density');
107  $fields['lom_user_role'] = $lng->txt('meta_intended_end_user_role');
108  $fields['lom_context'] = $lng->txt('meta_context');
109  $fields['lom_difficulty'] = $lng->txt('meta_difficulty');
110  $fields['lom_costs'] = $lng->txt('meta_cost');
111  $fields['lom_copyright'] = $lng->txt('meta_copyright_and_other_restrictions');
112  $fields['lom_purpose'] = $lng->txt('meta_purpose');
113  $fields['lom_taxon'] = $lng->txt('meta_taxon');
114 
115  // Append all advanced meta data fields
116  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
117  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
118  foreach (ilAdvancedMDRecord::_getRecords() as $record) {
119  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true) as $def) {
120  $fields['adv_' . $def->getFieldId()] = $def->getTitle();
121  }
122  }
123  return $fields;
124  }
125 
129  public function getActiveFields()
130  {
131  return $this->active_fields ? $this->active_fields : array();
132  }
133 
134  public function getActiveSections()
135  {
136  return $this->active_sections ? $this->active_sections : array();
137  }
138 
139  public function getFormElement($a_query, $a_field_name, ilPropertyFormGUI $a_form)
140  {
141  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
142 
143  $a_post_name = 'query[' . $a_field_name . ']';
144 
145  ilLoggerFactory::getLogger('sea')->debug('Query was: ' . print_r($a_query, true));
146  if (!is_array($a_query)) {
147  $a_query = array();
148  }
149 
150  switch ($a_field_name) {
151  case 'general_offline':
152  $offline_options = array(
153  '0' => $this->lng->txt('search_any'),
154  self::ONLINE_QUERY => $this->lng->txt('search_option_online'),
155  self::OFFLINE_QUERY => $this->lng->txt('search_option_offline')
156  );
157  $offline = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
158  $offline->setOptions($offline_options);
159  $offline->setValue($a_query['general_offline']);
160  return $offline;
161 
162  case 'lom_content':
163  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
164  $text->setSubmitFormOnEnter(true);
165  $text->setValue($a_query['lom_content']);
166  $text->setSize(30);
167  $text->setMaxLength(255);
168  return $text;
169 
170  // General
171  case 'lom_language':
172  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
173  $select->setValue($a_query['lom_language']);
174  $select->setOptions(ilMDUtilSelect::_getLanguageSelect(
175  '',
176  $a_field_name,
177  array(0 => $this->lng->txt('search_any')),
178  true
179  ));
180  return $select;
181 
182  case 'lom_keyword':
183  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
184  $text->setSubmitFormOnEnter(true);
185  $text->setValue($a_query['lom_keyword']);
186  $text->setSize(30);
187  $text->setMaxLength(255);
188  return $text;
189 
190  case 'lom_coverage':
191  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
192  $text->setSubmitFormOnEnter(true);
193  $text->setValue($a_query['lom_coverage']);
194  $text->setSize(30);
195  $text->setMaxLength(255);
196  return $text;
197 
198  case 'lom_structure':
199  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
200  $select->setValue($a_query['lom_structure']);
201  $select->setOptions(ilMDUtilSelect::_getStructureSelect(
202  '',
203  $a_field_name,
204  array(0 => $this->lng->txt('search_any')),
205  true
206  ));
207  return $select;
208 
209  // Lifecycle
210  case 'lom_status':
211  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
212  $select->setValue($a_query['lom_status']);
213  $select->setOptions(ilMDUtilSelect::_getStatusSelect(
214  '',
215  $a_field_name,
216  array(0 => $this->lng->txt('search_any')),
217  true
218  ));
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 
239  $text = new ilTextInputGUI($this->lng->txt('meta_entry'), 'query[' . 'lom_role_entry' . ']');
240  $text->setValue($a_query['lom_role_entry']);
241  $text->setSize(30);
242  $text->setMaxLength(255);
243 
244  $select->addSubItem($text);
245  return $select;
246 
247  // Technical
248  case 'lom_format':
249  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
250  $select->setValue($a_query['lom_format']);
251  $select->setOptions(ilMDUtilSelect::_getFormatSelect(
252  '',
253  $a_field_name,
254  array(0 => $this->lng->txt('search_any')),
255  true
256  ));
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']);
262  $select->setOptions(ilMDUtilSelect::_getOperatingSystemSelect(
263  '',
264  $a_field_name,
265  array(0 => $this->lng->txt('search_any')),
266  true
267  ));
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  ));
279  return $select;
280 
281  // Education
282  case 'lom_interactivity':
283  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
284  $select->setValue($a_query['lom_interactivity']);
286  '',
287  $a_field_name,
288  array(0 => $this->lng->txt('search_any')),
289  true
290  ));
291  return $select;
292 
293  case 'lom_resource':
294  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
295  $select->setValue($a_query['lom_resource']);
297  '',
298  $a_field_name,
299  array(0 => $this->lng->txt('search_any')),
300  true
301  ));
302  return $select;
303 
304  case 'lom_level':
305  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
306  $html = $this->getRangeSelect(
307  $this->lng->txt('from'),
309  $a_query['lom_level_start'],
310  'query[' . 'lom_level_start' . ']',
311  array(0 => $this->lng->txt('search_any'))
312  ),
313  $this->lng->txt('until'),
315  $a_query['lom_level_end'],
316  'query[' . 'lom_level_end' . ']',
317  array(0 => $this->lng->txt('search_any'))
318  )
319  );
320  $range->setHTML($html);
321  return $range;
322 
323  case 'lom_density':
324  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
325  $html = $this->getRangeSelect(
326  $this->lng->txt('from'),
328  $a_query['lom_density_start'],
329  'query[' . 'lom_density_start' . ']',
330  array(0 => $this->lng->txt('search_any'))
331  ),
332  $this->lng->txt('until'),
334  $a_query['lom_density_end'],
335  'query[' . 'lom_density_end' . ']',
336  array(0 => $this->lng->txt('search_any'))
337  )
338  );
339  $range->setHTML($html);
340  return $range;
341 
342 
343  case 'lom_user_role':
344  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
345  $select->setValue($a_query['lom_user_role']);
347  '',
348  $a_field_name,
349  array(0 => $this->lng->txt('search_any')),
350  true
351  ));
352  return $select;
353 
354  case 'lom_context':
355  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
356  $select->setValue($a_query['lom_context']);
357  $select->setOptions(ilMDUtilSelect::_getContextSelect(
358  '',
359  $a_field_name,
360  array(0 => $this->lng->txt('search_any')),
361  true
362  ));
363  return $select;
364 
365  case 'lom_difficulty':
366  $range = new ilCustomInputGUI($this->active_fields[$a_field_name]);
367  $html = $this->getRangeSelect(
368  $this->lng->txt('from'),
370  $a_query['lom_difficulty_start'],
371  'query[' . 'lom_difficulty_start' . ']',
372  array(0 => $this->lng->txt('search_any'))
373  ),
374  $this->lng->txt('until'),
376  $a_query['lom_difficulty_end'],
377  'query[' . 'lom_difficulty_end' . ']',
378  array(0 => $this->lng->txt('search_any'))
379  )
380  );
381  $range->setHTML($html);
382  return $range;
383 
384  // Rights
385  case 'lom_costs':
386  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
387  $select->setValue($a_query['lom_costs']);
388  $select->setOptions(ilMDUtilSelect::_getCostsSelect(
389  '',
390  $a_field_name,
391  array(0 => $this->lng->txt('search_any')),
392  true
393  ));
394  return $select;
395 
396  case 'lom_copyright':
397  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
398  $select->setValue($a_query['lom_copyright']);
400  '',
401  $a_field_name,
402  array(0 => $this->lng->txt('search_any')),
403  true
404  ));
405  return $select;
406 
407 
408 
409  // Classification
410  case 'lom_purpose':
411  $select = new ilSelectInputGUI($this->active_fields[$a_field_name], $a_post_name);
412  $select->setValue($a_query['lom_purpose']);
413  $select->setOptions(ilMDUtilSelect::_getPurposeSelect(
414  '',
415  $a_field_name,
416  array(0 => $this->lng->txt('search_any')),
417  true
418  ));
419  return $select;
420 
421  case 'lom_taxon':
422  $text = new ilTextInputGUI($this->active_fields[$a_field_name], $a_post_name);
423  $text->setSubmitFormOnEnter(true);
424  $text->setValue($a_query['lom_taxon']);
425  $text->setSize(30);
426  $text->setMaxLength(255);
427  return $text;
428 
429  default:
430  if (substr($a_field_name, 0, 3) != 'adv') {
431  break;
432  }
433 
434  // Advanced meta data
435  $field_id = substr($a_field_name, 4);
436  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
437  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
438 
439  $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
440  $field_form->setForm($a_form);
441  $field_form->setElementId($a_post_name);
442  $field_form->setTitle($this->active_fields[$a_field_name]);
443  $field_form->addToForm();
444 
445  // #17071 - reload search values
446  if (is_array($a_query) &&
447  array_key_exists($a_field_name, $a_query)) {
448  $field_form->importFromPost($a_query);
449  $field_form->validate();
450  }
451 
452  return;
453  }
454  return null;
455  }
456 
457 
462  public function parseFieldQuery($a_field, $a_query)
463  {
464  switch ($a_field) {
465  case 'lom_content':
466  return $a_query;
467 
468  case 'general_offline':
469 
470  switch ($a_query) {
471  case self::OFFLINE_QUERY:
472  return 'offline:1';
473 
474  default:
475  return '-offline:1';
476 
477  }
478  return '';
479 
480  // General
481  case 'lom_language':
482  return 'lomLanguage:' . $a_query;
483 
484  case 'lom_keyword':
485  return 'lomKeyword:' . $a_query;
486 
487  case 'lom_coverage':
488  return 'lomCoverage:' . $a_query;
489 
490  case 'lom_structure':
491  return 'lomStructure:' . $a_query;
492 
493  // Lifecycle
494  case 'lom_status':
495  return 'lomStatus:' . $a_query;
496 
497  case 'lom_version':
498  return 'lomVersion:' . $a_query;
499 
500  // Begin Contribute
501  case 'lom_role':
502  return 'lomRole:' . $a_query;
503 
504  case 'lom_role_entry':
505  return 'lomRoleEntity:' . $a_query;
506  // End contribute
507 
508  // Technical
509  case 'lom_format':
510  return 'lomFormat:' . $a_query;
511 
512  case 'lom_operating_system':
513  return 'lomOS:' . $a_query;
514 
515  case 'lom_browser':
516  return 'lomBrowser:' . $a_query;
517 
518  // Educational
519  case 'lom_interactivity':
520  return 'lomInteractivity:' . $a_query;
521 
522  case 'lom_resource':
523  return 'lomResource:' . $a_query;
524 
525  case 'lom_level_start':
526  $q_string = '';
527  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
529  for ($i = $a_query; $i <= count($options); $i++) {
530  if (strlen($q_string)) {
531  $q_string .= 'OR ';
532  }
533  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
534  }
535  return $q_string;
536 
537  case 'lom_level_end':
538  $q_string = '';
539  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
541  for ($i = 1; $i <= $a_query; $i++) {
542  if (strlen($q_string)) {
543  $q_string .= 'OR ';
544  }
545  $q_string .= ('lomLevel:"' . $options[$i] . '" ');
546  }
547  return $q_string;
548 
549  case 'lom_density_start':
550  $q_string = '';
551  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
552  $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
553  for ($i = $a_query; $i <= count($options); $i++) {
554  if (strlen($q_string)) {
555  $q_string .= 'OR ';
556  }
557  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
558  }
559  return $q_string;
560 
561  case 'lom_density_end':
562  $q_string = '';
563  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
564  $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
565  for ($i = 1; $i <= $a_query; $i++) {
566  if (strlen($q_string)) {
567  $q_string .= 'OR ';
568  }
569  $q_string .= ('lomDensity:"' . $options[$i] . '" ');
570  }
571  return $q_string;
572 
573  case 'lom_user_role':
574  return 'lomUserRole:' . $a_query;
575 
576  case 'lom_context':
577  return 'lomContext:' . $a_query;
578 
579  case 'lom_difficulty_start':
580  $q_string = '';
581  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
582  $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
583  for ($i = $a_query; $i <= count($options); $i++) {
584  if (strlen($q_string)) {
585  $q_string .= 'OR ';
586  }
587  $q_string .= ('lomDifficulty:"' . $options[$i] . '" ');
588  }
589  return $q_string;
590 
591  case 'lom_difficulty_end':
592  $q_string = '';
593  include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
594  $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
595  for ($i = 1; $i <= $a_query; $i++) {
596  if (strlen($q_string)) {
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 
622  // Advanced meta data
623  $field_id = substr($a_field, 4);
624  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
625  try {
626  // field might be invalid (cached query)
627  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
628  } catch (Exception $ex) {
629  return '';
630  }
631 
632  $adv_query = $field->getLuceneSearchString($a_query);
633  if ($adv_query) {
634  // #17558
635  if (!is_array($adv_query)) {
636  return 'advancedMetaData_' . $field_id . ': ' . $adv_query;
637  } else {
638  $res = array();
639  foreach ($adv_query as $adv_query_item) {
640  $res[] = 'advancedMetaData_' . $field_id . ': ' . $adv_query_item;
641  }
642  return '(' . implode(' OR ', $res) . ')';
643  }
644  }
645  }
646  }
647 
648 
652  protected function readFields()
653  {
654  foreach (self::getFields() as $name => $translation) {
655  if ($this->settings->isActive($name)) {
656  $this->active_fields[$name] = $translation;
657  }
658  }
659  }
660 
664  protected function readSections()
665  {
666  foreach ($this->getActiveFields() as $field_name => $translation) {
667  switch ($field_name) {
668  // Default section
669  case 'lom_content':
670  $this->active_sections['default']['fields'][] = 'lom_content';
671  $this->active_sections['default']['name'] = '';
672  break;
673 
674  case 'general_offline':
675  $this->active_sections['default']['fields'][] = 'general_offline';
676  $this->active_sections['default']['name'] = '';
677  break;
678 
679  case 'lom_type':
680  $this->active_sections['default']['fields'][] = 'lom_type';
681  $this->active_sections['default']['name'] = '';
682  break;
683 
684  // General
685  case 'lom_language':
686  $this->active_sections['general']['fields'][] = 'lom_language';
687  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
688  break;
689  case 'lom_keyword':
690  $this->active_sections['general']['fields'][] = 'lom_keyword';
691  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
692  break;
693  case 'lom_coverage':
694  $this->active_sections['general']['fields'][] = 'lom_coverage';
695  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
696  break;
697  case 'lom_structure':
698  $this->active_sections['general']['fields'][] = 'lom_structure';
699  $this->active_sections['general']['name'] = $this->lng->txt('meta_general');
700  break;
701 
702  // Lifecycle
703  case 'lom_status':
704  $this->active_sections['lifecycle']['fields'][] = 'lom_status';
705  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
706  break;
707  case 'lom_version':
708  $this->active_sections['lifecycle']['fields'][] = 'lom_version';
709  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
710  break;
711  case 'lom_contribute':
712  $this->active_sections['lifecycle']['fields'][] = 'lom_contribute';
713  $this->active_sections['lifecycle']['name'] = $this->lng->txt('meta_lifecycle');
714  break;
715 
716  // Technical
717  case 'lom_format':
718  $this->active_sections['technical']['fields'][] = 'lom_format';
719  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
720  break;
721  case 'lom_operating_system':
722  $this->active_sections['technical']['fields'][] = 'lom_operating_system';
723  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
724  break;
725  case 'lom_browser':
726  $this->active_sections['technical']['fields'][] = 'lom_browser';
727  $this->active_sections['technical']['name'] = $this->lng->txt('meta_technical');
728  break;
729 
730  // Education
731  case 'lom_interactivity':
732  $this->active_sections['education']['fields'][] = 'lom_interactivity';
733  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
734  break;
735  case 'lom_resource':
736  $this->active_sections['education']['fields'][] = 'lom_resource';
737  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
738  break;
739  case 'lom_level':
740  $this->active_sections['education']['fields'][] = 'lom_level';
741  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
742  break;
743  case 'lom_density':
744  $this->active_sections['education']['fields'][] = 'lom_density';
745  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
746  break;
747  case 'lom_user_role':
748  $this->active_sections['education']['fields'][] = 'lom_user_role';
749  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
750  break;
751  case 'lom_context':
752  $this->active_sections['education']['fields'][] = 'lom_context';
753  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
754  break;
755  case 'lom_difficulty':
756  $this->active_sections['education']['fields'][] = 'lom_difficulty';
757  $this->active_sections['education']['name'] = $this->lng->txt('meta_education');
758  break;
759 
760  // Rights
761  case 'lom_costs':
762  $this->active_sections['rights']['fields'][] = 'lom_costs';
763  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
764  break;
765  case 'lom_copyright':
766  $this->active_sections['rights']['fields'][] = 'lom_copyright';
767  $this->active_sections['rights']['name'] = $this->lng->txt('meta_rights');
768  break;
769 
770  // Classification
771  case 'lom_purpose':
772  $this->active_sections['classification']['fields'][] = 'lom_purpose';
773  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
774  break;
775  case 'lom_taxon':
776  $this->active_sections['classification']['fields'][] = 'lom_taxon';
777  $this->active_sections['classification']['name'] = $this->lng->txt('meta_classification');
778  break;
779 
780  default:
781  if (substr($field_name, 0, 3) != 'adv') {
782  break;
783  }
784 
785  // Advanced meta data
786  $field_id = substr($field_name, 4);
787  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
788  include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
789  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
790  $record_id = $field->getRecordId();
791 
792  $this->active_sections['adv_record_' . $record_id]['fields'][] = $field_name;
793  $this->active_sections['adv_record_' . $record_id]['name'] = ilAdvancedMDRecord::_lookupTitle($record_id);
794  break;
795  }
796  }
797  }
798 
802  protected function getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
803  {
804  $tpl = new ilTemplate('tpl.range_search.html', true, true, 'Services/Search');
805  $tpl->setVariable('TXT_FROM', $txt_from);
806  $tpl->setVariable('FROM', $select_from);
807  $tpl->setVariable('TXT_UPTO', $txt_until);
808  $tpl->setVariable('UPTO', $select_until);
809  return $tpl->get();
810  }
811 }
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.
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.
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.
if($format !==null) $name
Definition: metadata.php:146
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)
Create styles array
The data for the language used.
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.
settings()
Definition: settings.php:2
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...
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20