25include_once 
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
 
   60                $this->lng->loadLanguageModule(
'meta');
 
   71                if(isset(self::$instance) and self::$instance)
 
   85                $lng->loadLanguageModule(
'meta');
 
   89                include_once 
'./Services/Search/classes/class.ilSearchSettings.php';
 
   92                        $fields[
'general_offline']              = 
$lng->txt(
'lucene_offline_filter');
 
   97                $fields[
'lom_coverage']                         = 
$lng->txt(
'meta_coverage');
 
   98                $fields[
'lom_structure']                        = 
$lng->txt(
'meta_structure');
 
  100                $fields[
'lom_version']                          = 
$lng->txt(
'meta_version');
 
  101                $fields[
'lom_contribute']                       = 
$lng->txt(
'meta_contribute');
 
  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');
 
  113                $fields[
'lom_copyright']                        = 
$lng->txt(
'meta_copyright_and_other_restrictions');
 
  114                $fields[
'lom_purpose']                          = 
$lng->txt(
'meta_purpose');
 
  118                include_once 
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
 
  119                include_once 
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
 
  124                                $fields[
'adv_'.$def->getFieldId()] = $def->getTitle();                          
 
  135                return $this->active_fields ? $this->active_fields : array();
 
  140                return $this->active_sections ? $this->active_sections : array();
 
  145                include_once 
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
 
  147                $a_post_name = 
'query['.$a_field_name.
']';
 
  150                if(!is_array($a_query))
 
  155                switch($a_field_name)
 
  157                        case 'general_offline':
 
  158                                $offline_options = array(
 
  159                                        '0' => $this->lng->txt(
'search_any'),
 
  160                                        self::ONLINE_QUERY => $this->lng->txt(
'search_option_online'),
 
  161                                        self::OFFLINE_QUERY => $this->lng->txt(
'search_option_offline')
 
  163                                $offline = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  164                                $offline->setOptions($offline_options);
 
  165                                $offline->setValue($a_query[
'general_offline']);
 
  170                                $text->setSubmitFormOnEnter(
true);
 
  171                                $text->setValue($a_query[
'lom_content']);
 
  173                                $text->setMaxLength(255);
 
  178                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  179                                $select->setValue($a_query[
'lom_language']);
 
  183                                        array(0 => $this->lng->txt(
'search_any')),
 
  189                                $text->setSubmitFormOnEnter(
true);
 
  190                                $text->setValue($a_query[
'lom_keyword']);
 
  192                                $text->setMaxLength(255);
 
  197                                $text->setSubmitFormOnEnter(
true);
 
  198                                $text->setValue($a_query[
'lom_coverage']);
 
  200                                $text->setMaxLength(255);
 
  203                        case 'lom_structure':
 
  204                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  205                                $select->setValue($a_query[
'lom_structure']);
 
  209                                        array(0 => $this->lng->txt(
'search_any')),
 
  215                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  216                                $select->setValue($a_query[
'lom_status']);
 
  220                                        array(0 => $this->lng->txt(
'search_any')),
 
  226                                $text->setSubmitFormOnEnter(
true);
 
  227                                $text->setValue($a_query[
'lom_version']);
 
  229                                $text->setMaxLength(255);
 
  232                        case 'lom_contribute':
 
  233                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],
'query['.
'lom_role'.
']');
 
  234                                $select->setValue($a_query[
'lom_role']);
 
  238                                        array(0 => $this->lng->txt(
'search_any')),
 
  242                                        $text->setValue($a_query[
'lom_role_entry']);
 
  244                                        $text->setMaxLength(255);
 
  246                                $select->addSubItem(
$text);
 
  251                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  252                                $select->setValue($a_query[
'lom_format']);
 
  256                                        array(0 => $this->lng->txt(
'search_any')),
 
  260                        case 'lom_operating_system':
 
  261                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  262                                $select->setValue($a_query[
'lom_operating_system']);
 
  266                                        array(0 => $this->lng->txt(
'search_any')),
 
  271                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  272                                $select->setValue($a_query[
'lom_browser']);
 
  276                                        array(0 => $this->lng->txt(
'search_any')),
 
  281                        case 'lom_interactivity':
 
  282                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  283                                $select->setValue($a_query[
'lom_interactivity']);
 
  287                                        array(0 => $this->lng->txt(
'search_any')),
 
  292                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  293                                $select->setValue($a_query[
'lom_resource']);
 
  297                                        array(0 => $this->lng->txt(
'search_any')),
 
  304                                        $this->lng->txt(
'from'),
 
  306                                                $a_query[
'lom_level_start'],
 
  307                                                'query['.
