ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLuceneAdvancedSearchFields Class Reference

Field definitions of advanced meta data search. More...

+ Collaboration diagram for ilLuceneAdvancedSearchFields:

Public Member Functions

 getActiveFields ()
 Get all active fields. More...
 
 getActiveSections ()
 
 getFormElement ($a_query, $a_field_name, ilPropertyFormGUI $a_form)
 
 parseFieldQuery ($a_field, $a_query)
 Called from ilLuceneAdvancedQueryParser Parse a field specific query. More...
 

Static Public Member Functions

static getInstance ()
 Get singleton instance. More...
 
static getFields ()
 Return an array of all meta data fields. More...
 

Data Fields

const ONLINE_QUERY = 1
 
const OFFLINE_QUERY = 2
 

Protected Member Functions

 __construct ()
 
 readFields ()
 Read active fields. More...
 
 readSections ()
 Read active sections. More...
 
 getRangeSelect ($txt_from, $select_from, $txt_until, $select_until)
 get a range selection More...
 

Protected Attributes

 $lng = null
 

Private Attributes

 $settings = null
 
 $active_fields = array()
 
 $active_sections = array()
 

Static Private Attributes

static $instance = null
 
static $fields = null
 
static $sections = null
 

Detailed Description

Field definitions of advanced meta data search.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 36 of file class.ilLuceneAdvancedSearchFields.php.

Constructor & Destructor Documentation

◆ __construct()

ilLuceneAdvancedSearchFields::__construct ( )
protected

Definition at line 53 of file class.ilLuceneAdvancedSearchFields.php.

References $lng, ilLuceneAdvancedSearchSettings\getInstance(), readFields(), and readSections().

54  {
55  global $lng;
56 
58 
59  $this->lng = $lng;
60  $this->lng->loadLanguageModule('meta');
61 
62  $this->readFields();
63  $this->readSections();
64  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveFields()

ilLuceneAdvancedSearchFields::getActiveFields ( )

Get all active fields.

Definition at line 133 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by readSections().

134  {
135  return $this->active_fields ? $this->active_fields : array();
136  }
+ Here is the caller graph for this function:

◆ getActiveSections()

ilLuceneAdvancedSearchFields::getActiveSections ( )

Definition at line 138 of file class.ilLuceneAdvancedSearchFields.php.

139  {
140  return $this->active_sections ? $this->active_sections : array();
141  }

◆ getFields()

static ilLuceneAdvancedSearchFields::getFields ( )
static

Return an array of all meta data fields.

Definition at line 81 of file class.ilLuceneAdvancedSearchFields.php.

References $fields, $lng, ilAdvancedMDRecord\_getRecords(), ilSearchSettings\getInstance(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by ilLuceneAdvancedSearchActivationTableGUI\parse(), ilLuceneAdvancedSearchSettings\read(), and ilObjSearchSettingsGUI\saveAdvancedLuceneSettingsObject().

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  }
static _getRecords()
Get records.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormElement()

ilLuceneAdvancedSearchFields::getFormElement (   $a_query,
  $a_field_name,
ilPropertyFormGUI  $a_form 
)

Definition at line 143 of file class.ilLuceneAdvancedSearchFields.php.

References ilMDUtilSelect\_getBrowserSelect(), ilMDUtilSelect\_getContextSelect(), ilMDUtilSelect\_getCopyrightAndOtherRestrictionsSelect(), ilMDUtilSelect\_getCostsSelect(), ilMDUtilSelect\_getDifficultySelect(), ilMDUtilSelect\_getFormatSelect(), ilMDUtilSelect\_getIntendedEndUserRoleSelect(), ilMDUtilSelect\_getInteractivityLevelSelect(), ilMDUtilSelect\_getInteractivityTypeSelect(), ilMDUtilSelect\_getLanguageSelect(), ilMDUtilSelect\_getLearningResourceTypeSelect(), ilMDUtilSelect\_getOperatingSystemSelect(), ilMDUtilSelect\_getPurposeSelect(), ilMDUtilSelect\_getRoleSelect(), ilMDUtilSelect\_getSemanticDensitySelect(), ilMDUtilSelect\_getStatusSelect(), ilMDUtilSelect\_getStructureSelect(), ilADTFactory\getInstance(), ilAdvancedMDFieldDefinition\getInstance(), getRangeSelect(), and ilTextInputGUI\setValue().

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']);
262  $select->setOptions(ilMDUtilSelect::_getOperatingSystemSelect(
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';
421  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
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  }
_getContextSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta context.
_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...
This class represents a selection list property in a property form.
_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...
_getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
_getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
_getCostsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights costs 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.
_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 getInstance()
Get singleton.
_getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
_getDifficultySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
_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...
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
This class represents a text property in a property form.
_getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
This class represents a custom property in a property form.
getRangeSelect($txt_from, $select_from, $txt_until, $select_until)
get a range selection
_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...
_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...
setValue($a_value)
Set Value.
_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.
_getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
+ Here is the call graph for this function:

◆ getInstance()

static ilLuceneAdvancedSearchFields::getInstance ( )
static

Get singleton instance.

Definition at line 69 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by ilLuceneAdvancedQueryParser\__construct(), ilLuceneSearchGUI\__construct(), ilLuceneAdvancedSearchGUI\__construct(), ilLuceneUserSearchGUI\getTabs(), and ilAdvancedSearchGUI\ilAdvancedSearchGUI().

70  {
71  if(isset(self::$instance) and self::$instance)
72  {
73  return self::$instance;
74  }
75  return self::$instance = new ilLuceneAdvancedSearchFields();
76  }
Field definitions of advanced meta data search.
+ Here is the caller graph for this function:

◆ getRangeSelect()

ilLuceneAdvancedSearchFields::getRangeSelect (   $txt_from,
  $select_from,
  $txt_until,
  $select_until 
)
protected

get a range selection

Definition at line 811 of file class.ilLuceneAdvancedSearchFields.php.

References $tpl.

Referenced by getFormElement().

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  }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ parseFieldQuery()

ilLuceneAdvancedSearchFields::parseFieldQuery (   $a_field,
  $a_query 
)

Called from ilLuceneAdvancedQueryParser Parse a field specific query.

Definition at line 447 of file class.ilLuceneAdvancedSearchFields.php.

References $options, $res, ilMDUtilSelect\_getDifficultySelect(), ilMDUtilSelect\_getInteractivityLevelSelect(), ilMDUtilSelect\_getSemanticDensitySelect(), and ilAdvancedMDFieldDefinition\getInstance().

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  {
458  case self::OFFLINE_QUERY:
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)
626  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
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  }
_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.
if(!is_array($argv)) $options
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
_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...
+ Here is the call graph for this function:

