public function update()
 {
     parent::update();
     if (sizeof($this->confirmed_objects)) {
         ilADTFactory::initActiveRecordByType();
         foreach ($this->confirmed_objects as $old_option => $item_ids) {
             foreach ($item_ids as $item => $new_option) {
                 $item = explode("_", $item);
                 $obj_id = $item[0];
                 $sub_type = $item[1];
                 $sub_id = $item[2];
                 if (!$new_option) {
                     // remove existing value
                     $primary = array("obj_id" => array("integer", $obj_id), "sub_type" => array("text", $sub_type), "sub_id" => array("integer", $sub_id), "field_id" => array("integer", $this->getFieldId()));
                     ilADTActiveRecordByType::deleteByPrimary("adv_md_values", $primary, "Enum");
                 } else {
                     // update existing value
                     $primary = array("obj_id" => array("integer", $obj_id), "sub_type" => array("text", $sub_type), "sub_id" => array("integer", $sub_id), "field_id" => array("integer", $this->getFieldId()));
                     ilADTActiveRecordByType::writeByPrimary("adv_md_values", $primary, "Enum", $new_option);
                 }
                 if ($sub_type == "wpg") {
                     // #15763 - adapt advmd page lists
                     include_once "Modules/Wiki/classes/class.ilPCAMDPageList.php";
                     ilPCAMDPageList::migrateField($obj_id, $this->getFieldId(), $old_option, $new_option);
                 }
             }
         }
     }
 }
 public function update()
 {
     parent::update();
     if (sizeof($this->confirmed_objects)) {
         ilADTFactory::initActiveRecordByType();
         foreach ($this->confirmed_objects as $old_option => $obj_ids) {
             foreach ($obj_ids as $obj_id => $new_option) {
                 if (!$new_option) {
                     // remove existing value
                     $primary = array("obj_id" => array("integer", $obj_id), "field_id" => array("integer", $this->getFieldId()));
                     ilADTActiveRecordByType::deleteByPrimary("adv_md_values", $primary, "Enum");
                 } else {
                     // update existing value
                     $primary = array("obj_id" => array("integer", $obj_id), "field_id" => array("integer", $this->getFieldId()));
                     ilADTActiveRecordByType::writeByPrimary("adv_md_values", $primary, "Enum", $new_option);
                 }
             }
         }
     }
 }