/**
  * Read db entries
  *
  * @access private
  * 
  */
 private function read()
 {
     global $ilDB;
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
     $this->date_fields = ilAdvancedMDFieldDefinition::_lookupDateFields();
     $this->datetime_fields = ilAdvancedMDFieldDefinition::_lookupDatetimeFields();
     // Check active status
     $query = "SELECT active,field_id,amfd.title FROM adv_md_record amr " . "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id " . "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " . "WHERE active = 1 " . "AND obj_type = " . $this->db->quote($this->type, 'text') . " ";
     $res = $this->db->query($query);
     $this->active = $res->numRows() ? true : false;
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $this->active_fields[$row->field_id] = $row->title;
     }
     $query = "SELECT * FROM adv_md_substitutions " . "WHERE obj_type = " . $this->db->quote($this->type, 'text') . " ";
     $res = $this->db->query($query);
     $this->substitutions = array();
     $this->bold = array();
     $this->newline = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $tmp_substitutions = unserialize($row->substitution);
         if (is_array($tmp_substitutions)) {
             foreach ($tmp_substitutions as $substitution) {
                 if ($substitution['field_id']) {
                     $this->substitutions[] = $substitution['field_id'];
                 }
                 if ($substitution['bold']) {
                     $this->bold[] = $substitution['field_id'];
                 }
                 if ($substitution['newline']) {
                     $this->newline[] = $substitution['field_id'];
                 }
             }
         }
         $this->enabled_desc = !$row->hide_description;
         $this->enabled_field_names = !$row->hide_field_names;
     }
     if ($this->type == 'crs' or $this->type == 'rcrs') {
         // Handle ECS substitutions
         /*
         	 		if($begin = self::$mappings->getMappingByECSName('begin') and
         	 			$end = self::$mappings->getMappingByECSName('end'))
         	 		{
         	 			// Show something like 'Monday, 30.12.2008 9:00 - 12:00'
         	 			unset($this->active_fields[$end]);
         	 		}
         */
     }
 }