'lom_level_start'.
']',
 
  308                                                array(0 => $this->lng->txt(
'search_any'))),
 
  309                                        $this->lng->txt(
'until'),
 
  311                                                $a_query[
'lom_level_end'],
 
  312                                                'query['.
'lom_level_end'.
']',
 
  313                                                array(0 => $this->lng->txt(
'search_any')))
 
  315                                $range->setHTML(
$html);
 
  321                                        $this->lng->txt(
'from'),
 
  323                                                $a_query[
'lom_density_start'],
 
  324                                                'query['.
'lom_density_start'.
']',
 
  325                                                array(0 => $this->lng->txt(
'search_any'))),
 
  326                                        $this->lng->txt(
'until'),
 
  328                                                $a_query[
'lom_density_end'],
 
  329                                                'query['.
'lom_density_end'.
']',
 
  330                                                array(0 => $this->lng->txt(
'search_any')))
 
  332                                $range->setHTML(
$html);
 
  336                        case 'lom_user_role':
 
  337                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  338                                $select->setValue($a_query[
'lom_user_role']);
 
  342                                        array(0 => $this->lng->txt(
'search_any')),
 
  347                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  348                                $select->setValue($a_query[
'lom_context']);
 
  352                                        array(0 => $this->lng->txt(
'search_any')),
 
  356                        case 'lom_difficulty':
 
  359                                        $this->lng->txt(
'from'),
 
  361                                                $a_query[
'lom_difficulty_start'],
 
  362                                                'query['.
'lom_difficulty_start'.
']',
 
  363                                                array(0 => $this->lng->txt(
'search_any'))),
 
  364                                        $this->lng->txt(
'until'),
 
  366                                                $a_query[
'lom_difficulty_end'],
 
  367                                                'query['.
'lom_difficulty_end'.
']',
 
  368                                                array(0 => $this->lng->txt(
'search_any')))
 
  370                                $range->setHTML(
$html);
 
  375                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  376                                $select->setValue($a_query[
'lom_costs']);
 
  380                                        array(0 => $this->lng->txt(
'search_any')),
 
  384                        case 'lom_copyright':
 
  385                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  386                                $select->setValue($a_query[
'lom_copyright']);
 
  390                                        array(0 => $this->lng->txt(
'search_any')),
 
  398                                $select = 
new ilSelectInputGUI($this->active_fields[$a_field_name],$a_post_name);
 
  399                                $select->setValue($a_query[
'lom_purpose']);
 
  403                                        array(0 => $this->lng->txt(
'search_any')),
 
  409                                $text->setSubmitFormOnEnter(
true);
 
  410                                $text->setValue($a_query[
'lom_taxon']);
 
  412                                $text->setMaxLength(255);
 
  416                                if(substr($a_field_name,0,3) != 
'adv')
 
  420                                $field_id = substr($a_field_name,4);
 
  421                                include_once 
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
 
  424                                $field_form = 
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), 
true, 
false);                               
 
  425                                $field_form->setForm($a_form);
 
  426                                $field_form->setElementId($a_post_name);
 
  427                                $field_form->setTitle($this->active_fields[$a_field_name]);                     
 
  428                                $field_form->addToForm();
 
  431                                if(is_array($a_query) &&
 
  432                                        array_key_exists($a_field_name, $a_query))
 
  434                                        $field_form->importFromPost($a_query);
 
  435                                        $field_form->validate();
 
  455                        case 'general_offline':
 
  470                                return 'lomLanguage:'.$a_query;
 
  473                                return 'lomKeyword:'.$a_query;
 
  476                                return 'lomCoverage:'.$a_query;
 
  478                        case 'lom_structure':
 
  479                                return 'lomStructure:'.$a_query;
 
  483                                return 'lomStatus:'.$a_query;
 
  486                                return 'lomVersion:'.$a_query;
 
  490                                return 'lomRole:'.$a_query;
 
  492                        case 'lom_role_entry':
 
  493                                return 'lomRoleEntity:'.$a_query;
 
  498                                return 'lomFormat:'.$a_query;
 
  500                        case 'lom_operating_system':
 
  501                                return 'lomOS:'.$a_query;
 
  504                                return 'lomBrowser:'.$a_query;
 
  507                        case 'lom_interactivity':
 
  508                                return 'lomInteractivity:'.$a_query;
 
  511                                return 'lomResource:'.$a_query;
 
  513                        case 'lom_level_start':
 
  515                                include_once 
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
 
  517                                for($i = $a_query; $i <= count(
$options); $i++)
 
  519                                        if(strlen($q_string))
 
  523                                        $q_string .= (
'lomLevel:"'.$options[$i].
'" ');                                          
 
  527                        case 'lom_level_end':
 
  529                                include_once 
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
 
  531                                for($i = 1; $i <= $a_query; $i++)
 
  533                                        if(strlen($q_string))
 
  537                                        $q_string .= (
'lomLevel:"'.$options[$i].
'" ');                                          
 
  541                        case 'lom_density_start':
 
  543                                include_once 
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
 
  545                                for($i = $a_query; $i <= count(
$options); $i++)
 
  547                                        if(strlen($q_string))
 
  551                                        $q_string .= (
'lomDensity:"'.$options[$i].
'" ');                                                
 
  555                        case 'lom_density_end':
 
  557                                include_once 
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
 
  559                                for($i = 1; $i <= $a_query; $i++)
 
  561                                        if(strlen($q_string))
 
  565                                        $q_string .= (
'lomDensity:"'.$options[$i].
'" ');
 
  569                        case 'lom_user_role':
 
  570                                return 'lomUserRole:'.$a_query;
 
  573                                return 'lomContext:'.$a_query;
 
  575                        case 'lom_difficulty_start':
 
  577                                include_once 
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
 
  579                                for($i = $a_query; $i <= count(
$options); $i++)
 
  581                                        if(strlen($q_string))
 
  585                                        $q_string .= (
'lomDifficulty:"'.$options[$i].
'" ');                                             
 
  589                        case 'lom_difficulty_end':
 
  591                                include_once 
'./Services/MetaData/classes/class.ilMDUtilSelect.php';
 
  593                                for($i = 1; $i <= $a_query; $i++)
 
  595                                        if(strlen($q_string))
 
  599                                        $q_string .= (
'lomDifficulty:"'.$options[$i].
'" ');
 
  605                                return 'lomCosts:'.$a_query;
 
  607                        case 'lom_copyright':
 
  608                                return 'lomCopyright:'.$a_query;
 
  612                                return 'lomPurpose:'.$a_query;
 
  615                                return 'lomTaxon:'.$a_query;
 
  618                                if(substr($a_field,0,3) != 
'adv')
 
  622                                $field_id = substr($a_field,4);
 
  623                                include_once 
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';                               
 
  629                                catch (Exception $ex) 
 
  634                                $adv_query = $field->getLuceneSearchString($a_query);
 
  638                                        if(!is_array($adv_query))
 
  640                                                return 'advancedMetaData_'.$field_id.
': '.$adv_query;                           
 
  645                                                foreach($adv_query as $adv_query_item)
 
  647                                                        $res[] = 
'advancedMetaData_'.$field_id.
': '.$adv_query_item;                            
 
  649                                                return '('.implode(
' OR ', 
$res).
')';
 
  661                foreach(self::getFields() as $name => $translation)
 
  663                        if($this->
settings->isActive($name))
 
  665                                $this->active_fields[$name] = $translation;
 
  681                                        $this->active_sections[
'default'][
'fields'][] = 
'lom_content';
 
  682                                        $this->active_sections[
'default'][
'name'] = 
'';
 
  685                                case 'general_offline':
 
  686                                        $this->active_sections[
'default'][
'fields'][] = 
'general_offline';
 
  687                                        $this->active_sections[
'default'][
'name'] = 
'';
 
  691                                        $this->active_sections[
'default'][
'fields'][] = 
'lom_type';
 
  692                                        $this->active_sections[
'default'][
'name'] = 
'';
 
  697                                        $this->active_sections[
'general'][
'fields'][] = 
'lom_language';
 
  698                                        $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
 
  701                                        $this->active_sections[
'general'][
'fields'][] = 
'lom_keyword';
 
  702                                        $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
 
  705                                        $this->active_sections[
'general'][
'fields'][] = 
'lom_coverage';
 
  706                                        $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
 
  708                                case 'lom_structure':
 
  709                                        $this->active_sections[
'general'][
'fields'][] = 
'lom_structure';
 
  710                                        $this->active_sections[
'general'][
'name'] = $this->lng->txt(
'meta_general');
 
  715                                        $this->active_sections[
'lifecycle'][
'fields'][] = 
'lom_status';
 
  716                                        $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
 
  719                                        $this->active_sections[
'lifecycle'][
'fields'][] = 
'lom_version';
 
  720                                        $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
 
  722                                case 'lom_contribute':
 
  723                                        $this->active_sections[
'lifecycle'][
'fields'][] = 
'lom_contribute';
 
  724                                        $this->active_sections[
'lifecycle'][
'name'] = $this->lng->txt(
'meta_lifecycle');
 
  729                                        $this->active_sections[
'technical'][
'fields'][] = 
'lom_format';
 
  730                                        $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
 
  732                                case 'lom_operating_system':
 
  733                                        $this->active_sections[
'technical'][
'fields'][] = 
'lom_operating_system';
 
  734                                        $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
 
  737                                        $this->active_sections[
'technical'][
'fields'][] = 
'lom_browser';
 
  738                                        $this->active_sections[
'technical'][
'name'] = $this->lng->txt(
'meta_technical');
 
  742                                case 'lom_interactivity':
 
  743                                        $this->active_sections[
'education'][
'fields'][] = 
'lom_interactivity';
 
  744                                        $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
 
  747                                        $this->active_sections[
'education'][
'fields'][] = 
'lom_resource';
 
  748                                        $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
 
  751                                        $this->active_sections[
'education'][
'fields'][] = 
'lom_level';
 
  752                                        $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
 
  755                                        $this->active_sections[
'education'][
'fields'][] = 
'lom_density';
 
  756                                        $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
 
  758                                case 'lom_user_role':
 
  759                                        $this->active_sections[
'education'][
'fields'][] = 
'lom_user_role';
 
  760                                        $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
 
  763                                        $this->active_sections[
'education'][
'fields'][] = 
'lom_context';
 
  764                                        $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
 
  766                                case 'lom_difficulty':
 
  767                                        $this->active_sections[
'education'][
'fields'][] = 
'lom_difficulty';
 
  768                                        $this->active_sections[
'education'][
'name'] = $this->lng->txt(
'meta_education');
 
  773                                        $this->active_sections[
'rights'][
'fields'][] = 
'lom_costs';
 
  774                                        $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
 
  776                                case 'lom_copyright':
 
  777                                        $this->active_sections[
'rights'][
'fields'][] = 
'lom_copyright';
 
  778                                        $this->active_sections[
'rights'][
'name'] = $this->lng->txt(
'meta_rights');
 
  783                                        $this->active_sections[
'classification'][
'fields'][] = 
'lom_purpose';
 
  784                                        $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
 
  787                                        $this->active_sections[
'classification'][
'fields'][] = 
'lom_taxon';
 
  788                                        $this->active_sections[
'classification'][
'name'] = $this->lng->txt(
'meta_classification');
 
  792                                        if(substr($field_name,0,3) != 
'adv')
 
  796                                        $field_id = substr($field_name,4);
 
  797                                        include_once 
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
 
  798                                        include_once 
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
 
  800                                        $record_id = $field->getRecordId();
 
  802                                        $this->active_sections[
'adv_record_'.$record_id][
'fields'][] = $field_name;
 
  812        protected function getRangeSelect($txt_from,$select_from,$txt_until,$select_until)
 
  814                $tpl = 
new ilTemplate(
'tpl.range_search.html',
true,
true,
'Services/Search');
 
  815                $tpl->setVariable(
'TXT_FROM',$txt_from);
 
  816                $tpl->setVariable(
'FROM',$select_from);
 
  817                $tpl->setVariable(
'TXT_UPTO',$txt_until);
 
  818                $tpl->setVariable(
'UPTO',$select_until);
 
An exception for terminatinating execution or to throw for unit testing.
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.
static getLogger($a_component_id)
Get component logger.
Field definitions of advanced meta data search.
readSections()
Read active sections.
readFields()
Read active fields.
getFormElement($a_query, $a_field_name, ilPropertyFormGUI $a_form)
getActiveFields()
Get all active fields.
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.
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.
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.
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 _getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
static _getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
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 _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 _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 _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
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 _getLanguageSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta data language selector.
static _getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
static _getContextSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta context.
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 _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 _getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
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.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
if(!is_array($argv)) $options