◆ readFields()

ilLuceneAdvancedSearchFields::readFields ( )
protected

Read active fields.

Definition at line 658 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by __construct().

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  }
+ Here is the caller graph for this function:

◆ readSections()

ilLuceneAdvancedSearchFields::readSections ( )
protected

Read active sections.

Definition at line 672 of file class.ilLuceneAdvancedSearchFields.php.

References ilAdvancedMDRecord\_lookupTitle(), getActiveFields(), and ilAdvancedMDFieldDefinition\getInstance().

Referenced by __construct().

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';
798  $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
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  }
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
static _lookupTitle($a_record_id)
Lookup title.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active_fields

ilLuceneAdvancedSearchFields::$active_fields = array()
private

Definition at line 47 of file class.ilLuceneAdvancedSearchFields.php.

◆ $active_sections

ilLuceneAdvancedSearchFields::$active_sections = array()
private

Definition at line 50 of file class.ilLuceneAdvancedSearchFields.php.

◆ $fields

ilLuceneAdvancedSearchFields::$fields = null
staticprivate

Definition at line 46 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by getFields().

◆ $instance

ilLuceneAdvancedSearchFields::$instance = null
staticprivate

Definition at line 41 of file class.ilLuceneAdvancedSearchFields.php.

◆ $lng

ilLuceneAdvancedSearchFields::$lng = null
protected

Definition at line 44 of file class.ilLuceneAdvancedSearchFields.php.

Referenced by __construct(), and getFields().

◆ $sections

ilLuceneAdvancedSearchFields::$sections = null
staticprivate

Definition at line 49 of file class.ilLuceneAdvancedSearchFields.php.

◆ $settings

ilLuceneAdvancedSearchFields::$settings = null
private

Definition at line 42 of file class.ilLuceneAdvancedSearchFields.php.

◆ OFFLINE_QUERY

const ilLuceneAdvancedSearchFields::OFFLINE_QUERY = 2

Definition at line 39 of file class.ilLuceneAdvancedSearchFields.php.

◆ ONLINE_QUERY

const ilLuceneAdvancedSearchFields::ONLINE_QUERY = 1

Definition at line 38 of file class.ilLuceneAdvancedSearchFields.php.


The documentation for this class was generated from the following file: