private function loadFields()
 {
     if ($this->fields == NULL) {
         global $ilDB;
         $query = "SELECT field.id, field.table_id, field.title, field.description, field.datatype_id, field.required, field.is_unique, field.is_locked FROM il_dcl_field field INNER JOIN il_dcl_view view ON view.table_id = field.table_id INNER JOIN il_dcl_viewdefinition def ON def.view_id = view.id WHERE field.table_id =" . $ilDB->quote($this->getId(), "integer") . " ORDER BY def.field_order DESC";
         $fields = array();
         $set = $ilDB->query($query);
         while ($rec = $ilDB->fetchAssoc($set)) {
             $field = ilDataCollectionCache::buildFieldFromRecord($rec);
             //				$field = new ilDataCollectionField();
             //				$field->buildFromDBRecord($rec);
             $fields[$field->getId()] = $field;
         }
         $this->sortByOrder($fields);
         $this->fields = $fields;
     }
 }
 protected function loadFields()
 {
     if ($this->fields == NULL) {
         global $ilDB;
         $query = "SELECT DISTINCT field.* FROM il_dcl_field AS field\n\t\t\t          INNER JOIN il_dcl_view AS view ON view.table_id = field.table_id\n\t\t\t          INNER JOIN il_dcl_viewdefinition AS def ON def.view_id = view.id\n\t\t\t          WHERE field.table_id =" . $ilDB->quote($this->getId(), "integer") . "\n\t\t\t          ORDER BY def.field_order DESC";
         $fields = array();
         $set = $ilDB->query($query);
         while ($rec = $ilDB->fetchAssoc($set)) {
             $field = ilDataCollectionCache::buildFieldFromRecord($rec);
             $fields[$field->getId()] = $field;
         }
         $this->sortByOrder($fields);
         $this->fields = $fields;
     }
 }