function listMetaMetaData()
 {
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.md_editor.html', 'Services/MetaData');
     $this->__setTabs('meta_meta_metadata');
     $this->tpl->addBlockFile('MD_CONTENT', 'md_content', 'tpl.md_meta_metadata.html', 'Services/MetaData');
     $this->ctrl->setParameter($this, "section", "meta_meta_metadata");
     if (!is_object($this->md_section = $this->md_obj->getMetaMetadata())) {
         $this->tpl->setCurrentBlock("no_meta_meta");
         $this->tpl->setVariable("TXT_NO_META_META", $this->lng->txt("meta_no_meta_metadata"));
         $this->tpl->setVariable("TXT_ADD_META_META", $this->lng->txt("meta_add"));
         $this->tpl->setVariable("ACTION_ADD_META_META", $this->ctrl->getLinkTarget($this, "addSection"));
         $this->tpl->parseCurrentBlock();
         return true;
     }
     $this->ctrl->setReturn($this, 'listMetaMetaData');
     $this->ctrl->setParameter($this, "meta_index", $this->md_section->getMetaId());
     $this->tpl->setVariable("EDIT_ACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TXT_META_METADATA", $this->lng->txt('meta_meta_metadata'));
     // Delete link
     $this->tpl->setVariable("ACTION_DELETE", $this->ctrl->getLinkTarget($this, "deleteSection"));
     $this->tpl->setVariable("TXT_DELETE", $this->lng->txt('delete'));
     // New element
     $this->__fillSubelements();
     $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt('meta_language'));
     $this->tpl->setVariable("VAL_LANGUAGE", $this->__showLanguageSelect('met_language', $this->md_section->getLanguageCode()));
     $this->tpl->setVariable("TXT_METADATASCHEME", $this->lng->txt('meta_metadatascheme'));
     $this->tpl->setVariable("VAL_METADATASCHEME", $this->md_section->getMetaDataScheme());
     // Identifier
     foreach ($ids = $this->md_section->getIdentifierIds() as $id) {
         $md_ide = $this->md_section->getIdentifier($id);
         if (count($ids) > 1) {
             $this->ctrl->setParameter($this, 'meta_index', $id);
             $this->ctrl->setParameter($this, 'meta_path', 'meta_identifier');
             $this->tpl->setCurrentBlock("identifier_delete");
             $this->tpl->setVariable("IDENTIFIER_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
             $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_DELETE", $this->lng->txt('delete'));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("identifier_loop");
         $this->tpl->setVariable("IDENTIFIER_LOOP_NO", $id);
         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_IDENTIFIER", $this->lng->txt("meta_identifier"));
         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_CATALOG", $this->lng->txt("meta_catalog"));
         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_IDENTIFIER_CATALOG", ilUtil::prepareFormOutput($md_ide->getCatalog()));
         $this->tpl->setVariable("IDENTIFIER_LOOP_TXT_ENTRY", $this->lng->txt("meta_entry"));
         $this->tpl->setVariable("IDENTIFIER_LOOP_VAL_IDENTIFIER_ENTRY", ilUtil::prepareFormOutput($md_ide->getEntry()));
         $this->tpl->parseCurrentBlock();
     }
     // Contributes
     foreach ($ids = $this->md_section->getContributeIds() as $con_id) {
         $md_con = $this->md_section->getContribute($con_id);
         if (count($ids) > 1) {
             $this->ctrl->setParameter($this, 'meta_index', $con_id);
             $this->ctrl->setParameter($this, 'meta_path', 'meta_contribute');
             $this->tpl->setCurrentBlock("contribute_delete");
             $this->tpl->setVariable("CONTRIBUTE_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
             $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DELETE", $this->lng->txt('delete'));
             $this->tpl->parseCurrentBlock();
         }
         // Entities
         foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
             $md_ent = $md_con->getEntity($ent_id);
             $this->ctrl->setParameter($this, 'meta_path', 'meta_entity');
             if (count($ent_ids) > 1) {
                 $this->tpl->setCurrentBlock("contribute_entity_delete");
                 $this->ctrl->setParameter($this, 'meta_index', $ent_id);
                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_DELETE", $this->ctrl->getLinkTarget($this, 'deleteElement'));
                 $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_DELETE", $this->lng->txt('delete'));
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("contribute_entity_loop");
             $this->ctrl->setParameter($this, 'section_element', 'meta_entity');
             $this->ctrl->setParameter($this, 'meta_index', $con_id);
             $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_ACTION_ADD", $this->ctrl->getLinkTarget($this, 'addSectionElement'));
             $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ADD", $this->lng->txt('add'));
             $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_CONTRIBUTE_NO", $con_id);
             $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_NO", $ent_id);
             $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_VAL_ENTITY", ilUtil::prepareFormOutput($md_ent->getEntity()));
             $this->tpl->setVariable("CONTRIBUTE_ENTITY_LOOP_TXT_ENTITY", $this->lng->txt('meta_entity'));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("contribute_loop");
         $this->tpl->setVariable("CONTRIBUTE_LOOP_ROWSPAN", 2 + count($ent_ids));
         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_CONTRIBUTE", $this->lng->txt('meta_contribute'));
         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_ROLE", $this->lng->txt('meta_role'));
         $this->tpl->setVariable("SEL_CONTRIBUTE_ROLE", ilMDUtilSelect::_getRoleSelect($md_con->getRole(), "met_contribute[" . $con_id . "][Role]", array(0 => $this->lng->txt('meta_please_select'))));
         $this->tpl->setVariable("CONTRIBUTE_LOOP_TXT_DATE", $this->lng->txt('meta_date'));
         $this->tpl->setVariable("CONTRIBUTE_LOOP_NO", $con_id);
         $this->tpl->setVariable("CONTRIBUTE_LOOP_VAL_DATE", ilUtil::prepareFormOutput($md_con->getDate()));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("TXT_SAVE", $this->lng->txt('save'));
 }
 /** 
  * Called from ilLuceneAdvancedQueryParser
  * Parse a field specific query
  */
 public function parseFieldQuery($a_field, $a_query)
 {
     switch ($a_field) {
         case 'lom_content':
             return $a_query;
         case 'general_offline':
             switch ($a_query) {
                 case self::OFFLINE_QUERY:
                     return 'offline:1';
                 default:
                     return '-offline:1';
             }
             return '';
             // General
         // General
         case 'lom_language':
             return 'lomLanguage:' . $a_query;
         case 'lom_keyword':
             return 'lomKeyword:' . $a_query;
         case 'lom_coverage':
             return 'lomCoverage:' . $a_query;
         case 'lom_structure':
             return 'lomStructure:' . $a_query;
             // Lifecycle
         // Lifecycle
         case 'lom_status':
             return 'lomStatus:' . $a_query;
         case 'lom_version':
             return 'lomVersion:' . $a_query;
             // Begin Contribute
         // Begin Contribute
         case 'lom_role':
             return 'lomRole:' . $a_query;
         case 'lom_role_entry':
             return 'lomRoleEntity:' . $a_query;
             // End contribute
             // Technical
         // End contribute
         // Technical
         case 'lom_format':
             return 'lomFormat:' . $a_query;
         case 'lom_operating_system':
             return 'lomOS:' . $a_query;
         case 'lom_browser':
             return 'lomBrowser:' . $a_query;
             // Educational
         // Educational
         case 'lom_interactivity':
             return 'lomInteractivity:' . $a_query;
         case 'lom_resource':
             return 'lomResource:' . $a_query;
         case 'lom_level_start':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
             for ($i = $a_query; $i <= count($options); $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomLevel:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_level_end':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
             for ($i = 1; $i <= $a_query; $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomLevel:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_density_start':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
             for ($i = $a_query; $i <= count($options); $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDensity:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_density_end':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
             for ($i = 1; $i <= $a_query; $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDensity:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_user_role':
             return 'lomUserRole:' . $a_query;
         case 'lom_context':
             return 'lomContext:' . $a_query;
         case 'lom_difficulty_start':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
             for ($i = $a_query; $i <= count($options); $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDifficulty:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_difficulty_end':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
             for ($i = 1; $i <= $a_query; $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDifficulty:"' . $options[$i] . '" ';
             }
             return $q_string;
             // Rights
         // Rights
         case 'lom_costs':
             return 'lomCosts:' . $a_query;
         case 'lom_copyright':
             return 'lomCopyright:' . $a_query;
             // Classification
         // Classification
         case 'lom_purpose':
             return 'lomPurpose:' . $a_query;
         case 'lom_taxon':
             return 'lomTaxon:' . $a_query;
         default:
             if (substr($a_field, 0, 3) != 'adv') {
                 break;
             }
             // Advanced meta data
             $field_id = substr($a_field, 4);
             include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
             $field = ilAdvancedMDFieldDefinition::_getInstanceByFieldId($field_id);
             switch ($field->getFieldType()) {
                 case ilAdvancedMDFieldDefinition::TYPE_TEXT:
                 case ilAdvancedMDFieldDefinition::TYPE_SELECT:
                     return 'advancedMetaData_' . $field_id . ':' . $a_query;
                 case ilAdvancedMDFieldDefinition::TYPE_DATE:
                     $value = $_POST['adv_' . $field_id . '_start'];
                     $dt['year'] = (int) $value['date']['y'];
                     $dt['mon'] = (int) $value['date']['m'];
                     $dt['mday'] = (int) $value['date']['d'];
                     $dt['hours'] = (int) 0;
                     $dt['minutes'] = (int) 0;
                     $dt['seconds'] = (int) 0;
                     $date = new ilDate($dt, IL_CAL_FKT_GETDATE);
                     $ustart = $date->get(IL_CAL_UNIX);
                     $value = $_POST['adv_' . $field_id . '_end'];
                     $dt['year'] = (int) $value['date']['y'];
                     $dt['mon'] = (int) $value['date']['m'];
                     $dt['mday'] = (int) $value['date']['d'];
                     $dt['hours'] = (int) 0;
                     $dt['minutes'] = (int) 0;
                     $dt['seconds'] = (int) 0;
                     $date = new ilDate($dt, IL_CAL_FKT_GETDATE);
                     $uend = $date->get(IL_CAL_UNIX);
                     return 'advancedMetaData_' . $field_id . ':{' . $ustart . ' TO ' . $uend . '}';
                 case ilAdvancedMDFieldDefinition::TYPE_DATETIME:
                     $value = $_POST['adv_' . $field_id . '_start'];
                     $dt['year'] = (int) $value['date']['y'];
                     $dt['mon'] = (int) $value['date']['m'];
                     $dt['mday'] = (int) $value['date']['d'];
                     $dt['hours'] = (int) $value['time']['h'];
                     $dt['minutes'] = (int) $value['time']['m'];
                     $dt['seconds'] = (int) 0;
                     $date = new ilDateTime($dt, IL_CAL_FKT_GETDATE);
                     $ustart = $date->get(IL_CAL_UNIX);
                     $value = $_POST['adv_' . $field_id . '_end'];
                     $dt['year'] = (int) $value['date']['y'];
                     $dt['mon'] = (int) $value['date']['m'];
                     $dt['mday'] = (int) $value['date']['d'];
                     $dt['hours'] = (int) $value['time']['h'];
                     $dt['minutes'] = (int) $value['time']['m'];
                     $dt['seconds'] = (int) 0;
                     $date = new ilDateTime($dt, IL_CAL_FKT_GETDATE);
                     $uend = $date->get(IL_CAL_UNIX);
                     return 'advancedMetaData_' . $field_id . ':{' . $ustart . ' TO ' . $uend . '}';
             }
             break;
     }
 }
 /** 
  * Called from ilLuceneAdvancedQueryParser
  * Parse a field specific query
  */
 public function parseFieldQuery($a_field, $a_query)
 {
     switch ($a_field) {
         case 'lom_content':
             return $a_query;
         case 'general_offline':
             switch ($a_query) {
                 case self::OFFLINE_QUERY:
                     return 'offline:1';
                 default:
                     return '-offline:1';
             }
             return '';
             // General
         // General
         case 'lom_language':
             return 'lomLanguage:' . $a_query;
         case 'lom_keyword':
             return 'lomKeyword:' . $a_query;
         case 'lom_coverage':
             return 'lomCoverage:' . $a_query;
         case 'lom_structure':
             return 'lomStructure:' . $a_query;
             // Lifecycle
         // Lifecycle
         case 'lom_status':
             return 'lomStatus:' . $a_query;
         case 'lom_version':
             return 'lomVersion:' . $a_query;
             // Begin Contribute
         // Begin Contribute
         case 'lom_role':
             return 'lomRole:' . $a_query;
         case 'lom_role_entry':
             return 'lomRoleEntity:' . $a_query;
             // End contribute
             // Technical
         // End contribute
         // Technical
         case 'lom_format':
             return 'lomFormat:' . $a_query;
         case 'lom_operating_system':
             return 'lomOS:' . $a_query;
         case 'lom_browser':
             return 'lomBrowser:' . $a_query;
             // Educational
         // Educational
         case 'lom_interactivity':
             return 'lomInteractivity:' . $a_query;
         case 'lom_resource':
             return 'lomResource:' . $a_query;
         case 'lom_level_start':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
             for ($i = $a_query; $i <= count($options); $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomLevel:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_level_end':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getInteractivityLevelSelect(0, 'lom_level', array(), true);
             for ($i = 1; $i <= $a_query; $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomLevel:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_density_start':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
             for ($i = $a_query; $i <= count($options); $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDensity:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_density_end':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getSemanticDensitySelect(0, 'lom_density', array(), true);
             for ($i = 1; $i <= $a_query; $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDensity:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_user_role':
             return 'lomUserRole:' . $a_query;
         case 'lom_context':
             return 'lomContext:' . $a_query;
         case 'lom_difficulty_start':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
             for ($i = $a_query; $i <= count($options); $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDifficulty:"' . $options[$i] . '" ';
             }
             return $q_string;
         case 'lom_difficulty_end':
             $q_string = '';
             include_once './Services/MetaData/classes/class.ilMDUtilSelect.php';
             $options = ilMDUtilSelect::_getDifficultySelect(0, 'lom_difficulty', array(), true);
             for ($i = 1; $i <= $a_query; $i++) {
                 if (strlen($q_string)) {
                     $q_string .= 'OR ';
                 }
                 $q_string .= 'lomDifficulty:"' . $options[$i] . '" ';
             }
             return $q_string;
             // Rights
         // Rights
         case 'lom_costs':
             return 'lomCosts:' . $a_query;
         case 'lom_copyright':
             return 'lomCopyright:' . $a_query;
             // Classification
         // Classification
         case 'lom_purpose':
             return 'lomPurpose:' . $a_query;
         case 'lom_taxon':
             return 'lomTaxon:' . $a_query;
         default:
             if (substr($a_field, 0, 3) != 'adv') {
                 break;
             }
             // Advanced meta data
             $field_id = substr($a_field, 4);
             include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
             $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
             $adv_query = $field->getLuceneSearchString($a_query);
             if ($adv_query) {
                 return 'advancedMetaData_' . $field_id . ': ' . $adv_query;
             }
     }
 }